diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index a0f00eba7a..ef1995b8ca 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -1185,15 +1185,16 @@ static bool GrowTownWithBridge(const Town *t, const TileIndex tile, const DiagDi 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. */