Use GetTileMaxZ for slope cost check to avoid overly penalising foundations

This commit is contained in:
Jonathan G Rennison
2021-06-17 17:33:36 +01:00
parent 5e7b8ccd43
commit 9683676df1

View File

@@ -856,7 +856,7 @@ static int32 PublicRoad_CalculateG(AyStar *, AyStarNode *current, OpenListNode *
} else { } else {
cost += distance * COST_FOR_NEW_ROAD; 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; cost += COST_FOR_SLOPE;
auto current_node = &parent->path; auto current_node = &parent->path;
@@ -868,7 +868,7 @@ static int32 PublicRoad_CalculateG(AyStar *, AyStarNode *current, OpenListNode *
break; 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; cost += COST_FOR_SLOPE;
} }