Browse Source

Fixed summoned units not being removed after battle

AlexVinS 7 years ago
parent
commit
080a81db3a
2 changed files with 3 additions and 2 deletions
  1. 2 1
      AI/BattleAI/StackWithBonuses.cpp
  2. 1 1
      lib/battle/BattleInfo.cpp

+ 2 - 1
AI/BattleAI/StackWithBonuses.cpp

@@ -53,9 +53,10 @@ StackWithBonuses::StackWithBonuses(const HypotheticBattle * Owner, const battle:
 
 	player = Owner->getSidePlayer(side);
 
+	localInit(Owner);
+
 	position = info.position;
 	summoned = info.summoned;
-	localInit(Owner);
 }
 
 StackWithBonuses::~StackWithBonuses() = default;

+ 1 - 1
lib/battle/BattleInfo.cpp

@@ -797,8 +797,8 @@ void BattleInfo::addUnit(uint32_t id, const JsonNode & data)
 	auto ret = new CStack(&base, owner, info.id, info.side, SlotID::SUMMONED_SLOT_PLACEHOLDER);
 	ret->initialPosition = info.position;
 	stacks.push_back(ret);
-	ret->summoned = info.summoned;
 	ret->localInit(this);
+	ret->summoned = info.summoned;
 }
 
 void BattleInfo::moveUnit(uint32_t id, BattleHex destination)