1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-09-16 09:26:28 +02:00

Remove access to hero name translation

This commit is contained in:
Ivan Savenko
2024-07-03 17:01:38 +00:00
parent 17841b8f2a
commit 24b77b0972
5 changed files with 16 additions and 11 deletions

View File

@@ -649,7 +649,7 @@ void AIGateway::showBlockingDialog(const std::string & text, const std::vector<C
auto ratio = static_cast<float>(danger) / hero->getTotalStrength();
answer = topObj->id == goalObjectID; // no if we do not aim to visit this object
logAi->trace("Query hook: %s(%s) by %s danger ratio %f", target.toString(), topObj->getObjectName(), hero.name, ratio);
logAi->trace("Query hook: %s(%s) by %s danger ratio %f", target.toString(), topObj->getObjectName(), hero.name(), ratio);
if(cb->getObj(goalObjectID, false))
{
@@ -1574,7 +1574,7 @@ void AIGateway::requestActionASAP(std::function<void()> whatToDo)
void AIGateway::lostHero(HeroPtr h)
{
logAi->debug("I lost my hero %s. It's best to forget and move on.", h.name);
logAi->debug("I lost my hero %s. It's best to forget and move on.", h.name());
}
void AIGateway::answerQuery(QueryID queryID, int selection)

View File

@@ -67,7 +67,6 @@ HeroPtr::HeroPtr(const CGHeroInstance * H)
}
h = H;
name = h->getNameTranslated();
hid = H->id;
// infosCount[ai->playerID][hid]++;
}
@@ -89,6 +88,14 @@ bool HeroPtr::operator<(const HeroPtr & rhs) const
return hid < rhs.hid;
}
std::string HeroPtr::name() const
{
if (h)
return h->getNameTextID();
else
return "<NO HERO>";
}
const CGHeroInstance * HeroPtr::get(bool doWeExpectNull) const
{
return get(cb, doWeExpectNull);

View File

@@ -87,8 +87,7 @@ struct DLL_EXPORT HeroPtr
ObjectInstanceID hid;
public:
std::string name;
std::string name() const;
HeroPtr();
HeroPtr(const CGHeroInstance * H);
@@ -117,7 +116,6 @@ public:
{
handler & h;
handler & hid;
handler & name;
}
};

View File

@@ -176,7 +176,7 @@ int HeroManager::selectBestSkill(const HeroPtr & hero, const std::vector<Seconda
logAi->trace(
"Hero %s is proposed to learn %d with score %f",
hero.name,
hero.name(),
skills[i].toEnum(),
score);
}

View File

@@ -106,7 +106,7 @@ void ExecuteHeroChain::accept(AIGateway * ai)
if(!heroPtr.validAndSet())
{
logAi->error("Hero %s was lost. Exit hero chain.", heroPtr.name);
logAi->error("Hero %s was lost. Exit hero chain.", heroPtr.name());
return;
}
@@ -143,7 +143,7 @@ void ExecuteHeroChain::accept(AIGateway * ai)
if(!heroPtr.validAndSet())
{
logAi->error("Hero %s was lost trying to execute special action. Exit hero chain.", heroPtr.name);
logAi->error("Hero %s was lost trying to execute special action. Exit hero chain.", heroPtr.name());
return;
}
@@ -204,7 +204,7 @@ void ExecuteHeroChain::accept(AIGateway * ai)
{
if(!heroPtr.validAndSet())
{
logAi->error("Hero %s was lost. Exit hero chain.", heroPtr.name);
logAi->error("Hero %s was lost. Exit hero chain.", heroPtr.name());
return;
}
@@ -250,7 +250,7 @@ void ExecuteHeroChain::accept(AIGateway * ai)
{
if(!heroPtr.validAndSet())
{
logAi->debug("Hero %s was killed while attempting to reach %s", heroPtr.name, node->coord.toString());
logAi->debug("Hero %s was killed while attempting to reach %s", heroPtr.name(), node->coord.toString());
return;
}