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:
@@ -2144,7 +2144,7 @@ bool AfterLoadGame()
|
||||
/* Delete small ufos heading for non-existing vehicles */
|
||||
for (DisasterVehicle *v : DisasterVehicle::Iterate()) {
|
||||
if (v->subtype == 2 /* ST_SMALL_UFO */ && v->state != 0) {
|
||||
const Vehicle *u = Vehicle::GetIfValid(static_cast<uint32_t>(v->dest_tile));
|
||||
const Vehicle *u = Vehicle::GetIfValid(v->dest_tile.base());
|
||||
if (u == nullptr || u->type != VEH_ROAD || !RoadVehicle::From(u)->IsFrontEngine()) {
|
||||
delete v;
|
||||
}
|
||||
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user