diff --git a/server/rooms/makefile b/server/rooms/makefile index a0dda5d..1e22bde 100644 --- a/server/rooms/makefile +++ b/server/rooms/makefile @@ -1,5 +1,5 @@ #config -INCLUDES+=. ../entities ../monsters ../server_utilities ../waypoints ../../common/map ../../common/utilities +INCLUDES+=. ../characters ../entities ../monsters ../server_utilities ../waypoints ../../common/gameplay ../../common/map ../../common/utilities LIBS+= CXXFLAGS+=-std=c++11 $(addprefix -I,$(INCLUDES)) diff --git a/server/rooms/room_data.cpp b/server/rooms/room_data.cpp index 87a9502..815f73a 100644 --- a/server/rooms/room_data.cpp +++ b/server/rooms/room_data.cpp @@ -49,6 +49,6 @@ WaypointManager* RoomData::GetWaypointMgr() { return &waypointMgr; } -std::list* RoomData::GetEntityList() { - return &entityList; +std::list* RoomData::GetCharacterList() { + return &characterList; } diff --git a/server/rooms/room_data.hpp b/server/rooms/room_data.hpp index b5d9d9f..83720b9 100644 --- a/server/rooms/room_data.hpp +++ b/server/rooms/room_data.hpp @@ -22,7 +22,7 @@ #ifndef ROOMDATA_HPP_ #define ROOMDATA_HPP_ -#include "entity.hpp" +#include "character_data.hpp" #include "monster_manager.hpp" #include "region_pager_lua.hpp" #include "waypoint_manager.hpp" @@ -47,7 +47,7 @@ public: RegionPagerLua* GetPager(); MonsterManager* GetMonsterMgr(); WaypointManager* GetWaypointMgr(); - std::list* GetEntityList(); + std::list* GetCharacterList(); //TODO: triggers for unload, save, per-second, player enter, player exit, etc. @@ -61,7 +61,7 @@ private: RegionPagerLua pager; MonsterManager monsterMgr; WaypointManager waypointMgr; - std::list entityList; + std::list characterList; }; #endif diff --git a/server/rooms/room_manager.cpp b/server/rooms/room_manager.cpp index 65df378..1ba26ca 100644 --- a/server/rooms/room_manager.cpp +++ b/server/rooms/room_manager.cpp @@ -60,34 +60,34 @@ void RoomManager::UnloadIf(std::functionGetRoomIndex()); + RoomData* room = Get(character->GetRoomIndex()); if (!room) { - throw(std::runtime_error("Failed to push an entity to a non-existant room")); + throw(std::runtime_error("Failed to push an character to a non-existant room")); } - room->entityList.push_back(entity); + room->characterList.push_back(character); } -void RoomManager::PopEntity(Entity const* entity) { - //NOTE: to pop an entity from a room, the entity must first exist - if (!entity) { - throw(std::runtime_error("Failed to pop a null entity to a room")); +void RoomManager::PopCharacter(CharacterData const* character) { + //NOTE: to pop an character from a room, the character must first exist + if (!character) { + throw(std::runtime_error("Failed to pop a null character to a room")); } - RoomData* room = Get(entity->GetRoomIndex()); + RoomData* room = Get(character->GetRoomIndex()); if (!room) { - throw(std::runtime_error("Failed to pop an entity to a non-existant room")); + throw(std::runtime_error("Failed to pop an character to a non-existant room")); } - room->entityList.remove_if([entity](Entity* ptr) { - return entity == ptr; + room->characterList.remove_if([character](CharacterData* ptr) { + return character == ptr; }); } diff --git a/server/rooms/room_manager.hpp b/server/rooms/room_manager.hpp index 1b51c23..6e21382 100644 --- a/server/rooms/room_manager.hpp +++ b/server/rooms/room_manager.hpp @@ -22,7 +22,7 @@ #ifndef ROOMMANAGER_HPP_ #define ROOMMANAGER_HPP_ -#include "entity.hpp" +#include "character_data.hpp" #include "room_data.hpp" #include "singleton.hpp" @@ -40,8 +40,8 @@ public: void UnloadAll(); void UnloadIf(std::function)> fn); - void PushEntity(Entity* entity); - void PopEntity(Entity const* entity); + void PushCharacter(CharacterData* character); + void PopCharacter(CharacterData const* character); //accessors and mutators RoomData* Get(int uid); diff --git a/server/server_character_methods.cpp b/server/server_character_methods.cpp index 610ec2d..3f898f9 100644 --- a/server/server_character_methods.cpp +++ b/server/server_character_methods.cpp @@ -46,7 +46,7 @@ void ServerApplication::HandleCharacterCreate(CharacterPacket* const argPacket) } //push to the rooms - roomMgr.PushEntity(characterMgr.Get(characterIndex)); + roomMgr.PushCharacter(characterMgr.Get(characterIndex)); //pump this character to all clients CharacterPacket newPacket; @@ -90,7 +90,7 @@ void ServerApplication::HandleCharacterDelete(CharacterPacket* const argPacket) } //pop from the rooms - roomMgr.PopEntity(characterMgr.Get(characterIndex)); + roomMgr.PopCharacter(characterMgr.Get(characterIndex)); //delete the character characterMgr.Delete(characterIndex); @@ -126,7 +126,7 @@ void ServerApplication::HandleCharacterLoad(CharacterPacket* const argPacket) { } //push to the rooms - roomMgr.PushEntity(characterMgr.Get(characterIndex)); + roomMgr.PushCharacter(characterMgr.Get(characterIndex)); //pump this character to all clients CharacterPacket newPacket; @@ -159,7 +159,7 @@ void ServerApplication::HandleCharacterUnload(CharacterPacket* const argPacket) } //pop from the rooms - roomMgr.PopEntity(characterData); + roomMgr.PopCharacter(characterData); //unload the character characterMgr.Unload(argPacket->characterIndex); @@ -203,7 +203,7 @@ void ServerApplication::HandleCharacterSetRoom(CharacterPacket* const argPacket) } //pop from the old room - roomMgr.PopEntity(characterData); + roomMgr.PopCharacter(characterData); //set the character's room, zero it's origin, zero it's motion characterData->SetRoomIndex(argPacket->roomIndex); @@ -211,7 +211,7 @@ void ServerApplication::HandleCharacterSetRoom(CharacterPacket* const argPacket) characterData->SetMotion({0, 0}); //push to the new room - roomMgr.PushEntity(characterData); + roomMgr.PushCharacter(characterData); //update the clients CharacterPacket newPacket; diff --git a/server/server_methods.cpp b/server/server_methods.cpp index 7222ef0..1e968b1 100644 --- a/server/server_methods.cpp +++ b/server/server_methods.cpp @@ -150,7 +150,7 @@ void ServerApplication::FullCharacterUnload(int index) { } //pop from the rooms - roomMgr.PopEntity(&character.second); + roomMgr.PopCharacter(&character.second); //pump character unload CharacterPacket newPacket;