BattleData can hold a limited number of characters

This commit is contained in:
2016-08-29 19:05:41 +10:00
parent b2aecc933a
commit 4cce98dba4
7 changed files with 93 additions and 22 deletions
+9
View File
@@ -207,6 +207,8 @@ void RoomData::RunFrameCharacterBarrierCollisions() {
//move the character to the battle screen
if (characterBox.CheckOverlap(barrierBox)) {
//TODO: (0) What if the barrier is full?
//TODO: (0) What if the player logs in on top of a barrier?
//pump character unload
CharacterPacket charPacket;
charPacket.type = SerialPacketType::CHARACTER_UNLOAD;
@@ -293,6 +295,13 @@ void RoomData::PopCharacter(CharacterData const * const character) {
}
}
//check the battles to see if the character isn't there
for (auto& it : *battleMgr.GetContainer()) {
if (it.second.PopCharacter(character)) {
return;
}
}
throw(std::logic_error("cannot remove a non-existant instance of CharacterData in RoomData"));
}