1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-13 19:54:17 +02:00

CBattleInfoCallback: use obstacle only once

We should not affect creature by obstacle twice.
This commit is contained in:
Konstantin
2023-03-22 01:42:47 +03:00
parent 88a7b3141d
commit 8c1d6c8e13

View File

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