mirror of https://github.com/OpenTTD/OpenTTD.git
Fix: Engine age is in months, not days (#10773)
This commit is contained in:
parent
31d1a323ef
commit
0fc21b5686
|
@ -611,8 +611,8 @@ void CalcEngineReliability(Engine *e, bool new_month)
|
|||
re = Engine::Get(re->info.variant_id);
|
||||
}
|
||||
|
||||
uint age = re->age;
|
||||
if (new_month && re->index > e->index && age != MAX_DAY) age++; /* parent variant's age has not yet updated. */
|
||||
uint32 age = re->age;
|
||||
if (new_month && re->index > e->index && age != INT32_MAX) age++; /* parent variant's age has not yet updated. */
|
||||
|
||||
/* Check for early retirement */
|
||||
if (e->company_avail != 0 && !_settings_game.vehicle.never_expire_vehicles && e->info.base_life != 0xFF) {
|
||||
|
@ -1094,7 +1094,7 @@ void EnginesMonthlyLoop()
|
|||
bool refresh = false;
|
||||
for (Engine *e : Engine::Iterate()) {
|
||||
/* Age the vehicle */
|
||||
if ((e->flags & ENGINE_AVAILABLE) && e->age != MAX_DAY) {
|
||||
if ((e->flags & ENGINE_AVAILABLE) && e->age != INT32_MAX) {
|
||||
e->age++;
|
||||
CalcEngineReliability(e, true);
|
||||
refresh = true;
|
||||
|
|
|
@ -37,7 +37,7 @@ extern EnginePool _engine_pool;
|
|||
struct Engine : EnginePool::PoolItem<&_engine_pool> {
|
||||
std::string name; ///< Custom name of engine.
|
||||
TimerGameCalendar::Date intro_date; ///< Date of introduction of the engine.
|
||||
TimerGameCalendar::Date age; ///< Age of the engine, in days.
|
||||
int32 age; ///< Age of the engine in months.
|
||||
uint16 reliability; ///< Current reliability of the engine.
|
||||
uint16 reliability_spd_dec; ///< Speed of reliability decay between services (per day).
|
||||
uint16 reliability_start; ///< Initial reliability of the engine.
|
||||
|
|
Loading…
Reference in New Issue