mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
CGTownInstance: erase all stacks when town is captured by enemy
This commit is contained in:
@@ -802,6 +802,14 @@ void CGTownInstance::removeCapitols (PlayerColor owner) const
|
||||
}
|
||||
}
|
||||
|
||||
void CGTownInstance::clearArmy() const
|
||||
{
|
||||
while(!stacks.empty())
|
||||
{
|
||||
cb->eraseStack(StackLocation(this, stacks.begin()->first));
|
||||
}
|
||||
}
|
||||
|
||||
int CGTownInstance::getBoatType() const
|
||||
{
|
||||
switch (town->faction->alignment)
|
||||
@@ -1162,6 +1170,7 @@ void CGTownInstance::battleFinished(const CGHeroInstance *hero, const BattleResu
|
||||
{
|
||||
if(result.winner == 0)
|
||||
{
|
||||
clearArmy();
|
||||
removeCapitols(hero->getOwner());
|
||||
cb->setOwner (this, hero->tempOwner); //give control after checkout is done
|
||||
FoWChange fw;
|
||||
|
@@ -239,6 +239,7 @@ public:
|
||||
|
||||
void mergeGarrisonOnSiege() const; // merge garrison into army of visiting hero
|
||||
void removeCapitols (PlayerColor owner) const;
|
||||
void clearArmy() const;
|
||||
void addHeroToStructureVisitors(const CGHeroInstance *h, si32 structureInstanceID) const; //hero must be visiting or garrisoned in town
|
||||
|
||||
CGTownInstance();
|
||||
|
Reference in New Issue
Block a user