diff --git a/server/rooms/room_manager.cpp b/server/rooms/room_manager.cpp index d09bc81..ea7ba4e 100644 --- a/server/rooms/room_manager.cpp +++ b/server/rooms/room_manager.cpp @@ -45,7 +45,7 @@ int RoomManager::Create(std::string roomName, std::string tileset) { return counter++; } -void RoomManager::PushEntity(Entity* entity) { +void RoomManager::PushEntity(Entity const* entity) { if (!entity) { throw(std::runtime_error("Failed to push null entity")); } @@ -54,17 +54,17 @@ void RoomManager::PushEntity(Entity* entity) { if (it == elementMap.end()) { std::ostringstream msg; - msg << "Failed to push entity; Room index not found: " << entity->GetRoomIndex() << std::endl; +// msg << "Failed to push entity; Room index not found: " << entity->GetRoomIndex() << std::endl; throw(std::runtime_error(msg.str())); } - it->second.entityList.push_back(entity); + it->second.entityList.push_back(const_cast(entity)); std::cout << "\troom[" << it->first << "].entityList.size(): " << it->second.entityList.size() << std::endl; std::cout << "\tEntity: " << int(entity) << "," << int(it->second.entityList.front()) << std::endl; } -void RoomManager::PopEntity(Entity* entity) { +void RoomManager::PopEntity(Entity const* entity) { if (!entity) { throw(std::runtime_error("Failed to pop null entity")); } diff --git a/server/rooms/room_manager.hpp b/server/rooms/room_manager.hpp index 48cabfb..77dc7c5 100644 --- a/server/rooms/room_manager.hpp +++ b/server/rooms/room_manager.hpp @@ -40,8 +40,8 @@ public: //common public methods int Create(std::string name, std::string tileset); - void PushEntity(Entity* entity); - void PopEntity(Entity* entity); + void PushEntity(Entity const* entity); + void PopEntity(Entity const* entity); void UnloadAll(); void UnloadIf(std::function)> fn); diff --git a/server/server_methods.cpp b/server/server_methods.cpp index 5892cd3..ff5e827 100644 --- a/server/server_methods.cpp +++ b/server/server_methods.cpp @@ -152,7 +152,7 @@ void ServerApplication::FullCharacterUnload(int index) { //pop from the rooms std::cout << "popping index " << index << std::endl; - roomMgr.PopEntity(static_cast(&(character.second))); + roomMgr.PopEntity(reinterpret_cast(&character.second)); //pump character unload CharacterPacket newPacket;