1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +02:00

Try fix bypassing destroyed fort drawbridge

This commit is contained in:
Andrii Danylchenko 2020-11-21 19:01:42 +02:00
parent eb011e59c4
commit af192b8efe

View File

@ -1161,7 +1161,7 @@ ReachabilityInfo CBattleInfoCallback::makeBFS(const AccessibilityInfo &accessibi
if(!params.startPosition.isValid()) //if got call for arrow turrets
return ret;
const std::set<BattleHex> quicksands = getStoppers(params.perspective);
const std::set<BattleHex> obstacles = getStoppers(params.perspective);
std::queue<BattleHex> hexq; //bfs queue
@ -1178,10 +1178,18 @@ ReachabilityInfo CBattleInfoCallback::makeBFS(const AccessibilityInfo &accessibi
const BattleHex curHex = hexq.front();
hexq.pop();
//walking stack can't step past the quicksands
//TODO what if second hex of two-hex creature enters quicksand
if(curHex != params.startPosition && vstd::contains(quicksands, curHex))
//walking stack can't step past the obstacles
//TODO what if second hex of two-hex creature enters obstacles
if(curHex != params.startPosition && vstd::contains(obstacles, curHex))
{
if(curHex == ESiegeHex::GATE_BRIDGE)
{
if(battleGetGateState() != EGateState::DESTROYED && params.side == BattleSide::ATTACKER)
continue;
}
else
continue;
}
const int costToNeighbour = ret.distances[curHex.hex] + 1;
for(BattleHex neighbour : BattleHex::neighbouringTilesCache[curHex.hex])