OpenTTD Source: src/timetable.h File Reference

OpenTTD Source 14.0-RC3

Enumerations | Functions | Variables
timetable.h File Reference
`#include "timer/timer_game_tick.h"`
`#include "timer/timer_game_economy.h"`
`#include "vehicle_type.h"`

Go to the source code of this file.

## Enumerations
enum | TimetableMode : uint8_t { Days, Seconds, Ticks }

## Functions
TimerGameTick::TickCounter | GetStartTickFromDate (TimerGameEconomy::Date start_date)
| Get the TimerGameTick::TickCounter tick of a given date. More...
TimerGameEconomy::Date | GetDateFromStartTick (TimerGameTick::TickCounter start_tick)
| Get a date from a given start tick of timetable. More...
void | ShowTimetableWindow (const Vehicle *v)
| Show the timetable for a given vehicle. More...
void | UpdateVehicleTimetable (Vehicle *v, bool travelling)
| Update the timetable for the vehicle. More...
void | SetTimetableParams (int param1, int param2, TimerGameTick::Ticks ticks)
| Set the timetable parameters in the format as described by the setting. More...

## Variables
static const TimerGameEconomy::Year | MAX_TIMETABLE_START_YEARS = 15
| The maximum start date offset, in economy years.

## Detailed Description

Functions related to time tabling.

Definition in file timetable.h.

## Function Documentation

## ◆ GetDateFromStartTick()

TimerGameEconomy::Date GetDateFromStartTick | ( | TimerGameTick::TickCounter | start_tick | ) |

Get a date from a given start tick of timetable.

Parameters

  start_tick | The TimerGameTick::TickCounter when the timetable starts.

Returns
  The date when we reach this tick.

Definition at line 46 of file timetable_cmd.cpp.

References TimerGameTick::counter, TimerGameEconomy::date, TimerGameEconomy::date_fract, and Ticks::DAY_TICKS.

Referenced by CmdSetTimetableStart().

## ◆ GetStartTickFromDate()

TimerGameTick::TickCounter GetStartTickFromDate | ( | TimerGameEconomy::Date | start_date | ) |

Get the TimerGameTick::TickCounter tick of a given date.

Parameters

  start_date | The date when the timetable starts.

Returns
  The first tick of this date.

Definition at line 29 of file timetable_cmd.cpp.

References TimerGameTick::counter, TimerGameEconomy::date, TimerGameEconomy::date_fract, and Ticks::DAY_TICKS.

Referenced by ChangeTimetableStartCallback().

## ◆ SetTimetableParams()

void SetTimetableParams | ( | int | param1,
|  | int | param2,
|  | TimerGameTick::Ticks | ticks
| ) |  |

Set the timetable parameters in the format as described by the setting.

Parameters

  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, ClientSettings::gui, and GUISettings::timetable_mode.

Referenced by TimetableWindow::DrawSummaryPanel().

## ◆ ShowTimetableWindow()

void ShowTimetableWindow | ( | const Vehicle * | v | ) |

Show the timetable for a given vehicle.

Parameters

  v | The vehicle to show the timetable for.

Definition at line 866 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.

## ◆ UpdateVehicleTimetable()

void UpdateVehicleTimetable | ( | Vehicle * | v,
|  | bool | travelling
| ) |  |

Update the timetable for the vehicle.

Parameters

  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 Vehicle::current_order, BaseConsist::current_order_time, and Order::IsType().