mirror of https://github.com/OpenTTD/OpenTTD
parent
37d318c410
commit
fa562ba041
|
@ -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;
|
if (!(GetTownRoadBits(TileAddByDiagDir(tile, ReverseDiagDir(bridge_dir))) & DiagDirToRoadBits(bridge_dir))) return false;
|
||||||
|
|
||||||
/* We are in the right direction */
|
/* 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
|
TileIndex bridge_tile = tile; // Used to store the other waterside
|
||||||
|
|
||||||
const int delta = TileOffsByDiagDir(bridge_dir);
|
const int delta = TileOffsByDiagDir(bridge_dir);
|
||||||
|
|
||||||
/* To prevent really small towns from building disproportionately
|
/* To prevent really small towns from building disproportionately
|
||||||
* long bridges, make the max a function of its population. */
|
* long bridges, make the max a function of its population. */
|
||||||
int base_bridge_length = 5;
|
const uint TOWN_BRIDGE_LENGTH_CAP = 11;
|
||||||
int max_bridge_length = t->cache.population / 1000 + base_bridge_length;
|
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) {
|
if (slope == SLOPE_FLAT) {
|
||||||
/* Bridges starting on flat tiles are only allowed when crossing rivers, rails or one-way roads. */
|
/* Bridges starting on flat tiles are only allowed when crossing rivers, rails or one-way roads. */
|
||||||
|
|
Loading…
Reference in New Issue