OpenTTD Source
20241121-master-g67a0fccfad
|
GUI for time tabling. More...
#include "stdafx.h"
#include "command_func.h"
#include "gui.h"
#include "window_gui.h"
#include "window_func.h"
#include "textbuf_gui.h"
#include "strings_func.h"
#include "vehicle_base.h"
#include "string_func.h"
#include "gfx_func.h"
#include "company_func.h"
#include "timer/timer.h"
#include "timer/timer_game_tick.h"
#include "timer/timer_game_economy.h"
#include "timer/timer_window.h"
#include "date_gui.h"
#include "vehicle_gui.h"
#include "settings_type.h"
#include "timetable_cmd.h"
#include "timetable.h"
#include "widgets/timetable_widget.h"
#include "table/sprites.h"
#include "table/strings.h"
#include "safeguards.h"
Go to the source code of this file.
Data Structures | |
struct | TimetableArrivalDeparture |
Container for the arrival/departure dates of a vehicle. More... | |
struct | TimetableWindow |
Functions | |
void | SetTimetableParams (int param1, int param2, TimerGameTick::Ticks ticks) |
Set the timetable parameters in the format as described by the setting. More... | |
static TimerGameTick::Ticks | TicksPerTimetableUnit () |
Get the number of ticks in the current timetable display unit. More... | |
bool | VehicleIsAboveLatenessThreshold (TimerGameTick::Ticks ticks, bool round_to_day) |
Determine if a vehicle should be shown as late or early, using a threshold depending on the timetable display setting. More... | |
static bool | CanDetermineTimeTaken (const Order *order, bool travelling) |
Check whether it is possible to determine how long the order takes. More... | |
static void | FillTimetableArrivalDepartureTable (const Vehicle *v, VehicleOrderID start, bool travelling, std::vector< TimetableArrivalDeparture > &table, TimerGameTick::Ticks offset) |
Fill the table with arrivals and departures. More... | |
static void | ChangeTimetableStartCallback (const Window *w, TimerGameEconomy::Date date, void *data) |
Callback for when a time has been chosen to start the time table. More... | |
void | ShowTimetableWindow (const Vehicle *v) |
Show the timetable for a given vehicle. More... | |
Variables | |
static constexpr NWidgetPart | _nested_timetable_widgets [] |
static WindowDesc | _timetable_desc (WDP_AUTO, "view_vehicle_timetable", 400, 130, WC_VEHICLE_TIMETABLE, WC_VEHICLE_VIEW, WDF_CONSTRUCTION, _nested_timetable_widgets) |
GUI for time tabling.
Definition in file timetable_gui.cpp.
|
static |
Check whether it is possible to determine how long the order takes.
order | the order to check. |
travelling | whether we are interested in the travel or the wait part. |
Definition at line 114 of file timetable_gui.cpp.
References Order::IsType().
|
static |
Callback for when a time has been chosen to start the time table.
w | the window related to the setting of the date |
date | the actually chosen date |
Definition at line 195 of file timetable_gui.cpp.
References GetStartTickFromDate(), and Window::window_number.
|
static |
Fill the table with arrivals and departures.
v | Vehicle which must have at least 2 orders. |
start | order index to start at |
travelling | Are we still in the travelling part of the start order |
table | Fill in arrival and departures including intermediate orders |
offset | Add this value to result and all arrivals and departures |
Definition at line 138 of file timetable_gui.cpp.
References Vehicle::GetNumOrders(), Vehicle::GetOrder(), Ticks::INVALID_TICKS, and Order::IsType().
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, ClientSettings::gui, and GUISettings::timetable_mode.
Referenced by TimetableWindow::DrawSummaryPanel().
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.
|
inlinestatic |
Get the number of ticks in the current timetable display unit.
Definition at line 74 of file timetable_gui.cpp.
References _settings_client, ClientSettings::gui, and GUISettings::timetable_mode.
Referenced by TimetableWindow::DrawSummaryPanel().
bool VehicleIsAboveLatenessThreshold | ( | TimerGameTick::Ticks | ticks, |
bool | round_to_day | ||
) |
Determine if a vehicle should be shown as late or early, using a threshold depending on the timetable display setting.
ticks | The number of ticks that the vehicle is late or early. |
round_to_day | When using ticks, if we should round up to the nearest day. |
Definition at line 94 of file timetable_gui.cpp.
References _settings_client, ClientSettings::gui, and GUISettings::timetable_mode.
Referenced by TimetableWindow::DrawArrivalDeparturePanel().