1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-17 01:32:21 +02:00

Plug assertion (report warning instead) on some maps start.

This commit is contained in:
AlexVinS
2016-11-03 19:15:16 +03:00
parent 9e366df70f
commit 329a537eec

View File

@ -2313,7 +2313,11 @@ void CPlayerInterface::acceptTurn()
components.push_back(Component(Component::FLAG, playerColor.getNum(), 0, 0)); components.push_back(Component(Component::FLAG, playerColor.getNum(), 0, 0));
MetaString text; MetaString text;
auto daysWithoutCastle = *cb->getPlayer(playerColor)->daysWithoutCastle; const auto & optDaysWithoutCastle = cb->getPlayer(playerColor)->daysWithoutCastle;
if(optDaysWithoutCastle)
{
auto daysWithoutCastle = optDaysWithoutCastle.get();
if (daysWithoutCastle < 6) if (daysWithoutCastle < 6)
{ {
text.addTxt(MetaString::ARRAY_TXT,128); //%s, you only have %d days left to capture a town or you will be banished from this land. text.addTxt(MetaString::ARRAY_TXT,128); //%s, you only have %d days left to capture a town or you will be banished from this land.
@ -2328,6 +2332,9 @@ void CPlayerInterface::acceptTurn()
showInfoDialogAndWait(components, text); showInfoDialogAndWait(components, text);
} }
else
logGlobal->warn("Player has no towns, but daysWithoutCastle is not set");
}
} }
void CPlayerInterface::tryDiggging(const CGHeroInstance *h) void CPlayerInterface::tryDiggging(const CGHeroInstance *h)