Add wrapper class for diagonal or orthogonal tile iteration

This commit is contained in:
Jonathan G Rennison
2022-12-30 18:09:55 +00:00
parent b88ab5f271
commit 160dcc345a
7 changed files with 66 additions and 28 deletions

View File

@@ -2411,8 +2411,8 @@ CommandCost CmdConvertRail(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
CommandCost error = CommandCost(STR_ERROR_NO_SUITABLE_RAILROAD_TRACK); // by default, there is no track to convert.
bool found_convertible_track = false; // whether we actually did convert some track (see bug #7633)
std::unique_ptr<TileIterator> iter(diagonal ? (TileIterator *)new DiagonalTileIterator(area_start, area_end) : new OrthogonalTileIterator(area_start, area_end));
for (; (tile = *iter) != INVALID_TILE; ++(*iter)) {
OrthogonalOrDiagonalTileIterator iter(area_start, area_end, diagonal);
for (; (tile = *iter) != INVALID_TILE; ++iter) {
TileType tt = GetTileType(tile);
/* Check if there is any track on tile */