From 256b8c79f98c2fa5a7144797aa883687d211ce0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E4=BD=A9=E8=8C=B9?= Date: Thu, 23 Mar 2023 12:41:07 -0600 Subject: [PATCH] Add more logging to debug strategy for useless/not possible actions --- src/strategy/Engine.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/strategy/Engine.cpp b/src/strategy/Engine.cpp index ba2e435a..7f64d91d 100644 --- a/src/strategy/Engine.cpp +++ b/src/strategy/Engine.cpp @@ -213,12 +213,40 @@ bool Engine::DoNextAction(Unit* unit, uint32 depth, bool minimal) } else { + if (botAI->HasStrategy("debug", BOT_STATE_NON_COMBAT)) + { + std::ostringstream out; + out << "do: "; + out << action->getName(); + out << " impossible ("; + + out << action->getRelevance() << ")"; + + if (!event.GetSource().empty()) + out << " [" << event.GetSource() << "]"; + + botAI->TellMasterNoFacing(out); + } LogAction("A:%s - IMPOSSIBLE", action->getName().c_str()); MultiplyAndPush(actionNode->getAlternatives(), relevance + 0.03, false, event, "alt"); } } else { + if (botAI->HasStrategy("debug", BOT_STATE_NON_COMBAT)) + { + std::ostringstream out; + out << "do: "; + out << action->getName(); + out << " useless ("; + + out << action->getRelevance() << ")"; + + if (!event.GetSource().empty()) + out << " [" << event.GetSource() << "]"; + + botAI->TellMasterNoFacing(out); + } lastRelevance = relevance; LogAction("A:%s - USELESS", action->getName().c_str()); }