mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-15 20:03:15 +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
|
int CGTownInstance::getBoatType() const
|
||||||
{
|
{
|
||||||
switch (town->faction->alignment)
|
switch (town->faction->alignment)
|
||||||
@@ -1162,6 +1170,7 @@ void CGTownInstance::battleFinished(const CGHeroInstance *hero, const BattleResu
|
|||||||
{
|
{
|
||||||
if(result.winner == 0)
|
if(result.winner == 0)
|
||||||
{
|
{
|
||||||
|
clearArmy();
|
||||||
removeCapitols(hero->getOwner());
|
removeCapitols(hero->getOwner());
|
||||||
cb->setOwner (this, hero->tempOwner); //give control after checkout is done
|
cb->setOwner (this, hero->tempOwner); //give control after checkout is done
|
||||||
FoWChange fw;
|
FoWChange fw;
|
||||||
|
@@ -239,6 +239,7 @@ public:
|
|||||||
|
|
||||||
void mergeGarrisonOnSiege() const; // merge garrison into army of visiting hero
|
void mergeGarrisonOnSiege() const; // merge garrison into army of visiting hero
|
||||||
void removeCapitols (PlayerColor owner) const;
|
void removeCapitols (PlayerColor owner) const;
|
||||||
|
void clearArmy() const;
|
||||||
void addHeroToStructureVisitors(const CGHeroInstance *h, si32 structureInstanceID) const; //hero must be visiting or garrisoned in town
|
void addHeroToStructureVisitors(const CGHeroInstance *h, si32 structureInstanceID) const; //hero must be visiting or garrisoned in town
|
||||||
|
|
||||||
CGTownInstance();
|
CGTownInstance();
|
||||||
|
Reference in New Issue
Block a user