From 440b468e273f337da3740c33b81d671412a5fc64 Mon Sep 17 00:00:00 2001 From: Dydzio Date: Thu, 18 Jan 2024 20:42:08 +0100 Subject: [PATCH] Some partial success on getting fly to work similarly to SoD --- lib/pathfinder/PathfinderOptions.cpp | 2 +- lib/pathfinder/PathfindingRules.cpp | 21 ++++++++++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/lib/pathfinder/PathfinderOptions.cpp b/lib/pathfinder/PathfinderOptions.cpp index 4c83acafc..a7e42795c 100644 --- a/lib/pathfinder/PathfinderOptions.cpp +++ b/lib/pathfinder/PathfinderOptions.cpp @@ -29,7 +29,7 @@ PathfinderOptions::PathfinderOptions() , useCastleGate(false) , lightweightFlyingMode(false) , oneTurnSpecialLayersLimit(true) - , originalMovementRules(false) + , originalMovementRules(true) , turnLimit(std::numeric_limits::max()) , canUseCast(false) { diff --git a/lib/pathfinder/PathfindingRules.cpp b/lib/pathfinder/PathfindingRules.cpp index d041aff85..ff589f3ee 100644 --- a/lib/pathfinder/PathfindingRules.cpp +++ b/lib/pathfinder/PathfindingRules.cpp @@ -384,12 +384,23 @@ void LayerTransitionRule::process( case EPathfindingLayer::AIR: if(pathfinderConfig->options.originalMovementRules) { - if((source.node->accessible != EPathAccessibility::ACCESSIBLE && - source.node->accessible != EPathAccessibility::VISITABLE) && - (destination.node->accessible != EPathAccessibility::VISITABLE && - destination.node->accessible != EPathAccessibility::ACCESSIBLE)) + if(destination.coord.x == 2 && destination.coord.y == 35) + logGlobal->error(source.node->coord.toString() + std::string(" Layer: ") + std::to_string(destination.node->layer) + std::string(" Accessibility: ") + std::to_string((int)source.node->accessible)); + + if(source.node->accessible != EPathAccessibility::ACCESSIBLE && + source.node->accessible != EPathAccessibility::VISITABLE && + destination.node->accessible != EPathAccessibility::VISITABLE && + destination.node->accessible != EPathAccessibility::ACCESSIBLE) { - destination.blocked = true; + if(destination.node->accessible == EPathAccessibility::BLOCKVIS) + { + if(source.nodeObject || source.tile->blocked) + { + destination.blocked = true; + } + } + else + destination.blocked = true; } } else if(destination.node->accessible != EPathAccessibility::ACCESSIBLE)