mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-24 08:32:34 +02:00
Fix 1569 winning hero with no troops shall retreat
This commit is contained in:
parent
b02bd61c83
commit
9dfef2186d
@ -712,7 +712,7 @@ void CGameHandler::battleAfterLevelUp( const BattleResult &result )
|
||||
|
||||
setBattle(nullptr);
|
||||
|
||||
if(visitObjectAfterVictory && result.winner==0)
|
||||
if(visitObjectAfterVictory && result.winner==0 && !finishingBattle->winnerHero->stacks.empty())
|
||||
{
|
||||
logGlobal->traceStream() << "post-victory visit";
|
||||
visitObjectOnTile(*getTile(finishingBattle->winnerHero->getPosition()), finishingBattle->winnerHero);
|
||||
@ -741,6 +741,24 @@ void CGameHandler::battleAfterLevelUp( const BattleResult &result )
|
||||
|
||||
sendAndApply(&sah);
|
||||
}
|
||||
if(finishingBattle->winnerHero->stacks.empty())
|
||||
{
|
||||
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(const CGHeroInstance *another = getPlayer(finishingBattle->victor)->availableHeroes.at(1))
|
||||
sah.hid[1] = another->subID;
|
||||
else
|
||||
sah.hid[1] = -1;
|
||||
|
||||
sendAndApply(&sah);
|
||||
}
|
||||
}
|
||||
|
||||
void CGameHandler::prepareAttack(BattleAttack &bat, const CStack *att, const CStack *def, int distance, int targetHex)
|
||||
|
Loading…
Reference in New Issue
Block a user