summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-02-04 00:50:31 +0300
committerAndrei Karas <akaras@inbox.ru>2016-02-04 00:50:31 +0300
commit8db56130426f2c61e10219eddb67ee86bea82961 (patch)
tree51c7ccf82996260a9d4becdc942ad8617a681889 /src
parent8d969b8b7a4178d6a72795a9446ddc7f8e398a00 (diff)
downloadmanaverse-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')
-rw-r--r--src/actormanager.cpp38
-rw-r--r--src/actormanager.h5
2 files changed, 35 insertions, 8 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,
diff --git a/src/actormanager.h b/src/actormanager.h
index 59f8552d2..60a0bec00 100644
--- a/src/actormanager.h
+++ b/src/actormanager.h
@@ -259,10 +259,9 @@ class ActorManager final: public ConfigListener
bool isBlocked(const BeingId id) const;
- void printAllToChat() const;
+ void printAllToChat();
- static void printBeingsToChat(const ActorSprites &beings,
- const std::string &header);
+ void printBeingsToChat(const std::string &header);
static void printBeingsToChat(const std::vector<Being*> &beings,
const std::string &header);