mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-27 22:49:25 +02:00
CGameHandler::endBattle: change town ownership when hero lost siege
This commit is contained in:
@@ -673,8 +673,12 @@ void CGameHandler::endBattle(int3 tile, const CGHeroInstance *hero1, const CGHer
|
|||||||
}
|
}
|
||||||
if(battleResult.data->winner!=1 && hero2)
|
if(battleResult.data->winner!=1 && hero2)
|
||||||
{
|
{
|
||||||
|
auto town = hero2->visitedTown;
|
||||||
RemoveObject ro(hero2->id);
|
RemoveObject ro(hero2->id);
|
||||||
sendAndApply(&ro);
|
sendAndApply(&ro);
|
||||||
|
|
||||||
|
if(town && !town->garrisonHero) // TODO: that must be called from CGHeroInstance or CGTownInstance
|
||||||
|
town->battleFinished(hero1, *battleResult.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
//give exp
|
//give exp
|
||||||
|
|||||||
Reference in New Issue
Block a user