diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -38,6 +38,7 @@ #include "train_cmd.h" #include "misc_cmd.h" #include "timer/timer_game_calendar.h" +#include "timer/timer_game_economy.h" #include "table/strings.h" #include "table/train_sprites.h" @@ -653,7 +654,7 @@ static CommandCost CmdBuildRailWagon(DoC v->railtype = rvi->railtype; - v->date_of_last_service = TimerGameCalendar::date; + v->date_of_last_service = TimerGameEconomy::date; v->date_of_last_service_newgrf = TimerGameCalendar::date; v->build_year = TimerGameCalendar::year; v->sprite_cache.sprite_seq.Set(SPR_IMG_QUERY); @@ -787,7 +788,7 @@ CommandCost CmdBuildRailVehicle(DoComman v->railtype = rvi->railtype; v->SetServiceInterval(Company::Get(_current_company)->settings.vehicle.servint_trains); - v->date_of_last_service = TimerGameCalendar::date; + v->date_of_last_service = TimerGameEconomy::date; v->date_of_last_service_newgrf = TimerGameCalendar::date; v->build_year = TimerGameCalendar::year; v->sprite_cache.sprite_seq.Set(SPR_IMG_QUERY); @@ -4163,11 +4164,15 @@ static void CheckIfTrainNeedsService(Tra SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, WID_VV_START_STOP); } -/** Update day counters of the train vehicle. */ -void Train::OnNewDay() +/** Calendar day handler. */ +void Train::OnNewCalendarDay() { AgeVehicle(this); - +} + +/** Economy day handler. */ +void Train::OnNewEconomyDay() +{ if ((++this->day_counter & 7) == 0) DecreaseVehicleValue(this); if (this->IsFrontEngine()) {