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:
@@ -832,13 +832,22 @@ void CAdvMapInt::fendTurn()
|
|||||||
|
|
||||||
if(settings["adventure"]["heroReminder"].Bool())
|
if(settings["adventure"]["heroReminder"].Bool())
|
||||||
{
|
{
|
||||||
for (int i = 0; i < LOCPLINT->wanderingHeroes.size(); i++)
|
for(auto hero : LOCPLINT->wanderingHeroes)
|
||||||
if (!isHeroSleeping(LOCPLINT->wanderingHeroes[i]) && (LOCPLINT->wanderingHeroes[i]->movement > 0))
|
{
|
||||||
|
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);
|
LOCPLINT->showYesNoDialog(CGI->generaltexth->allTexts[55], std::bind(&CAdvMapInt::endingTurn, this), 0, false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
endingTurn();
|
endingTurn();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user