mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-06 09:09:40 +02:00
* fixed project files for RD configuration
* fixed crash when creature is casting Hypnosis (ie. exped Vampire Lords) * fixed crash when creature is casting Cure before attack (ie. exped Unicorns) * fixed crash when creature is summoning elemental (TODO fix it) * fixed crash when doing a bonus system operation with a hero liberated from prison (ie. entering town or battle) * fixed deadlock when StupidAI tried to assault the turrets * fixed never ending siege when StupidAI has to use catapult (no more deadlocks on AI-AI siege) * fixed deadlock when a hero received a level during another player's turn (ie. when he successfully defended) * AI can win the game by defeating all enemies if there is a specific victory condition applying only to human players * added options to help testing adventure map AI (--onlyAI, --autoSkip and --oneGoodAI). * many minor changes
This commit is contained in:
@@ -2140,6 +2140,11 @@ CGPath * CPlayerInterface::getAndVerifyPath(const CGHeroInstance * h)
|
||||
|
||||
void CPlayerInterface::acceptTurn()
|
||||
{
|
||||
if(conf.cc.autoSkip)
|
||||
{
|
||||
while(CInfoWindow *iw = dynamic_cast<CInfoWindow *>(GH.topInt()))
|
||||
iw->close();
|
||||
}
|
||||
waitWhileDialog();
|
||||
|
||||
if(howManyPeople > 1)
|
||||
@@ -2171,24 +2176,47 @@ void CPlayerInterface::acceptTurn()
|
||||
adventureInt->select(towns.front());
|
||||
|
||||
adventureInt->showAll(screen);
|
||||
|
||||
if(conf.cc.autoSkip && !LOCPLINT->shiftPressed())
|
||||
{
|
||||
if(CInfoWindow *iw = dynamic_cast<CInfoWindow *>(GH.topInt()))
|
||||
iw->close();
|
||||
|
||||
adventureInt->endTurn.callback();
|
||||
}
|
||||
}
|
||||
|
||||
void CPlayerInterface::tryDiggging(const CGHeroInstance *h)
|
||||
{
|
||||
std::string hlp;
|
||||
if(h->movement < h->maxMovePoints(true))
|
||||
showInfoDialog(CGI->generaltexth->allTexts[56]); //"Digging for artifacts requires a whole day, try again tomorrow."
|
||||
else if(cb->getTile(h->getPosition(false))->tertype == TerrainTile::water)
|
||||
showInfoDialog(CGI->generaltexth->allTexts[60]); //Try looking on land!
|
||||
else
|
||||
CGI->mh->getTerrainDescr(h->getPosition(false), hlp, false);
|
||||
|
||||
int msgToShow = -1;
|
||||
CGHeroInstance::ECanDig isDiggingPossible = h->diggingStatus();
|
||||
if(hlp.length())
|
||||
isDiggingPossible = CGHeroInstance::TILE_OCCUPIED; //TODO integrate with canDig
|
||||
|
||||
switch(isDiggingPossible)
|
||||
{
|
||||
const TerrainTile *t = cb->getTile(h->getPosition());
|
||||
CGI->mh->getTerrainDescr(h->getPosition(false), hlp, false);
|
||||
if(hlp.length() || t->blockingObjects.size() > 1)
|
||||
showInfoDialog(CGI->generaltexth->allTexts[97]); //Try searching on clear ground.
|
||||
else
|
||||
cb->dig(h);
|
||||
case CGHeroInstance::CAN_DIG:
|
||||
break;
|
||||
case CGHeroInstance::LACK_OF_MOVEMENT:
|
||||
msgToShow = 56; //"Digging for artifacts requires a whole day, try again tomorrow."
|
||||
break;
|
||||
case CGHeroInstance::TILE_OCCUPIED:
|
||||
msgToShow = 97; //Try searching on clear ground.
|
||||
break;
|
||||
case CGHeroInstance::WRONG_TERRAIN:
|
||||
msgToShow = 60; ////Try looking on land!
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
}
|
||||
|
||||
if(msgToShow < 0)
|
||||
cb->dig(h);
|
||||
else
|
||||
showInfoDialog(CGI->generaltexth->allTexts[msgToShow]);
|
||||
}
|
||||
|
||||
void CPlayerInterface::updateInfo(const CGObjectInstance * specific)
|
||||
|
||||
Reference in New Issue
Block a user