From 263f32fb0184d0344a4f12185cb2137bf5f778fa Mon Sep 17 00:00:00 2001 From: DarthArgus Date: Sun, 18 Dec 2016 04:25:28 +0000 Subject: [PATCH] fix a bit of chatty ai logs --- .../library/serverGame/src/shared/ai/AiLogManager.cpp | 8 +++++++- .../src/shared/controller/AiCreatureController.cpp | 3 +-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/engine/server/library/serverGame/src/shared/ai/AiLogManager.cpp b/engine/server/library/serverGame/src/shared/ai/AiLogManager.cpp index 27102e60..ed94da98 100755 --- a/engine/server/library/serverGame/src/shared/ai/AiLogManager.cpp +++ b/engine/server/library/serverGame/src/shared/ai/AiLogManager.cpp @@ -52,7 +52,13 @@ void AiLogManager::setLogging(NetworkId const & networkId, bool const enabled) // ---------------------------------------------------------------------- bool AiLogManager::isLogging(NetworkId const & networkId) { - return ConfigServerGame::isAiLoggingEnabled() || (s_aiList.find(networkId) != s_aiList.end()); + bool result = (ConfigServerGame::isAiLoggingEnabled() && (s_aiList.find(networkId) != s_aiList.end())); + + if (!result) { + s_aiList.erase(networkId); + } + + return result; } // ====================================================================== diff --git a/engine/server/library/serverGame/src/shared/controller/AiCreatureController.cpp b/engine/server/library/serverGame/src/shared/controller/AiCreatureController.cpp index 9df8520f..a51091c6 100755 --- a/engine/server/library/serverGame/src/shared/controller/AiCreatureController.cpp +++ b/engine/server/library/serverGame/src/shared/controller/AiCreatureController.cpp @@ -167,8 +167,7 @@ AICreatureController::~AICreatureController() if (owner != nullptr && owner->isAuthoritative() && !getHibernate() && m_hibernationDelay.get() > 0 && m_hibernationTimer.get() > 0) ObjectTracker::removeDelayedHibernatingAI(); - if ( (owner != nullptr) - && AiLogManager::isLogging(owner->getNetworkId())) + if ((owner != nullptr) && AiLogManager::isLogging(owner->getNetworkId())) { AiLogManager::setLogging(owner->getNetworkId(), false); }