This commit is contained in:
@@ -438,7 +438,8 @@ uint Engine::GetDisplayMaxTractiveEffort() const
|
||||
*/
|
||||
TimerGameCalendar::Date Engine::GetLifeLengthInDays() const
|
||||
{
|
||||
return TimerGameCalendar::DateAtStartOfYear(this->info.lifelength + _settings_game.vehicle.extend_vehicle_life);
|
||||
/* Assume leap years; this gives the player a bit more than the given amount of years, but never less. */
|
||||
return static_cast<int32_t>(this->info.lifelength + _settings_game.vehicle.extend_vehicle_life) * CalendarTime::DAYS_IN_LEAP_YEAR;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -663,7 +664,7 @@ void SetYearEngineAgingStops()
|
||||
|
||||
/* Base year ending date on half the model life */
|
||||
TimerGameCalendar::YearMonthDay ymd;
|
||||
TimerGameCalendar::ConvertDateToYMD(ei->base_intro + static_cast<int32_t>(TimerGameCalendar::DateAtStartOfYear(ei->lifelength)) / 2, &ymd);
|
||||
TimerGameCalendar::ConvertDateToYMD(ei->base_intro + (static_cast<int32_t>(ei->lifelength) * CalendarTime::DAYS_IN_LEAP_YEAR) / 2, &ymd);
|
||||
|
||||
_year_engine_aging_stops = std::max(_year_engine_aging_stops, ymd.year);
|
||||
}
|
||||
|
@@ -305,7 +305,7 @@ CommandCost CmdSetTimetableStart(DoCommandFlag flags, VehicleID veh_id, bool tim
|
||||
|
||||
/* Don't let a timetable start more than 15 years into the future or 1 year in the past. */
|
||||
if (start_date < 0 || start_date > CalendarTime::MAX_DATE) return CMD_ERROR;
|
||||
if (start_date - TimerGameCalendar::date > TimerGameCalendar::DateAtStartOfYear(MAX_TIMETABLE_START_YEARS)) return CMD_ERROR;
|
||||
if (start_date - TimerGameCalendar::date > static_cast<int32_t>(MAX_TIMETABLE_START_YEARS) * CalendarTime::DAYS_IN_LEAP_YEAR) return CMD_ERROR;
|
||||
if (TimerGameCalendar::date - start_date > CalendarTime::DAYS_IN_LEAP_YEAR) return CMD_ERROR;
|
||||
if (timetable_all && !v->orders->IsCompleteTimetable()) return CommandCost(STR_ERROR_TIMETABLE_INCOMPLETE);
|
||||
if (timetable_all && start_date + total_duration / Ticks::DAY_TICKS > CalendarTime::MAX_DATE) return CMD_ERROR;
|
||||
|
Reference in New Issue
Block a user