46       STR_ORDER_FULL_LOAD_ANY,
 
   51       STR_ORDER_UNLOAD_FULL_LOAD,
 
   52       STR_ORDER_UNLOAD_FULL_LOAD_ANY,
 
   53       STR_ORDER_UNLOAD_NO_LOAD,
 
   57       STR_ORDER_TRANSFER_FULL_LOAD,
 
   58       STR_ORDER_TRANSFER_FULL_LOAD_ANY,
 
   59       STR_ORDER_TRANSFER_NO_LOAD,
 
   69       STR_ORDER_NO_UNLOAD_FULL_LOAD,
 
   70       STR_ORDER_NO_UNLOAD_FULL_LOAD_ANY,
 
   71       STR_ORDER_NO_UNLOAD_NO_LOAD,
 
   78       STR_ORDER_FULL_LOAD_REFIT,
 
   79       STR_ORDER_FULL_LOAD_ANY_REFIT,
 
   82       STR_ORDER_UNLOAD_REFIT,
 
   84       STR_ORDER_UNLOAD_FULL_LOAD_REFIT,
 
   85       STR_ORDER_UNLOAD_FULL_LOAD_ANY_REFIT,
 
   88       STR_ORDER_TRANSFER_REFIT,
 
   90       STR_ORDER_TRANSFER_FULL_LOAD_REFIT,
 
   91       STR_ORDER_TRANSFER_FULL_LOAD_ANY_REFIT,
 
  100       STR_ORDER_NO_UNLOAD_REFIT,
 
  102       STR_ORDER_NO_UNLOAD_FULL_LOAD_REFIT,
 
  103       STR_ORDER_NO_UNLOAD_FULL_LOAD_ANY_REFIT,
 
  109 static const StringID _order_non_stop_drowdown[] = {
 
  111   STR_ORDER_GO_NON_STOP_TO,
 
  113   STR_ORDER_GO_NON_STOP_VIA,
 
  117 static const StringID _order_full_load_drowdown[] = {
 
  118   STR_ORDER_DROP_LOAD_IF_POSSIBLE,
 
  120   STR_ORDER_DROP_FULL_LOAD_ALL,
 
  121   STR_ORDER_DROP_FULL_LOAD_ANY,
 
  122   STR_ORDER_DROP_NO_LOADING,
 
  126 static const StringID _order_unload_drowdown[] = {
 
  127   STR_ORDER_DROP_UNLOAD_IF_ACCEPTED,
 
  128   STR_ORDER_DROP_UNLOAD,
 
  129   STR_ORDER_DROP_TRANSFER,
 
  131   STR_ORDER_DROP_NO_UNLOADING,
 
  135 static const StringID _order_goto_dropdown[] = {
 
  137   STR_ORDER_GO_TO_NEAREST_DEPOT,
 
  138   STR_ORDER_CONDITIONAL,
 
  143 static const StringID _order_goto_dropdown_aircraft[] = {
 
  145   STR_ORDER_GO_TO_NEAREST_HANGAR,
 
  146   STR_ORDER_CONDITIONAL,
 
  162 static const StringID _order_conditional_condition[] = {
 
  163   STR_ORDER_CONDITIONAL_COMPARATOR_EQUALS,
 
  164   STR_ORDER_CONDITIONAL_COMPARATOR_NOT_EQUALS,
 
  165   STR_ORDER_CONDITIONAL_COMPARATOR_LESS_THAN,
 
  166   STR_ORDER_CONDITIONAL_COMPARATOR_LESS_EQUALS,
 
  167   STR_ORDER_CONDITIONAL_COMPARATOR_MORE_THAN,
 
  168   STR_ORDER_CONDITIONAL_COMPARATOR_MORE_EQUALS,
 
  169   STR_ORDER_CONDITIONAL_COMPARATOR_IS_TRUE,
 
  170   STR_ORDER_CONDITIONAL_COMPARATOR_IS_FALSE,
 
  177 static const StringID _order_depot_action_dropdown[] = {
 
  178   STR_ORDER_DROP_GO_ALWAYS_DEPOT,
 
  179   STR_ORDER_DROP_SERVICE_DEPOT,
 
  180   STR_ORDER_DROP_HALT_DEPOT,
 
  184 static int DepotActionStringIndex(
const Order *order)
 
  195 static const StringID _order_refit_action_dropdown[] = {
 
  196   STR_ORDER_DROP_REFIT_AUTO,
 
  197   STR_ORDER_DROP_REFIT_AUTO_ANY,
 
  213 void DrawOrderString(
const Vehicle *v, 
const Order *order, 
int order_index, 
int y, 
bool selected, 
bool timetable, 
int left, 
int middle, 
int right)
 
  217   SpriteID sprite = rtl ? SPR_ARROW_LEFT : SPR_ARROW_RIGHT;
 
  221     DrawSprite(sprite, PAL_NONE, rtl ? right - 2 * sprite_size.width : left + sprite_size.width, y + ((
int)
FONT_HEIGHT_NORMAL - (
int)sprite_size.height) / 2);
 
  227   if (order->
IsType(OT_IMPLICIT)) {
 
  228     colour = (selected ? TC_SILVER : TC_GREY) | 
TC_NO_SHADE;
 
  229   } 
else if (selected) {
 
  255       SetDParam(3, timetable ? STR_EMPTY : STR_ORDER_IMPLICIT);
 
  258     case OT_GOTO_STATION: {
 
  287         SetDParam(0, STR_ORDER_GO_TO_NEAREST_DEPOT_FORMAT);
 
  296         SetDParam(0, STR_ORDER_GO_TO_DEPOT_FORMAT);
 
  311       if (!timetable && order->
IsRefit()) {
 
  317     case OT_GOTO_WAYPOINT:
 
  325         SetDParam(0, STR_ORDER_CONDITIONAL_UNCONDITIONAL);
 
  330         SetDParam(3, STR_ORDER_CONDITIONAL_COMPARATOR_EQUALS + occ);
 
  345     default: NOT_REACHED();
 
  348   DrawString(rtl ? left : middle, rtl ? middle : right, y, STR_ORDER_TEXT, colour);
 
  526     int num = this->selected_order;
 
  555     assert(type > OPOS_NONE && type < OPOS_END);
 
  563     this->goto_type = type;
 
  576     if (order == NULL || order->
GetLoadType() == load_type) 
return;
 
  601       if (order == NULL) 
return;
 
  630     if (order == NULL || order->
GetUnloadType() == unload_type) 
return;
 
  632     if (unload_type < 0) {
 
  703     int selected = this->selected_order + (int)
_networking;
 
  707       this->UpdateButtonState();
 
  731       this->UpdateButtonState();
 
  778     this->selected_order = -1;
 
  780     this->goto_type = OPOS_NONE;
 
  787       int station_orders = 0;
 
  789       FOR_VEHICLE_ORDERS(v, order) {
 
  790         if (order->
IsType(OT_GOTO_STATION)) station_orders++;
 
  811         d.width += padding.width;
 
  812         d.height += padding.height;
 
  822         d.width += padding.width;
 
  823         d.height += padding.height;
 
  853         if (this->selected_order == -1) 
break;
 
  857         this->selected_order = -1;
 
  867         if (gui_scope) 
break; 
 
  868         from = 
GB(data, 0, 8);
 
  872         if (this->selected_order == -1) 
break;
 
  874         if (from == to) 
break; 
 
  876         if (from != this->selected_order) {
 
  878           this->selected_order -= (int)(from <= this->selected_order);
 
  880           this->selected_order += (int)(to   <= this->selected_order);
 
  889           this->selected_order = -1;
 
  894         this->selected_order = to;
 
  899     if (gui_scope) this->UpdateButtonState();
 
  907   void UpdateButtonState()
 
  934         nwi->
SetDataTip(STR_ORDERS_DELETE_BUTTON, STR_ORDERS_DELETE_ALL_TOOLTIP);
 
  936         nwi->
SetDataTip(STR_ORDERS_DELETE_BUTTON, STR_ORDERS_DELETE_TOOLTIP);
 
  953     assert(row_sel != NULL || (train_row_sel != NULL && left_sel != NULL && middle_sel != NULL && right_sel != NULL));
 
  957       if (row_sel != NULL) {
 
  975         case OT_GOTO_STATION:
 
  976           if (row_sel != NULL) {
 
  997         case OT_GOTO_WAYPOINT:
 
  998           if (row_sel != NULL) {
 
 1014           if (row_sel != NULL) {
 
 1032         case OT_CONDITIONAL: {
 
 1033           if (row_sel != NULL) {
 
 1040           this->GetWidget<NWidgetCore>(
WID_O_COND_VARIABLE)->widget_data   = STR_ORDER_CONDITIONAL_LOAD_PERCENTAGE + ocv;
 
 1048           if (row_sel != NULL) {
 
 1073       this->selected_order = -1; 
 
 1090     int line_height = this->GetWidget<NWidgetBase>(
WID_O_ORDER_LIST)->resize_y;
 
 1096       while (order != NULL) {
 
 1098         if (!this->vscroll->
IsVisible(i)) 
break;
 
 1100         if (i != this->selected_order && i == this->
order_over) {
 
 1111         order = order->
next;
 
 1121     while (order != NULL) {
 
 1123       if (!this->vscroll->
IsVisible(i)) 
break;
 
 1129       order = order->
next;
 
 1145         if (order != NULL && order->
IsType(OT_CONDITIONAL)) {
 
 1163         if (this->goto_type == OPOS_CONDITIONAL) {
 
 1191           this->selected_order = -1;
 
 1192         } 
else if (sel == this->selected_order) {
 
 1195                 MOF_STOP_LOCATION | ((this->vehicle->GetOrder(sel)->GetStopLocation() + 1) % OSL_END) << 4,
 
 1200           this->selected_order = sel;
 
 1208         this->UpdateButtonState();
 
 1225         if (this->GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) {
 
 1230                           o->
IsType(OT_GOTO_STATION) ? 0 : (o->
IsType(OT_GOTO_WAYPOINT) ? 3 : 12));
 
 1235         if (this->GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) {
 
 1236           if (this->goto_type != OPOS_NONE) {
 
 1243           switch (this->goto_type) {
 
 1244             case OPOS_NONE:        sel = -1; 
break;
 
 1245             case OPOS_GOTO:        sel =  0; 
break;
 
 1246             case OPOS_CONDITIONAL: sel =  2; 
break;
 
 1247             case OPOS_SHARE:       sel =  3; 
break;
 
 1248             default: NOT_REACHED();
 
 1255         if (this->GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) {
 
 1263         if (this->GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) {
 
 1275         if (this->GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) {
 
 1283         if (this->GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) {
 
 1319         ShowVehicleListWindow(this->
vehicle);
 
 1328       uint value = atoi(str);
 
 1337           value = 
Clamp(value, 0, 100);
 
 1368           default: NOT_REACHED();
 
 1399           this->selected_order = -1;
 
 1400           this->UpdateButtonState();
 
 1446     if (this->goto_type == OPOS_GOTO) {
 
 1448       if (cmd.
IsType(OT_NOTHING)) 
return;
 
 1457   virtual bool OnVehicleSelect(
const Vehicle *v)
 
 1464     bool share_order = 
_ctrl_pressed || this->goto_type == OPOS_SHARE;
 
 1469       this->selected_order = -1;
 
 1477     this->goto_type = OPOS_NONE;
 
 1516 static Hotkey order_hotkeys[] = {
 
 1517   Hotkey(
'D', 
"skip", OHK_SKIP),
 
 1518   Hotkey(
'F', 
"delete", OHK_DELETE),
 
 1519   Hotkey(
'G', 
"goto", OHK_GOTO),
 
 1520   Hotkey(
'H', 
"nonstop", OHK_NONSTOP),
 
 1521   Hotkey(
'J', 
"fullload", OHK_FULLLOAD),
 
 1522   Hotkey(
'K', 
"unload", OHK_UNLOAD),
 
 1523   Hotkey((uint16)0, 
"nearest_depot", OHK_NEAREST_DEPOT),
 
 1524   Hotkey((uint16)0, 
"always_service", OHK_ALWAYS_SERVICE),
 
 1525   Hotkey((uint16)0, 
"transfer", OHK_TRANSFER),
 
 1526   Hotkey((uint16)0, 
"no_unload", OHK_NO_UNLOAD),
 
 1527   Hotkey((uint16)0, 
"no_load", OHK_NO_LOAD),
 
 1530 HotkeyList OrdersWindow::hotkeys(
"order", order_hotkeys);
 
 1543     NWidget(
WWT_PANEL, COLOUR_GREY, 
WID_O_ORDER_LIST), 
SetMinimalSize(372, 62), 
SetDataTip(0x0, STR_ORDERS_LIST_TOOLTIP), 
SetResize(1, 1), 
SetScrollbar(
WID_O_SCROLLBAR), 
EndContainer(),
 
 1593                             SetDataTip(STR_ORDERS_STOP_SHARING_BUTTON, STR_ORDERS_STOP_SHARING_TOOLTIP), 
SetResize(1, 0),
 
 1603   WDP_AUTO, 
"view_vehicle_orders_train", 384, 100,
 
 1606   _nested_orders_train_widgets, 
lengthof(_nested_orders_train_widgets),
 
 1607   &OrdersWindow::hotkeys
 
 1621     NWidget(
WWT_PANEL, COLOUR_GREY, 
WID_O_ORDER_LIST), 
SetMinimalSize(372, 62), 
SetDataTip(0x0, STR_ORDERS_LIST_TOOLTIP), 
SetResize(1, 1), 
SetScrollbar(
WID_O_SCROLLBAR), 
EndContainer(),
 
 1667                           SetDataTip(STR_ORDERS_STOP_SHARING_BUTTON, STR_ORDERS_STOP_SHARING_TOOLTIP), 
SetResize(1, 0),
 
 1676   WDP_AUTO, 
"view_vehicle_orders", 384, 100,
 
 1679   _nested_orders_widgets, 
lengthof(_nested_orders_widgets),
 
 1680   &OrdersWindow::hotkeys
 
 1694     NWidget(
WWT_PANEL, COLOUR_GREY, 
WID_O_ORDER_LIST), 
SetMinimalSize(372, 72), 
SetDataTip(0x0, STR_ORDERS_LIST_TOOLTIP), 
SetResize(1, 1), 
SetScrollbar(
WID_O_SCROLLBAR), 
EndContainer(),
 
 1703   WDP_AUTO, 
"view_vehicle_orders_competitor", 384, 86,
 
 1706   _nested_other_orders_widgets, 
lengthof(_nested_other_orders_widgets),
 
 1707   &OrdersWindow::hotkeys
 
 1710 void ShowOrdersWindow(
const Vehicle *v)