OpenTTD Source 20241224-master-gf74b0cf984
|
Functions related to time tabling. More...
Go to the source code of this file.
Enumerations | |
enum class | TimetableMode : uint8_t { Days , Seconds , Ticks } |
Functions | |
TimerGameTick::TickCounter | GetStartTickFromDate (TimerGameEconomy::Date start_date) |
Get the TimerGameTick::TickCounter tick of a given date. | |
TimerGameEconomy::Date | GetDateFromStartTick (TimerGameTick::TickCounter start_tick) |
Get a date from a given start tick of timetable. | |
void | ShowTimetableWindow (const Vehicle *v) |
Show the timetable for a given vehicle. | |
void | UpdateVehicleTimetable (Vehicle *v, bool travelling) |
Update the timetable for the vehicle. | |
void | SetTimetableParams (int param1, int param2, TimerGameTick::Ticks ticks) |
Set the timetable parameters in the format as described by the setting. | |
Variables | |
static const TimerGameEconomy::Year | MAX_TIMETABLE_START_YEARS = 15 |
The maximum start date offset, in economy years. | |
Functions related to time tabling.
Definition in file timetable.h.
|
strong |
Definition at line 19 of file timetable.h.
TimerGameEconomy::Date GetDateFromStartTick | ( | TimerGameTick::TickCounter | start_tick | ) |
Get a date from a given start tick of timetable.
start_tick | The TimerGameTick::TickCounter when the timetable starts. |
Definition at line 46 of file timetable_cmd.cpp.
References TimerGameTick::counter, TimerGameEconomy::date, TimerGameEconomy::date_fract, and Ticks::DAY_TICKS.
Referenced by CmdSetTimetableStart(), and TimetableWindow::DrawSummaryPanel().
TimerGameTick::TickCounter GetStartTickFromDate | ( | TimerGameEconomy::Date | start_date | ) |
Get the TimerGameTick::TickCounter tick of a given date.
start_date | The date when the timetable starts. |
Definition at line 29 of file timetable_cmd.cpp.
References TimerGameTick::counter, TimerGameEconomy::date, TimerGameEconomy::date_fract, and Ticks::DAY_TICKS.
Referenced by ChangeTimetableStartCallback().
void SetTimetableParams | ( | int | param1, |
int | param2, | ||
TimerGameTick::Ticks | ticks | ||
) |
Set the timetable parameters in the format as described by the setting.
param1 | the first DParam to fill |
param2 | the second DParam to fill |
ticks | the number of ticks to 'draw' |
Definition at line 50 of file timetable_gui.cpp.
References _settings_client, Ticks::DAY_TICKS, ClientSettings::gui, SetDParam(), Ticks::TICKS_PER_SECOND, and GUISettings::timetable_mode.
Referenced by DrawOrderString(), TimetableWindow::DrawSummaryPanel(), and TimetableWindow::DrawTimetablePanel().
void ShowTimetableWindow | ( | const Vehicle * | v | ) |
Show the timetable for a given vehicle.
v | The vehicle to show the timetable for. |
Definition at line 872 of file timetable_gui.cpp.
References CloseWindowById(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, WC_VEHICLE_DETAILS, and WC_VEHICLE_ORDERS.
Referenced by OrdersWindow::OnClick(), and VehicleViewWindow::OnClick().
void UpdateVehicleTimetable | ( | Vehicle * | v, |
bool | travelling | ||
) |
Update the timetable for the vehicle.
v | The vehicle to update the timetable for. |
travelling | Whether we just travelled or waited at a station. |
Definition at line 469 of file timetable_cmd.cpp.
References _settings_client, CeilDiv(), ChangeTimetable(), ClrBit(), TimerGameTick::counter, BaseConsist::cur_real_order_index, Vehicle::current_order, BaseConsist::current_order_time, Ticks::DAY_TICKS, Vehicle::FirstShared(), Vehicle::GetFirstOrder(), Vehicle::GetNumOrders(), Vehicle::GetOrder(), Order::GetTimetabledTravel(), Order::GetTimetabledWait(), OrderList::GetTimetableTotalDuration(), Order::GetWaitTime(), ClientSettings::gui, HasBit(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, Ticks::INVALID_TICKS, Order::IsTravelTimetabled(), Order::IsType(), Order::IsWaitTimetabled(), BaseConsist::lateness_counter, MTF_TRAVEL_TIME, MTF_WAIT_TIME, Vehicle::NextShared(), Vehicle::orders, SetBit(), Order::SetWaitTime(), SetWindowDirty(), Ticks::TICKS_PER_SECOND, GUISettings::timetable_mode, BaseConsist::timetable_start, BaseConsist::vehicle_flags, VF_AUTOFILL_PRES_WAIT_TIME, VF_AUTOFILL_TIMETABLE, VF_TIMETABLE_STARTED, and WC_VEHICLE_TIMETABLE.
Referenced by Vehicle::BeginLoading(), Vehicle::LeaveStation(), ProcessOrders(), UpdateOrderDest(), and VehicleEnterDepot().
|
static |
The maximum start date offset, in economy years.
Definition at line 17 of file timetable.h.
Referenced by CmdSetTimetableStart(), and TimetableWindow::OnClick().