Codechange: make explicit when a TileIndex is cast to its basetype (#11190)

This prevents people accidentially assigning a TileIndex to a Date
or any other type they shouldn't.
This commit is contained in:
Patric Stout
2023-08-15 18:12:05 +02:00
committed by GitHub
parent 5d3f7939e2
commit 07730584d7
31 changed files with 120 additions and 105 deletions

View File

@@ -21,14 +21,14 @@ void ScriptTileList::AddRectangle(TileIndex t1, TileIndex t2)
if (!::IsValidTile(t2)) return;
TileArea ta(t1, t2);
for (TileIndex t : ta) this->AddItem(t);
for (TileIndex t : ta) this->AddItem(static_cast<uint32_t>(t));
}
void ScriptTileList::AddTile(TileIndex tile)
{
if (!::IsValidTile(tile)) return;
this->AddItem(tile);
this->AddItem(static_cast<uint32_t>(tile));
}
void ScriptTileList::RemoveRectangle(TileIndex t1, TileIndex t2)
@@ -37,14 +37,14 @@ void ScriptTileList::RemoveRectangle(TileIndex t1, TileIndex t2)
if (!::IsValidTile(t2)) return;
TileArea ta(t1, t2);
for (TileIndex t : ta) this->RemoveItem(t);
for (TileIndex t : ta) this->RemoveItem(static_cast<uint32_t>(t));
}
void ScriptTileList::RemoveTile(TileIndex tile)
{
if (!::IsValidTile(tile)) return;
this->RemoveItem(tile);
this->RemoveItem(static_cast<uint32_t>(tile));
}
/**