Discourage trails crossing water
This commit is contained in:
Binary file not shown.
@@ -2621,8 +2621,18 @@ static int build_trail_path(worldgen_ctx *ctx, double ax, double az, double bx,
|
|||||||
double next_height = heights[ni];
|
double next_height = heights[ni];
|
||||||
double slope = fabs(next_height - current_height);
|
double slope = fabs(next_height - current_height);
|
||||||
if (slope > 3.0) continue;
|
if (slope > 3.0) continue;
|
||||||
|
int water = 0;
|
||||||
|
int wx = (int)llround(min_x + nx * TRAIL_CELL_SIZE);
|
||||||
|
int wz = (int)llround(min_z + nz * TRAIL_CELL_SIZE);
|
||||||
|
column_data cd = get_column_data(ctx, wx, wz);
|
||||||
|
if (cd.has_water && next_height <= cd.water_surface) {
|
||||||
|
water = 1;
|
||||||
|
}
|
||||||
double base_cost = (neighbors[n][0] == 0 || neighbors[n][1] == 0) ? 1.0 : 1.41421356237;
|
double base_cost = (neighbors[n][0] == 0 || neighbors[n][1] == 0) ? 1.0 : 1.41421356237;
|
||||||
double cost = base_cost * (1.0 + slope * 6.0);
|
double cost = base_cost * (1.0 + slope * 6.0);
|
||||||
|
if (water) {
|
||||||
|
cost += 10.0;
|
||||||
|
}
|
||||||
if (dist[current] + cost < dist[ni]) {
|
if (dist[current] + cost < dist[ni]) {
|
||||||
dist[ni] = dist[current] + cost;
|
dist[ni] = dist[current] + cost;
|
||||||
prev[ni] = current;
|
prev[ni] = current;
|
||||||
|
|||||||
Reference in New Issue
Block a user