summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-01-04 10:50:24 +0000
committerrubidium <rubidium@openttd.org>2009-01-04 10:50:24 +0000
commitd44ba26cd7d02ff9cdf883f9d3f30fe19e5a2285 (patch)
tree57d992bf69ea4fef59d9e70fdd973e1172be20f8
parentc27460e29cfc0ea51e28005a2d0a966bbe1b933b (diff)
downloadopenttd-d44ba26cd7d02ff9cdf883f9d3f30fe19e5a2285.tar.xz
(svn r14821) -Change [FS#2390]: make the road grids of town match, when all are using the same road layout ofcourse (cirdan)
-rw-r--r--src/town_cmd.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp
index ec318f488..218f4d9c7 100644
--- a/src/town_cmd.cpp
+++ b/src/town_cmd.cpp
@@ -1580,6 +1580,15 @@ Town *CreateRandomTown(uint attempts, TownSizeMode mode, uint size)
do {
/* Generate a tile index not too close from the edge */
TileIndex tile = RandomTile();
+ switch (_settings_game.economy.town_layout) {
+ case TL_2X2_GRID:
+ tile = TileXY(TileX(tile) - TileX(tile) % 3, TileY(tile) - TileY(tile) % 3);
+ break;
+ case TL_3X3_GRID:
+ tile = TileXY(TileX(tile) & ~3, TileY(tile) & ~3);
+ break;
+ default: break;
+ }
if (DistanceFromEdge(tile) < 20) continue;
/* Make sure the tile is plain */