Sfoglia il codice sorgente

CPathfinder: move embark special case code down

It's not affect cost calculations any way so let it's be in same order as it's used in condition under it.
ArseniyShestakov 10 anni fa
parent
commit
cd7c5acbc4
1 ha cambiato i file con 4 aggiunte e 4 eliminazioni
  1. 4 4
      lib/CGameState.cpp

+ 4 - 4
lib/CGameState.cpp

@@ -3417,10 +3417,6 @@ void CPathfinder::calculatePaths()
 			if(!isMovementPossible())
 				continue;
 
-			//special case -> hero embarked a boat standing on a guarded tile -> we must allow to move away from that tile
-			if(cp->accessible == CGPathNode::VISITABLE && guardedSource && cp->theNodeBefore->land && ct->topVisitableId() == Obj::BOAT)
-				guardedSource = false;
-
 			int cost = gs->getMovementCost(hero, cp->coord, dp->coord, flying, movement);
 			int remains = movement - cost;
 			if(useEmbarkCost)
@@ -3439,6 +3435,10 @@ void CPathfinder::calculatePaths()
 				remains = moveAtNextTile - cost;
 			}
 
+			//special case -> hero embarked a boat standing on a guarded tile -> we must allow to move away from that tile
+			if(cp->accessible == CGPathNode::VISITABLE && guardedSource && cp->theNodeBefore->land && ct->topVisitableId() == Obj::BOAT)
+				guardedSource = false;
+
 			if((dp->turns==0xff		//we haven't been here before
 				|| dp->turns > turnAtNextTile
 				|| (dp->turns >= turnAtNextTile  &&  dp->moveRemains < remains)) //this route is faster