From 9683676df11e6887fbff1788d289842148c8a49f Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Thu, 17 Jun 2021 17:33:36 +0100 Subject: [PATCH] Use GetTileMaxZ for slope cost check to avoid overly penalising foundations --- src/road.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/road.cpp b/src/road.cpp index d4ea3a6c36..26699fab65 100644 --- a/src/road.cpp +++ b/src/road.cpp @@ -856,7 +856,7 @@ static int32 PublicRoad_CalculateG(AyStar *, AyStarNode *current, OpenListNode * } else { cost += distance * COST_FOR_NEW_ROAD; - if (GetTileZ(parent->path.node.tile) != GetTileZ(current->tile)) { + if (GetTileMaxZ(parent->path.node.tile) != GetTileMaxZ(current->tile)) { cost += COST_FOR_SLOPE; auto current_node = &parent->path; @@ -868,7 +868,7 @@ static int32 PublicRoad_CalculateG(AyStar *, AyStarNode *current, OpenListNode * break; } - if (GetTileZ(current_node->node.tile) != GetTileZ(parent_node->node.tile)) { + if (GetTileMaxZ(current_node->node.tile) != GetTileMaxZ(parent_node->node.tile)) { cost += COST_FOR_SLOPE; }