1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

Add hardcodedFeature to switch winner's retreating with no troops

This commit is contained in:
Vadim Markovtsev
2016-01-27 11:38:35 +03:00
parent 4483c45905
commit 36eaa399e7
10 changed files with 111 additions and 42 deletions

View File

@@ -757,18 +757,21 @@ void CGameHandler::battleAfterLevelUp( const BattleResult &result )
RemoveObject ro(finishingBattle->winnerHero->id);
sendAndApply(&ro);
SetAvailableHeroes sah;
sah.player = finishingBattle->victor;
sah.hid[0] = finishingBattle->winnerHero->subID;
sah.army[0].clear();
sah.army[0].setCreature(SlotID(0), finishingBattle->winnerHero->type->initialArmy.at(0).creature, 1);
if (VLC->modh->settings.WINNING_HERO_WITH_NO_TROOPS_RETREATS)
{
SetAvailableHeroes sah;
sah.player = finishingBattle->victor;
sah.hid[0] = finishingBattle->winnerHero->subID;
sah.army[0].clear();
sah.army[0].setCreature(SlotID(0), finishingBattle->winnerHero->type->initialArmy.at(0).creature, 1);
if(const CGHeroInstance *another = getPlayer(finishingBattle->victor)->availableHeroes.at(0))
sah.hid[1] = another->subID;
else
sah.hid[1] = -1;
if(const CGHeroInstance *another = getPlayer(finishingBattle->victor)->availableHeroes.at(0))
sah.hid[1] = another->subID;
else
sah.hid[1] = -1;
sendAndApply(&sah);
sendAndApply(&sah);
}
}
}