OpenTTD Source  13.0-beta1
order_gui.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of OpenTTD.
3  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
6  */
7 
10 #include "stdafx.h"
11 #include "command_func.h"
12 #include "viewport_func.h"
13 #include "depot_map.h"
14 #include "roadveh.h"
15 #include "timetable.h"
16 #include "strings_func.h"
17 #include "company_func.h"
18 #include "widgets/dropdown_type.h"
19 #include "widgets/dropdown_func.h"
20 #include "textbuf_gui.h"
21 #include "string_func.h"
22 #include "tilehighlight_func.h"
23 #include "network/network.h"
24 #include "station_base.h"
25 #include "industry.h"
26 #include "waypoint_base.h"
27 #include "core/geometry_func.hpp"
28 #include "hotkeys.h"
29 #include "aircraft.h"
30 #include "engine_func.h"
31 #include "vehicle_func.h"
32 #include "order_cmd.h"
33 #include "company_cmd.h"
34 
35 #include "widgets/order_widget.h"
36 
37 #include "safeguards.h"
38 
39 
41 static const StringID _station_load_types[][5][5] = {
42  {
43  /* No refitting. */
44  {
45  STR_EMPTY,
47  STR_ORDER_FULL_LOAD,
48  STR_ORDER_FULL_LOAD_ANY,
49  STR_ORDER_NO_LOAD,
50  }, {
51  STR_ORDER_UNLOAD,
53  STR_ORDER_UNLOAD_FULL_LOAD,
54  STR_ORDER_UNLOAD_FULL_LOAD_ANY,
55  STR_ORDER_UNLOAD_NO_LOAD,
56  }, {
57  STR_ORDER_TRANSFER,
59  STR_ORDER_TRANSFER_FULL_LOAD,
60  STR_ORDER_TRANSFER_FULL_LOAD_ANY,
61  STR_ORDER_TRANSFER_NO_LOAD,
62  }, {
63  /* Unload and transfer do not work together. */
68  }, {
69  STR_ORDER_NO_UNLOAD,
71  STR_ORDER_NO_UNLOAD_FULL_LOAD,
72  STR_ORDER_NO_UNLOAD_FULL_LOAD_ANY,
73  STR_ORDER_NO_UNLOAD_NO_LOAD,
74  }
75  }, {
76  /* With auto-refitting. No loading and auto-refitting do not work together. */
77  {
78  STR_ORDER_AUTO_REFIT,
80  STR_ORDER_FULL_LOAD_REFIT,
81  STR_ORDER_FULL_LOAD_ANY_REFIT,
83  }, {
84  STR_ORDER_UNLOAD_REFIT,
86  STR_ORDER_UNLOAD_FULL_LOAD_REFIT,
87  STR_ORDER_UNLOAD_FULL_LOAD_ANY_REFIT,
89  }, {
90  STR_ORDER_TRANSFER_REFIT,
92  STR_ORDER_TRANSFER_FULL_LOAD_REFIT,
93  STR_ORDER_TRANSFER_FULL_LOAD_ANY_REFIT,
95  }, {
96  /* Unload and transfer do not work together. */
101  }, {
102  STR_ORDER_NO_UNLOAD_REFIT,
104  STR_ORDER_NO_UNLOAD_FULL_LOAD_REFIT,
105  STR_ORDER_NO_UNLOAD_FULL_LOAD_ANY_REFIT,
107  }
108  }
109 };
110 
111 static const StringID _order_non_stop_drowdown[] = {
112  STR_ORDER_GO_TO,
113  STR_ORDER_GO_NON_STOP_TO,
114  STR_ORDER_GO_VIA,
115  STR_ORDER_GO_NON_STOP_VIA,
117 };
118 
119 static const StringID _order_full_load_drowdown[] = {
120  STR_ORDER_DROP_LOAD_IF_POSSIBLE,
121  STR_EMPTY,
122  STR_ORDER_DROP_FULL_LOAD_ALL,
123  STR_ORDER_DROP_FULL_LOAD_ANY,
124  STR_ORDER_DROP_NO_LOADING,
126 };
127 
128 static const StringID _order_unload_drowdown[] = {
129  STR_ORDER_DROP_UNLOAD_IF_ACCEPTED,
130  STR_ORDER_DROP_UNLOAD,
131  STR_ORDER_DROP_TRANSFER,
132  STR_EMPTY,
133  STR_ORDER_DROP_NO_UNLOADING,
135 };
136 
137 static const StringID _order_goto_dropdown[] = {
138  STR_ORDER_GO_TO,
139  STR_ORDER_GO_TO_NEAREST_DEPOT,
140  STR_ORDER_CONDITIONAL,
141  STR_ORDER_SHARE,
143 };
144 
145 static const StringID _order_goto_dropdown_aircraft[] = {
146  STR_ORDER_GO_TO,
147  STR_ORDER_GO_TO_NEAREST_HANGAR,
148  STR_ORDER_CONDITIONAL,
149  STR_ORDER_SHARE,
151 };
152 
159  OCV_AGE,
163 };
164 
165 static const StringID _order_conditional_condition[] = {
166  STR_ORDER_CONDITIONAL_COMPARATOR_EQUALS,
167  STR_ORDER_CONDITIONAL_COMPARATOR_NOT_EQUALS,
168  STR_ORDER_CONDITIONAL_COMPARATOR_LESS_THAN,
169  STR_ORDER_CONDITIONAL_COMPARATOR_LESS_EQUALS,
170  STR_ORDER_CONDITIONAL_COMPARATOR_MORE_THAN,
171  STR_ORDER_CONDITIONAL_COMPARATOR_MORE_EQUALS,
172  STR_ORDER_CONDITIONAL_COMPARATOR_IS_TRUE,
173  STR_ORDER_CONDITIONAL_COMPARATOR_IS_FALSE,
175 };
176 
177 extern uint ConvertSpeedToDisplaySpeed(uint speed);
178 extern uint ConvertDisplaySpeedToSpeed(uint speed);
179 
180 static const StringID _order_depot_action_dropdown[] = {
181  STR_ORDER_DROP_GO_ALWAYS_DEPOT,
182  STR_ORDER_DROP_SERVICE_DEPOT,
183  STR_ORDER_DROP_HALT_DEPOT,
185 };
186 
187 static int DepotActionStringIndex(const Order *order)
188 {
189  if (order->GetDepotActionType() & ODATFB_HALT) {
190  return DA_STOP;
191  } else if (order->GetDepotOrderType() & ODTFB_SERVICE) {
192  return DA_SERVICE;
193  } else {
194  return DA_ALWAYS_GO;
195  }
196 }
197 
198 static const StringID _order_refit_action_dropdown[] = {
199  STR_ORDER_DROP_REFIT_AUTO,
200  STR_ORDER_DROP_REFIT_AUTO_ANY,
202 };
203 
216 void DrawOrderString(const Vehicle *v, const Order *order, int order_index, int y, bool selected, bool timetable, int left, int middle, int right)
217 {
218  bool rtl = _current_text_dir == TD_RTL;
219 
220  SpriteID sprite = rtl ? SPR_ARROW_LEFT : SPR_ARROW_RIGHT;
221  Dimension sprite_size = GetSpriteSize(sprite);
222  if (v->cur_real_order_index == order_index) {
223  DrawSprite(sprite, PAL_NONE, rtl ? right - sprite_size.width : left, y + ((int)FONT_HEIGHT_NORMAL - (int)sprite_size.height) / 2);
224  DrawSprite(sprite, PAL_NONE, rtl ? right - 2 * sprite_size.width : left + sprite_size.width, y + ((int)FONT_HEIGHT_NORMAL - (int)sprite_size.height) / 2);
225  } else if (v->cur_implicit_order_index == order_index) {
226  DrawSprite(sprite, PAL_NONE, rtl ? right - sprite_size.width : left, y + ((int)FONT_HEIGHT_NORMAL - (int)sprite_size.height) / 2);
227  }
228 
229  TextColour colour = TC_BLACK;
230  if (order->IsType(OT_IMPLICIT)) {
231  colour = (selected ? TC_SILVER : TC_GREY) | TC_NO_SHADE;
232  } else if (selected) {
233  colour = TC_WHITE;
234  }
235 
236  SetDParam(0, order_index + 1);
237  DrawString(left, rtl ? right - 2 * sprite_size.width - 3 : middle, y, STR_ORDER_INDEX, colour, SA_RIGHT | SA_FORCE);
238 
239  SetDParam(5, STR_EMPTY);
240  SetDParam(8, STR_EMPTY);
241 
242  /* Check range for aircraft. */
243  if (v->type == VEH_AIRCRAFT && Aircraft::From(v)->GetRange() > 0 && order->IsGotoOrder()) {
244  const Order *next = order->next != nullptr ? order->next : v->GetFirstOrder();
245  if (GetOrderDistance(order, next, v) > Aircraft::From(v)->acache.cached_max_range_sqr) SetDParam(8, STR_ORDER_OUT_OF_RANGE);
246  }
247 
248  switch (order->GetType()) {
249  case OT_DUMMY:
250  SetDParam(0, STR_INVALID_ORDER);
251  SetDParam(1, order->GetDestination());
252  break;
253 
254  case OT_IMPLICIT:
255  SetDParam(0, STR_ORDER_GO_TO_STATION);
256  SetDParam(1, STR_ORDER_GO_TO);
257  SetDParam(2, order->GetDestination());
258  SetDParam(3, timetable ? STR_EMPTY : STR_ORDER_IMPLICIT);
259  break;
260 
261  case OT_GOTO_STATION: {
262  OrderLoadFlags load = order->GetLoadType();
263  OrderUnloadFlags unload = order->GetUnloadType();
264  bool valid_station = CanVehicleUseStation(v, Station::Get(order->GetDestination()));
265 
266  SetDParam(0, valid_station ? STR_ORDER_GO_TO_STATION : STR_ORDER_GO_TO_STATION_CAN_T_USE_STATION);
267  SetDParam(1, STR_ORDER_GO_TO + (v->IsGroundVehicle() ? order->GetNonStopType() : 0));
268  SetDParam(2, order->GetDestination());
269 
270  if (timetable) {
271  SetDParam(3, STR_EMPTY);
272 
273  if (order->GetWaitTime() > 0) {
274  SetDParam(5, order->IsWaitTimetabled() ? STR_TIMETABLE_STAY_FOR : STR_TIMETABLE_STAY_FOR_ESTIMATED);
275  SetTimetableParams(6, 7, order->GetWaitTime());
276  }
277  } else {
278  SetDParam(3, (order->GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION) ? STR_EMPTY : _station_load_types[order->IsRefit()][unload][load]);
279  if (order->IsRefit()) {
280  SetDParam(4, order->IsAutoRefit() ? STR_ORDER_AUTO_REFIT_ANY : CargoSpec::Get(order->GetRefitCargo())->name);
281  }
282  if (v->type == VEH_TRAIN && (order->GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION) == 0) {
283  SetDParam(5, order->GetStopLocation() + STR_ORDER_STOP_LOCATION_NEAR_END);
284  }
285  }
286  break;
287  }
288 
289  case OT_GOTO_DEPOT:
290  if (order->GetDepotActionType() & ODATFB_NEAREST_DEPOT) {
291  SetDParam(0, STR_ORDER_GO_TO_NEAREST_DEPOT_FORMAT);
292  if (v->type == VEH_AIRCRAFT) {
293  SetDParam(2, STR_ORDER_NEAREST_HANGAR);
294  SetDParam(3, STR_EMPTY);
295  } else {
296  SetDParam(2, STR_ORDER_NEAREST_DEPOT);
297  SetDParam(3, STR_ORDER_TRAIN_DEPOT + v->type);
298  }
299  } else {
300  SetDParam(0, STR_ORDER_GO_TO_DEPOT_FORMAT);
301  SetDParam(2, v->type);
302  SetDParam(3, order->GetDestination());
303  }
304 
305  if (order->GetDepotOrderType() & ODTFB_SERVICE) {
306  SetDParam(1, (order->GetNonStopType() & ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS) ? STR_ORDER_SERVICE_NON_STOP_AT : STR_ORDER_SERVICE_AT);
307  } else {
308  SetDParam(1, (order->GetNonStopType() & ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS) ? STR_ORDER_GO_NON_STOP_TO : STR_ORDER_GO_TO);
309  }
310 
311  if (!timetable && (order->GetDepotActionType() & ODATFB_HALT)) {
312  SetDParam(5, STR_ORDER_STOP_ORDER);
313  }
314 
315  if (!timetable && order->IsRefit()) {
316  SetDParam(5, (order->GetDepotActionType() & ODATFB_HALT) ? STR_ORDER_REFIT_STOP_ORDER : STR_ORDER_REFIT_ORDER);
318  }
319  break;
320 
321  case OT_GOTO_WAYPOINT:
322  SetDParam(0, (order->GetNonStopType() & ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS) ? STR_ORDER_GO_NON_STOP_TO_WAYPOINT : STR_ORDER_GO_TO_WAYPOINT);
323  SetDParam(1, order->GetDestination());
324  break;
325 
326  case OT_CONDITIONAL:
327  SetDParam(1, order->GetConditionSkipToOrder() + 1);
328  if (order->GetConditionVariable() == OCV_UNCONDITIONALLY) {
329  SetDParam(0, STR_ORDER_CONDITIONAL_UNCONDITIONAL);
330  } else {
332  SetDParam(0, (occ == OCC_IS_TRUE || occ == OCC_IS_FALSE) ? STR_ORDER_CONDITIONAL_TRUE_FALSE : STR_ORDER_CONDITIONAL_NUM);
333  SetDParam(2, STR_ORDER_CONDITIONAL_LOAD_PERCENTAGE + order->GetConditionVariable());
334  SetDParam(3, STR_ORDER_CONDITIONAL_COMPARATOR_EQUALS + occ);
335 
336  uint value = order->GetConditionValue();
337  if (order->GetConditionVariable() == OCV_MAX_SPEED) value = ConvertSpeedToDisplaySpeed(value);
338  SetDParam(4, value);
339  }
340 
341  if (timetable && order->GetWaitTime() > 0) {
342  SetDParam(5, order->IsWaitTimetabled() ? STR_TIMETABLE_AND_TRAVEL_FOR : STR_TIMETABLE_AND_TRAVEL_FOR_ESTIMATED);
343  SetTimetableParams(6, 7, order->GetWaitTime());
344  } else {
345  SetDParam(5, STR_EMPTY);
346  }
347  break;
348 
349  default: NOT_REACHED();
350  }
351 
352  DrawString(rtl ? left : middle, rtl ? middle : right, y, STR_ORDER_TEXT, colour);
353 }
354 
362 {
363  /* Hack-ish; unpack order 0, so everything gets initialised with either zero
364  * or a suitable default value for the variable. Then also override the index
365  * as it is not coming from a pool, so would be initialised. */
366  Order order(0);
367  order.index = 0;
368 
369  /* check depot first */
370  if (IsDepotTypeTile(tile, (TransportType)(uint)v->type) && IsTileOwner(tile, _local_company)) {
371  order.MakeGoToDepot(v->type == VEH_AIRCRAFT ? GetStationIndex(tile) : GetDepotIndex(tile),
374 
376 
377  return order;
378  }
379 
380  /* check rail waypoint */
381  if (IsRailWaypointTile(tile) &&
382  v->type == VEH_TRAIN &&
383  IsTileOwner(tile, _local_company)) {
384  order.MakeGoToWaypoint(GetStationIndex(tile));
386  return order;
387  }
388 
389  /* check buoy (no ownership) */
390  if (IsBuoyTile(tile) && v->type == VEH_SHIP) {
391  order.MakeGoToWaypoint(GetStationIndex(tile));
392  return order;
393  }
394 
395  /* check for station or industry with neutral station */
396  if (IsTileType(tile, MP_STATION) || IsTileType(tile, MP_INDUSTRY)) {
397  const Station *st = nullptr;
398 
399  if (IsTileType(tile, MP_STATION)) {
400  st = Station::GetByTile(tile);
401  } else {
402  const Industry *in = Industry::GetByTile(tile);
403  st = in->neutral_station;
404  }
405  if (st != nullptr && (st->owner == _local_company || st->owner == OWNER_NONE)) {
406  byte facil;
407  switch (v->type) {
408  case VEH_SHIP: facil = FACIL_DOCK; break;
409  case VEH_TRAIN: facil = FACIL_TRAIN; break;
410  case VEH_AIRCRAFT: facil = FACIL_AIRPORT; break;
411  case VEH_ROAD: facil = FACIL_BUS_STOP | FACIL_TRUCK_STOP; break;
412  default: NOT_REACHED();
413  }
414  if (st->facilities & facil) {
415  order.MakeGoToStation(st->index);
419  return order;
420  }
421  }
422  }
423 
424  /* not found */
425  order.Free();
426  return order;
427 }
428 
430 enum {
431  OHK_SKIP,
432  OHK_DELETE,
433  OHK_GOTO,
434  OHK_NONSTOP,
435  OHK_FULLLOAD,
436  OHK_UNLOAD,
437  OHK_NEAREST_DEPOT,
438  OHK_ALWAYS_SERVICE,
439  OHK_TRANSFER,
440  OHK_NO_UNLOAD,
441  OHK_NO_LOAD,
442 };
443 
484 struct OrdersWindow : public Window {
485 private:
488  OPOS_NONE,
489  OPOS_GOTO,
490  OPOS_CONDITIONAL,
491  OPOS_SHARE,
492  OPOS_END,
493  };
494 
496  enum DisplayPane {
497  /* WID_O_SEL_TOP_ROW_GROUNDVEHICLE */
500 
501  /* WID_O_SEL_TOP_LEFT */
504 
505  /* WID_O_SEL_TOP_MIDDLE */
508 
509  /* WID_O_SEL_TOP_RIGHT */
512 
513  /* WID_O_SEL_TOP_ROW */
517 
518  /* WID_O_SEL_BOTTOM_MIDDLE */
521  };
522 
523  int selected_order;
525  OrderPlaceObjectState goto_type;
526  const Vehicle *vehicle;
527  Scrollbar *vscroll;
530 
537  {
538  int num = this->selected_order;
539  return (num >= 0 && num < vehicle->GetNumOrders()) ? num : vehicle->GetNumOrders();
540  }
541 
551  {
552  NWidgetBase *nwid = this->GetWidget<NWidgetBase>(WID_O_ORDER_LIST);
553  uint sel = (y - nwid->pos_y - WD_FRAMERECT_TOP) / nwid->resize_y; // Selected line in the WID_O_ORDER_LIST panel.
554 
555  if (sel >= this->vscroll->GetCapacity()) return INVALID_VEH_ORDER_ID;
556 
557  sel += this->vscroll->GetPosition();
558 
559  return (sel <= vehicle->GetNumOrders()) ? sel : INVALID_VEH_ORDER_ID;
560  }
561 
566  {
567  assert(type > OPOS_NONE && type < OPOS_END);
568 
569  static const HighLightStyle goto_place_style[OPOS_END - 1] = {
570  HT_RECT | HT_VEHICLE, // OPOS_GOTO
571  HT_NONE, // OPOS_CONDITIONAL
572  HT_VEHICLE, // OPOS_SHARE
573  };
574  SetObjectToPlaceWnd(ANIMCURSOR_PICKSTATION, PAL_NONE, goto_place_style[type - 1], this);
575  this->goto_type = type;
576  this->SetWidgetDirty(WID_O_GOTO);
577  }
578 
584  void OrderClick_FullLoad(OrderLoadFlags load_type, bool toggle = false)
585  {
586  VehicleOrderID sel_ord = this->OrderGetSel();
587  const Order *order = this->vehicle->GetOrder(sel_ord);
588 
589  if (order == nullptr) return;
590 
591  if (toggle && order->GetLoadType() == load_type) {
592  load_type = OLF_LOAD_IF_POSSIBLE; // reset to 'default'
593  }
594  if (order->GetLoadType() == load_type) return; // If we still match, do nothing
595 
596  Command<CMD_MODIFY_ORDER>::Post(STR_ERROR_CAN_T_MODIFY_THIS_ORDER, this->vehicle->tile, this->vehicle->index, sel_ord, MOF_LOAD, load_type);
597  }
598 
602  void OrderClick_Service(int i)
603  {
604  VehicleOrderID sel_ord = this->OrderGetSel();
605 
606  if (i < 0) {
607  const Order *order = this->vehicle->GetOrder(sel_ord);
608  if (order == nullptr) return;
610  }
611  Command<CMD_MODIFY_ORDER>::Post(STR_ERROR_CAN_T_MODIFY_THIS_ORDER, this->vehicle->tile, this->vehicle->index, sel_ord, MOF_DEPOT_ACTION, i);
612  }
613 
618  {
619  Order order;
620  order.next = nullptr;
621  order.index = 0;
622  order.MakeGoToDepot(INVALID_DEPOT, ODTFB_PART_OF_ORDERS,
625 
626  Command<CMD_INSERT_ORDER>::Post(STR_ERROR_CAN_T_INSERT_NEW_ORDER, this->vehicle->tile, this->vehicle->index, this->OrderGetSel(), order);
627  }
628 
634  void OrderClick_Unload(OrderUnloadFlags unload_type, bool toggle = false)
635  {
636  VehicleOrderID sel_ord = this->OrderGetSel();
637  const Order *order = this->vehicle->GetOrder(sel_ord);
638 
639  if (order == nullptr) return;
640 
641  if (toggle && order->GetUnloadType() == unload_type) {
642  unload_type = OUF_UNLOAD_IF_POSSIBLE;
643  }
644  if (order->GetUnloadType() == unload_type) return; // If we still match, do nothing
645 
646  Command<CMD_MODIFY_ORDER>::Post(STR_ERROR_CAN_T_MODIFY_THIS_ORDER, this->vehicle->tile, this->vehicle->index, sel_ord, MOF_UNLOAD, unload_type);
647 
648  /* Transfer and unload orders with leave empty as default */
649  if (unload_type == OUFB_TRANSFER || unload_type == OUFB_UNLOAD) {
650  Command<CMD_MODIFY_ORDER>::Post(this->vehicle->tile, this->vehicle->index, sel_ord, MOF_LOAD, OLFB_NO_LOAD);
652  }
653  }
654 
659  void OrderClick_Nonstop(int non_stop)
660  {
661  if (!this->vehicle->IsGroundVehicle()) return;
662 
663  VehicleOrderID sel_ord = this->OrderGetSel();
664  const Order *order = this->vehicle->GetOrder(sel_ord);
665 
666  if (order == nullptr || order->GetNonStopType() == non_stop) return;
667 
668  /* Keypress if negative, so 'toggle' to the next */
669  if (non_stop < 0) {
671  }
672 
674  Command<CMD_MODIFY_ORDER>::Post(STR_ERROR_CAN_T_MODIFY_THIS_ORDER, this->vehicle->tile, this->vehicle->index, sel_ord, MOF_NON_STOP, non_stop);
675  }
676 
682  {
683  /* Don't skip when there's nothing to skip */
684  if (_ctrl_pressed && this->vehicle->cur_implicit_order_index == this->OrderGetSel()) return;
685  if (this->vehicle->GetNumOrders() <= 1) return;
686 
687  Command<CMD_SKIP_TO_ORDER>::Post(_ctrl_pressed ? STR_ERROR_CAN_T_SKIP_TO_ORDER : STR_ERROR_CAN_T_SKIP_ORDER,
688  this->vehicle->tile, this->vehicle->index, _ctrl_pressed ? this->OrderGetSel() : ((this->vehicle->cur_implicit_order_index + 1) % this->vehicle->GetNumOrders()));
689  }
690 
695  {
696  /* When networking, move one order lower */
697  int selected = this->selected_order + (int)_networking;
698 
699  if (Command<CMD_DELETE_ORDER>::Post(STR_ERROR_CAN_T_DELETE_THIS_ORDER, this->vehicle->tile, this->vehicle->index, this->OrderGetSel())) {
700  this->selected_order = selected >= this->vehicle->GetNumOrders() ? -1 : selected;
701  this->UpdateButtonState();
702  }
703  }
704 
712  {
713  /* Don't try to stop sharing orders if 'End of Shared Orders' isn't selected. */
714  if (!this->vehicle->IsOrderListShared() || this->selected_order != this->vehicle->GetNumOrders()) return;
715  /* If Ctrl is pressed, delete the order list as if we clicked the 'Delete' button. */
716  if (_ctrl_pressed) {
717  this->OrderClick_Delete();
718  return;
719  }
720 
721  /* Get another vehicle that share orders with this vehicle. */
722  Vehicle *other_shared = (this->vehicle->FirstShared() == this->vehicle) ? this->vehicle->NextShared() : this->vehicle->PreviousShared();
723  /* Copy the order list of the other vehicle. */
724  if (Command<CMD_CLONE_ORDER>::Post(STR_ERROR_CAN_T_STOP_SHARING_ORDER_LIST, this->vehicle->tile, CO_COPY, this->vehicle->index, other_shared->index)) {
725  this->UpdateButtonState();
726  }
727  }
728 
735  void OrderClick_Refit(int i, bool auto_refit)
736  {
737  if (_ctrl_pressed) {
738  /* Cancel refitting */
739  Command<CMD_ORDER_REFIT>::Post(this->vehicle->tile, this->vehicle->index, this->OrderGetSel(), CT_NO_REFIT);
740  } else {
741  if (i == 1) { // Auto-refit to available cargo type.
742  Command<CMD_ORDER_REFIT>::Post(this->vehicle->tile, this->vehicle->index, this->OrderGetSel(), CT_AUTO_REFIT);
743  } else {
744  ShowVehicleRefitWindow(this->vehicle, this->OrderGetSel(), this, auto_refit);
745  }
746  }
747  }
748 
751  {
752  this->can_do_refit = false;
753  this->can_do_autorefit = false;
754  for (const Vehicle *w = this->vehicle; w != nullptr; w = w->IsGroundVehicle() ? w->Next() : nullptr) {
755  if (IsEngineRefittable(w->engine_type)) this->can_do_refit = true;
756  if (HasBit(Engine::Get(w->engine_type)->info.misc_flags, EF_AUTO_REFIT)) this->can_do_autorefit = true;
757  }
758  }
759 
760 public:
761  OrdersWindow(WindowDesc *desc, const Vehicle *v) : Window(desc)
762  {
763  this->vehicle = v;
764 
765  this->CreateNestedTree();
766  this->vscroll = this->GetScrollbar(WID_O_SCROLLBAR);
767  this->FinishInitNested(v->index);
768  if (v->owner == _local_company) {
769  this->DisableWidget(WID_O_EMPTY);
770  }
771 
772  this->selected_order = -1;
773  this->order_over = INVALID_VEH_ORDER_ID;
774  this->goto_type = OPOS_NONE;
775  this->owner = v->owner;
776 
777  this->UpdateAutoRefitState();
778 
780  /* If there are less than 2 station, make Go To active. */
781  int station_orders = 0;
782  for(const Order *order : v->Orders()) {
783  if (order->IsType(OT_GOTO_STATION)) station_orders++;
784  }
785 
786  if (station_orders < 2) this->OrderClick_Goto(OPOS_GOTO);
787  }
789  }
790 
791  void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
792  {
793  switch (widget) {
794  case WID_O_ORDER_LIST:
795  resize->height = FONT_HEIGHT_NORMAL;
796  size->height = 6 * resize->height + WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM;
797  break;
798 
799  case WID_O_COND_VARIABLE: {
800  Dimension d = {0, 0};
801  for (uint i = 0; i < lengthof(_order_conditional_variable); i++) {
802  d = maxdim(d, GetStringBoundingBox(STR_ORDER_CONDITIONAL_LOAD_PERCENTAGE + _order_conditional_variable[i]));
803  }
804  d.width += padding.width;
805  d.height += padding.height;
806  *size = maxdim(*size, d);
807  break;
808  }
809 
810  case WID_O_COND_COMPARATOR: {
811  Dimension d = {0, 0};
812  for (int i = 0; _order_conditional_condition[i] != INVALID_STRING_ID; i++) {
813  d = maxdim(d, GetStringBoundingBox(_order_conditional_condition[i]));
814  }
815  d.width += padding.width;
816  d.height += padding.height;
817  *size = maxdim(*size, d);
818  break;
819  }
820  }
821  }
822 
828  void OnInvalidateData(int data = 0, bool gui_scope = true) override
829  {
832 
833  switch (data) {
834  case VIWD_AUTOREPLACE:
835  /* Autoreplace replaced the vehicle */
836  this->vehicle = Vehicle::Get(this->window_number);
837  FALLTHROUGH;
838 
840  /* Vehicle composition was changed. */
841  this->UpdateAutoRefitState();
842  break;
843 
845  /* Removed / replaced all orders (after deleting / sharing) */
846  if (this->selected_order == -1) break;
847 
848  this->CloseChildWindows();
849  HideDropDownMenu(this);
850  this->selected_order = -1;
851  break;
852 
853  case VIWD_MODIFY_ORDERS:
854  /* Some other order changes */
855  break;
856 
857  default:
858  if (data < 0) break;
859 
860  if (gui_scope) break; // only do this once; from command scope
861  from = GB(data, 0, 8);
862  to = GB(data, 8, 8);
863  /* Moving an order. If one of these is INVALID_VEH_ORDER_ID, then
864  * the order is being created / removed */
865  if (this->selected_order == -1) break;
866 
867  if (from == to) break; // no need to change anything
868 
869  if (from != this->selected_order) {
870  /* Moving from preceding order? */
871  this->selected_order -= (int)(from <= this->selected_order);
872  /* Moving to preceding order? */
873  this->selected_order += (int)(to <= this->selected_order);
874  break;
875  }
876 
877  /* Now we are modifying the selected order */
878  if (to == INVALID_VEH_ORDER_ID) {
879  /* Deleting selected order */
880  this->CloseChildWindows();
881  HideDropDownMenu(this);
882  this->selected_order = -1;
883  break;
884  }
885 
886  /* Moving selected order */
887  this->selected_order = to;
888  break;
889  }
890 
891  this->vscroll->SetCount(this->vehicle->GetNumOrders() + 1);
892  if (gui_scope) this->UpdateButtonState();
893 
894  /* Scroll to the new order. */
895  if (from == INVALID_VEH_ORDER_ID && to != INVALID_VEH_ORDER_ID && !this->vscroll->IsVisible(to)) {
896  this->vscroll->ScrollTowards(to);
897  }
898  }
899 
900  void UpdateButtonState()
901  {
902  if (this->vehicle->owner != _local_company) return; // No buttons are displayed with competitor order windows.
903 
904  bool shared_orders = this->vehicle->IsOrderListShared();
905  VehicleOrderID sel = this->OrderGetSel();
906  const Order *order = this->vehicle->GetOrder(sel);
907 
908  /* Second row. */
909  /* skip */
910  this->SetWidgetDisabledState(WID_O_SKIP, this->vehicle->GetNumOrders() <= 1);
911 
912  /* delete / stop sharing */
913  NWidgetStacked *delete_sel = this->GetWidget<NWidgetStacked>(WID_O_SEL_BOTTOM_MIDDLE);
914  if (shared_orders && this->selected_order == this->vehicle->GetNumOrders()) {
915  /* The 'End of Shared Orders' order is selected, show the 'stop sharing' button. */
917  } else {
918  /* The 'End of Shared Orders' order isn't selected, show the 'delete' button. */
921  (uint)this->vehicle->GetNumOrders() + ((shared_orders || this->vehicle->GetNumOrders() != 0) ? 1 : 0) <= (uint)this->selected_order);
922 
923  /* Set the tooltip of the 'delete' button depending on whether the
924  * 'End of Orders' order or a regular order is selected. */
925  NWidgetCore *nwi = this->GetWidget<NWidgetCore>(WID_O_DELETE);
926  if (this->selected_order == this->vehicle->GetNumOrders()) {
927  nwi->SetDataTip(STR_ORDERS_DELETE_BUTTON, STR_ORDERS_DELETE_ALL_TOOLTIP);
928  } else {
929  nwi->SetDataTip(STR_ORDERS_DELETE_BUTTON, STR_ORDERS_DELETE_TOOLTIP);
930  }
931  }
932 
933  /* First row. */
935  this->RaiseWidget(WID_O_UNLOAD);
936  this->RaiseWidget(WID_O_SERVICE);
937 
938  /* Selection widgets. */
939  /* Train or road vehicle. */
940  NWidgetStacked *train_row_sel = this->GetWidget<NWidgetStacked>(WID_O_SEL_TOP_ROW_GROUNDVEHICLE);
941  NWidgetStacked *left_sel = this->GetWidget<NWidgetStacked>(WID_O_SEL_TOP_LEFT);
942  NWidgetStacked *middle_sel = this->GetWidget<NWidgetStacked>(WID_O_SEL_TOP_MIDDLE);
943  NWidgetStacked *right_sel = this->GetWidget<NWidgetStacked>(WID_O_SEL_TOP_RIGHT);
944  /* Ship or airplane. */
945  NWidgetStacked *row_sel = this->GetWidget<NWidgetStacked>(WID_O_SEL_TOP_ROW);
946  assert(row_sel != nullptr || (train_row_sel != nullptr && left_sel != nullptr && middle_sel != nullptr && right_sel != nullptr));
947 
948 
949  if (order == nullptr) {
950  if (row_sel != nullptr) {
951  row_sel->SetDisplayedPlane(DP_ROW_LOAD);
952  } else {
954  left_sel->SetDisplayedPlane(DP_LEFT_LOAD);
955  middle_sel->SetDisplayedPlane(DP_MIDDLE_UNLOAD);
956  right_sel->SetDisplayedPlane(DP_RIGHT_EMPTY);
959  }
963  } else {
966 
967  switch (order->GetType()) {
968  case OT_GOTO_STATION:
969  if (row_sel != nullptr) {
970  row_sel->SetDisplayedPlane(DP_ROW_LOAD);
971  } else {
973  left_sel->SetDisplayedPlane(DP_LEFT_LOAD);
974  middle_sel->SetDisplayedPlane(DP_MIDDLE_UNLOAD);
975  right_sel->SetDisplayedPlane(DP_RIGHT_REFIT);
978  }
981 
982  /* Can only do refitting when stopping at the destination and loading cargo.
983  * Also enable the button if a refit is already set to allow clearing it. */
986  ((!this->can_do_refit || !this->can_do_autorefit) && !order->IsRefit()));
987 
988  break;
989 
990  case OT_GOTO_WAYPOINT:
991  if (row_sel != nullptr) {
992  row_sel->SetDisplayedPlane(DP_ROW_LOAD);
993  } else {
995  left_sel->SetDisplayedPlane(DP_LEFT_LOAD);
996  middle_sel->SetDisplayedPlane(DP_MIDDLE_UNLOAD);
997  right_sel->SetDisplayedPlane(DP_RIGHT_EMPTY);
1000  }
1002  this->DisableWidget(WID_O_UNLOAD);
1004  break;
1005 
1006  case OT_GOTO_DEPOT:
1007  if (row_sel != nullptr) {
1008  row_sel->SetDisplayedPlane(DP_ROW_DEPOT);
1009  } else {
1011  left_sel->SetDisplayedPlane(DP_LEFT_REFIT);
1012  middle_sel->SetDisplayedPlane(DP_MIDDLE_SERVICE);
1013  right_sel->SetDisplayedPlane(DP_RIGHT_EMPTY);
1016  }
1017  /* Disable refit button if the order is no 'always go' order.
1018  * However, keep the service button enabled for refit-orders to allow clearing refits (without knowing about ctrl). */
1020  (order->GetDepotOrderType() & ODTFB_SERVICE) || (order->GetDepotActionType() & ODATFB_HALT) ||
1021  (!this->can_do_refit && !order->IsRefit()));
1023  break;
1024 
1025  case OT_CONDITIONAL: {
1026  if (row_sel != nullptr) {
1028  } else {
1030  }
1032  /* Set the strings for the dropdown boxes. */
1033  this->GetWidget<NWidgetCore>(WID_O_COND_VARIABLE)->widget_data = STR_ORDER_CONDITIONAL_LOAD_PERCENTAGE + ocv;
1034  this->GetWidget<NWidgetCore>(WID_O_COND_COMPARATOR)->widget_data = _order_conditional_condition[order->GetConditionComparator()];
1037  break;
1038  }
1039 
1040  default: // every other order
1041  if (row_sel != nullptr) {
1042  row_sel->SetDisplayedPlane(DP_ROW_LOAD);
1043  } else {
1045  left_sel->SetDisplayedPlane(DP_LEFT_LOAD);
1046  middle_sel->SetDisplayedPlane(DP_MIDDLE_UNLOAD);
1047  right_sel->SetDisplayedPlane(DP_RIGHT_EMPTY);
1049  }
1051  this->DisableWidget(WID_O_UNLOAD);
1053  break;
1054  }
1055  }
1056 
1057  /* Disable list of vehicles with the same shared orders if there is no list */
1058  this->SetWidgetDisabledState(WID_O_SHARED_ORDER_LIST, !shared_orders);
1059 
1060  this->SetDirty();
1061  }
1062 
1063  void OnPaint() override
1064  {
1065  if (this->vehicle->owner != _local_company) {
1066  this->selected_order = -1; // Disable selection any selected row at a competitor order window.
1067  } else {
1068  this->SetWidgetLoweredState(WID_O_GOTO, this->goto_type != OPOS_NONE);
1069  }
1070  this->DrawWidgets();
1071  }
1072 
1073  void DrawWidget(const Rect &r, int widget) const override
1074  {
1075  if (widget != WID_O_ORDER_LIST) return;
1076 
1077  bool rtl = _current_text_dir == TD_RTL;
1078  SetDParamMaxValue(0, this->vehicle->GetNumOrders(), 2);
1079  int index_column_width = GetStringBoundingBox(STR_ORDER_INDEX).width + 2 * GetSpriteSize(rtl ? SPR_ARROW_RIGHT : SPR_ARROW_LEFT).width + 3;
1080  int middle = rtl ? r.right - WD_FRAMETEXT_RIGHT - index_column_width : r.left + WD_FRAMETEXT_LEFT + index_column_width;
1081 
1082  int y = r.top + WD_FRAMERECT_TOP;
1083  int line_height = this->GetWidget<NWidgetBase>(WID_O_ORDER_LIST)->resize_y;
1084 
1085  int i = this->vscroll->GetPosition();
1086  const Order *order = this->vehicle->GetOrder(i);
1087  /* First draw the highlighting underground if it exists. */
1088  if (this->order_over != INVALID_VEH_ORDER_ID) {
1089  while (order != nullptr) {
1090  /* Don't draw anything if it extends past the end of the window. */
1091  if (!this->vscroll->IsVisible(i)) break;
1092 
1093  if (i != this->selected_order && i == this->order_over) {
1094  /* Highlight dragged order destination. */
1095  int top = (this->order_over < this->selected_order ? y : y + line_height) - WD_FRAMERECT_TOP;
1096  int bottom = std::min(top + 2, r.bottom - WD_FRAMERECT_BOTTOM);
1097  top = std::max(top - 3, r.top + WD_FRAMERECT_TOP);
1098  GfxFillRect(r.left + WD_FRAMETEXT_LEFT, top, r.right - WD_FRAMETEXT_RIGHT, bottom, _colour_gradient[COLOUR_GREY][7]);
1099  break;
1100  }
1101  y += line_height;
1102 
1103  i++;
1104  order = order->next;
1105  }
1106 
1107  /* Reset counters for drawing the orders. */
1108  y = r.top + WD_FRAMERECT_TOP;
1109  i = this->vscroll->GetPosition();
1110  order = this->vehicle->GetOrder(i);
1111  }
1112 
1113  /* Draw the orders. */
1114  while (order != nullptr) {
1115  /* Don't draw anything if it extends past the end of the window. */
1116  if (!this->vscroll->IsVisible(i)) break;
1117 
1118  DrawOrderString(this->vehicle, order, i, y, i == this->selected_order, false, r.left + WD_FRAMETEXT_LEFT, middle, r.right - WD_FRAMETEXT_RIGHT);
1119  y += line_height;
1120 
1121  i++;
1122  order = order->next;
1123  }
1124 
1125  if (this->vscroll->IsVisible(i)) {
1126  StringID str = this->vehicle->IsOrderListShared() ? STR_ORDERS_END_OF_SHARED_ORDERS : STR_ORDERS_END_OF_ORDERS;
1127  DrawString(rtl ? r.left + WD_FRAMETEXT_LEFT : middle, rtl ? middle : r.right - WD_FRAMETEXT_RIGHT, y, str, (i == this->selected_order) ? TC_WHITE : TC_BLACK);
1128  }
1129  }
1130 
1131  void SetStringParameters(int widget) const override
1132  {
1133  switch (widget) {
1134  case WID_O_COND_VALUE: {
1135  VehicleOrderID sel = this->OrderGetSel();
1136  const Order *order = this->vehicle->GetOrder(sel);
1137 
1138  if (order != nullptr && order->IsType(OT_CONDITIONAL)) {
1139  uint value = order->GetConditionValue();
1140  if (order->GetConditionVariable() == OCV_MAX_SPEED) value = ConvertSpeedToDisplaySpeed(value);
1141  SetDParam(0, value);
1142  }
1143  break;
1144  }
1145 
1146  case WID_O_CAPTION:
1147  SetDParam(0, this->vehicle->index);
1148  break;
1149  }
1150  }
1151 
1152  void OnClick(Point pt, int widget, int click_count) override
1153  {
1154  switch (widget) {
1155  case WID_O_ORDER_LIST: {
1156  if (this->goto_type == OPOS_CONDITIONAL) {
1157  VehicleOrderID order_id = this->GetOrderFromPt(_cursor.pos.y - this->top);
1158  if (order_id != INVALID_VEH_ORDER_ID) {
1159  Order order;
1160  order.next = nullptr;
1161  order.index = 0;
1162  order.MakeConditional(order_id);
1163 
1164  Command<CMD_INSERT_ORDER>::Post(STR_ERROR_CAN_T_INSERT_NEW_ORDER, this->vehicle->tile, this->vehicle->index, this->OrderGetSel(), order);
1165  }
1167  break;
1168  }
1169 
1170  VehicleOrderID sel = this->GetOrderFromPt(pt.y);
1171 
1172  if (_ctrl_pressed && sel < this->vehicle->GetNumOrders()) {
1173  TileIndex xy = this->vehicle->GetOrder(sel)->GetLocation(this->vehicle);
1174  if (xy != INVALID_TILE) ScrollMainWindowToTile(xy);
1175  return;
1176  }
1177 
1178  /* This order won't be selected any more, close all child windows and dropdowns */
1179  this->CloseChildWindows();
1180  HideDropDownMenu(this);
1181 
1182  if (sel == INVALID_VEH_ORDER_ID || this->vehicle->owner != _local_company) {
1183  /* Deselect clicked order */
1184  this->selected_order = -1;
1185  } else if (sel == this->selected_order) {
1186  if (this->vehicle->type == VEH_TRAIN && sel < this->vehicle->GetNumOrders()) {
1187  Command<CMD_MODIFY_ORDER>::Post(STR_ERROR_CAN_T_MODIFY_THIS_ORDER,
1188  this->vehicle->tile, this->vehicle->index, sel,
1189  MOF_STOP_LOCATION, (this->vehicle->GetOrder(sel)->GetStopLocation() + 1) % OSL_END);
1190  }
1191  } else {
1192  /* Select clicked order */
1193  this->selected_order = sel;
1194 
1195  if (this->vehicle->owner == _local_company) {
1196  /* Activate drag and drop */
1197  SetObjectToPlaceWnd(SPR_CURSOR_MOUSE, PAL_NONE, HT_DRAG, this);
1198  }
1199  }
1200 
1201  this->UpdateButtonState();
1202  break;
1203  }
1204 
1205  case WID_O_SKIP:
1206  this->OrderClick_Skip();
1207  break;
1208 
1209  case WID_O_DELETE:
1210  this->OrderClick_Delete();
1211  break;
1212 
1213  case WID_O_STOP_SHARING:
1214  this->OrderClick_StopSharing();
1215  break;
1216 
1217  case WID_O_NON_STOP:
1218  if (this->GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) {
1219  this->OrderClick_Nonstop(-1);
1220  } else {
1221  const Order *o = this->vehicle->GetOrder(this->OrderGetSel());
1222  ShowDropDownMenu(this, _order_non_stop_drowdown, o->GetNonStopType(), WID_O_NON_STOP, 0,
1223  o->IsType(OT_GOTO_STATION) ? 0 : (o->IsType(OT_GOTO_WAYPOINT) ? 3 : 12));
1224  }
1225  break;
1226 
1227  case WID_O_GOTO:
1228  if (this->GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) {
1229  if (this->goto_type != OPOS_NONE) {
1231  } else {
1232  this->OrderClick_Goto(OPOS_GOTO);
1233  }
1234  } else {
1235  int sel;
1236  switch (this->goto_type) {
1237  case OPOS_NONE: sel = -1; break;
1238  case OPOS_GOTO: sel = 0; break;
1239  case OPOS_CONDITIONAL: sel = 2; break;
1240  case OPOS_SHARE: sel = 3; break;
1241  default: NOT_REACHED();
1242  }
1243  ShowDropDownMenu(this, this->vehicle->type == VEH_AIRCRAFT ? _order_goto_dropdown_aircraft : _order_goto_dropdown, sel, WID_O_GOTO, 0, 0);
1244  }
1245  break;
1246 
1247  case WID_O_FULL_LOAD:
1248  if (this->GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) {
1250  } else {
1251  ShowDropDownMenu(this, _order_full_load_drowdown, this->vehicle->GetOrder(this->OrderGetSel())->GetLoadType(), WID_O_FULL_LOAD, 0, 2);
1252  }
1253  break;
1254 
1255  case WID_O_UNLOAD:
1256  if (this->GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) {
1257  this->OrderClick_Unload(OUFB_UNLOAD, true);
1258  } else {
1259  ShowDropDownMenu(this, _order_unload_drowdown, this->vehicle->GetOrder(this->OrderGetSel())->GetUnloadType(), WID_O_UNLOAD, 0, 8);
1260  }
1261  break;
1262 
1263  case WID_O_REFIT:
1264  this->OrderClick_Refit(0, false);
1265  break;
1266 
1267  case WID_O_SERVICE:
1268  if (this->GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) {
1269  this->OrderClick_Service(-1);
1270  } else {
1271  ShowDropDownMenu(this, _order_depot_action_dropdown, DepotActionStringIndex(this->vehicle->GetOrder(this->OrderGetSel())), WID_O_SERVICE, 0, 0);
1272  }
1273  break;
1274 
1275  case WID_O_REFIT_DROPDOWN:
1276  if (this->GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) {
1277  this->OrderClick_Refit(0, true);
1278  } else {
1279  ShowDropDownMenu(this, _order_refit_action_dropdown, 0, WID_O_REFIT_DROPDOWN, 0, 0);
1280  }
1281  break;
1282 
1283  case WID_O_TIMETABLE_VIEW:
1284  ShowTimetableWindow(this->vehicle);
1285  break;
1286 
1287  case WID_O_COND_VARIABLE: {
1288  DropDownList list;
1289  for (uint i = 0; i < lengthof(_order_conditional_variable); i++) {
1290  list.emplace_back(new DropDownListStringItem(STR_ORDER_CONDITIONAL_LOAD_PERCENTAGE + _order_conditional_variable[i], _order_conditional_variable[i], false));
1291  }
1292  ShowDropDownList(this, std::move(list), this->vehicle->GetOrder(this->OrderGetSel())->GetConditionVariable(), WID_O_COND_VARIABLE);
1293  break;
1294  }
1295 
1296  case WID_O_COND_COMPARATOR: {
1297  const Order *o = this->vehicle->GetOrder(this->OrderGetSel());
1298  ShowDropDownMenu(this, _order_conditional_condition, o->GetConditionComparator(), WID_O_COND_COMPARATOR, 0, (o->GetConditionVariable() == OCV_REQUIRES_SERVICE) ? 0x3F : 0xC0);
1299  break;
1300  }
1301 
1302  case WID_O_COND_VALUE: {
1303  const Order *order = this->vehicle->GetOrder(this->OrderGetSel());
1304  uint value = order->GetConditionValue();
1305  if (order->GetConditionVariable() == OCV_MAX_SPEED) value = ConvertSpeedToDisplaySpeed(value);
1306  SetDParam(0, value);
1307  ShowQueryString(STR_JUST_INT, STR_ORDER_CONDITIONAL_VALUE_CAPT, 5, this, CS_NUMERAL, QSF_NONE);
1308  break;
1309  }
1310 
1312  ShowVehicleListWindow(this->vehicle);
1313  break;
1314  }
1315  }
1316 
1317  void OnQueryTextFinished(char *str) override
1318  {
1319  if (!StrEmpty(str)) {
1320  VehicleOrderID sel = this->OrderGetSel();
1321  uint value = atoi(str);
1322 
1323  switch (this->vehicle->GetOrder(sel)->GetConditionVariable()) {
1324  case OCV_MAX_SPEED:
1325  value = ConvertDisplaySpeedToSpeed(value);
1326  break;
1327 
1328  case OCV_RELIABILITY:
1329  case OCV_LOAD_PERCENTAGE:
1330  value = Clamp(value, 0, 100);
1331  break;
1332 
1333  default:
1334  break;
1335  }
1336  Command<CMD_MODIFY_ORDER>::Post(STR_ERROR_CAN_T_MODIFY_THIS_ORDER, this->vehicle->tile, this->vehicle->index, sel, MOF_COND_VALUE, Clamp(value, 0, 2047));
1337  }
1338  }
1339 
1340  void OnDropdownSelect(int widget, int index) override
1341  {
1342  switch (widget) {
1343  case WID_O_NON_STOP:
1344  this->OrderClick_Nonstop(index);
1345  break;
1346 
1347  case WID_O_FULL_LOAD:
1348  this->OrderClick_FullLoad((OrderLoadFlags)index);
1349  break;
1350 
1351  case WID_O_UNLOAD:
1352  this->OrderClick_Unload((OrderUnloadFlags)index);
1353  break;
1354 
1355  case WID_O_GOTO:
1356  switch (index) {
1357  case 0: this->OrderClick_Goto(OPOS_GOTO); break;
1358  case 1: this->OrderClick_NearestDepot(); break;
1359  case 2: this->OrderClick_Goto(OPOS_CONDITIONAL); break;
1360  case 3: this->OrderClick_Goto(OPOS_SHARE); break;
1361  default: NOT_REACHED();
1362  }
1363  break;
1364 
1365  case WID_O_SERVICE:
1366  this->OrderClick_Service(index);
1367  break;
1368 
1369  case WID_O_REFIT_DROPDOWN:
1370  this->OrderClick_Refit(index, true);
1371  break;
1372 
1373  case WID_O_COND_VARIABLE:
1374  Command<CMD_MODIFY_ORDER>::Post(STR_ERROR_CAN_T_MODIFY_THIS_ORDER, this->vehicle->tile, this->vehicle->index, this->OrderGetSel(), MOF_COND_VARIABLE, index);
1375  break;
1376 
1377  case WID_O_COND_COMPARATOR:
1378  Command<CMD_MODIFY_ORDER>::Post(STR_ERROR_CAN_T_MODIFY_THIS_ORDER, this->vehicle->tile, this->vehicle->index, this->OrderGetSel(), MOF_COND_COMPARATOR, index);
1379  break;
1380  }
1381  }
1382 
1383  void OnDragDrop(Point pt, int widget) override
1384  {
1385  switch (widget) {
1386  case WID_O_ORDER_LIST: {
1387  VehicleOrderID from_order = this->OrderGetSel();
1388  VehicleOrderID to_order = this->GetOrderFromPt(pt.y);
1389 
1390  if (!(from_order == to_order || from_order == INVALID_VEH_ORDER_ID || from_order > this->vehicle->GetNumOrders() || to_order == INVALID_VEH_ORDER_ID || to_order > this->vehicle->GetNumOrders()) &&
1391  Command<CMD_MOVE_ORDER>::Post(STR_ERROR_CAN_T_MOVE_THIS_ORDER, this->vehicle->tile, this->vehicle->index, from_order, to_order)) {
1392  this->selected_order = -1;
1393  this->UpdateButtonState();
1394  }
1395  break;
1396  }
1397 
1398  case WID_O_DELETE:
1399  this->OrderClick_Delete();
1400  break;
1401 
1402  case WID_O_STOP_SHARING:
1403  this->OrderClick_StopSharing();
1404  break;
1405  }
1406 
1408 
1409  if (this->order_over != INVALID_VEH_ORDER_ID) {
1410  /* End of drag-and-drop, hide dragged order destination highlight. */
1411  this->order_over = INVALID_VEH_ORDER_ID;
1413  }
1414  }
1415 
1416  EventState OnHotkey(int hotkey) override
1417  {
1418  if (this->vehicle->owner != _local_company) return ES_NOT_HANDLED;
1419 
1420  switch (hotkey) {
1421  case OHK_SKIP: this->OrderClick_Skip(); break;
1422  case OHK_DELETE: this->OrderClick_Delete(); break;
1423  case OHK_GOTO: this->OrderClick_Goto(OPOS_GOTO); break;
1424  case OHK_NONSTOP: this->OrderClick_Nonstop(-1); break;
1425  case OHK_FULLLOAD: this->OrderClick_FullLoad(OLF_FULL_LOAD_ANY, true); break;
1426  case OHK_UNLOAD: this->OrderClick_Unload(OUFB_UNLOAD, true); break;
1427  case OHK_NEAREST_DEPOT: this->OrderClick_NearestDepot(); break;
1428  case OHK_ALWAYS_SERVICE: this->OrderClick_Service(-1); break;
1429  case OHK_TRANSFER: this->OrderClick_Unload(OUFB_TRANSFER, true); break;
1430  case OHK_NO_UNLOAD: this->OrderClick_Unload(OUFB_NO_UNLOAD, true); break;
1431  case OHK_NO_LOAD: this->OrderClick_FullLoad(OLFB_NO_LOAD, true); break;
1432  default: return ES_NOT_HANDLED;
1433  }
1434  return ES_HANDLED;
1435  }
1436 
1437  void OnPlaceObject(Point pt, TileIndex tile) override
1438  {
1439  if (this->goto_type == OPOS_GOTO) {
1440  const Order cmd = GetOrderCmdFromTile(this->vehicle, tile);
1441  if (cmd.IsType(OT_NOTHING)) return;
1442 
1443  if (Command<CMD_INSERT_ORDER>::Post(STR_ERROR_CAN_T_INSERT_NEW_ORDER, this->vehicle->tile, this->vehicle->index, this->OrderGetSel(), cmd)) {
1444  /* With quick goto the Go To button stays active */
1446  }
1447  }
1448  }
1449 
1450  bool OnVehicleSelect(const Vehicle *v) override
1451  {
1452  /* v is vehicle getting orders. Only copy/clone orders if vehicle doesn't have any orders yet.
1453  * We disallow copying orders of other vehicles if we already have at least one order entry
1454  * ourself as it easily copies orders of vehicles within a station when we mean the station.
1455  * Obviously if you press CTRL on a non-empty orders vehicle you know what you are doing
1456  * TODO: give a warning message */
1457  bool share_order = _ctrl_pressed || this->goto_type == OPOS_SHARE;
1458  if (this->vehicle->GetNumOrders() != 0 && !share_order) return false;
1459 
1460  if (Command<CMD_CLONE_ORDER>::Post(share_order ? STR_ERROR_CAN_T_SHARE_ORDER_LIST : STR_ERROR_CAN_T_COPY_ORDER_LIST,
1461  this->vehicle->tile, share_order ? CO_SHARE : CO_COPY, this->vehicle->index, v->index)) {
1462  this->selected_order = -1;
1464  }
1465  return true;
1466  }
1467 
1468  void OnPlaceObjectAbort() override
1469  {
1470  this->goto_type = OPOS_NONE;
1471  this->SetWidgetDirty(WID_O_GOTO);
1472 
1473  /* Remove drag highlighting if it exists. */
1474  if (this->order_over != INVALID_VEH_ORDER_ID) {
1475  this->order_over = INVALID_VEH_ORDER_ID;
1477  }
1478  }
1479 
1480  void OnMouseDrag(Point pt, int widget) override
1481  {
1482  if (this->selected_order != -1 && widget == WID_O_ORDER_LIST) {
1483  /* An order is dragged.. */
1484  VehicleOrderID from_order = this->OrderGetSel();
1485  VehicleOrderID to_order = this->GetOrderFromPt(pt.y);
1486  uint num_orders = this->vehicle->GetNumOrders();
1487 
1488  if (from_order != INVALID_VEH_ORDER_ID && from_order <= num_orders) {
1489  if (to_order != INVALID_VEH_ORDER_ID && to_order <= num_orders) { // ..over an existing order.
1490  this->order_over = to_order;
1491  this->SetWidgetDirty(widget);
1492  } else if (from_order != to_order && this->order_over != INVALID_VEH_ORDER_ID) { // ..outside of the order list.
1493  this->order_over = INVALID_VEH_ORDER_ID;
1494  this->SetWidgetDirty(widget);
1495  }
1496  }
1497  }
1498  }
1499 
1500  void OnResize() override
1501  {
1502  /* Update the scroll bar */
1503  this->vscroll->SetCapacityFromWidget(this, WID_O_ORDER_LIST);
1504  }
1505 
1506  static HotkeyList hotkeys;
1507 };
1508 
1509 static Hotkey order_hotkeys[] = {
1510  Hotkey('D', "skip", OHK_SKIP),
1511  Hotkey('F', "delete", OHK_DELETE),
1512  Hotkey('G', "goto", OHK_GOTO),
1513  Hotkey('H', "nonstop", OHK_NONSTOP),
1514  Hotkey('J', "fullload", OHK_FULLLOAD),
1515  Hotkey('K', "unload", OHK_UNLOAD),
1516  Hotkey((uint16)0, "nearest_depot", OHK_NEAREST_DEPOT),
1517  Hotkey((uint16)0, "always_service", OHK_ALWAYS_SERVICE),
1518  Hotkey((uint16)0, "transfer", OHK_TRANSFER),
1519  Hotkey((uint16)0, "no_unload", OHK_NO_UNLOAD),
1520  Hotkey((uint16)0, "no_load", OHK_NO_LOAD),
1521  HOTKEY_LIST_END
1522 };
1523 HotkeyList OrdersWindow::hotkeys("order", order_hotkeys);
1524 
1528  NWidget(WWT_CLOSEBOX, COLOUR_GREY),
1529  NWidget(WWT_CAPTION, COLOUR_GREY, WID_O_CAPTION), SetDataTip(STR_ORDERS_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
1530  NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_O_TIMETABLE_VIEW), SetMinimalSize(61, 14), SetDataTip(STR_ORDERS_TIMETABLE_VIEW, STR_ORDERS_TIMETABLE_VIEW_TOOLTIP),
1531  NWidget(WWT_SHADEBOX, COLOUR_GREY),
1532  NWidget(WWT_DEFSIZEBOX, COLOUR_GREY),
1533  NWidget(WWT_STICKYBOX, COLOUR_GREY),
1534  EndContainer(),
1536  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(),
1537  NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_O_SCROLLBAR),
1538  EndContainer(),
1539 
1540  /* First button row. */
1544  NWidget(NWID_BUTTON_DROPDOWN, COLOUR_GREY, WID_O_NON_STOP), SetMinimalSize(93, 12), SetFill(1, 0),
1545  SetDataTip(STR_ORDER_NON_STOP, STR_ORDER_TOOLTIP_NON_STOP), SetResize(1, 0),
1546  NWidget(NWID_SELECTION, INVALID_COLOUR, WID_O_SEL_TOP_LEFT),
1547  NWidget(NWID_BUTTON_DROPDOWN, COLOUR_GREY, WID_O_FULL_LOAD), SetMinimalSize(93, 12), SetFill(1, 0),
1548  SetDataTip(STR_ORDER_TOGGLE_FULL_LOAD, STR_ORDER_TOOLTIP_FULL_LOAD), SetResize(1, 0),
1549  NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_O_REFIT), SetMinimalSize(93, 12), SetFill(1, 0),
1550  SetDataTip(STR_ORDER_REFIT, STR_ORDER_REFIT_TOOLTIP), SetResize(1, 0),
1551  EndContainer(),
1552  NWidget(NWID_SELECTION, INVALID_COLOUR, WID_O_SEL_TOP_MIDDLE),
1553  NWidget(NWID_BUTTON_DROPDOWN, COLOUR_GREY, WID_O_UNLOAD), SetMinimalSize(93, 12), SetFill(1, 0),
1554  SetDataTip(STR_ORDER_TOGGLE_UNLOAD, STR_ORDER_TOOLTIP_UNLOAD), SetResize(1, 0),
1555  NWidget(NWID_BUTTON_DROPDOWN, COLOUR_GREY, WID_O_SERVICE), SetMinimalSize(93, 12), SetFill(1, 0),
1556  SetDataTip(STR_ORDER_SERVICE, STR_ORDER_SERVICE_TOOLTIP), SetResize(1, 0),
1557  EndContainer(),
1558  NWidget(NWID_SELECTION, INVALID_COLOUR, WID_O_SEL_TOP_RIGHT),
1559  NWidget(WWT_TEXTBTN, COLOUR_GREY, WID_O_EMPTY), SetMinimalSize(93, 12), SetFill(1, 0),
1560  SetDataTip(STR_ORDER_REFIT, STR_ORDER_REFIT_TOOLTIP), SetResize(1, 0),
1562  SetDataTip(STR_ORDER_REFIT_AUTO, STR_ORDER_REFIT_AUTO_TOOLTIP), SetResize(1, 0),
1563  EndContainer(),
1564  EndContainer(),
1566  NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_O_COND_VARIABLE), SetMinimalSize(124, 12), SetFill(1, 0),
1567  SetDataTip(STR_NULL, STR_ORDER_CONDITIONAL_VARIABLE_TOOLTIP), SetResize(1, 0),
1568  NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_O_COND_COMPARATOR), SetMinimalSize(124, 12), SetFill(1, 0),
1569  SetDataTip(STR_NULL, STR_ORDER_CONDITIONAL_COMPARATOR_TOOLTIP), SetResize(1, 0),
1570  NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_O_COND_VALUE), SetMinimalSize(124, 12), SetFill(1, 0),
1571  SetDataTip(STR_BLACK_COMMA, STR_ORDER_CONDITIONAL_VALUE_TOOLTIP), SetResize(1, 0),
1572  EndContainer(),
1573  EndContainer(),
1574  NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_O_SHARED_ORDER_LIST), SetMinimalSize(12, 12), SetDataTip(SPR_SHARED_ORDERS_ICON, STR_ORDERS_VEH_WITH_SHARED_ORDERS_LIST_TOOLTIP),
1575  EndContainer(),
1576 
1577  /* Second button row. */
1580  NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_O_SKIP), SetMinimalSize(124, 12), SetFill(1, 0),
1581  SetDataTip(STR_ORDERS_SKIP_BUTTON, STR_ORDERS_SKIP_TOOLTIP), SetResize(1, 0),
1583  NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_O_DELETE), SetMinimalSize(124, 12), SetFill(1, 0),
1584  SetDataTip(STR_ORDERS_DELETE_BUTTON, STR_ORDERS_DELETE_TOOLTIP), SetResize(1, 0),
1585  NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_O_STOP_SHARING), SetMinimalSize(124, 12), SetFill(1, 0),
1586  SetDataTip(STR_ORDERS_STOP_SHARING_BUTTON, STR_ORDERS_STOP_SHARING_TOOLTIP), SetResize(1, 0),
1587  EndContainer(),
1588  NWidget(NWID_BUTTON_DROPDOWN, COLOUR_GREY, WID_O_GOTO), SetMinimalSize(124, 12), SetFill(1, 0),
1589  SetDataTip(STR_ORDERS_GO_TO_BUTTON, STR_ORDERS_GO_TO_TOOLTIP), SetResize(1, 0),
1590  EndContainer(),
1591  NWidget(WWT_RESIZEBOX, COLOUR_GREY),
1592  EndContainer(),
1593 };
1594 
1595 static WindowDesc _orders_train_desc(
1596  WDP_AUTO, "view_vehicle_orders_train", 384, 100,
1600  &OrdersWindow::hotkeys
1601 );
1602 
1606  NWidget(WWT_CLOSEBOX, COLOUR_GREY),
1607  NWidget(WWT_CAPTION, COLOUR_GREY, WID_O_CAPTION), SetDataTip(STR_ORDERS_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
1608  NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_O_TIMETABLE_VIEW), SetMinimalSize(61, 14), SetDataTip(STR_ORDERS_TIMETABLE_VIEW, STR_ORDERS_TIMETABLE_VIEW_TOOLTIP),
1609  NWidget(WWT_SHADEBOX, COLOUR_GREY),
1610  NWidget(WWT_DEFSIZEBOX, COLOUR_GREY),
1611  NWidget(WWT_STICKYBOX, COLOUR_GREY),
1612  EndContainer(),
1614  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(),
1615  NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_O_SCROLLBAR),
1616  EndContainer(),
1617 
1618  /* First button row. */
1620  NWidget(NWID_SELECTION, INVALID_COLOUR, WID_O_SEL_TOP_ROW),
1621  /* Load + unload + refit buttons. */
1623  NWidget(NWID_BUTTON_DROPDOWN, COLOUR_GREY, WID_O_FULL_LOAD), SetMinimalSize(124, 12), SetFill(1, 0),
1624  SetDataTip(STR_ORDER_TOGGLE_FULL_LOAD, STR_ORDER_TOOLTIP_FULL_LOAD), SetResize(1, 0),
1625  NWidget(NWID_BUTTON_DROPDOWN, COLOUR_GREY, WID_O_UNLOAD), SetMinimalSize(124, 12), SetFill(1, 0),
1626  SetDataTip(STR_ORDER_TOGGLE_UNLOAD, STR_ORDER_TOOLTIP_UNLOAD), SetResize(1, 0),
1628  SetDataTip(STR_ORDER_REFIT_AUTO, STR_ORDER_REFIT_AUTO_TOOLTIP), SetResize(1, 0),
1629  EndContainer(),
1630  /* Refit + service buttons. */
1632  NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_O_REFIT), SetMinimalSize(186, 12), SetFill(1, 0),
1633  SetDataTip(STR_ORDER_REFIT, STR_ORDER_REFIT_TOOLTIP), SetResize(1, 0),
1634  NWidget(NWID_BUTTON_DROPDOWN, COLOUR_GREY, WID_O_SERVICE), SetMinimalSize(124, 12), SetFill(1, 0),
1635  SetDataTip(STR_ORDER_SERVICE, STR_ORDER_SERVICE_TOOLTIP), SetResize(1, 0),
1636  EndContainer(),
1637 
1638  /* Buttons for setting a condition. */
1640  NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_O_COND_VARIABLE), SetMinimalSize(124, 12), SetFill(1, 0),
1641  SetDataTip(STR_NULL, STR_ORDER_CONDITIONAL_VARIABLE_TOOLTIP), SetResize(1, 0),
1642  NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_O_COND_COMPARATOR), SetMinimalSize(124, 12), SetFill(1, 0),
1643  SetDataTip(STR_NULL, STR_ORDER_CONDITIONAL_COMPARATOR_TOOLTIP), SetResize(1, 0),
1644  NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_O_COND_VALUE), SetMinimalSize(124, 12), SetFill(1, 0),
1645  SetDataTip(STR_BLACK_COMMA, STR_ORDER_CONDITIONAL_VALUE_TOOLTIP), SetResize(1, 0),
1646  EndContainer(),
1647  EndContainer(),
1648 
1649  NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, WID_O_SHARED_ORDER_LIST), SetMinimalSize(12, 12), SetDataTip(SPR_SHARED_ORDERS_ICON, STR_ORDERS_VEH_WITH_SHARED_ORDERS_LIST_TOOLTIP),
1650  EndContainer(),
1651 
1652  /* Second button row. */
1654  NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_O_SKIP), SetMinimalSize(124, 12), SetFill(1, 0),
1655  SetDataTip(STR_ORDERS_SKIP_BUTTON, STR_ORDERS_SKIP_TOOLTIP), SetResize(1, 0),
1657  NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_O_DELETE), SetMinimalSize(124, 12), SetFill(1, 0),
1658  SetDataTip(STR_ORDERS_DELETE_BUTTON, STR_ORDERS_DELETE_TOOLTIP), SetResize(1, 0),
1659  NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_O_STOP_SHARING), SetMinimalSize(124, 12), SetFill(1, 0),
1660  SetDataTip(STR_ORDERS_STOP_SHARING_BUTTON, STR_ORDERS_STOP_SHARING_TOOLTIP), SetResize(1, 0),
1661  EndContainer(),
1662  NWidget(NWID_BUTTON_DROPDOWN, COLOUR_GREY, WID_O_GOTO), SetMinimalSize(124, 12), SetFill(1, 0),
1663  SetDataTip(STR_ORDERS_GO_TO_BUTTON, STR_ORDERS_GO_TO_TOOLTIP), SetResize(1, 0),
1664  NWidget(WWT_RESIZEBOX, COLOUR_GREY),
1665  EndContainer(),
1666 };
1667 
1668 static WindowDesc _orders_desc(
1669  WDP_AUTO, "view_vehicle_orders", 384, 100,
1673  &OrdersWindow::hotkeys
1674 );
1675 
1679  NWidget(WWT_CLOSEBOX, COLOUR_GREY),
1680  NWidget(WWT_CAPTION, COLOUR_GREY, WID_O_CAPTION), SetDataTip(STR_ORDERS_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
1681  NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_O_TIMETABLE_VIEW), SetMinimalSize(61, 14), SetDataTip(STR_ORDERS_TIMETABLE_VIEW, STR_ORDERS_TIMETABLE_VIEW_TOOLTIP),
1682  NWidget(WWT_SHADEBOX, COLOUR_GREY),
1683  NWidget(WWT_DEFSIZEBOX, COLOUR_GREY),
1684  NWidget(WWT_STICKYBOX, COLOUR_GREY),
1685  EndContainer(),
1687  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(),
1689  NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_O_SCROLLBAR),
1690  NWidget(WWT_RESIZEBOX, COLOUR_GREY),
1691  EndContainer(),
1692  EndContainer(),
1693 };
1694 
1695 static WindowDesc _other_orders_desc(
1696  WDP_AUTO, "view_vehicle_orders_competitor", 384, 86,
1700  &OrdersWindow::hotkeys
1701 );
1702 
1703 void ShowOrdersWindow(const Vehicle *v)
1704 {
1707  if (BringWindowToFrontById(WC_VEHICLE_ORDERS, v->index) != nullptr) return;
1708 
1709  /* Using a different WindowDescs for _local_company causes problems.
1710  * Due to this we have to close order windows in ChangeWindowOwner/CloseCompanyWindows,
1711  * because we cannot change switch the WindowDescs and keeping the old WindowDesc results
1712  * in crashed due to missing widges.
1713  * TODO Rewrite the order GUI to not use different WindowDescs.
1714  */
1715  if (v->owner != _local_company) {
1716  new OrdersWindow(&_other_orders_desc, v);
1717  } else {
1718  new OrdersWindow(v->IsGroundVehicle() ? &_orders_train_desc : &_orders_desc, v);
1719  }
1720 }
VEH_AIRCRAFT
@ VEH_AIRCRAFT
Aircraft vehicle type.
Definition: vehicle_type.h:27
ES_HANDLED
@ ES_HANDLED
The passed event is handled.
Definition: window_type.h:718
_nested_other_orders_widgets
static const NWidgetPart _nested_other_orders_widgets[]
Nested widget definition for competitor orders.
Definition: order_gui.cpp:1677
WID_O_COND_VALUE
@ WID_O_COND_VALUE
Choose condition value.
Definition: order_widget.h:32
DA_STOP
@ DA_STOP
Go to the depot and stop there.
Definition: order_type.h:163
ConvertSpeedToDisplaySpeed
uint ConvertSpeedToDisplaySpeed(uint speed)
Convert the given (internal) speed to the display speed.
Definition: strings.cpp:751
BaseStation::facilities
StationFacility facilities
The facilities that this station has.
Definition: base_station_base.h:63
BaseConsist::cur_implicit_order_index
VehicleOrderID cur_implicit_order_index
The index to the current implicit order.
Definition: base_consist.h:29
VehicleOrderID
byte VehicleOrderID
The index of an order within its current vehicle (not pool related)
Definition: order_type.h:15
Order::IsRefit
bool IsRefit() const
Is this order a refit order.
Definition: order_base.h:118
WD_FRAMERECT_TOP
@ WD_FRAMERECT_TOP
Offset at top to draw the frame rectangular area.
Definition: window_gui.h:64
Order::GetWaitTime
uint16 GetWaitTime() const
Get the time in ticks a vehicle will probably wait at the destination (timetabled or not).
Definition: order_base.h:193
OUFB_UNLOAD
@ OUFB_UNLOAD
Force unloading all cargo onto the platform, possibly not getting paid.
Definition: order_type.h:54
Order::IsType
bool IsType(OrderType type) const
Check whether this order is of the given type.
Definition: order_base.h:71
order_cmd.h
Pool::PoolItem<&_engine_pool >::Get
static Titem * Get(size_t index)
Returns Titem with given index.
Definition: pool_type.hpp:337
ScrollMainWindowToTile
bool ScrollMainWindowToTile(TileIndex tile, bool instant)
Scrolls the viewport of the main window to a given location.
Definition: viewport.cpp:2446
OrdersWindow::OrderClick_Delete
void OrderClick_Delete()
Handle the click on the delete button.
Definition: order_gui.cpp:694
SetScrollbar
static NWidgetPart SetScrollbar(int index)
Attach a scrollbar to a widget.
Definition: widget_type.h:1190
Vehicle::PreviousShared
Vehicle * PreviousShared() const
Get the previous vehicle of the shared vehicle chain.
Definition: vehicle_base.h:688
Order::SetLoadType
void SetLoadType(OrderLoadFlags load_type)
Set how the consist must be loaded.
Definition: order_base.h:158
HotkeyList
List of hotkeys for a window.
Definition: hotkeys.h:40
WID_O_SEL_TOP_LEFT
@ WID_O_SEL_TOP_LEFT
NWID_SELECTION widget for left part of the top row of the 'your train' order window.
Definition: order_widget.h:33
GB
static uint GB(const T x, const uint8 s, const uint8 n)
Fetch n bits from x, started at bit s.
Definition: bitmath_func.hpp:32
Dimension
Dimensions (a width and height) of a rectangle in 2D.
Definition: geometry_type.hpp:27
Scrollbar::GetCapacity
uint16 GetCapacity() const
Gets the number of visible elements of the scrollbar.
Definition: widget_type.h:664
command_func.h
OrdersWindow::OnInvalidateData
void OnInvalidateData(int data=0, bool gui_scope=true) override
Some data on this window has become invalid.
Definition: order_gui.cpp:828
IsRailWaypointTile
static bool IsRailWaypointTile(TileIndex t)
Is this tile a station tile and a rail waypoint?
Definition: station_map.h:123
WWT_STICKYBOX
@ WWT_STICKYBOX
Sticky box (at top-right of a window, after WWT_DEFSIZEBOX)
Definition: widget_type.h:64
ODTFB_SERVICE
@ ODTFB_SERVICE
This depot order is because of the servicing limit.
Definition: order_type.h:95
Window::GetScrollbar
const Scrollbar * GetScrollbar(uint widnum) const
Return the Scrollbar to a widget index.
Definition: window.cpp:320
WDF_CONSTRUCTION
@ WDF_CONSTRUCTION
This window is used for construction; close it whenever changing company.
Definition: window_gui.h:210
dropdown_func.h
SetTimetableParams
void SetTimetableParams(int param1, int param2, Ticks ticks)
Set the timetable parameters in the format as described by the setting.
Definition: timetable_gui.cpp:47
MOF_COND_VARIABLE
@ MOF_COND_VARIABLE
A conditional variable changes.
Definition: order_type.h:149
OrderLoadFlags
OrderLoadFlags
Flags related to the loading order.
Definition: order_type.h:62
WID_O_REFIT
@ WID_O_REFIT
Select refit.
Definition: order_widget.h:26
OrdersWindow::OrderClick_StopSharing
void OrderClick_StopSharing()
Handle the click on the 'stop sharing' button.
Definition: order_gui.cpp:711
OrdersWindow::order_over
VehicleOrderID order_over
Order over which another order is dragged, INVALID_VEH_ORDER_ID if none.
Definition: order_gui.cpp:524
OrdersWindow::OnDropdownSelect
void OnDropdownSelect(int widget, int index) override
A dropdown option associated to this window has been selected.
Definition: order_gui.cpp:1340
OUFB_TRANSFER
@ OUFB_TRANSFER
Transfer all cargo onto the platform.
Definition: order_type.h:55
OrdersWindow::DisplayPane
DisplayPane
Displayed planes of the NWID_SELECTION widgets.
Definition: order_gui.cpp:496
FACIL_TRUCK_STOP
@ FACIL_TRUCK_STOP
Station with truck stops.
Definition: station_type.h:54
WWT_CAPTION
@ WWT_CAPTION
Window caption (window title between closebox and stickybox)
Definition: widget_type.h:59
Scrollbar::ScrollTowards
void ScrollTowards(int position)
Scroll towards the given position; if the item is visible nothing happens, otherwise it will be shown...
Definition: widget_type.h:777
Station
Station data structure.
Definition: station_base.h:454
Order::GetDestination
DestinationID GetDestination() const
Gets the destination of this order.
Definition: order_base.h:104
OrdersWindow::OrderClick_Skip
void OrderClick_Skip()
Handle the click on the skip button.
Definition: order_gui.cpp:681
OrdersWindow::OnClick
void OnClick(Point pt, int widget, int click_count) override
A click with the left mouse button has been made on the window.
Definition: order_gui.cpp:1152
OrdersWindow::DP_ROW_LOAD
@ DP_ROW_LOAD
Display 'load' / 'unload' / 'refit' buttons in the top row of the ship/airplane order window.
Definition: order_gui.cpp:514
Order::GetConditionValue
uint16 GetConditionValue() const
Get the value to base the skip on.
Definition: order_base.h:155
DrawOrderString
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.
Definition: order_gui.cpp:216
OrdersWindow::DP_ROW_CONDITIONAL
@ DP_ROW_CONDITIONAL
Display the conditional order buttons in the top row of the ship/airplane order window.
Definition: order_gui.cpp:516
DropDownList
std::vector< std::unique_ptr< const DropDownListItem > > DropDownList
A drop down list is a collection of drop down list items.
Definition: dropdown_type.h:99
WWT_DEFSIZEBOX
@ WWT_DEFSIZEBOX
Default window size box (at top-right of a window, between WWT_SHADEBOX and WWT_STICKYBOX)
Definition: widget_type.h:63
Window::CreateNestedTree
void CreateNestedTree(bool fill_nested=true)
Perform the first part of the initialization of a nested widget tree.
Definition: window.cpp:1760
GUISettings::new_nonstop
bool new_nonstop
ttdpatch compatible nonstop handling
Definition: settings_type.h:112
OrdersWindow::OrderClick_NearestDepot
void OrderClick_NearestDepot()
Handle the click on the service in nearest depot button.
Definition: order_gui.cpp:617
Pool::PoolItem::index
Tindex index
Index of this pool item.
Definition: pool_type.hpp:235
CargoSpec::Get
static CargoSpec * Get(size_t index)
Retrieve cargo details for the given cargo ID.
Definition: cargotype.h:118
NWID_HORIZONTAL
@ NWID_HORIZONTAL
Horizontal container.
Definition: widget_type.h:73
maxdim
Dimension maxdim(const Dimension &d1, const Dimension &d2)
Compute bounding box of both dimensions.
Definition: geometry_func.cpp:22
Order::Free
void Free()
'Free' the order
Definition: order_cmd.cpp:63
MOF_STOP_LOCATION
@ MOF_STOP_LOCATION
Passes an OrderStopLocation.
Definition: order_type.h:145
HasBit
static bool HasBit(const T x, const uint8 y)
Checks if a bit in a value is set.
Definition: bitmath_func.hpp:103
INVALID_TILE
static constexpr TileIndex INVALID_TILE
The very nice invalid tile marker.
Definition: tile_type.h:108
_nested_orders_widgets
static const NWidgetPart _nested_orders_widgets[]
Nested widget definition for "your" orders (non-train).
Definition: order_gui.cpp:1604
IsDepotTypeTile
static bool IsDepotTypeTile(TileIndex tile, TransportType type)
Check if a tile is a depot and it is a depot of the given type.
Definition: depot_map.h:18
Order::GetUnloadType
OrderUnloadFlags GetUnloadType() const
How must the consist be unloaded?
Definition: order_base.h:139
TileIndex
The index/ID of a Tile.
Definition: tile_type.h:85
Scrollbar::SetCount
void SetCount(int num)
Sets the number of elements in the list.
Definition: widget_type.h:712
WID_O_REFIT_DROPDOWN
@ WID_O_REFIT_DROPDOWN
Open refit options.
Definition: order_widget.h:29
_ctrl_pressed
bool _ctrl_pressed
Is Ctrl pressed?
Definition: gfx.cpp:38
TextColour
TextColour
Colour of the strings, see _string_colourmap in table/string_colours.h or docs/ottd-colourtext-palett...
Definition: gfx_type.h:250
SetResize
static NWidgetPart SetResize(int16 dx, int16 dy)
Widget part function for setting the resize step.
Definition: widget_type.h:995
aircraft.h
OrderDepotTypeFlags
OrderDepotTypeFlags
Reasons that could cause us to go to the depot.
Definition: order_type.h:93
OrdersWindow::UpdateAutoRefitState
void UpdateAutoRefitState()
Cache auto-refittability of the vehicle chain.
Definition: order_gui.cpp:750
SpecializedStation< Station, false >::Get
static Station * Get(size_t index)
Gets station with given index.
Definition: base_station_base.h:219
WID_O_SCROLLBAR
@ WID_O_SCROLLBAR
Order list scrollbar.
Definition: order_widget.h:18
_settings_client
ClientSettings _settings_client
The current settings for this game.
Definition: settings.cpp:53
DrawString
int DrawString(int left, int right, int top, const char *str, TextColour colour, StringAlignment align, bool underline, FontSize fontsize)
Draw string, possibly truncated to make it fit in its allocated space.
Definition: gfx.cpp:645
WC_VEHICLE_TIMETABLE
@ WC_VEHICLE_TIMETABLE
Vehicle timetable; Window numbers:
Definition: window_type.h:216
MP_INDUSTRY
@ MP_INDUSTRY
Part of an industry.
Definition: tile_type.h:56
OrdersWindow::OnMouseDrag
void OnMouseDrag(Point pt, int widget) override
An 'object' is being dragged at the provided position, highlight the target if possible.
Definition: order_gui.cpp:1480
Window::owner
Owner owner
The owner of the content shown in this window. Company colour is acquired from this variable.
Definition: window_gui.h:319
SA_RIGHT
@ SA_RIGHT
Right align the text (must be a single bit).
Definition: gfx_type.h:330
VEH_ROAD
@ VEH_ROAD
Road vehicle type.
Definition: vehicle_type.h:25
Vehicle
Vehicle data structure.
Definition: vehicle_base.h:224
Industry
Defines the internal data of a functional industry.
Definition: industry.h:66
Vehicle::IsGroundVehicle
bool IsGroundVehicle() const
Check if the vehicle is a ground vehicle.
Definition: vehicle_base.h:488
Vehicle::owner
Owner owner
Which company owns the vehicle?
Definition: vehicle_base.h:288
_station_load_types
static const StringID _station_load_types[][5][5]
Order load types that could be given to station orders.
Definition: order_gui.cpp:41
Scrollbar
Scrollbar data structure.
Definition: widget_type.h:631
WD_FRAMETEXT_LEFT
@ WD_FRAMETEXT_LEFT
Left offset of the text of the frame.
Definition: window_gui.h:72
WID_O_NON_STOP
@ WID_O_NON_STOP
Goto non-stop to destination.
Definition: order_widget.h:22
BaseStation::owner
Owner owner
The owner of this station.
Definition: base_station_base.h:62
ShowTimetableWindow
void ShowTimetableWindow(const Vehicle *v)
Show the timetable for a given vehicle.
Definition: timetable_gui.cpp:704
MOF_NON_STOP
@ MOF_NON_STOP
Passes an OrderNonStopFlags.
Definition: order_type.h:144
_colour_gradient
byte _colour_gradient[COLOUR_END][8]
All 16 colour gradients 8 colours per gradient from darkest (0) to lightest (7)
Definition: gfx.cpp:55
Aircraft::GetRange
uint16 GetRange() const
Get the range of this aircraft.
Definition: aircraft.h:133
SetDParam
static void SetDParam(uint n, uint64 v)
Set a string parameter v at index n in the global string parameter array.
Definition: strings_func.h:196
OrderStopLocation
OrderStopLocation
Where to stop the trains.
Definition: order_type.h:83
NWidgetPart
Partial widget specification to allow NWidgets to be written nested.
Definition: widget_type.h:973
SetDataTip
static NWidgetPart SetDataTip(uint32 data, StringID tip)
Widget part function for setting the data and tooltip.
Definition: widget_type.h:1109
OrdersWindow::OrderClick_Goto
void OrderClick_Goto(OrderPlaceObjectState type)
Handle the click on the goto button.
Definition: order_gui.cpp:565
OrdersWindow::OnResize
void OnResize() override
Called after the window got resized.
Definition: order_gui.cpp:1500
Industry::neutral_station
Station * neutral_station
Associated neutral station.
Definition: industry.h:69
OrdersWindow::OrderClick_Nonstop
void OrderClick_Nonstop(int non_stop)
Handle the click on the nonstop button.
Definition: order_gui.cpp:659
WID_O_EMPTY
@ WID_O_EMPTY
Placeholder for refit dropdown when not owner.
Definition: order_widget.h:28
GetStringBoundingBox
Dimension GetStringBoundingBox(const char *str, FontSize start_fontsize)
Return the string dimension in pixels.
Definition: gfx.cpp:891
textbuf_gui.h
WID_O_COND_VARIABLE
@ WID_O_COND_VARIABLE
Choose condition variable.
Definition: order_widget.h:30
Order::MakeGoToDepot
void MakeGoToDepot(DepotID destination, OrderDepotTypeFlags order, OrderNonStopFlags non_stop_type=ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS, OrderDepotActionFlags action=ODATF_SERVICE_ONLY, CargoID cargo=CT_NO_REFIT)
Makes this order a Go To Depot order.
Definition: order_cmd.cpp:90
Order::GetType
OrderType GetType() const
Get the type of order of this order.
Definition: order_base.h:77
SpriteID
uint32 SpriteID
The number of a sprite, without mapping bits and colourtables.
Definition: gfx_type.h:17
Order::GetStopLocation
OrderStopLocation GetStopLocation() const
Where must we stop at the platform?
Definition: order_base.h:143
ONSF_NO_STOP_AT_ANY_STATION
@ ONSF_NO_STOP_AT_ANY_STATION
The vehicle will not stop at any stations it passes including the destination.
Definition: order_type.h:76
WindowDesc
High level window description.
Definition: window_gui.h:168
OrdersWindow::OnDragDrop
void OnDragDrop(Point pt, int widget) override
A dragged 'object' has been released.
Definition: order_gui.cpp:1383
GetOrderDistance
uint GetOrderDistance(const Order *prev, const Order *cur, const Vehicle *v, int conditional_depth)
Get the distance between two orders of a vehicle.
Definition: order_cmd.cpp:710
WID_O_SEL_TOP_MIDDLE
@ WID_O_SEL_TOP_MIDDLE
NWID_SELECTION widget for middle part of the top row of the 'your train' order window.
Definition: order_widget.h:34
WID_O_SKIP
@ WID_O_SKIP
Skip current order.
Definition: order_widget.h:19
company_cmd.h
ANIMCURSOR_PICKSTATION
static const CursorID ANIMCURSOR_PICKSTATION
716 - 718 - goto-order icon
Definition: sprites.h:1497
ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS
@ ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS
The vehicle will not stop at any stations it passes except the destination.
Definition: order_type.h:74
Order::GetNonStopType
OrderNonStopFlags GetNonStopType() const
At which stations must we stop?
Definition: order_base.h:141
NC_EQUALSIZE
@ NC_EQUALSIZE
Value of the NCB_EQUALSIZE flag.
Definition: widget_type.h:464
Vehicle::Orders
IterateWrapper Orders() const
Returns an iterable ensemble of orders of a vehicle.
Definition: vehicle_base.h:1042
FACIL_BUS_STOP
@ FACIL_BUS_STOP
Station with bus stops.
Definition: station_type.h:55
OLF_FULL_LOAD_ANY
@ OLF_FULL_LOAD_ANY
Full load a single cargo of the consist.
Definition: order_type.h:65
EF_AUTO_REFIT
@ EF_AUTO_REFIT
Automatic refitting is allowed.
Definition: engine_type.h:159
WDP_AUTO
@ WDP_AUTO
Find a place automatically.
Definition: window_gui.h:156
OrdersWindow::OnQueryTextFinished
void OnQueryTextFinished(char *str) override
The query window opened from this window has closed.
Definition: order_gui.cpp:1317
Order::GetRefitCargo
CargoID GetRefitCargo() const
Get the cargo to to refit to.
Definition: order_base.h:132
timetable.h
OrdersWindow::OnPlaceObject
void OnPlaceObject(Point pt, TileIndex tile) override
The user clicked some place on the map when a tile highlight mode has been set.
Definition: order_gui.cpp:1437
OrdersWindow::can_do_autorefit
bool can_do_autorefit
Vehicle chain can be auto-refitted.
Definition: order_gui.cpp:529
Window::resize
ResizeInfo resize
Resize information.
Definition: window_gui.h:317
ONSF_STOP_EVERYWHERE
@ ONSF_STOP_EVERYWHERE
The vehicle will stop at any station it passes and the destination.
Definition: order_type.h:73
WC_VEHICLE_VIEW
@ WC_VEHICLE_VIEW
Vehicle view; Window numbers:
Definition: window_type.h:331
tilehighlight_func.h
Window::EnableWidget
void EnableWidget(byte widget_index)
Sets a widget to Enabled.
Definition: window_gui.h:405
INVALID_VEH_ORDER_ID
static const VehicleOrderID INVALID_VEH_ORDER_ID
Invalid vehicle order index (sentinel)
Definition: order_type.h:21
Industry::GetByTile
static Industry * GetByTile(TileIndex tile)
Get the industry of the given tile.
Definition: industry.h:144
_order_conditional_variable
static const OrderConditionVariable _order_conditional_variable[]
Variables for conditional orders; this defines the order of appearance in the dropdown box.
Definition: order_gui.cpp:154
Vehicle::tile
TileIndex tile
Current tile index.
Definition: vehicle_base.h:245
MOF_COND_COMPARATOR
@ MOF_COND_COMPARATOR
A comparator changes.
Definition: order_type.h:150
Order::MakeGoToWaypoint
void MakeGoToWaypoint(StationID destination)
Makes this order a Go To Waypoint order.
Definition: order_cmd.cpp:104
Window::SetDirty
void SetDirty() const
Mark entire window as dirty (in need of re-paint)
Definition: window.cpp:993
TransportType
TransportType
Available types of transport.
Definition: transport_type.h:19
OrdersWindow::OrderClick_Service
void OrderClick_Service(int i)
Handle the click on the service.
Definition: order_gui.cpp:602
OUF_UNLOAD_IF_POSSIBLE
@ OUF_UNLOAD_IF_POSSIBLE
Unload all cargo that the station accepts.
Definition: order_type.h:53
ES_NOT_HANDLED
@ ES_NOT_HANDLED
The passed event is not handled.
Definition: window_type.h:719
WD_FRAMERECT_BOTTOM
@ WD_FRAMERECT_BOTTOM
Offset at bottom to draw the frame rectangular area.
Definition: window_gui.h:65
WWT_PUSHTXTBTN
@ WWT_PUSHTXTBTN
Normal push-button (no toggle button) with text caption.
Definition: widget_type.h:104
OrdersWindow::DP_MIDDLE_SERVICE
@ DP_MIDDLE_SERVICE
Display 'service' in the middle button of the top row of the train/rv order window.
Definition: order_gui.cpp:507
OrdersWindow::DrawWidget
void DrawWidget(const Rect &r, int widget) const override
Draw the contents of a nested widget.
Definition: order_gui.cpp:1073
NWidgetBase
Baseclass for nested widgets.
Definition: widget_type.h:126
OrdersWindow::UpdateWidgetSize
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
Update size and resize step of a widget in the window.
Definition: order_gui.cpp:791
ShowDropDownList
void ShowDropDownList(Window *w, DropDownList &&list, int selected, int button, uint width, bool auto_width, bool instant_close)
Show a drop down list.
Definition: dropdown.cpp:443
WID_O_SEL_TOP_RIGHT
@ WID_O_SEL_TOP_RIGHT
NWID_SELECTION widget for right part of the top row of the 'your train' order window.
Definition: order_widget.h:35
dropdown_type.h
ODATFB_NEAREST_DEPOT
@ ODATFB_NEAREST_DEPOT
Send the vehicle to the nearest depot.
Definition: order_type.h:105
OrdersWindow::OrderClick_FullLoad
void OrderClick_FullLoad(OrderLoadFlags load_type, bool toggle=false)
Handle the click on the full load button.
Definition: order_gui.cpp:584
OrdersWindow::DP_GROUNDVEHICLE_ROW_NORMAL
@ DP_GROUNDVEHICLE_ROW_NORMAL
Display the row for normal/depot orders in the top row of the train/rv order window.
Definition: order_gui.cpp:498
OrdersWindow::OrderGetSel
VehicleOrderID OrderGetSel() const
Return the memorised selected order.
Definition: order_gui.cpp:536
SA_FORCE
@ SA_FORCE
Force the alignment, i.e. don't swap for RTL languages.
Definition: gfx_type.h:340
WC_VEHICLE_DETAILS
@ WC_VEHICLE_DETAILS
Vehicle details; Window numbers:
Definition: window_type.h:192
OCC_IS_TRUE
@ OCC_IS_TRUE
Skip if the variable is true.
Definition: order_type.h:134
Window::SetWidgetDisabledState
void SetWidgetDisabledState(byte widget_index, bool disab_stat)
Sets the enabled/disabled status of a widget.
Definition: window_gui.h:386
_local_company
CompanyID _local_company
Company controlled by the human player at this client. Can also be COMPANY_SPECTATOR.
Definition: company_cmd.cpp:46
DropDownListStringItem
Common string list item.
Definition: dropdown_type.h:39
industry.h
safeguards.h
ShowQueryString
void ShowQueryString(StringID str, StringID caption, uint maxsize, Window *parent, CharSetFilter afilter, QueryStringFlags flags)
Show a query popup window with a textbox in it.
Definition: misc_gui.cpp:1125
DA_ALWAYS_GO
@ DA_ALWAYS_GO
Always go to the depot.
Definition: order_type.h:161
OrdersWindow::GetOrderFromPt
VehicleOrderID GetOrderFromPt(int y)
Calculate the selected order.
Definition: order_gui.cpp:550
IsTileOwner
static bool IsTileOwner(TileIndex tile, Owner owner)
Checks if a tile belongs to the given owner.
Definition: tile_map.h:214
StrEmpty
static bool StrEmpty(const char *s)
Check if a string buffer is empty.
Definition: string_func.h:67
ODTFB_PART_OF_ORDERS
@ ODTFB_PART_OF_ORDERS
This depot order is because of a regular order.
Definition: order_type.h:96
Order::IsGotoOrder
bool IsGotoOrder() const
Is this a 'goto' order with a real destination?
Definition: order_base.h:94
Order::GetConditionComparator
OrderConditionComparator GetConditionComparator() const
What is the comparator to use?
Definition: order_base.h:151
TC_NO_SHADE
@ TC_NO_SHADE
Do not add shading to this text colour.
Definition: gfx_type.h:274
_networking
bool _networking
are we in networking mode?
Definition: network.cpp:58
OrdersWindow::DP_MIDDLE_UNLOAD
@ DP_MIDDLE_UNLOAD
Display 'unload' in the middle button of the top row of the train/rv order window.
Definition: order_gui.cpp:506
HT_NONE
@ HT_NONE
default
Definition: tilehighlight_type.h:20
DrawSprite
void DrawSprite(SpriteID img, PaletteID pal, int x, int y, const SubSprite *sub, ZoomLevel zoom)
Draw a sprite, not in a viewport.
Definition: gfx.cpp:1044
OrdersWindow::OrderPlaceObjectState
OrderPlaceObjectState
Under what reason are we using the PlaceObject functionality?
Definition: order_gui.cpp:487
Point
Coordinates of a point in 2D.
Definition: geometry_type.hpp:21
ShowDropDownMenu
void ShowDropDownMenu(Window *w, const StringID *strings, int selected, int button, uint32 disabled_mask, uint32 hidden_mask, uint width)
Show a dropdown menu window near a widget of the parent window.
Definition: dropdown.cpp:480
FACIL_DOCK
@ FACIL_DOCK
Station with a dock.
Definition: station_type.h:57
Order::MakeGoToStation
void MakeGoToStation(StationID destination)
Makes this order a Go To Station order.
Definition: order_cmd.cpp:75
Order::GetConditionSkipToOrder
VehicleOrderID GetConditionSkipToOrder() const
Get the order to skip to.
Definition: order_base.h:153
WD_FRAMETEXT_RIGHT
@ WD_FRAMETEXT_RIGHT
Right offset of the text of the frame.
Definition: window_gui.h:73
stdafx.h
Window::window_number
WindowNumber window_number
Window number within the window class.
Definition: window_gui.h:307
OrdersWindow::DP_RIGHT_EMPTY
@ DP_RIGHT_EMPTY
Display an empty panel in the right button of the top row of the train/rv order window.
Definition: order_gui.cpp:510
GfxFillRect
void GfxFillRect(int left, int top, int right, int bottom, int colour, FillRectMode mode)
Applies a certain FillRectMode-operation to a rectangle [left, right] x [top, bottom] on the screen.
Definition: gfx.cpp:119
Vehicle::IsOrderListShared
bool IsOrderListShared() const
Check if we share our orders with another vehicle.
Definition: vehicle_base.h:700
OLF_LOAD_IF_POSSIBLE
@ OLF_LOAD_IF_POSSIBLE
Load as long as there is cargo that fits in the train.
Definition: order_type.h:63
NWidgetStacked::SetDisplayedPlane
void SetDisplayedPlane(int plane)
Select which plane to show (for NWID_SELECTION only).
Definition: widget.cpp:1195
Order::SetStopLocation
void SetStopLocation(OrderStopLocation stop_location)
Set where we must stop at the platform.
Definition: order_base.h:164
viewport_func.h
NWidgetStacked
Stacked widgets, widgets all occupying the same space in the window.
Definition: widget_type.h:438
IsTileType
static bool IsTileType(TileIndex tile, TileType type)
Checks if a tile is a given tiletype.
Definition: tile_map.h:150
ODATFB_HALT
@ ODATFB_HALT
Service the vehicle and then halt it.
Definition: order_type.h:104
NWID_VERTICAL
@ NWID_VERTICAL
Vertical container.
Definition: widget_type.h:75
WID_O_SEL_BOTTOM_MIDDLE
@ WID_O_SEL_BOTTOM_MIDDLE
NWID_SELECTION widget for the middle part of the bottom row of the 'your train' order window.
Definition: order_widget.h:38
HT_VEHICLE
@ HT_VEHICLE
vehicle is accepted as target as well (bitmask)
Definition: tilehighlight_type.h:27
OrdersWindow::DP_RIGHT_REFIT
@ DP_RIGHT_REFIT
Display 'refit' in the right button of the top row of the train/rv order window.
Definition: order_gui.cpp:511
HT_DRAG
@ HT_DRAG
dragging items in the depot windows
Definition: tilehighlight_type.h:24
VIWD_CONSIST_CHANGED
@ VIWD_CONSIST_CHANGED
Vehicle composition was changed.
Definition: vehicle_gui.h:34
GetSpriteSize
Dimension GetSpriteSize(SpriteID sprid, Point *offset, ZoomLevel zoom)
Get the size of a sprite.
Definition: gfx.cpp:979
WWT_CLOSEBOX
@ WWT_CLOSEBOX
Close box (at top-left of a window)
Definition: widget_type.h:67
WWT_RESIZEBOX
@ WWT_RESIZEBOX
Resize box (normally at bottom-right of a window)
Definition: widget_type.h:66
OrdersWindow::OnPlaceObjectAbort
void OnPlaceObjectAbort() override
The user cancelled a tile highlight mode that has been set.
Definition: order_gui.cpp:1468
BaseConsist::cur_real_order_index
VehicleOrderID cur_real_order_index
The index to the current real (non-implicit) order.
Definition: base_consist.h:28
ONSF_NO_STOP_AT_DESTINATION_STATION
@ ONSF_NO_STOP_AT_DESTINATION_STATION
The vehicle will stop at any station it passes except the destination.
Definition: order_type.h:75
WID_O_ORDER_LIST
@ WID_O_ORDER_LIST
Order list panel.
Definition: order_widget.h:17
string_func.h
Vehicle::FirstShared
Vehicle * FirstShared() const
Get the first vehicle of this vehicle chain.
Definition: vehicle_base.h:694
StringID
uint32 StringID
Numeric value that represents a string, independent of the selected language.
Definition: strings_type.h:16
WWT_PUSHIMGBTN
@ WWT_PUSHIMGBTN
Normal push-button (no toggle button) with image caption.
Definition: widget_type.h:105
OrderUnloadFlags
OrderUnloadFlags
Flags related to the unloading order.
Definition: order_type.h:52
IsBuoyTile
static bool IsBuoyTile(TileIndex t)
Is tile t a buoy tile?
Definition: station_map.h:316
WID_O_SHARED_ORDER_LIST
@ WID_O_SHARED_ORDER_LIST
Open list of shared vehicles.
Definition: order_widget.h:39
GUISettings::quick_goto
bool quick_goto
Allow quick access to 'goto button' in vehicle orders window.
Definition: settings_type.h:154
vehicle_func.h
EndContainer
static NWidgetPart EndContainer()
Widget part function for denoting the end of a container (horizontal, vertical, WWT_FRAME,...
Definition: widget_type.h:1094
OrdersWindow::OnHotkey
EventState OnHotkey(int hotkey) override
A hotkey has been pressed.
Definition: order_gui.cpp:1416
station_base.h
Clamp
static T Clamp(const T a, const T min, const T max)
Clamp a value between an interval.
Definition: math_func.hpp:77
strings_func.h
NWID_VSCROLLBAR
@ NWID_VSCROLLBAR
Vertical scrollbar.
Definition: widget_type.h:82
OCV_MAX_SPEED
@ OCV_MAX_SPEED
Skip based on the maximum speed.
Definition: order_type.h:115
OSL_PLATFORM_FAR_END
@ OSL_PLATFORM_FAR_END
Stop at the far end of the platform.
Definition: order_type.h:86
MOF_UNLOAD
@ MOF_UNLOAD
Passes an OrderUnloadType.
Definition: order_type.h:146
WID_O_COND_COMPARATOR
@ WID_O_COND_COMPARATOR
Choose condition type.
Definition: order_widget.h:31
NWidgetCore::SetDataTip
void SetDataTip(uint32 widget_data, StringID tool_tip)
Set data and tool tip of the nested widget.
Definition: widget.cpp:962
HideDropDownMenu
int HideDropDownMenu(Window *pw)
Delete the drop-down menu from window pw.
Definition: dropdown.cpp:498
OCV_RELIABILITY
@ OCV_RELIABILITY
Skip based on the reliability.
Definition: order_type.h:114
FACIL_TRAIN
@ FACIL_TRAIN
Station with train station.
Definition: station_type.h:53
Window::CloseChildWindows
void CloseChildWindows(WindowClass wc=WC_INVALID) const
Close all children a window might have in a head-recursive manner.
Definition: window.cpp:1080
Vehicle::GetFirstOrder
Order * GetFirstOrder() const
Get the first order of the vehicles order list.
Definition: vehicle_base.h:673
SpecializedVehicle< Aircraft, VEH_AIRCRAFT >::From
static Aircraft * From(Vehicle *v)
Converts a Vehicle to SpecializedVehicle with type checking.
Definition: vehicle_base.h:1170
FONT_HEIGHT_NORMAL
#define FONT_HEIGHT_NORMAL
Height of characters in the normal (FS_NORMAL) font.
Definition: gfx_func.h:168
VIWD_AUTOREPLACE
@ VIWD_AUTOREPLACE
Autoreplace replaced the vehicle.
Definition: vehicle_gui.h:35
GUISettings::stop_location
uint8 stop_location
what is the default stop location of trains?
Definition: settings_type.h:113
GetOrderCmdFromTile
static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
Get the order command a vehicle can do in a given tile.
Definition: order_gui.cpp:361
NWidget
static NWidgetPart NWidget(WidgetType tp, Colours col, int16 idx=-1)
Widget part function for starting a new 'real' widget.
Definition: widget_type.h:1209
WID_O_SEL_TOP_ROW_GROUNDVEHICLE
@ WID_O_SEL_TOP_ROW_GROUNDVEHICLE
NWID_SELECTION widget for the top row of the 'your train' order window.
Definition: order_widget.h:36
Scrollbar::IsVisible
bool IsVisible(uint16 item) const
Checks whether given current item is visible in the list.
Definition: widget_type.h:683
OCV_REMAINING_LIFETIME
@ OCV_REMAINING_LIFETIME
Skip based on the remaining lifetime.
Definition: order_type.h:119
geometry_func.hpp
OUFB_NO_UNLOAD
@ OUFB_NO_UNLOAD
Totally no unloading will be done.
Definition: order_type.h:56
order_widget.h
WID_O_TIMETABLE_VIEW
@ WID_O_TIMETABLE_VIEW
Toggle timetable view.
Definition: order_widget.h:16
SetDParamMaxValue
void SetDParamMaxValue(uint n, uint64 max_value, uint min_count, FontSize size)
Set DParam n to some number that is suitable for string size computations.
Definition: strings.cpp:94
WID_O_SERVICE
@ WID_O_SERVICE
Select service (at depot).
Definition: order_widget.h:27
SetMinimalSize
static NWidgetPart SetMinimalSize(int16 x, int16 y)
Widget part function for setting the minimal size.
Definition: widget_type.h:1012
WWT_PANEL
@ WWT_PANEL
Simple depressed panel.
Definition: widget_type.h:48
Vehicle::NextShared
Vehicle * NextShared() const
Get the next vehicle of the shared vehicle chain.
Definition: vehicle_base.h:682
OWNER_NONE
@ OWNER_NONE
The tile has no ownership.
Definition: company_type.h:25
MOF_COND_VALUE
@ MOF_COND_VALUE
The value to set the condition to.
Definition: order_type.h:151
OrdersWindow::DP_ROW_DEPOT
@ DP_ROW_DEPOT
Display 'refit' / 'service' buttons in the top row of the ship/airplane order window.
Definition: order_gui.cpp:515
NWidgetBase::resize_y
uint resize_y
Vertical resize step (0 means not resizable).
Definition: widget_type.h:179
CT_AUTO_REFIT
@ CT_AUTO_REFIT
Automatically choose cargo type when doing auto refitting.
Definition: cargo_type.h:67
MP_STATION
@ MP_STATION
A tile of a station.
Definition: tile_type.h:53
SpecializedStation< Station, false >::GetByTile
static Station * GetByTile(TileIndex tile)
Get the station belonging to a specific tile.
Definition: base_station_base.h:238
GetStationIndex
static StationID GetStationIndex(TileIndex t)
Get StationID from a tile.
Definition: station_map.h:28
waypoint_base.h
EventState
EventState
State of handling an event.
Definition: window_type.h:717
HT_RECT
@ HT_RECT
rectangle (stations, depots, ...)
Definition: tilehighlight_type.h:21
Scrollbar::GetPosition
uint16 GetPosition() const
Gets the position of the first visible element in the list.
Definition: widget_type.h:673
ConvertDisplaySpeedToSpeed
uint ConvertDisplaySpeedToSpeed(uint speed)
Convert the given display speed to the (internal) speed.
Definition: strings.cpp:764
OrdersWindow
Order window code for all vehicles.
Definition: order_gui.cpp:484
Order::SetDepotOrderType
void SetDepotOrderType(OrderDepotTypeFlags depot_order_type)
Set the cause to go to the depot.
Definition: order_base.h:166
CargoSpec::name
StringID name
Name of this type of cargo.
Definition: cargotype.h:71
Order::IsAutoRefit
bool IsAutoRefit() const
Is this order a auto-refit order.
Definition: order_base.h:125
Window::FinishInitNested
void FinishInitNested(WindowNumber window_number=0)
Perform the second part of the initialization of a nested widget tree.
Definition: window.cpp:1776
depot_map.h
OrdersWindow::OnPaint
void OnPaint() override
The window must be repainted.
Definition: order_gui.cpp:1063
Order::SetDepotActionType
void SetDepotActionType(OrderDepotActionFlags depot_service_type)
Set what we are going to do in the depot.
Definition: order_base.h:168
company_func.h
OCV_LOAD_PERCENTAGE
@ OCV_LOAD_PERCENTAGE
Skip based on the amount of load.
Definition: order_type.h:113
Window::top
int top
y position of top edge of the window
Definition: window_gui.h:313
Order::MakeConditional
void MakeConditional(VehicleOrderID order)
Makes this order an conditional order.
Definition: order_cmd.cpp:143
HighLightStyle
HighLightStyle
Highlighting draw styles.
Definition: tilehighlight_type.h:19
Order::GetDepotOrderType
OrderDepotTypeFlags GetDepotOrderType() const
What caused us going to the depot?
Definition: order_base.h:145
network.h
CommandHelper
Definition: command_func.h:94
Order::GetConditionVariable
OrderConditionVariable GetConditionVariable() const
What variable do we have to compare?
Definition: order_base.h:149
lengthof
#define lengthof(x)
Return the length of an fixed size array.
Definition: stdafx.h:386
Scrollbar::SetCapacityFromWidget
void SetCapacityFromWidget(Window *w, int widget, int padding=0)
Set capacity of visible elements from the size and resize properties of a widget.
Definition: widget.cpp:2212
WID_O_UNLOAD
@ WID_O_UNLOAD
Select unload.
Definition: order_widget.h:25
WID_O_CAPTION
@ WID_O_CAPTION
Caption of the window.
Definition: order_widget.h:15
CloseWindowById
void CloseWindowById(WindowClass cls, WindowNumber number, bool force)
Close a window by its class and window number (if it is open).
Definition: window.cpp:1176
NWidgetBase::pos_y
int pos_y
Vertical position of top-left corner of the widget in the window.
Definition: widget_type.h:190
OrderConditionVariable
OrderConditionVariable
Variables (of a vehicle) to 'cause' skipping on.
Definition: order_type.h:112
SetObjectToPlaceWnd
void SetObjectToPlaceWnd(CursorID icon, PaletteID pal, HighLightStyle mode, Window *w)
Change the cursor and mouse click/drag handling to a mode for performing special operations like tile...
Definition: viewport.cpp:3361
OrdersWindow::can_do_refit
bool can_do_refit
Vehicle chain can be refitted in depot.
Definition: order_gui.cpp:528
SetFill
static NWidgetPart SetFill(uint fill_x, uint fill_y)
Widget part function for setting filling.
Definition: widget_type.h:1078
Order::GetLocation
TileIndex GetLocation(const Vehicle *v, bool airport=false) const
Returns a tile somewhat representing the order destination (not suitable for pathfinding).
Definition: order_cmd.cpp:683
SPR_CURSOR_MOUSE
static const CursorID SPR_CURSOR_MOUSE
Cursor sprite numbers.
Definition: sprites.h:1376
WID_O_DELETE
@ WID_O_DELETE
Delete selected order.
Definition: order_widget.h:20
IsEngineRefittable
bool IsEngineRefittable(EngineID engine)
Check if an engine is refittable.
Definition: engine.cpp:1146
OrdersWindow::SetStringParameters
void SetStringParameters(int widget) const override
Initialize string parameters for a widget.
Definition: order_gui.cpp:1131
OCV_REQUIRES_SERVICE
@ OCV_REQUIRES_SERVICE
Skip when the vehicle requires service.
Definition: order_type.h:117
Window
Data structure for an opened window.
Definition: window_gui.h:279
VEH_TRAIN
@ VEH_TRAIN
Train vehicle type.
Definition: vehicle_type.h:24
WID_O_SEL_TOP_ROW
@ WID_O_SEL_TOP_ROW
NWID_SELECTION widget for the top row of the 'your non-trains' order window.
Definition: order_widget.h:37
Window::RaiseWidget
void RaiseWidget(byte widget_index)
Marks a widget as raised.
Definition: window_gui.h:477
WID_O_FULL_LOAD
@ WID_O_FULL_LOAD
Select full load.
Definition: order_widget.h:24
Vehicle::GetOrder
Order * GetOrder(int index) const
Returns order 'index' of a vehicle or nullptr when it doesn't exists.
Definition: vehicle_base.h:880
OrdersWindow::DP_LEFT_REFIT
@ DP_LEFT_REFIT
Display 'refit' in the left button of the top row of the train/rv order window.
Definition: order_gui.cpp:503
BaseVehicle::type
VehicleType type
Type of vehicle.
Definition: vehicle_type.h:52
OrdersWindow::OrderClick_Refit
void OrderClick_Refit(int i, bool auto_refit)
Handle the click on the refit button.
Definition: order_gui.cpp:735
Window::DrawWidgets
void DrawWidgets() const
Paint all widgets of a window.
Definition: widget.cpp:636
FACIL_AIRPORT
@ FACIL_AIRPORT
Station with an airport.
Definition: station_type.h:56
OrdersWindow::DP_LEFT_LOAD
@ DP_LEFT_LOAD
Display 'load' in the left button of the top row of the train/rv order window.
Definition: order_gui.cpp:502
VIWD_MODIFY_ORDERS
@ VIWD_MODIFY_ORDERS
Other order modifications.
Definition: vehicle_gui.h:33
CanVehicleUseStation
bool CanVehicleUseStation(EngineID engine_type, const Station *st)
Can this station be used by the given engine type?
Definition: vehicle.cpp:2861
NWID_SELECTION
@ NWID_SELECTION
Stacked widgets, only one visible at a time (eg in a panel with tabs).
Definition: widget_type.h:78
NWidgetCore
Base class for a 'real' widget.
Definition: widget_type.h:311
Window::SetWidgetDirty
void SetWidgetDirty(byte widget_index) const
Invalidate a widget, i.e.
Definition: window.cpp:608
VEH_SHIP
@ VEH_SHIP
Ship vehicle type.
Definition: vehicle_type.h:26
OCV_MAX_RELIABILITY
@ OCV_MAX_RELIABILITY
Skip based on the maximum reliability.
Definition: order_type.h:120
Rect
Specification of a rectangle with absolute coordinates of all edges.
Definition: geometry_type.hpp:47
OrdersWindow::DP_GROUNDVEHICLE_ROW_CONDITIONAL
@ DP_GROUNDVEHICLE_ROW_CONDITIONAL
Display the row for conditional orders in the top row of the train/rv order window.
Definition: order_gui.cpp:499
CursorVars::pos
Point pos
logical mouse position
Definition: gfx_type.h:117
BringWindowToFrontById
Window * BringWindowToFrontById(WindowClass cls, WindowNumber number)
Find a window and make it the relative top-window on the screen.
Definition: window.cpp:1259
MOF_LOAD
@ MOF_LOAD
Passes an OrderLoadType.
Definition: order_type.h:147
OCC_IS_FALSE
@ OCC_IS_FALSE
Skip if the variable is false.
Definition: order_type.h:135
Vehicle::GetNumOrders
VehicleOrderID GetNumOrders() const
Get the number of orders this vehicle has.
Definition: vehicle_base.h:706
VIWD_REMOVE_ALL_ORDERS
@ VIWD_REMOVE_ALL_ORDERS
Removed / replaced all orders (after deleting / sharing).
Definition: vehicle_gui.h:32
CT_NO_REFIT
@ CT_NO_REFIT
Do not refit cargo of a vehicle (used in vehicle orders and auto-replace/auto-new).
Definition: cargo_type.h:68
Order::GetDepotActionType
OrderDepotActionFlags GetDepotActionType() const
What are we going to do when in the depot.
Definition: order_base.h:147
ShowVehicleRefitWindow
void ShowVehicleRefitWindow(const Vehicle *v, VehicleOrderID order, Window *parent, bool auto_refit)
Show the refit window for a vehicle.
Definition: vehicle_gui.cpp:1122
OrdersWindow::OrderClick_Unload
void OrderClick_Unload(OrderUnloadFlags unload_type, bool toggle=false)
Handle the click on the unload button.
Definition: order_gui.cpp:634
Window::DisableWidget
void DisableWidget(byte widget_index)
Sets a widget to disabled.
Definition: window_gui.h:396
_nested_orders_train_widgets
static const NWidgetPart _nested_orders_train_widgets[]
Nested widget definition for "your" train orders.
Definition: order_gui.cpp:1526
Order::next
Order * next
Pointer to next order. If nullptr, end of list.
Definition: order_base.h:59
WID_O_STOP_SHARING
@ WID_O_STOP_SHARING
Stop sharing orders.
Definition: order_widget.h:21
MOF_DEPOT_ACTION
@ MOF_DEPOT_ACTION
Selects the OrderDepotAction.
Definition: order_type.h:148
Order
Definition: order_base.h:36
ResetObjectToPlace
void ResetObjectToPlace()
Reset the cursor and mouse mode handling back to default (normal cursor, only clicking in windows).
Definition: viewport.cpp:3424
Window::SetWidgetLoweredState
void SetWidgetLoweredState(byte widget_index, bool lowered_stat)
Sets the lowered/raised status of a widget.
Definition: window_gui.h:447
DA_SERVICE
@ DA_SERVICE
Service only if needed.
Definition: order_type.h:162
TD_RTL
@ TD_RTL
Text is written right-to-left by default.
Definition: strings_type.h:24
_current_text_dir
TextDirection _current_text_dir
Text direction of the currently selected language.
Definition: strings.cpp:48
CS_NUMERAL
@ CS_NUMERAL
Only numeric ones.
Definition: string_type.h:28
OCV_AGE
@ OCV_AGE
Skip based on the age.
Definition: order_type.h:116
Order::IsWaitTimetabled
bool IsWaitTimetabled() const
Does this order have an explicit wait time set?
Definition: order_base.h:184
Order::SetNonStopType
void SetNonStopType(OrderNonStopFlags non_stop_type)
Set whether we must stop at stations or not.
Definition: order_base.h:162
GetDepotIndex
static DepotID GetDepotIndex(TileIndex t)
Get the index of which depot is attached to the tile.
Definition: depot_map.h:52
OrderConditionComparator
OrderConditionComparator
Comparator for the skip reasoning.
Definition: order_type.h:127
WWT_TEXTBTN
@ WWT_TEXTBTN
(Toggle) Button with text
Definition: widget_type.h:53
INVALID_STRING_ID
static const StringID INVALID_STRING_ID
Constant representing an invalid string (16bit in case it is used in savegames)
Definition: strings_type.h:17
WC_VEHICLE_ORDERS
@ WC_VEHICLE_ORDERS
Vehicle orders; Window numbers:
Definition: window_type.h:204
ClientSettings::gui
GUISettings gui
settings related to the GUI
Definition: settings_type.h:598
NWID_BUTTON_DROPDOWN
@ NWID_BUTTON_DROPDOWN
Button with a drop-down.
Definition: widget_type.h:80
OCV_UNCONDITIONALLY
@ OCV_UNCONDITIONALLY
Always skip.
Definition: order_type.h:118
OLFB_NO_LOAD
@ OLFB_NO_LOAD
Do not load anything.
Definition: order_type.h:66
WWT_DROPDOWN
@ WWT_DROPDOWN
Drop down list.
Definition: widget_type.h:68
Order::GetLoadType
OrderLoadFlags GetLoadType() const
How must the consist be loaded?
Definition: order_base.h:137
engine_func.h
Hotkey
All data for a single hotkey.
Definition: hotkeys.h:22
hotkeys.h
roadveh.h
WID_O_GOTO
@ WID_O_GOTO
Goto destination.
Definition: order_widget.h:23
OrdersWindow::DP_BOTTOM_MIDDLE_STOP_SHARING
@ DP_BOTTOM_MIDDLE_STOP_SHARING
Display 'stop sharing' in the middle button of the bottom row of the vehicle order window.
Definition: order_gui.cpp:520
WWT_SHADEBOX
@ WWT_SHADEBOX
Shade box (at top-right of a window, between WWT_DEBUGBOX and WWT_DEFSIZEBOX)
Definition: widget_type.h:62
OrdersWindow::vehicle
const Vehicle * vehicle
Vehicle owning the orders being displayed and manipulated.
Definition: order_gui.cpp:526
OrdersWindow::DP_BOTTOM_MIDDLE_DELETE
@ DP_BOTTOM_MIDDLE_DELETE
Display 'delete' in the middle button of the bottom row of the vehicle order window.
Definition: order_gui.cpp:519