Codechange: Make TileIndex a "strong" typedef to give it a distinct type.

This is accomplished by changing it to a single member struct with the
appropriate operator overloads to make it all work with not too much
source modifications.
This commit is contained in:
Michael Lutz
2021-11-06 23:11:22 +01:00
parent 4fc055d6e9
commit b0990fcff7
23 changed files with 160 additions and 33 deletions

View File

@@ -454,7 +454,7 @@ CommandCost CmdBuildCanal(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32
/* Outside the editor you can only drag canals, and not areas */
if (_game_mode != GM_EDITOR) {
TileArea ta(tile, p1);
TileArea ta(tile, (TileIndex)p1);
if (ta.w != 1 && ta.h != 1) return CMD_ERROR;
}
@@ -462,9 +462,9 @@ CommandCost CmdBuildCanal(DoCommandFlag flags, TileIndex tile, uint32 p1, uint32
std::unique_ptr<TileIterator> iter;
if (HasBit(p2, 2)) {
iter = std::make_unique<DiagonalTileIterator>(tile, p1);
iter = std::make_unique<DiagonalTileIterator>(tile, (TileIndex)p1);
} else {
iter = std::make_unique<OrthogonalTileIterator>(tile, p1);
iter = std::make_unique<OrthogonalTileIterator>(tile, (TileIndex)p1);
}
for (; *iter != INVALID_TILE; ++(*iter)) {