Codechange: Add base() method to StrongType to allow access to the base type without casting. (#11445)

This removes the ability to explicitly cast to the base type, but the requirement
to use .base() means the conversion is still explicit.
This commit is contained in:
Peter Nelson
2023-11-06 20:29:35 +00:00
committed by GitHub
parent 737775f834
commit ab535c0a86
73 changed files with 174 additions and 173 deletions

View File

@@ -787,7 +787,7 @@ void RunTileLoop()
_tile_type_procs[GetTileType(tile)]->tile_loop_proc(tile);
/* Get the next tile in sequence using a Galois LFSR. */
tile = (static_cast<uint32_t>(tile) >> 1) ^ (-(int32_t)(static_cast<uint32_t>(tile) & 1) & feedback);
tile = (tile.base() >> 1) ^ (-(int32_t)(tile.base() & 1) & feedback);
}
_cur_tileloop_tile = tile;
@@ -939,7 +939,7 @@ static void CreateDesertOrRainForest(uint desert_tropic_line)
const TileIndexDiffC *data;
for (TileIndex tile = 0; tile != Map::Size(); ++tile) {
if ((static_cast<uint32_t>(tile) % update_freq) == 0) IncreaseGeneratingWorldProgress(GWP_LANDSCAPE);
if ((tile.base() % update_freq) == 0) IncreaseGeneratingWorldProgress(GWP_LANDSCAPE);
if (!IsValidTile(tile)) continue;
@@ -960,7 +960,7 @@ static void CreateDesertOrRainForest(uint desert_tropic_line)
}
for (TileIndex tile = 0; tile != Map::Size(); ++tile) {
if ((static_cast<uint32_t>(tile) % update_freq) == 0) IncreaseGeneratingWorldProgress(GWP_LANDSCAPE);
if ((tile.base() % update_freq) == 0) IncreaseGeneratingWorldProgress(GWP_LANDSCAPE);
if (!IsValidTile(tile)) continue;