mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2026-07-24 20:12:42 +00:00
Codechange: make DiagDirection a scoped enum
This commit is contained in:
committed by
Peter Nelson
parent
356ca9c6d9
commit
f010c21f1a
+5
-5
@@ -818,17 +818,17 @@ static bool TryBuildCoastLighthouse()
|
||||
/* Pick a random perimeter tile to start from. */
|
||||
int perimeter = (GB(r, 16, 16) % (2 * (maxx + maxy))) - maxy;
|
||||
DiagDirection dir;
|
||||
for (dir = DIAGDIR_NE; perimeter > 0; dir++) {
|
||||
for (dir = DiagDirection::NE; perimeter > 0; dir++) {
|
||||
perimeter -= (DiagDirToAxis(dir) == Axis::X) ? maxx : maxy;
|
||||
}
|
||||
|
||||
TileIndex tile;
|
||||
switch (dir) {
|
||||
default:
|
||||
case DIAGDIR_NE: tile = TileXY(maxx - 1, r % maxy); break;
|
||||
case DIAGDIR_SE: tile = TileXY(r % maxx, 1); break;
|
||||
case DIAGDIR_SW: tile = TileXY(1, r % maxy); break;
|
||||
case DIAGDIR_NW: tile = TileXY(r % maxx, maxy - 1); break;
|
||||
case DiagDirection::NE: tile = TileXY(maxx - 1, r % maxy); break;
|
||||
case DiagDirection::SE: tile = TileXY(r % maxx, 1); break;
|
||||
case DiagDirection::SW: tile = TileXY(1, r % maxy); break;
|
||||
case DiagDirection::NW: tile = TileXY(r % maxx, maxy - 1); break;
|
||||
}
|
||||
|
||||
/* Now walk inwards until we find a valid tile, or hit the other edge of the map. */
|
||||
|
||||
Reference in New Issue
Block a user