OpenTTD Source 20241224-master-gf74b0cf984
|
GUI related to orders. More...
#include "stdafx.h"
#include "command_func.h"
#include "viewport_func.h"
#include "depot_map.h"
#include "roadveh.h"
#include "timetable.h"
#include "strings_func.h"
#include "company_func.h"
#include "dropdown_type.h"
#include "dropdown_func.h"
#include "textbuf_gui.h"
#include "string_func.h"
#include "tilehighlight_func.h"
#include "network/network.h"
#include "station_base.h"
#include "industry.h"
#include "waypoint_base.h"
#include "core/geometry_func.hpp"
#include "hotkeys.h"
#include "aircraft.h"
#include "engine_func.h"
#include "vehicle_func.h"
#include "vehiclelist.h"
#include "error.h"
#include "order_cmd.h"
#include "company_cmd.h"
#include "widgets/order_widget.h"
#include "safeguards.h"
Go to the source code of this file.
Data Structures | |
struct | OrdersWindow |
Order window code for all vehicles. More... | |
Enumerations | |
enum | { OHK_SKIP , OHK_DELETE , OHK_GOTO , OHK_NONSTOP , OHK_FULLLOAD , OHK_UNLOAD , OHK_NEAREST_DEPOT , OHK_ALWAYS_SERVICE , OHK_TRANSFER , OHK_NO_UNLOAD , OHK_NO_LOAD } |
Hotkeys for order window. More... | |
Functions | |
uint | ConvertSpeedToDisplaySpeed (uint speed, VehicleType type) |
Convert the given (internal) speed to the display speed. | |
uint | ConvertDisplaySpeedToSpeed (uint speed, VehicleType type) |
Convert the given display speed to the (internal) speed. | |
static int | DepotActionStringIndex (const Order *order) |
void | DrawOrderString (const Vehicle *v, const Order *order, int order_index, int y, bool selected, bool timetable, int left, int middle, int right) |
Draws an order in order or timetable GUI. | |
static Order | GetOrderCmdFromTile (const Vehicle *v, TileIndex tile) |
Get the order command a vehicle can do in a given tile. | |
void | ShowOrdersWindow (const Vehicle *v) |
Variables | |
static const StringID | _station_load_types [][5][5] |
Order load types that could be given to station orders. | |
static const StringID | _order_non_stop_drowdown [] |
static const StringID | _order_full_load_drowdown [] |
static const StringID | _order_unload_drowdown [] |
static const StringID | _order_goto_dropdown [] |
static const StringID | _order_goto_dropdown_aircraft [] |
static const OrderConditionVariable | _order_conditional_variable [] |
Variables for conditional orders; this defines the order of appearance in the dropdown box. | |
static const StringID | _order_conditional_condition [] |
static const StringID | _order_depot_action_dropdown [] |
static const StringID | _order_refit_action_dropdown [] |
static constexpr NWidgetPart | _nested_orders_train_widgets [] |
Nested widget definition for "your" train orders. | |
static WindowDesc | _orders_train_desc (WDP_AUTO, "view_vehicle_orders_train", 384, 100, WC_VEHICLE_ORDERS, WC_VEHICLE_VIEW, WDF_CONSTRUCTION, _nested_orders_train_widgets, &OrdersWindow::hotkeys) |
static constexpr NWidgetPart | _nested_orders_widgets [] |
Nested widget definition for "your" orders (non-train). | |
static WindowDesc | _orders_desc (WDP_AUTO, "view_vehicle_orders", 384, 100, WC_VEHICLE_ORDERS, WC_VEHICLE_VIEW, WDF_CONSTRUCTION, _nested_orders_widgets, &OrdersWindow::hotkeys) |
static constexpr NWidgetPart | _nested_other_orders_widgets [] |
Nested widget definition for competitor orders. | |
static WindowDesc | _other_orders_desc (WDP_AUTO, "view_vehicle_orders_competitor", 384, 86, WC_VEHICLE_ORDERS, WC_VEHICLE_VIEW, WDF_CONSTRUCTION, _nested_other_orders_widgets, &OrdersWindow::hotkeys) |
GUI related to orders.
Definition in file order_gui.cpp.
anonymous enum |
Hotkeys for order window.
Definition at line 480 of file order_gui.cpp.
|
extern |
Convert the given display speed to the (internal) speed.
speed | the speed to convert |
Definition at line 896 of file strings.cpp.
References Units::c, UnitConversion::FromDisplay(), and GetVelocityUnits().
Referenced by OrdersWindow::OnQueryTextFinished().
|
extern |
Convert the given (internal) speed to the display speed.
speed | the speed to convert |
Definition at line 883 of file strings.cpp.
References Units::c, GetVelocityUnits(), and UnitConversion::ToDisplay().
Referenced by DrawOrderString(), OrdersWindow::OnClick(), and OrdersWindow::SetStringParameters().
|
static |
Definition at line 184 of file order_gui.cpp.
void DrawOrderString | ( | const Vehicle * | v, |
const Order * | order, | ||
int | order_index, | ||
int | y, | ||
bool | selected, | ||
bool | timetable, | ||
int | left, | ||
int | middle, | ||
int | right | ||
) |
Draws an order in order or timetable GUI.
v | Vehicle the order belongs to |
order | The order to draw |
order_index | Index of the order in the orders of the vehicle |
y | Y position for drawing |
selected | True, if the order is selected |
timetable | True, when drawing in the timetable GUI |
left | Left border for text drawing |
middle | X position between order index and order text |
right | Right border for text drawing |
Definition at line 214 of file order_gui.cpp.
References _current_text_dir, _settings_client, _station_load_types, CanVehicleUseStation(), ConvertSpeedToDisplaySpeed(), BaseConsist::cur_implicit_order_index, BaseConsist::cur_real_order_index, DrawSprite(), DrawString(), SpecializedVehicle< Aircraft, VEH_AIRCRAFT >::From(), FS_NORMAL, SpecializedStation< Station, false >::Get(), CargoSpec::Get(), GetCharacterHeight(), Order::GetConditionComparator(), Order::GetConditionSkipToOrder(), Order::GetConditionValue(), Order::GetConditionVariable(), Order::GetDepotActionType(), Order::GetDepotOrderType(), Order::GetDestination(), Vehicle::GetFirstOrder(), Order::GetLoadType(), Order::GetNonStopType(), GetOrderDistance(), Aircraft::GetRange(), Order::GetRefitCargo(), GetSpriteSize(), Order::GetStopLocation(), Order::GetType(), Order::GetUnloadType(), Order::GetWaitTime(), ClientSettings::gui, Order::IsAutoRefit(), Order::IsGotoOrder(), Vehicle::IsGroundVehicle(), Order::IsRefit(), Order::IsType(), Order::IsWaitTimetabled(), CargoSpec::name, Order::next, OCC_IS_FALSE, OCC_IS_TRUE, OCV_MAX_SPEED, OCV_UNCONDITIONALLY, ODATFB_HALT, ODATFB_NEAREST_DEPOT, ODATFB_UNBUNCH, ODTFB_SERVICE, ONSF_NO_STOP_AT_DESTINATION_STATION, ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS, SA_FORCE, SA_RIGHT, SetDParam(), SetTimetableParams(), GUISettings::stop_location, TC_NO_SHADE, TD_RTL, BaseVehicle::type, VEH_AIRCRAFT, and VEH_TRAIN.
Referenced by TimetableWindow::DrawTimetablePanel(), and OrdersWindow::DrawWidget().
Get the order command a vehicle can do in a given tile.
Definition at line 379 of file order_gui.cpp.
References _ctrl_pressed, _local_company, _settings_client, FACIL_AIRPORT, FACIL_BUS_STOP, FACIL_DOCK, FACIL_TRAIN, FACIL_TRUCK_STOP, BaseStation::facilities, Order::Free(), BaseStation::GetByTile(), Industry::GetByTile(), GetDepotIndex(), GetStationIndex(), ClientSettings::gui, Vehicle::HasConditionalOrder(), Vehicle::HasFullLoadOrder(), Vehicle::HasUnbunchingOrder(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, IsBuoyTile(), IsDepotTypeTile(), Vehicle::IsGroundVehicle(), IsRailWaypointTile(), IsRoadWaypointTile(), IsTileOwner(), IsTileType(), Order::MakeGoToDepot(), Order::MakeGoToStation(), Order::MakeGoToWaypoint(), MP_INDUSTRY, MP_STATION, Industry::neutral_station, GUISettings::new_nonstop, ODATFB_UNBUNCH, ODTFB_PART_OF_ORDERS, OLF_FULL_LOAD_ANY, ONSF_NO_STOP_AT_ANY_STATION, ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS, ONSF_STOP_EVERYWHERE, OSL_PLATFORM_FAR_END, BaseStation::owner, OWNER_NONE, Order::SetDepotActionType(), Order::SetLoadType(), Order::SetNonStopType(), Order::SetStopLocation(), ShowErrorMessage(), GUISettings::stop_location, BaseVehicle::type, VEH_AIRCRAFT, VEH_ROAD, VEH_SHIP, VEH_TRAIN, and WL_INFO.
Referenced by OrdersWindow::OnPlaceObject().
void ShowOrdersWindow | ( | const Vehicle * | v | ) |
Definition at line 1793 of file order_gui.cpp.
|
staticconstexpr |
Nested widget definition for "your" train orders.
Definition at line 1617 of file order_gui.cpp.
|
staticconstexpr |
Nested widget definition for "your" orders (non-train).
Definition at line 1694 of file order_gui.cpp.
|
staticconstexpr |
Nested widget definition for competitor orders.
Definition at line 1767 of file order_gui.cpp.
|
static |
Definition at line 163 of file order_gui.cpp.
|
static |
Variables for conditional orders; this defines the order of appearance in the dropdown box.
Definition at line 152 of file order_gui.cpp.
Referenced by OrdersWindow::OnClick(), and OrdersWindow::UpdateWidgetSize().
|
static |
Definition at line 177 of file order_gui.cpp.
|
static |
Definition at line 121 of file order_gui.cpp.
|
static |
Definition at line 137 of file order_gui.cpp.
|
static |
Definition at line 144 of file order_gui.cpp.
|
static |
Definition at line 114 of file order_gui.cpp.
|
static |
Definition at line 197 of file order_gui.cpp.
|
static |
Definition at line 129 of file order_gui.cpp.
|
static |
Order load types that could be given to station orders.
Definition at line 44 of file order_gui.cpp.
Referenced by DrawOrderString().