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

Fix: Terrain description should be shown correctly

This commit is contained in:
Dmitry Orlov
2021-11-06 00:08:48 +03:00
committed by Andrii Danylchenko
parent 7cfd1fe0ca
commit 0427fa45dd
4 changed files with 63 additions and 24 deletions

View File

@ -2386,16 +2386,16 @@ void CPlayerInterface::acceptTurn()
}
}
void CPlayerInterface::tryDiggging(const CGHeroInstance *h)
void CPlayerInterface::tryDiggging(const CGHeroInstance * h)
{
std::string hlp;
CGI->mh->getTerrainDescr(h->getPosition(false), hlp, false);
auto isDiggingPossible = h->diggingStatus();
if (hlp.length())
isDiggingPossible = EDiggingStatus::TILE_OCCUPIED; //TODO integrate with canDig
int msgToShow = -1;
switch(isDiggingPossible)
const bool isBlocked = CGI->mh->hasObjectHole(h->getPosition(false)); // Don't dig in the pit.
const auto diggingStatus = isBlocked
? EDiggingStatus::TILE_OCCUPIED
: h->diggingStatus().num;
switch(diggingStatus)
{
case EDiggingStatus::CAN_DIG:
break;
@ -2412,7 +2412,7 @@ void CPlayerInterface::tryDiggging(const CGHeroInstance *h)
assert(0);
}
if (msgToShow < 0)
if(msgToShow < 0)
cb->dig(h);
else
showInfoDialog(CGI->generaltexth->allTexts[msgToShow]);