Codechange: Split dates and timers into Economy and Calendar time (#10700)
This commit is contained in:
@@ -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(DoCommandFlag flags, TileIndex tile, const
|
||||
|
||||
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(DoCommandFlag flags, TileIndex tile, const Engin
|
||||
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(Train *v)
|
||||
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()) {
|
||||
|
Reference in New Issue
Block a user