I need to do some refactoring

This commit is contained in:
2016-08-26 00:11:54 +10:00
parent 64833f86da
commit b2aecc933a
2 changed files with 17 additions and 8 deletions
+16 -8
View File
@@ -205,20 +205,28 @@ void RoomData::RunFrameCharacterBarrierCollisions() {
//barrier bounds //barrier bounds
BoundingBox barrierBox = barrierIt.second.GetBounds() + barrierIt.second.GetOrigin(); BoundingBox barrierBox = barrierIt.second.GetBounds() + barrierIt.second.GetOrigin();
//move the character to the battle screen
if (characterBox.CheckOverlap(barrierBox)) { if (characterBox.CheckOverlap(barrierBox)) {
//Actually move the character to a battle //pump character unload
BattleData* battle = battleMgr.Find(barrierIt.second.GetBattleIndex()); CharacterPacket charPacket;
// battle->PushCharacter(characterIt.second); charPacket.type = SerialPacketType::CHARACTER_UNLOAD;
// characterList. charPacket.characterIndex = characterIt->GetIndex();
pumpPacketProximity(static_cast<SerialPacket*>(&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 //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 //Send the entry message to the client
BarrierPacket newPacket; // BarrierPacket newPacket;
newPacket.type = SerialPacketType::BARRIER_ENTRY; // newPacket.type = SerialPacketType::BARRIER_ENTRY;
newPacket.barrierIndex = barrierIt.first; // newPacket.barrierIndex = barrierIt.first;
// udpNetworkUtility.Send(); // udpNetworkUtility.Send();
+1
View File
@@ -596,6 +596,7 @@ void ServerApplication::hQueryCharacterExists(CharacterPacket* const argPacket)
//respond with all character data //respond with all character data
CharacterPacket newPacket; CharacterPacket newPacket;
//TODO: move this expensive lookup
for (auto& it : *characterMgr.GetContainer()) { for (auto& it : *characterMgr.GetContainer()) {
if (argPacket->roomIndex != -1 && it.second.GetRoomIndex() != argPacket->roomIndex) { if (argPacket->roomIndex != -1 && it.second.GetRoomIndex() != argPacket->roomIndex) {
continue; continue;