Browse Source

CBattleInfoCallback: use obstacle only once

We should not affect creature by obstacle twice.
Konstantin 2 years ago
parent
commit
8c1d6c8e13
1 changed files with 2 additions and 1 deletions
  1. 2 1
      lib/battle/CBattleInfoCallback.cpp

+ 2 - 1
lib/battle/CBattleInfoCallback.cpp

@@ -810,7 +810,8 @@ std::vector<std::shared_ptr<const CObstacleInstance>> CBattleInfoCallback::getAl
 			BattleHex otherHex = unit->occupiedHex(unit->getPosition());
 			if(otherHex.isValid())
 				for(auto & i : battleGetAllObstaclesOnPos(otherHex, false))
-					affectedObstacles.push_back(i);
+					if(!vstd::contains(affectedObstacles, i))
+						affectedObstacles.push_back(i);
 		}
 		for(auto hex : unit->getHexes())
 			if(hex == ESiegeHex::GATE_BRIDGE)