1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Added GUARDED state to distinguish from blocked visitable

This commit is contained in:
Ivan Savenko 2024-05-23 18:46:03 +00:00
parent 7a6540ec2f
commit ef29c47408
3 changed files with 3 additions and 2 deletions

View File

@ -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

View File

@ -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;

View File

@ -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;