Changeset - r24584:d5cb1858b4b7
[Not reviewed]
master
0 1 0
Didac Perez Parera - 4 years ago 2020-12-27 00:10:21
perez.didac@gmail.com
Feature: Make maximum length of town bridges depend on population.
1 file changed with 8 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/town_cmd.cpp
Show inline comments
 
@@ -1159,10 +1159,15 @@ static bool GrowTownWithBridge(const Tow
 

	
 
	const int delta = TileOffsByDiagDir(bridge_dir);
 

	
 
	/* To prevent really small towns from building disproportionately
 
	 * long bridges, make the max a function of its population. */
 
	int base_bridge_length = 4;
 
	int max_bridge_length = t->cache.population / 1000 + base_bridge_length;
 

	
 
	if (slope == SLOPE_FLAT) {
 
		/* Bridges starting on flat tiles are only allowed when crossing rivers, rails or one-way roads. */
 
		do {
 
			if (bridge_length++ >= 4) {
 
			if (bridge_length++ >= base_bridge_length) {
 
				/* Allow to cross rivers, not big lakes, nor large amounts of rails or one-way roads. */
 
				return false;
 
			}
 
@@ -1170,8 +1175,8 @@ static bool GrowTownWithBridge(const Tow
 
		} while (IsValidTile(bridge_tile) && ((IsWaterTile(bridge_tile) && !IsSea(bridge_tile)) || IsPlainRailTile(bridge_tile) || (IsNormalRoadTile(bridge_tile) && GetDisallowedRoadDirections(bridge_tile) != DRD_NONE)));
 
	} else {
 
		do {
 
			if (bridge_length++ >= 11) {
 
				/* Max 11 tile long bridges */
 
			if (bridge_length++ >= max_bridge_length) {
 
				/* Ensure the bridge is not longer than the max allowed length. */
 
				return false;
 
			}
 
			bridge_tile += delta;
0 comments (0 inline, 0 general)