# order_gui.cpp File Reference

GUI related to orders. More...

`#include "stdafx.h"`
`#include "station_map.h"`
`#include "window_gui.h"`
`#include "command_func.h"`
`#include "viewport_func.h"`
`#include "gfx_func.h"`
`#include "depot_base.h"`
`#include "vehicle_base.h"`
`#include "vehicle_gui.h"`
`#include "timetable.h"`
`#include "cargotype.h"`
`#include "strings_func.h"`
`#include "window_func.h"`
`#include "vehicle_func.h"`
`#include "company_func.h"`
`#include "newgrf_cargo.h"`
`#include "widgets/dropdown_func.h"`
`#include "textbuf_gui.h"`
`#include "string_func.h"`
`#include "tilehighlight_func.h"`
`#include "network/network.h"`
`#include "settings_type.h"`
`#include "table/sprites.h"`
`#include "table/strings.h"`

Go to the source code of this file.

## Data Structures
struct | OrdersWindow
struct | OrdersWindow::KeyToEvent
## Enumerations
enum | OrderWindowWidgets { ORDER_WIDGET_CLOSEBOX = 0, ORDER_WIDGET_CAPTION, ORDER_WIDGET_TIMETABLE_VIEW, ORDER_WIDGET_STICKY, ORDER_WIDGET_ORDER_LIST, ORDER_WIDGET_SCROLLBAR, ORDER_WIDGET_SKIP, ORDER_WIDGET_DELETE, ORDER_WIDGET_NON_STOP_DROPDOWN, ORDER_WIDGET_NON_STOP, ORDER_WIDGET_GOTO_DROPDOWN, ORDER_WIDGET_GOTO, ORDER_WIDGET_FULL_LOAD_DROPDOWN, ORDER_WIDGET_FULL_LOAD, ORDER_WIDGET_UNLOAD_DROPDOWN, ORDER_WIDGET_UNLOAD, ORDER_WIDGET_REFIT, ORDER_WIDGET_SERVICE_DROPDOWN, ORDER_WIDGET_SERVICE, ORDER_WIDGET_COND_VARIABLE, ORDER_WIDGET_COND_COMPARATOR, ORDER_WIDGET_COND_VALUE, ORDER_WIDGET_RESIZE_BAR, ORDER_WIDGET_SHARED_ORDER_LIST, ORDER_WIDGET_RESIZE }
## Functions
uint | ConvertSpeedToDisplaySpeed (uint speed)
| Convert the given (internal) speed to the display speed.
uint | ConvertDisplaySpeedToSpeed (uint speed)
| 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 width)
static Order | GetOrderCmdFromTile (const Vehicle *v, TileIndex tile)
void | ShowOrdersWindow (const Vehicle *v)
## Variables
static const StringID | _station_load_types [][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 StringID | _order_conditional_variable []
static const StringID | _order_conditional_condition []
static const StringID | _order_depot_action_dropdown []
static const Widget | _orders_train_widgets []
| Widget definition for "your" train orders.
static const WindowDesc | _orders_train_desc (WDP_AUTO, WDP_AUTO, 386, 100, 386, 100, WC_VEHICLE_ORDERS, WC_VEHICLE_VIEW, WDF_STD_TOOLTIPS|WDF_STD_BTN|WDF_DEF_WIDGET|WDF_STICKY_BUTTON|WDF_RESIZABLE, _orders_train_widgets)
static const Widget | _orders_widgets []
| Widget definition for "your" orders (!train).
static const WindowDesc | _orders_desc (WDP_AUTO, WDP_AUTO, 386, 100, 386, 100, WC_VEHICLE_ORDERS, WC_VEHICLE_VIEW, WDF_STD_TOOLTIPS|WDF_STD_BTN|WDF_DEF_WIDGET|WDF_STICKY_BUTTON|WDF_RESIZABLE, _orders_widgets)
static const Widget | _other_orders_widgets []
| Widget definition for competitor orders.
static const WindowDesc | _other_orders_desc (WDP_AUTO, WDP_AUTO, 386, 88, 386, 88, WC_VEHICLE_ORDERS, WC_VEHICLE_VIEW, WDF_STD_TOOLTIPS|WDF_STD_BTN|WDF_DEF_WIDGET|WDF_UNCLICK_BUTTONS|WDF_STICKY_BUTTON|WDF_RESIZABLE|WDF_CONSTRUCTION, _other_orders_widgets)

## Detailed Description

GUI related to orders.

Definition in file order_gui.cpp.

## Function Documentation

uint ConvertDisplaySpeedToSpeed | ( | uint | speed | ) |

Convert the given display speed to the (internal) speed.

Parameters:

  | speed | the speed to convert

Returns:
  the converted speed.

Definition at line 551 of file strings.cpp.

References _settings_game, GameSettings::locale, and LocaleSettings::units.

uint ConvertSpeedToDisplaySpeed | ( | uint | speed | ) |

Convert the given (internal) speed to the display speed.

Parameters:

  | speed | the speed to convert

Returns:
  the converted speed.

Definition at line 541 of file strings.cpp.

References _settings_game, GameSettings::locale, and LocaleSettings::units.

## Variable Documentation

const StringID _order_conditional_condition[]`[static]`

Initial value:

     {
      STR_ORDER_CONDITIONAL_COMPARATOR_EQUALS,
      STR_ORDER_CONDITIONAL_COMPARATOR_NOT_EQUALS,
      STR_ORDER_CONDITIONAL_COMPARATOR_LESS_THAN,
      STR_ORDER_CONDITIONAL_COMPARATOR_LESS_EQUALS,
      STR_ORDER_CONDITIONAL_COMPARATOR_MORE_THAN,
      STR_ORDER_CONDITIONAL_COMPARATOR_MORE_EQUALS,
      STR_ORDER_CONDITIONAL_COMPARATOR_IS_TRUE,
      STR_ORDER_CONDITIONAL_COMPARATOR_IS_FALSE,
      INVALID_STRING_ID,
    }

Definition at line 144 of file order_gui.cpp.

const StringID _order_conditional_variable[]`[static]`

Initial value:

     {
      STR_ORDER_CONDITIONAL_LOAD_PERCENTAGE,
      STR_ORDER_CONDITIONAL_RELIABILITY,
      STR_ORDER_CONDITIONAL_MAX_SPEED,
      STR_ORDER_CONDITIONAL_AGE,
      STR_ORDER_CONDITIONAL_REQUIRES_SERVICE,
      STR_ORDER_CONDITIONAL_UNCONDITIONALLY,
      INVALID_STRING_ID,
    }

Definition at line 134 of file order_gui.cpp.

const StringID _order_depot_action_dropdown[]`[static]`

Initial value:

     {
      STR_ORDER_DROP_GO_ALWAYS_DEPOT,
      STR_ORDER_DROP_SERVICE_DEPOT,
      STR_ORDER_DROP_HALT_DEPOT,
      INVALID_STRING_ID
    }

Definition at line 159 of file order_gui.cpp.

const StringID _order_full_load_drowdown[]`[static]`

Initial value:

     {
      STR_ORDER_DROP_LOAD_IF_POSSIBLE,
      STR_EMPTY,
      STR_ORDER_DROP_FULL_LOAD_ALL,
      STR_ORDER_DROP_FULL_LOAD_ANY,
      STR_ORDER_DROP_NO_LOADING,
      INVALID_STRING_ID
    }

Definition at line 102 of file order_gui.cpp.

const StringID _order_goto_dropdown[]`[static]`

Initial value:

     {
      STR_ORDER_GO_TO,
      STR_ORDER_GO_TO_NEAREST_DEPOT,
      STR_ORDER_CONDITIONAL,
      INVALID_STRING_ID
    }

Definition at line 120 of file order_gui.cpp.

const StringID _order_goto_dropdown_aircraft[]`[static]`

Initial value:

     {
      STR_ORDER_GO_TO,
      STR_ORDER_GO_TO_NEAREST_HANGAR,
      STR_ORDER_CONDITIONAL,
      INVALID_STRING_ID
    }

Definition at line 127 of file order_gui.cpp.

const StringID _order_non_stop_drowdown[]`[static]`

Initial value:

     {
      STR_ORDER_GO_TO,
      STR_ORDER_GO_NON_STOP_TO,
      STR_ORDER_GO_VIA,
      STR_ORDER_GO_NON_STOP_VIA,
      INVALID_STRING_ID
    }

Definition at line 94 of file order_gui.cpp.

const StringID _order_unload_drowdown[]`[static]`

Initial value:

     {
      STR_ORDER_DROP_UNLOAD_IF_ACCEPTED,
      STR_ORDER_DROP_UNLOAD,
      STR_ORDER_DROP_TRANSFER,
      STR_EMPTY,
      STR_ORDER_DROP_NO_UNLOADING,
      INVALID_STRING_ID
    }

Definition at line 111 of file order_gui.cpp.

const StringID _station_load_types[][5]`[static]`

Order load types that could be given to station orders.

Definition at line 60 of file order_gui.cpp.