Browse Source

Added GUARDED state to distinguish from blocked visitable

Ivan Savenko 1 year ago
parent
commit
ef29c47408

+ 1 - 0
lib/pathfinder/CGPathNode.h

@@ -37,6 +37,7 @@ enum class EPathAccessibility : ui8
 	NOT_SET,
 	ACCESSIBLE, //tile can be entered and passed
 	VISITABLE, //tile can be entered as the last tile in path
+	GUARDED,  //visitable, but in zone of control of nearby monster
 	BLOCKVIS,  //visitable from neighboring tile but not passable
 	FLYABLE, //can only be accessed in air layer
 	BLOCKED //tile can be neither entered nor visited

+ 1 - 1
lib/pathfinder/PathfinderUtil.h

@@ -58,7 +58,7 @@ namespace PathfinderUtil
 			else if(gs->guardingCreaturePosition(pos).valid())
 			{
 				// Monster close by; blocked visit for battle
-				return EPathAccessibility::BLOCKVIS;
+				return EPathAccessibility::GUARDED;
 			}
 
 			break;

+ 1 - 1
lib/pathfinder/PathfindingRules.cpp

@@ -377,7 +377,7 @@ void LayerTransitionRule::process(
 
 	case EPathfindingLayer::SAIL:
 		//tile must be accessible -> exception: unblocked blockvis tiles -> clear but guarded by nearby monster coast
-		if((destination.node->accessible != EPathAccessibility::ACCESSIBLE && (destination.node->accessible != EPathAccessibility::BLOCKVIS || destination.tile->blocked))
+		if((destination.node->accessible != EPathAccessibility::ACCESSIBLE && destination.node->accessible != EPathAccessibility::GUARDED)
 			|| destination.tile->visitable)  //TODO: passableness problem -> town says it's passable (thus accessible) but we obviously can't disembark onto town gate
 		{
 			destination.blocked = true;