Changeset - r26648:6013207914d2
[Not reviewed]
master
0 1 0
2TallTyler - 21 months ago 2022-12-13 18:36:32
tyler@tylertrahan.com
Cleanup: Refactor Wide Rivers code slightly
1 file changed with 3 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/landscape.cpp
Show inline comments
 
@@ -1173,15 +1173,15 @@ static bool RiverMakeWider(TileIndex til
 
			cur_slope = GetTileSlope(tile);
 
			if (cur_slope != desired_slope && IsSlopeWithOneCornerRaised(cur_slope)) {
 
				to_change = cur_slope ^ desired_slope;
 
				Command<CMD_TERRAFORM_LAND>::Do(DC_EXEC | DC_AUTO, tile, to_change, true);
 
			}
 
		}
 
		/* Update cur_slope after possibly terraforming. */
 
		cur_slope = GetTileSlope(tile);
 
	}
 
	/* Update cur_slope after possibly terraforming. */
 
	cur_slope = GetTileSlope(tile);
 

	
 
	/* Sloped rivers need water both upstream and downstream. */
 
	if (IsInclinedSlope(cur_slope)) {
 
		DiagDirection slope_direction = GetInclinedSlopeDirection(cur_slope);
 

	
 
		TileIndex upstream_tile = TileAddByDiagDir(tile, slope_direction);
 
@@ -1316,13 +1316,13 @@ static void River_FoundEndNode(AyStar *a
 
			TileIndex tile = path->node.tile;
 

	
 
			/* Check if we should widen river depending on how far we are away from the source. */
 
			current_river_length = DistanceManhattan(data->spring, tile);
 
			radius = std::min(3u, (current_river_length / (long_river_length / 3u)) + 1u);
 

	
 
			if (radius > 1) CircularTileSearch(&tile, radius + RandomRange(1), RiverMakeWider, (void *)&path->node.tile);
 
			if (radius > 1) CircularTileSearch(&tile, radius, RiverMakeWider, (void *)&path->node.tile);
 
		}
 
	}
 
}
 

	
 
static const uint RIVER_HASH_SIZE = 8; ///< The number of bits the hash for river finding should have.
 

	
0 comments (0 inline, 0 general)