Changeset - r10564:29e96c981acd
[Not reviewed]
master
0 1 0
rubidium - 15 years ago 2009-01-04 10:50:24
rubidium@openttd.org
(svn r14821) -Change [FS#2390]: make the road grids of town match, when all are using the same road layout ofcourse (cirdan)
1 file changed with 9 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/town_cmd.cpp
Show inline comments
 
@@ -1577,12 +1577,21 @@ CommandCost CmdBuildTown(TileIndex tile,
 

	
 
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 */
 
		if (!IsTileType(tile, MP_CLEAR) || GetTileSlope(tile, NULL) != SLOPE_FLAT) continue;
 

	
 
		/* Check not too close to a town */
0 comments (0 inline, 0 general)