summaryrefslogtreecommitdiff
path: root/src/town_cmd.cpp
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
commite15231c4a455d0a0d0326375f659bdba67d6b33f (patch)
tree57d992bf69ea4fef59d9e70fdd973e1172be20f8 /src/town_cmd.cpp
parentfad3519d4f8e0c43d66bfb6031217c47367a5cac (diff)
downloadopenttd-e15231c4a455d0a0d0326375f659bdba67d6b33f.tar.xz
(svn r14821) -Change [FS#2390]: make the road grids of town match, when all are using the same road layout ofcourse (cirdan)
Diffstat (limited to 'src/town_cmd.cpp')
-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 */