diff options
Diffstat (limited to 'src/town_cmd.cpp')
-rw-r--r-- | src/town_cmd.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index 8928ffdbf..f3dbe7ae4 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -1159,10 +1159,15 @@ static bool GrowTownWithBridge(const Town *t, const TileIndex tile, const DiagDi 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 Town *t, const TileIndex tile, const DiagDi } 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; |