Added monster message handlers
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
/* Copyright: (c) Kayne Ruse 2013-2015
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
*
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
*
|
||||
* 3. This notice may not be removed or altered from any source
|
||||
* distribution.
|
||||
*/
|
||||
#include "ip_operators.hpp"
|
||||
|
||||
bool operator==(IPaddress lhs, IPaddress rhs) {
|
||||
return lhs.host == rhs.host && lhs.port == rhs.port;
|
||||
}
|
||||
|
||||
bool operator!=(IPaddress lhs, IPaddress rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/* Copyright: (c) Kayne Ruse 2013-2015
|
||||
*
|
||||
* This software is provided 'as-is', without any express or implied
|
||||
* warranty. In no event will the authors be held liable for any damages
|
||||
* arising from the use of this software.
|
||||
*
|
||||
* Permission is granted to anyone to use this software for any purpose,
|
||||
* including commercial applications, and to alter it and redistribute it
|
||||
* freely, subject to the following restrictions:
|
||||
*
|
||||
* 1. The origin of this software must not be misrepresented; you must not
|
||||
* claim that you wrote the original software. If you use this software
|
||||
* in a product, an acknowledgment in the product documentation would be
|
||||
* appreciated but is not required.
|
||||
*
|
||||
* 2. Altered source versions must be plainly marked as such, and must not be
|
||||
* misrepresented as being the original software.
|
||||
*
|
||||
* 3. This notice may not be removed or altered from any source
|
||||
* distribution.
|
||||
*/
|
||||
#ifndef IPOPERATORS_HPP_
|
||||
#define IPOPERATORS_HPP_
|
||||
|
||||
#include "SDL/SDL_net.h"
|
||||
|
||||
//these should've come standard
|
||||
bool operator==(IPaddress lhs, IPaddress rhs);
|
||||
bool operator!=(IPaddress lhs, IPaddress rhs);
|
||||
|
||||
#endif
|
||||
@@ -99,6 +99,13 @@ protected:
|
||||
void HandleCharacterMovement(CharacterPacket* const);
|
||||
void HandleCharacterAttack(CharacterPacket* const);
|
||||
|
||||
//monster management
|
||||
void HandleMonsterCreate(MonsterPacket* const);
|
||||
void HandleMonsterDelete(MonsterPacket* const);
|
||||
void HandleMonsterQueryExists(MonsterPacket* const);
|
||||
void HandleMonsterMovement(MonsterPacket* const);
|
||||
void HandleMonsterAttack(MonsterPacket* const);
|
||||
|
||||
//player movement
|
||||
void SendLocalCharacterMovement();
|
||||
std::list<BoundingBox> GenerateCollisionGrid(Entity*, int tileWidth, int tileHeight);
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
#include <stdexcept>
|
||||
|
||||
//-------------------------
|
||||
//entity management
|
||||
//character management
|
||||
//-------------------------
|
||||
|
||||
//DOCS: preexisting characters will result in query responses
|
||||
@@ -147,6 +147,30 @@ void InWorld::HandleCharacterAttack(CharacterPacket* const argPacket) {
|
||||
//TODO: attack animation
|
||||
}
|
||||
|
||||
//-------------------------
|
||||
//monster management
|
||||
//-------------------------
|
||||
|
||||
void InWorld::HandleMonsterCreate(MonsterPacket* const argPacket) {
|
||||
//TODO
|
||||
}
|
||||
|
||||
void InWorld::HandleMonsterDelete(MonsterPacket* const argPacket) {
|
||||
//TODO
|
||||
}
|
||||
|
||||
void InWorld::HandleMonsterQueryExists(MonsterPacket* const argPacket) {
|
||||
//TODO
|
||||
}
|
||||
|
||||
void InWorld::HandleMonsterMovement(MonsterPacket* const argPacket) {
|
||||
//TODO
|
||||
}
|
||||
|
||||
void InWorld::HandleMonsterAttack(MonsterPacket* const argPacket) {
|
||||
//TODO
|
||||
}
|
||||
|
||||
//-------------------------
|
||||
//player movement
|
||||
//-------------------------
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "in_world.hpp"
|
||||
|
||||
#include "channels.hpp"
|
||||
#include "ip_operators.hpp"
|
||||
#include "terminal_error.hpp"
|
||||
|
||||
#include <chrono>
|
||||
@@ -68,8 +69,6 @@ void InWorld::HandlePacket(SerialPacket* const argPacket) {
|
||||
case SerialPacketType::QUERY_CHARACTER_EXISTS:
|
||||
HandleCharacterQueryExists(static_cast<CharacterPacket*>(argPacket));
|
||||
break;
|
||||
|
||||
//character movement
|
||||
case SerialPacketType::CHARACTER_MOVEMENT:
|
||||
HandleCharacterMovement(static_cast<CharacterPacket*>(argPacket));
|
||||
break;
|
||||
@@ -77,6 +76,23 @@ void InWorld::HandlePacket(SerialPacket* const argPacket) {
|
||||
HandleCharacterAttack(static_cast<CharacterPacket*>(argPacket));
|
||||
break;
|
||||
|
||||
//monster management
|
||||
case SerialPacketType::MONSTER_CREATE:
|
||||
HandleMonsterCreate(static_cast<MonsterPacket*>(argPacket));
|
||||
break;
|
||||
case SerialPacketType::MONSTER_DELETE:
|
||||
HandleMonsterDelete(static_cast<MonsterPacket*>(argPacket));
|
||||
break;
|
||||
case SerialPacketType::QUERY_MONSTER_EXISTS:
|
||||
HandleMonsterQueryExists(static_cast<MonsterPacket*>(argPacket));
|
||||
break;
|
||||
case SerialPacketType::MONSTER_MOVEMENT:
|
||||
HandleMonsterMovement(static_cast<MonsterPacket*>(argPacket));
|
||||
break;
|
||||
case SerialPacketType::MONSTER_ATTACK:
|
||||
HandleMonsterAttack(static_cast<MonsterPacket*>(argPacket));
|
||||
break;
|
||||
|
||||
//rejection messages
|
||||
case SerialPacketType::REGION_REJECTION:
|
||||
case SerialPacketType::CHARACTER_REJECTION:
|
||||
|
||||
@@ -31,18 +31,6 @@
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
//-------------------------
|
||||
//these should've come standard
|
||||
//-------------------------
|
||||
|
||||
bool operator==(IPaddress lhs, IPaddress rhs) {
|
||||
return lhs.host == rhs.host && lhs.port == rhs.port;
|
||||
}
|
||||
|
||||
bool operator!=(IPaddress lhs, IPaddress rhs) {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
//-------------------------
|
||||
//Public access members
|
||||
//-------------------------
|
||||
|
||||
Reference in New Issue
Block a user