Use GetTileMaxZ for slope cost check to avoid overly penalising foundations

pull/272/head
Jonathan G Rennison 3 years ago
parent 5e7b8ccd43
commit 9683676df1

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

Loading…
Cancel
Save