diff --git a/client/client_utilities/ip_operators.cpp b/client/client_utilities/ip_operators.cpp new file mode 100644 index 0000000..fe3ba48 --- /dev/null +++ b/client/client_utilities/ip_operators.cpp @@ -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); +} \ No newline at end of file diff --git a/client/client_utilities/ip_operators.hpp b/client/client_utilities/ip_operators.hpp new file mode 100644 index 0000000..cdfff9e --- /dev/null +++ b/client/client_utilities/ip_operators.hpp @@ -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 \ No newline at end of file diff --git a/client/gameplay_scenes/in_world.hpp b/client/gameplay_scenes/in_world.hpp index d328c6d..7dfa1fc 100644 --- a/client/gameplay_scenes/in_world.hpp +++ b/client/gameplay_scenes/in_world.hpp @@ -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 GenerateCollisionGrid(Entity*, int tileWidth, int tileHeight); diff --git a/client/gameplay_scenes/in_world_entities.cpp b/client/gameplay_scenes/in_world_entities.cpp index db3a2c8..7fd7155 100644 --- a/client/gameplay_scenes/in_world_entities.cpp +++ b/client/gameplay_scenes/in_world_entities.cpp @@ -28,7 +28,7 @@ #include //------------------------- -//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 //------------------------- diff --git a/client/gameplay_scenes/in_world_networking.cpp b/client/gameplay_scenes/in_world_networking.cpp index fc025eb..db23ce1 100644 --- a/client/gameplay_scenes/in_world_networking.cpp +++ b/client/gameplay_scenes/in_world_networking.cpp @@ -22,6 +22,7 @@ #include "in_world.hpp" #include "channels.hpp" +#include "ip_operators.hpp" #include "terminal_error.hpp" #include @@ -68,8 +69,6 @@ void InWorld::HandlePacket(SerialPacket* const argPacket) { case SerialPacketType::QUERY_CHARACTER_EXISTS: HandleCharacterQueryExists(static_cast(argPacket)); break; - - //character movement case SerialPacketType::CHARACTER_MOVEMENT: HandleCharacterMovement(static_cast(argPacket)); break; @@ -77,6 +76,23 @@ void InWorld::HandlePacket(SerialPacket* const argPacket) { HandleCharacterAttack(static_cast(argPacket)); break; + //monster management + case SerialPacketType::MONSTER_CREATE: + HandleMonsterCreate(static_cast(argPacket)); + break; + case SerialPacketType::MONSTER_DELETE: + HandleMonsterDelete(static_cast(argPacket)); + break; + case SerialPacketType::QUERY_MONSTER_EXISTS: + HandleMonsterQueryExists(static_cast(argPacket)); + break; + case SerialPacketType::MONSTER_MOVEMENT: + HandleMonsterMovement(static_cast(argPacket)); + break; + case SerialPacketType::MONSTER_ATTACK: + HandleMonsterAttack(static_cast(argPacket)); + break; + //rejection messages case SerialPacketType::REGION_REJECTION: case SerialPacketType::CHARACTER_REJECTION: diff --git a/client/gameplay_scenes/in_world_scene_components.cpp b/client/gameplay_scenes/in_world_scene_components.cpp index a7c982c..55ed44d 100644 --- a/client/gameplay_scenes/in_world_scene_components.cpp +++ b/client/gameplay_scenes/in_world_scene_components.cpp @@ -31,18 +31,6 @@ #include #include -//------------------------- -//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 //-------------------------