Codechange: make DiagDirection a scoped enum

This commit is contained in:
Peter Nelson
2026-05-31 13:11:53 +01:00
committed by Peter Nelson
parent 356ca9c6d9
commit f010c21f1a
56 changed files with 395 additions and 394 deletions
+5 -5
View File
@@ -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. */