1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-13 19:54:17 +02:00

CAdvMapInt: improve hero reminder by checking hero path

Dialog won't show up if movement points insufficient for first step on current path.
This commit is contained in:
Arseniy Shestakov
2018-02-24 21:49:42 +08:00
parent 968bd4a7da
commit 434deffb54

View File

@@ -832,13 +832,22 @@ void CAdvMapInt::fendTurn()
if(settings["adventure"]["heroReminder"].Bool())
{
for (int i = 0; i < LOCPLINT->wanderingHeroes.size(); i++)
if (!isHeroSleeping(LOCPLINT->wanderingHeroes[i]) && (LOCPLINT->wanderingHeroes[i]->movement > 0))
for(auto hero : LOCPLINT->wanderingHeroes)
{
if(!isHeroSleeping(hero) && hero->movement > 0)
{
// Only show hero reminder if conditions met:
// - There still movement points
// - Hero don't have a path or there not points for first step on path
auto path = LOCPLINT->getAndVerifyPath(hero);
if(!path || path->nodes.size() < 2 || !path->nodes[path->nodes.size()-2].turns)
{
LOCPLINT->showYesNoDialog(CGI->generaltexth->allTexts[55], std::bind(&CAdvMapInt::endingTurn, this), 0, false);
return;
}
}
}
}
endingTurn();
}