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

@@ -57,8 +57,8 @@ static void FixTTDMapArray()
/* _old_map3 is moved to _m::m3 and _m::m4 */
for (TileIndex t = 0; t < OLD_MAP_SIZE; t++) {
Tile tile(t);
tile.m3() = _old_map3[static_cast<uint32_t>(t) * 2];
tile.m4() = _old_map3[static_cast<uint32_t>(t) * 2 + 1];
tile.m3() = _old_map3[t.base() * 2];
tile.m4() = _old_map3[t.base() * 2 + 1];
}
for (TileIndex t = 0; t < OLD_MAP_SIZE; t++) {
@@ -416,7 +416,7 @@ static bool FixTTOEngines()
if (TimerGameCalendar::date >= e->intro_date && HasBit(e->info.climates, 0)) {
e->flags |= ENGINE_AVAILABLE;
e->company_avail = MAX_UVALUE(CompanyMask);
e->age = TimerGameCalendar::date > e->intro_date ? static_cast<int32_t>(TimerGameCalendar::date - e->intro_date) / 30 : 0;
e->age = TimerGameCalendar::date > e->intro_date ? (TimerGameCalendar::date - e->intro_date).base() / 30 : 0;
}
} else {
/* Using data from TTO savegame */