mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-09 15:41:15 +00:00
Feature: Make maximum length of town bridges depend on population.
This commit is contained in:
parent
c3faec4e9a
commit
64eddaeb49
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user