diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-02-04 00:50:31 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-02-04 00:50:31 +0300 |
commit | 8db56130426f2c61e10219eddb67ee86bea82961 (patch) | |
tree | 51c7ccf82996260a9d4becdc942ad8617a681889 /src/actormanager.cpp | |
parent | 8d969b8b7a4178d6a72795a9446ddc7f8e398a00 (diff) | |
download | manaverse-8db56130426f2c61e10219eddb67ee86bea82961.tar.gz manaverse-8db56130426f2c61e10219eddb67ee86bea82961.tar.bz2 manaverse-8db56130426f2c61e10219eddb67ee86bea82961.tar.xz manaverse-8db56130426f2c61e10219eddb67ee86bea82961.zip |
Extend chat command /all to log corruption in actors lists.
Diffstat (limited to 'src/actormanager.cpp')
-rw-r--r-- | src/actormanager.cpp | 38 |
1 files changed, 33 insertions, 5 deletions
diff --git a/src/actormanager.cpp b/src/actormanager.cpp index 98e8ef008..1152324c2 100644 --- a/src/actormanager.cpp +++ b/src/actormanager.cpp @@ -1481,14 +1481,13 @@ bool ActorManager::isBlocked(const BeingId id) const return mBlockedBeings.find(id) != mBlockedBeings.end(); } -void ActorManager::printAllToChat() const +void ActorManager::printAllToChat() { // TRANSLATORS: visible beings on map - printBeingsToChat(getAll(), _("Visible on map")); + printBeingsToChat(_("Visible on map")); } -void ActorManager::printBeingsToChat(const ActorSprites &beings, - const std::string &header) +void ActorManager::printBeingsToChat(const std::string &header) { if (!debugChatTab) return; @@ -1496,7 +1495,7 @@ void ActorManager::printBeingsToChat(const ActorSprites &beings, debugChatTab->chatLog("---------------------------------------", ChatMsgType::BY_SERVER); debugChatTab->chatLog(header, ChatMsgType::BY_SERVER); - FOR_EACH (std::set<ActorSprite*>::const_iterator, it, beings) + for_actors { if (!*it) continue; @@ -1509,9 +1508,38 @@ void ActorManager::printBeingsToChat(const ActorSprites &beings, debugChatTab->chatLog(strprintf("%s (%d,%d) %d", being->getName().c_str(), being->getTileX(), being->getTileY(), toInt(being->getSubType(), int)), ChatMsgType::BY_SERVER); + if (mActorsIdMap.find(being->getId()) == mActorsIdMap.end()) + { + debugChatTab->chatLog("missing in id map: %s", + being->getName().c_str()); + } } debugChatTab->chatLog("---------------------------------------", ChatMsgType::BY_SERVER); + FOR_EACH (ActorSpritesMapConstIterator, itr, mActorsIdMap) + { + ActorSprite *actor = (*itr).second; + if (!actor) + continue; + if (actor->getId() != (*itr).first) + debugChatTab->chatLog("Actor with wrong key in map", ""); + + bool found(false); + + for_actors + { + if (!*it) + continue; + + if ((*it)->getId() == actor->getId()) + { + found = true; + break; + } + } + if (!found) + debugChatTab->chatLog("Actor present in map but not in set", ""); + } } void ActorManager::printBeingsToChat(const std::vector<Being*> &beings, |