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

@@ -139,7 +139,7 @@
if (!IsValidEngine(engine_id)) return -1;
if (GetVehicleType(engine_id) == ScriptVehicle::VT_RAIL && IsWagon(engine_id)) return -1;
return (int32_t)::Engine::Get(engine_id)->GetLifeLengthInDays();
return ::Engine::Get(engine_id)->GetLifeLengthInDays().base();
}
/* static */ Money ScriptEngine::GetRunningCost(EngineID engine_id)
@@ -179,7 +179,7 @@
{
if (!IsValidEngine(engine_id)) return ScriptDate::DATE_INVALID;
return (ScriptDate::Date)(int32_t)::Engine::Get(engine_id)->intro_date;
return (ScriptDate::Date)::Engine::Get(engine_id)->intro_date.base();
}
/* static */ ScriptVehicle::VehicleType ScriptEngine::GetVehicleType(EngineID engine_id)