From b2aecc933a274ee225e0048afcb25caa71fef555 Mon Sep 17 00:00:00 2001 From: Kayne Ruse Date: Fri, 26 Aug 2016 00:11:54 +1000 Subject: [PATCH] I need to do some refactoring --- server/rooms/room_data.cpp | 24 ++++++++++++++++-------- server/server_application.cpp | 1 + 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/server/rooms/room_data.cpp b/server/rooms/room_data.cpp index 559d637..7b09528 100644 --- a/server/rooms/room_data.cpp +++ b/server/rooms/room_data.cpp @@ -205,20 +205,28 @@ void RoomData::RunFrameCharacterBarrierCollisions() { //barrier bounds BoundingBox barrierBox = barrierIt.second.GetBounds() + barrierIt.second.GetOrigin(); + //move the character to the battle screen if (characterBox.CheckOverlap(barrierBox)) { - //Actually move the character to a battle - BattleData* battle = battleMgr.Find(barrierIt.second.GetBattleIndex()); -// battle->PushCharacter(characterIt.second); -// characterList. + //pump character unload + CharacterPacket charPacket; + charPacket.type = SerialPacketType::CHARACTER_UNLOAD; + charPacket.characterIndex = characterIt->GetIndex(); + pumpPacketProximity(static_cast(&charPacket), characterIt->GetRoomIndex()); + std::cout << "CharacterList size: " << characterList.size() << std::endl; + + //Actually move the character to a battle + BattleData* battle = battleMgr.Find(barrierIt.second.GetBattleIndex()); //TODO: barriers should hold the battle's pointer + battle->PushCharacter(characterIt); + PopCharacter(characterIt); //DEBUG: output barrierIndex, battleIndex - std::cout << barrierIt.first << "\t" << barrierIt.second.GetBattleIndex() << std::endl; + std::cout << "CharacterList size: " << characterList.size() << std::endl; //Send the entry message to the client - BarrierPacket newPacket; - newPacket.type = SerialPacketType::BARRIER_ENTRY; - newPacket.barrierIndex = barrierIt.first; +// BarrierPacket newPacket; +// newPacket.type = SerialPacketType::BARRIER_ENTRY; +// newPacket.barrierIndex = barrierIt.first; // udpNetworkUtility.Send(); diff --git a/server/server_application.cpp b/server/server_application.cpp index 567393e..48c3404 100644 --- a/server/server_application.cpp +++ b/server/server_application.cpp @@ -596,6 +596,7 @@ void ServerApplication::hQueryCharacterExists(CharacterPacket* const argPacket) //respond with all character data CharacterPacket newPacket; + //TODO: move this expensive lookup for (auto& it : *characterMgr.GetContainer()) { if (argPacket->roomIndex != -1 && it.second.GetRoomIndex() != argPacket->roomIndex) { continue;