Changeset - r26266:2dedce6458bf
[Not reviewed]
master
0 1 0
Tyler Trahan - 2 years ago 2022-05-14 14:55:39
tyler@tylertrahan.com
Fix #9712: Cap town bridge length at original 11-tile limit (#9890)
1 file changed with 4 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/town_cmd.cpp
Show inline comments
 
@@ -1185,15 +1185,16 @@ static bool GrowTownWithBridge(const Tow
 
	if (!(GetTownRoadBits(TileAddByDiagDir(tile, ReverseDiagDir(bridge_dir))) & DiagDirToRoadBits(bridge_dir))) return false;
 

	
 
	/* We are in the right direction */
 
	int bridge_length = 0;      // This value stores the length of the possible bridge
 
	uint bridge_length = 0;       // This value stores the length of the possible bridge
 
	TileIndex bridge_tile = tile; // Used to store the other waterside
 

	
 
	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 = 5;
 
	int max_bridge_length = t->cache.population / 1000 + base_bridge_length;
 
	const uint TOWN_BRIDGE_LENGTH_CAP = 11;
 
	uint base_bridge_length = 5;
 
	uint max_bridge_length = std::min(t->cache.population / 1000 + base_bridge_length, TOWN_BRIDGE_LENGTH_CAP);
 

	
 
	if (slope == SLOPE_FLAT) {
 
		/* Bridges starting on flat tiles are only allowed when crossing rivers, rails or one-way roads. */
0 comments (0 inline, 0 general)