annotate src/order_gui.cpp @ 9476:bba7a506af6d draft

(svn r13411) -Codechange: remove the return value from the thread procs because it is never used.
author rubidium <rubidium@openttd.org>
date Sun, 08 Jun 2008 10:51:36 +0000
parents c93ddf309a10
children 963b653e2e61
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1 /* $Id$ */
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
2
9111
d48433370037 (svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description.
rubidium <rubidium@openttd.org>
parents: 8969
diff changeset
3 /** @file order_gui.cpp GUI related to orders. */
6351
1dcf39ea9b9b (svn r9390) -Documentation : correct Doxygen of comments and @file inclusion. This time, brought to you by the letter O
belugas <belugas@openttd.org>
parents: 6329
diff changeset
4
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
5 #include "stdafx.h"
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
6 #include "openttd.h"
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
7 #include "road_map.h"
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
8 #include "station_map.h"
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
9 #include "gui.h"
8107
f65cf2bc3255 (svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium <rubidium@openttd.org>
parents: 8106
diff changeset
10 #include "window_gui.h"
8785
2a8950a812dc (svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium <rubidium@openttd.org>
parents: 8784
diff changeset
11 #include "station_base.h"
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
12 #include "town.h"
8116
9cc845deddfe (svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium <rubidium@openttd.org>
parents: 8114
diff changeset
13 #include "command_func.h"
8224
c45446125bf0 (svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium <rubidium@openttd.org>
parents: 8211
diff changeset
14 #include "viewport_func.h"
c45446125bf0 (svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium <rubidium@openttd.org>
parents: 8211
diff changeset
15 #include "gfx_func.h"
8962
322e2779f67a (svn r12754) -Codechange: split depot.h into depot_map.h, depot_func.h and depot_base.h and remove quite a lot of unneeded (before this) includes of depot.h.
rubidium <rubidium@openttd.org>
parents: 8961
diff changeset
16 #include "depot_base.h"
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
17 #include "waypoint.h"
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
18 #include "train.h"
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
19 #include "water_map.h"
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
20 #include "vehicle_gui.h"
6980
cb6b3e277df0 (svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros <maedhros@openttd.org>
parents: 6923
diff changeset
21 #include "timetable.h"
6091
17ebeb5a2c37 (svn r8826) -Codechange: Replace _cargoc's separate arrays with a regular struct array (with accessor) and implement new initialization method using cargo labels.
peter1138 <peter1138@openttd.org>
parents: 5984
diff changeset
22 #include "cargotype.h"
8114
2d6af5d7a142 (svn r11675) -Codechange: split the string types from the string functions.
rubidium <rubidium@openttd.org>
parents: 8108
diff changeset
23 #include "strings_func.h"
8131
e300ac8001ae (svn r11692) -Codechange: move some functions from 'functions.h' to a more logical place and remove about 50% of the includes of 'functions.h'
rubidium <rubidium@openttd.org>
parents: 8121
diff changeset
24 #include "window_func.h"
8144
d18c8a0bb638 (svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium <rubidium@openttd.org>
parents: 8139
diff changeset
25 #include "vehicle_func.h"
8211
165064de4629 (svn r11774) -Change: do not include variables.h in a header when it is not needed.
rubidium <rubidium@openttd.org>
parents: 8144
diff changeset
26 #include "settings_type.h"
8254
7d580c9c41fb (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium <rubidium@openttd.org>
parents: 8237
diff changeset
27 #include "player_func.h"
8787
ff327b646d49 (svn r12495) -Codechange: reduce the dependency on newgrf_station.h (especially because newgrf_station.h includes a lot of stuff).
rubidium <rubidium@openttd.org>
parents: 8785
diff changeset
28 #include "newgrf_cargo.h"
8877
ee31d0131cd1 (svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium <rubidium@openttd.org>
parents: 8876
diff changeset
29 #include "widgets/dropdown_func.h"
8900
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
30 #include "textbuf_gui.h"
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
31 #include "string_func.h"
8962
322e2779f67a (svn r12754) -Codechange: split depot.h into depot_map.h, depot_func.h and depot_base.h and remove quite a lot of unneeded (before this) includes of depot.h.
rubidium <rubidium@openttd.org>
parents: 8961
diff changeset
32 #include "depot_base.h"
9127
428852b86d4d (svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents: 9116
diff changeset
33 #include "tilehighlight_func.h"
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
34
8264
2495310e220f (svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium <rubidium@openttd.org>
parents: 8254
diff changeset
35 #include "table/sprites.h"
2495310e220f (svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium <rubidium@openttd.org>
parents: 8254
diff changeset
36 #include "table/strings.h"
2495310e220f (svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium <rubidium@openttd.org>
parents: 8254
diff changeset
37
5828
9dc7252be011 (svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni <bjarni@openttd.org>
parents: 5745
diff changeset
38 enum OrderWindowWidgets {
9dc7252be011 (svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni <bjarni@openttd.org>
parents: 5745
diff changeset
39 ORDER_WIDGET_CLOSEBOX = 0,
9dc7252be011 (svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni <bjarni@openttd.org>
parents: 5745
diff changeset
40 ORDER_WIDGET_CAPTION,
6980
cb6b3e277df0 (svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros <maedhros@openttd.org>
parents: 6923
diff changeset
41 ORDER_WIDGET_TIMETABLE_VIEW,
5828
9dc7252be011 (svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni <bjarni@openttd.org>
parents: 5745
diff changeset
42 ORDER_WIDGET_ORDER_LIST,
9dc7252be011 (svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni <bjarni@openttd.org>
parents: 5745
diff changeset
43 ORDER_WIDGET_SCROLLBAR,
9dc7252be011 (svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni <bjarni@openttd.org>
parents: 5745
diff changeset
44 ORDER_WIDGET_SKIP,
9dc7252be011 (svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni <bjarni@openttd.org>
parents: 5745
diff changeset
45 ORDER_WIDGET_DELETE,
9dc7252be011 (svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni <bjarni@openttd.org>
parents: 5745
diff changeset
46 ORDER_WIDGET_NON_STOP,
9dc7252be011 (svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni <bjarni@openttd.org>
parents: 5745
diff changeset
47 ORDER_WIDGET_GOTO,
8894
2bcad37f1d27 (svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium <rubidium@openttd.org>
parents: 8893
diff changeset
48 ORDER_WIDGET_GOTO_DROPDOWN,
5828
9dc7252be011 (svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni <bjarni@openttd.org>
parents: 5745
diff changeset
49 ORDER_WIDGET_FULL_LOAD,
9dc7252be011 (svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni <bjarni@openttd.org>
parents: 5745
diff changeset
50 ORDER_WIDGET_UNLOAD,
5829
09c5ef7113db (svn r8395) -Cleanup: [orders window] moved the refit button two places up, so the order of the widget array fits the placement on the screen
bjarni <bjarni@openttd.org>
parents: 5828
diff changeset
51 ORDER_WIDGET_REFIT,
8874
a6a05ae5a7da (svn r12641) -Codechange: do not use the same button for two completely distinct tasks, just make an extra button for it and hide them when not needed.
rubidium <rubidium@openttd.org>
parents: 8873
diff changeset
52 ORDER_WIDGET_SERVICE,
8900
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
53 ORDER_WIDGET_COND_VARIABLE,
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
54 ORDER_WIDGET_COND_COMPARATOR,
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
55 ORDER_WIDGET_COND_VALUE,
8874
a6a05ae5a7da (svn r12641) -Codechange: do not use the same button for two completely distinct tasks, just make an extra button for it and hide them when not needed.
rubidium <rubidium@openttd.org>
parents: 8873
diff changeset
56 ORDER_WIDGET_RESIZE_BAR,
5828
9dc7252be011 (svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni <bjarni@openttd.org>
parents: 5745
diff changeset
57 ORDER_WIDGET_SHARED_ORDER_LIST,
9dc7252be011 (svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni <bjarni@openttd.org>
parents: 5745
diff changeset
58 ORDER_WIDGET_RESIZE,
9dc7252be011 (svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni <bjarni@openttd.org>
parents: 5745
diff changeset
59 };
9dc7252be011 (svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni <bjarni@openttd.org>
parents: 5745
diff changeset
60
8876
c583862e8a89 (svn r12643) -Codechange: be more explicit about the orders a vehicle has (non stop and full load are ambiguous and depend on some patch settings).
rubidium <rubidium@openttd.org>
parents: 8874
diff changeset
61 /** Order load types that could be given to station orders. */
c583862e8a89 (svn r12643) -Codechange: be more explicit about the orders a vehicle has (non stop and full load are ambiguous and depend on some patch settings).
rubidium <rubidium@openttd.org>
parents: 8874
diff changeset
62 static const StringID _station_load_types[][5] = {
8845
bb04cb5677d8 (svn r12595) -Codechange: hide Order's flags in the last few cases.
rubidium <rubidium@openttd.org>
parents: 8843
diff changeset
63 {
8876
c583862e8a89 (svn r12643) -Codechange: be more explicit about the orders a vehicle has (non stop and full load are ambiguous and depend on some patch settings).
rubidium <rubidium@openttd.org>
parents: 8874
diff changeset
64 STR_EMPTY,
8885
2d7e1a978a1a (svn r12652) -Codechange: rework the order GUI a little more to make it a little more clear that 'transfer' is just an unload type.
rubidium <rubidium@openttd.org>
parents: 8883
diff changeset
65 INVALID_STRING_ID,
8876
c583862e8a89 (svn r12643) -Codechange: be more explicit about the orders a vehicle has (non stop and full load are ambiguous and depend on some patch settings).
rubidium <rubidium@openttd.org>
parents: 8874
diff changeset
66 STR_ORDER_FULL_LOAD,
c583862e8a89 (svn r12643) -Codechange: be more explicit about the orders a vehicle has (non stop and full load are ambiguous and depend on some patch settings).
rubidium <rubidium@openttd.org>
parents: 8874
diff changeset
67 STR_ORDER_FULL_LOAD_ANY,
c583862e8a89 (svn r12643) -Codechange: be more explicit about the orders a vehicle has (non stop and full load are ambiguous and depend on some patch settings).
rubidium <rubidium@openttd.org>
parents: 8874
diff changeset
68 STR_ORDER_NO_LOAD,
8845
bb04cb5677d8 (svn r12595) -Codechange: hide Order's flags in the last few cases.
rubidium <rubidium@openttd.org>
parents: 8843
diff changeset
69 }, {
8885
2d7e1a978a1a (svn r12652) -Codechange: rework the order GUI a little more to make it a little more clear that 'transfer' is just an unload type.
rubidium <rubidium@openttd.org>
parents: 8883
diff changeset
70 STR_ORDER_UNLOAD,
2d7e1a978a1a (svn r12652) -Codechange: rework the order GUI a little more to make it a little more clear that 'transfer' is just an unload type.
rubidium <rubidium@openttd.org>
parents: 8883
diff changeset
71 INVALID_STRING_ID,
2d7e1a978a1a (svn r12652) -Codechange: rework the order GUI a little more to make it a little more clear that 'transfer' is just an unload type.
rubidium <rubidium@openttd.org>
parents: 8883
diff changeset
72 STR_ORDER_UNLOAD_FULL_LOAD,
2d7e1a978a1a (svn r12652) -Codechange: rework the order GUI a little more to make it a little more clear that 'transfer' is just an unload type.
rubidium <rubidium@openttd.org>
parents: 8883
diff changeset
73 STR_ORDER_UNLOAD_FULL_LOAD_ANY,
2d7e1a978a1a (svn r12652) -Codechange: rework the order GUI a little more to make it a little more clear that 'transfer' is just an unload type.
rubidium <rubidium@openttd.org>
parents: 8883
diff changeset
74 STR_ORDER_UNLOAD_NO_LOAD,
2d7e1a978a1a (svn r12652) -Codechange: rework the order GUI a little more to make it a little more clear that 'transfer' is just an unload type.
rubidium <rubidium@openttd.org>
parents: 8883
diff changeset
75 }, {
8876
c583862e8a89 (svn r12643) -Codechange: be more explicit about the orders a vehicle has (non stop and full load are ambiguous and depend on some patch settings).
rubidium <rubidium@openttd.org>
parents: 8874
diff changeset
76 STR_ORDER_TRANSFER,
8885
2d7e1a978a1a (svn r12652) -Codechange: rework the order GUI a little more to make it a little more clear that 'transfer' is just an unload type.
rubidium <rubidium@openttd.org>
parents: 8883
diff changeset
77 INVALID_STRING_ID,
8876
c583862e8a89 (svn r12643) -Codechange: be more explicit about the orders a vehicle has (non stop and full load are ambiguous and depend on some patch settings).
rubidium <rubidium@openttd.org>
parents: 8874
diff changeset
78 STR_ORDER_TRANSFER_FULL_LOAD,
c583862e8a89 (svn r12643) -Codechange: be more explicit about the orders a vehicle has (non stop and full load are ambiguous and depend on some patch settings).
rubidium <rubidium@openttd.org>
parents: 8874
diff changeset
79 STR_ORDER_TRANSFER_FULL_LOAD_ANY,
8885
2d7e1a978a1a (svn r12652) -Codechange: rework the order GUI a little more to make it a little more clear that 'transfer' is just an unload type.
rubidium <rubidium@openttd.org>
parents: 8883
diff changeset
80 STR_ORDER_TRANSFER_NO_LOAD,
2d7e1a978a1a (svn r12652) -Codechange: rework the order GUI a little more to make it a little more clear that 'transfer' is just an unload type.
rubidium <rubidium@openttd.org>
parents: 8883
diff changeset
81 }, {
2d7e1a978a1a (svn r12652) -Codechange: rework the order GUI a little more to make it a little more clear that 'transfer' is just an unload type.
rubidium <rubidium@openttd.org>
parents: 8883
diff changeset
82 /* Unload and transfer do not work together. */
2d7e1a978a1a (svn r12652) -Codechange: rework the order GUI a little more to make it a little more clear that 'transfer' is just an unload type.
rubidium <rubidium@openttd.org>
parents: 8883
diff changeset
83 INVALID_STRING_ID,
2d7e1a978a1a (svn r12652) -Codechange: rework the order GUI a little more to make it a little more clear that 'transfer' is just an unload type.
rubidium <rubidium@openttd.org>
parents: 8883
diff changeset
84 INVALID_STRING_ID,
2d7e1a978a1a (svn r12652) -Codechange: rework the order GUI a little more to make it a little more clear that 'transfer' is just an unload type.
rubidium <rubidium@openttd.org>
parents: 8883
diff changeset
85 INVALID_STRING_ID,
8876
c583862e8a89 (svn r12643) -Codechange: be more explicit about the orders a vehicle has (non stop and full load are ambiguous and depend on some patch settings).
rubidium <rubidium@openttd.org>
parents: 8874
diff changeset
86 INVALID_STRING_ID,
8883
23eea6824c4b (svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium <rubidium@openttd.org>
parents: 8882
diff changeset
87 }, {
23eea6824c4b (svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium <rubidium@openttd.org>
parents: 8882
diff changeset
88 STR_ORDER_NO_UNLOAD,
23eea6824c4b (svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium <rubidium@openttd.org>
parents: 8882
diff changeset
89 INVALID_STRING_ID,
23eea6824c4b (svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium <rubidium@openttd.org>
parents: 8882
diff changeset
90 STR_ORDER_NO_UNLOAD_FULL_LOAD,
23eea6824c4b (svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium <rubidium@openttd.org>
parents: 8882
diff changeset
91 STR_ORDER_NO_UNLOAD_FULL_LOAD_ANY,
23eea6824c4b (svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium <rubidium@openttd.org>
parents: 8882
diff changeset
92 INVALID_STRING_ID,
8845
bb04cb5677d8 (svn r12595) -Codechange: hide Order's flags in the last few cases.
rubidium <rubidium@openttd.org>
parents: 8843
diff changeset
93 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
94 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
95
8888
29207e0e22a0 (svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium <rubidium@openttd.org>
parents: 8887
diff changeset
96 static const StringID _order_non_stop_drowdown[] = {
29207e0e22a0 (svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium <rubidium@openttd.org>
parents: 8887
diff changeset
97 STR_ORDER_GO_TO,
29207e0e22a0 (svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium <rubidium@openttd.org>
parents: 8887
diff changeset
98 STR_ORDER_GO_NON_STOP_TO,
29207e0e22a0 (svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium <rubidium@openttd.org>
parents: 8887
diff changeset
99 STR_ORDER_GO_VIA,
29207e0e22a0 (svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium <rubidium@openttd.org>
parents: 8887
diff changeset
100 STR_ORDER_GO_NON_STOP_VIA,
29207e0e22a0 (svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium <rubidium@openttd.org>
parents: 8887
diff changeset
101 INVALID_STRING_ID
29207e0e22a0 (svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium <rubidium@openttd.org>
parents: 8887
diff changeset
102 };
29207e0e22a0 (svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium <rubidium@openttd.org>
parents: 8887
diff changeset
103
29207e0e22a0 (svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium <rubidium@openttd.org>
parents: 8887
diff changeset
104 static const StringID _order_full_load_drowdown[] = {
29207e0e22a0 (svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium <rubidium@openttd.org>
parents: 8887
diff changeset
105 STR_ORDER_DROP_LOAD_IF_POSSIBLE,
29207e0e22a0 (svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium <rubidium@openttd.org>
parents: 8887
diff changeset
106 STR_EMPTY,
29207e0e22a0 (svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium <rubidium@openttd.org>
parents: 8887
diff changeset
107 STR_ORDER_DROP_FULL_LOAD_ALL,
29207e0e22a0 (svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium <rubidium@openttd.org>
parents: 8887
diff changeset
108 STR_ORDER_DROP_FULL_LOAD_ANY,
29207e0e22a0 (svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium <rubidium@openttd.org>
parents: 8887
diff changeset
109 STR_ORDER_DROP_NO_LOADING,
29207e0e22a0 (svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium <rubidium@openttd.org>
parents: 8887
diff changeset
110 INVALID_STRING_ID
29207e0e22a0 (svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium <rubidium@openttd.org>
parents: 8887
diff changeset
111 };
29207e0e22a0 (svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium <rubidium@openttd.org>
parents: 8887
diff changeset
112
29207e0e22a0 (svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium <rubidium@openttd.org>
parents: 8887
diff changeset
113 static const StringID _order_unload_drowdown[] = {
29207e0e22a0 (svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium <rubidium@openttd.org>
parents: 8887
diff changeset
114 STR_ORDER_DROP_UNLOAD_IF_ACCEPTED,
29207e0e22a0 (svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium <rubidium@openttd.org>
parents: 8887
diff changeset
115 STR_ORDER_DROP_UNLOAD,
29207e0e22a0 (svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium <rubidium@openttd.org>
parents: 8887
diff changeset
116 STR_ORDER_DROP_TRANSFER,
29207e0e22a0 (svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium <rubidium@openttd.org>
parents: 8887
diff changeset
117 STR_EMPTY,
29207e0e22a0 (svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium <rubidium@openttd.org>
parents: 8887
diff changeset
118 STR_ORDER_DROP_NO_UNLOADING,
29207e0e22a0 (svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium <rubidium@openttd.org>
parents: 8887
diff changeset
119 INVALID_STRING_ID
29207e0e22a0 (svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium <rubidium@openttd.org>
parents: 8887
diff changeset
120 };
29207e0e22a0 (svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium <rubidium@openttd.org>
parents: 8887
diff changeset
121
8894
2bcad37f1d27 (svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium <rubidium@openttd.org>
parents: 8893
diff changeset
122 static const StringID _order_goto_dropdown[] = {
2bcad37f1d27 (svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium <rubidium@openttd.org>
parents: 8893
diff changeset
123 STR_ORDER_GO_TO,
2bcad37f1d27 (svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium <rubidium@openttd.org>
parents: 8893
diff changeset
124 STR_ORDER_GO_TO_NEAREST_DEPOT,
8900
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
125 STR_ORDER_CONDITIONAL,
8894
2bcad37f1d27 (svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium <rubidium@openttd.org>
parents: 8893
diff changeset
126 INVALID_STRING_ID
2bcad37f1d27 (svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium <rubidium@openttd.org>
parents: 8893
diff changeset
127 };
2bcad37f1d27 (svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium <rubidium@openttd.org>
parents: 8893
diff changeset
128
2bcad37f1d27 (svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium <rubidium@openttd.org>
parents: 8893
diff changeset
129 static const StringID _order_goto_dropdown_aircraft[] = {
2bcad37f1d27 (svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium <rubidium@openttd.org>
parents: 8893
diff changeset
130 STR_ORDER_GO_TO,
2bcad37f1d27 (svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium <rubidium@openttd.org>
parents: 8893
diff changeset
131 STR_ORDER_GO_TO_NEAREST_HANGAR,
8900
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
132 STR_ORDER_CONDITIONAL,
8894
2bcad37f1d27 (svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium <rubidium@openttd.org>
parents: 8893
diff changeset
133 INVALID_STRING_ID
2bcad37f1d27 (svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium <rubidium@openttd.org>
parents: 8893
diff changeset
134 };
2bcad37f1d27 (svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium <rubidium@openttd.org>
parents: 8893
diff changeset
135
8900
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
136 static const StringID _order_conditional_variable[] = {
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
137 STR_ORDER_CONDITIONAL_LOAD_PERCENTAGE,
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
138 STR_ORDER_CONDITIONAL_RELIABILITY,
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
139 STR_ORDER_CONDITIONAL_MAX_SPEED,
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
140 STR_ORDER_CONDITIONAL_AGE,
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
141 STR_ORDER_CONDITIONAL_REQUIRES_SERVICE,
8903
d15e125c0b6a (svn r12670) -Add: unconditional/always order 'jump/skip' variable.
rubidium <rubidium@openttd.org>
parents: 8900
diff changeset
142 STR_ORDER_CONDITIONAL_UNCONDITIONALLY,
8900
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
143 INVALID_STRING_ID,
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
144 };
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
145
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
146 static const StringID _order_conditional_condition[] = {
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
147 STR_ORDER_CONDITIONAL_COMPARATOR_EQUALS,
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
148 STR_ORDER_CONDITIONAL_COMPARATOR_NOT_EQUALS,
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
149 STR_ORDER_CONDITIONAL_COMPARATOR_LESS_THAN,
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
150 STR_ORDER_CONDITIONAL_COMPARATOR_LESS_EQUALS,
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
151 STR_ORDER_CONDITIONAL_COMPARATOR_MORE_THAN,
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
152 STR_ORDER_CONDITIONAL_COMPARATOR_MORE_EQUALS,
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
153 STR_ORDER_CONDITIONAL_COMPARATOR_IS_TRUE,
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
154 STR_ORDER_CONDITIONAL_COMPARATOR_IS_FALSE,
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
155 INVALID_STRING_ID,
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
156 };
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
157
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
158 extern uint ConvertSpeedToDisplaySpeed(uint speed);
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
159 extern uint ConvertDisplaySpeedToSpeed(uint speed);
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
160
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
161
8929
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
162 void DrawOrderString(const Vehicle *v, const Order *order, int order_index, int y, bool selected, bool timetable)
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
163 {
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
164 StringID str = (v->cur_order_index == order_index) ? STR_8805 : STR_8804;
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
165 SetDParam(6, STR_EMPTY);
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
166
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
167 switch (order->GetType()) {
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
168 case OT_DUMMY:
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
169 SetDParam(1, STR_INVALID_ORDER);
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
170 SetDParam(2, order->GetDestination());
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
171 break;
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
172
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
173 case OT_GOTO_STATION: {
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
174 OrderLoadFlags load = order->GetLoadType();
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
175 OrderUnloadFlags unload = order->GetUnloadType();
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
176
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
177 SetDParam(1, STR_GO_TO_STATION);
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
178 SetDParam(2, STR_ORDER_GO_TO + ((v->type == VEH_TRAIN || v->type == VEH_ROAD) ? order->GetNonStopType() : 0));
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
179 SetDParam(3, order->GetDestination());
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
180
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
181 if (timetable) {
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
182 SetDParam(4, STR_EMPTY);
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
183
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
184 if (order->wait_time > 0) {
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
185 SetDParam(6, STR_TIMETABLE_STAY_FOR);
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
186 SetTimetableParams(7, 8, order->wait_time);
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
187 }
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
188 } else {
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
189 SetDParam(4, (order->GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION) ? STR_EMPTY : _station_load_types[unload][load]);
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
190 }
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
191 } break;
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
192
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
193 case OT_GOTO_DEPOT:
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
194 if (v->type == VEH_AIRCRAFT) {
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
195 if (order->GetDepotActionType() & ODATFB_NEAREST_DEPOT) {
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
196 SetDParam(1, STR_GO_TO_NEAREST_DEPOT);
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
197 SetDParam(3, STR_ORDER_NEAREST_HANGAR);
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
198 } else {
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
199 SetDParam(1, STR_GO_TO_HANGAR);
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
200 SetDParam(3, order->GetDestination());
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
201 }
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
202 SetDParam(4, STR_EMPTY);
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
203 } else {
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
204 if (order->GetDepotActionType() & ODATFB_NEAREST_DEPOT) {
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
205 SetDParam(1, STR_GO_TO_NEAREST_DEPOT);
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
206 SetDParam(3, STR_ORDER_NEAREST_DEPOT);
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
207 } else {
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
208 SetDParam(1, STR_GO_TO_DEPOT);
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
209 SetDParam(3, GetDepot(order->GetDestination())->town_index);
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
210 }
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
211
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
212 switch (v->type) {
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
213 case VEH_TRAIN: SetDParam(4, STR_ORDER_TRAIN_DEPOT); break;
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
214 case VEH_ROAD: SetDParam(4, STR_ORDER_ROAD_DEPOT); break;
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
215 case VEH_SHIP: SetDParam(4, STR_ORDER_SHIP_DEPOT); break;
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
216 default: NOT_REACHED();
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
217 }
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
218 }
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
219
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
220 if (order->GetDepotOrderType() & ODTFB_SERVICE) {
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
221 SetDParam(2, (order->GetNonStopType() & ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS) ? STR_ORDER_SERVICE_NON_STOP_AT : STR_ORDER_SERVICE_AT);
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
222 } else {
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
223 SetDParam(2, (order->GetNonStopType() & ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS) ? STR_ORDER_GO_NON_STOP_TO : STR_ORDER_GO_TO);
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
224 }
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
225
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
226 if (!timetable && order->IsRefit()) {
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
227 SetDParam(6, STR_REFIT_ORDER);
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
228 SetDParam(7, GetCargo(order->GetRefitCargo())->name);
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
229 }
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
230 break;
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
231
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
232 case OT_GOTO_WAYPOINT:
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
233 SetDParam(1, (order->GetNonStopType() & ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS) ? STR_GO_NON_STOP_TO_WAYPOINT : STR_GO_TO_WAYPOINT);
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
234 SetDParam(2, order->GetDestination());
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
235 break;
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
236
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
237 case OT_CONDITIONAL:
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
238 SetDParam(2, order->GetConditionSkipToOrder() + 1);
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
239 if (order->GetConditionVariable() == OCV_UNCONDITIONALLY) {
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
240 SetDParam(1, STR_CONDITIONAL_UNCONDITIONAL);
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
241 } else {
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
242 OrderConditionComparator occ = order->GetConditionComparator();
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
243 SetDParam(1, (occ == OCC_IS_TRUE || occ == OCC_IS_FALSE) ? STR_CONDITIONAL_TRUE_FALSE : STR_CONDITIONAL_NUM);
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
244 SetDParam(3, STR_ORDER_CONDITIONAL_LOAD_PERCENTAGE + order->GetConditionVariable());
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
245 SetDParam(4, STR_ORDER_CONDITIONAL_COMPARATOR_EQUALS + occ);
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
246
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
247 uint value = order->GetConditionValue();
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
248 if (order->GetConditionVariable() == OCV_MAX_SPEED) value = ConvertSpeedToDisplaySpeed(value);
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
249 SetDParam(5, value);
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
250 }
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
251 break;
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
252
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
253 default: NOT_REACHED();
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
254 }
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
255
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
256 SetDParam(0, order_index + 1);
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
257 DrawString(2, y, str, selected ? TC_WHITE : TC_BLACK);
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
258 }
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
259
2b6a37a13245 (svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents: 8919
diff changeset
260
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
261 static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
262 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
263 Order order;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
264 order.next = NULL;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
265 order.index = 0;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
266
8871
24e1116b32f6 (svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents: 8869
diff changeset
267 /* check depot first */
9413
512ea64da840 (svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium <rubidium@openttd.org>
parents: 9354
diff changeset
268 if (_settings_game.order.gotodepot) {
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
269 switch (GetTileType(tile)) {
8871
24e1116b32f6 (svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents: 8869
diff changeset
270 case MP_RAILWAY:
24e1116b32f6 (svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents: 8869
diff changeset
271 if (v->type == VEH_TRAIN && IsTileOwner(tile, _local_player)) {
24e1116b32f6 (svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents: 8869
diff changeset
272 if (IsRailDepot(tile)) {
24e1116b32f6 (svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents: 8869
diff changeset
273 order.MakeGoToDepot(GetDepotByTile(tile)->index, ODTFB_PART_OF_ORDERS);
9413
512ea64da840 (svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium <rubidium@openttd.org>
parents: 9354
diff changeset
274 if (_settings_client.gui.new_nonstop) order.SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS);
8871
24e1116b32f6 (svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents: 8869
diff changeset
275 return order;
24e1116b32f6 (svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents: 8869
diff changeset
276 }
24e1116b32f6 (svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents: 8869
diff changeset
277 }
24e1116b32f6 (svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents: 8869
diff changeset
278 break;
24e1116b32f6 (svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents: 8869
diff changeset
279
24e1116b32f6 (svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents: 8869
diff changeset
280 case MP_ROAD:
24e1116b32f6 (svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents: 8869
diff changeset
281 if (IsRoadDepot(tile) && v->type == VEH_ROAD && IsTileOwner(tile, _local_player)) {
8853
02787d6f3834 (svn r12615) -Codechange: rename some enums related to depot orders to make it more clear that they are no loading/unloading flags. Also add more type strictness.
rubidium <rubidium@openttd.org>
parents: 8848
diff changeset
282 order.MakeGoToDepot(GetDepotByTile(tile)->index, ODTFB_PART_OF_ORDERS);
9413
512ea64da840 (svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium <rubidium@openttd.org>
parents: 9354
diff changeset
283 if (_settings_client.gui.new_nonstop) order.SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
284 return order;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
285 }
8871
24e1116b32f6 (svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents: 8869
diff changeset
286 break;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
287
8871
24e1116b32f6 (svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents: 8869
diff changeset
288 case MP_STATION:
24e1116b32f6 (svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents: 8869
diff changeset
289 if (v->type != VEH_AIRCRAFT) break;
24e1116b32f6 (svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents: 8869
diff changeset
290 if (IsHangar(tile) && IsTileOwner(tile, _local_player)) {
24e1116b32f6 (svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents: 8869
diff changeset
291 order.MakeGoToDepot(GetStationIndex(tile), ODTFB_PART_OF_ORDERS);
24e1116b32f6 (svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents: 8869
diff changeset
292 return order;
24e1116b32f6 (svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents: 8869
diff changeset
293 }
24e1116b32f6 (svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents: 8869
diff changeset
294 break;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
295
8871
24e1116b32f6 (svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents: 8869
diff changeset
296 case MP_WATER:
24e1116b32f6 (svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents: 8869
diff changeset
297 if (v->type != VEH_SHIP) break;
8961
b33bcd7fa037 (svn r12753) -Codechange: do not use IsDepotTypeTile() where simpler function can be used
smatz <smatz@openttd.org>
parents: 8954
diff changeset
298 if (IsShipDepot(tile) && IsTileOwner(tile, _local_player)) {
8871
24e1116b32f6 (svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents: 8869
diff changeset
299 TileIndex tile2 = GetOtherShipDepotTile(tile);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
300
8871
24e1116b32f6 (svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents: 8869
diff changeset
301 order.MakeGoToDepot(GetDepotByTile(tile < tile2 ? tile : tile2)->index, ODTFB_PART_OF_ORDERS);
24e1116b32f6 (svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents: 8869
diff changeset
302 return order;
24e1116b32f6 (svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents: 8869
diff changeset
303 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
304
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
305 default:
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
306 break;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
307 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
308 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
309
8871
24e1116b32f6 (svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents: 8869
diff changeset
310 /* check waypoint */
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
311 if (IsTileType(tile, MP_RAILWAY) &&
6259
4a39d6291d58 (svn r9068) -Codechange: capitalize the VEH_Train etc. enums to match the coding style (and rest of the code).
rubidium <rubidium@openttd.org>
parents: 6091
diff changeset
312 v->type == VEH_TRAIN &&
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
313 IsTileOwner(tile, _local_player) &&
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
314 IsRailWaypoint(tile)) {
8836
890a77315801 (svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents: 8787
diff changeset
315 order.MakeGoToWaypoint(GetWaypointByTile(tile)->index);
9413
512ea64da840 (svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium <rubidium@openttd.org>
parents: 9354
diff changeset
316 if (_settings_client.gui.new_nonstop) order.SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
317 return order;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
318 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
319
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
320 if (IsTileType(tile, MP_STATION)) {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
321 StationID st_index = GetStationIndex(tile);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
322 const Station *st = GetStation(st_index);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
323
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
324 if (st->owner == _current_player || st->owner == OWNER_NONE) {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
325 byte facil;
8871
24e1116b32f6 (svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents: 8869
diff changeset
326 (facil = FACIL_DOCK, v->type == VEH_SHIP) ||
24e1116b32f6 (svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents: 8869
diff changeset
327 (facil = FACIL_TRAIN, v->type == VEH_TRAIN) ||
24e1116b32f6 (svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents: 8869
diff changeset
328 (facil = FACIL_AIRPORT, v->type == VEH_AIRCRAFT) ||
24e1116b32f6 (svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents: 8869
diff changeset
329 (facil = FACIL_BUS_STOP, v->type == VEH_ROAD && IsCargoInClass(v->cargo_type, CC_PASSENGERS)) ||
24e1116b32f6 (svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents: 8869
diff changeset
330 (facil = FACIL_TRUCK_STOP, 1);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
331 if (st->facilities & facil) {
8836
890a77315801 (svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents: 8787
diff changeset
332 order.MakeGoToStation(st_index);
9413
512ea64da840 (svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium <rubidium@openttd.org>
parents: 9354
diff changeset
333 if (_settings_client.gui.new_nonstop && (v->type == VEH_TRAIN || v->type == VEH_ROAD)) order.SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
334 return order;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
335 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
336 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
337 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
338
8871
24e1116b32f6 (svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents: 8869
diff changeset
339 /* not found */
6263
715aa17970ab (svn r9072) -Codechange: [Orders] added methods to orders to free them and check if they are in use
bjarni <bjarni@openttd.org>
parents: 6259
diff changeset
340 order.Free();
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
341 return order;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
342 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
343
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
344 struct OrdersWindow : public Window {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
345 private:
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
346 /** Under what reason are we using the PlaceObject functionality? */
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
347 enum OrderPlaceObjectState {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
348 OPOS_GOTO,
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
349 OPOS_CONDITIONAL,
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
350 };
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
351
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
352 int selected_order;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
353 OrderPlaceObjectState goto_type;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
354 const Vehicle *vehicle;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
355
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
356 /**
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
357 * Return the memorised selected order.
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
358 * @return the memorised order if it is a vaild one
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
359 * else return the number of orders
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
360 */
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
361 int OrderGetSel()
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
362 {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
363 int num = this->selected_order;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
364 return (num >= 0 && num < vehicle->num_orders) ? num : vehicle->num_orders;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
365 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
366
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
367 /**
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
368 * Calculate the selected order.
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
369 * The calculation is based on the relative (to the window) y click position and
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
370 * the position of the scrollbar.
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
371 *
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
372 * @param y Y-value of the click relative to the window origin
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
373 * @param v current vehicle
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
374 * @return the new selected order if the order is valid else return that
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
375 * an invalid one has been selected.
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
376 */
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
377 int GetOrderFromPt(int y)
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
378 {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
379 /*
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
380 * Calculation description:
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
381 * 15 = 14 (w->widget[ORDER_WIDGET_ORDER_LIST].top) + 1 (frame-line)
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
382 * 10 = order text hight
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
383 */
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
384 int sel = (y - this->widget[ORDER_WIDGET_ORDER_LIST].top - 1) / 10;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
385
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
386 if ((uint)sel >= this->vscroll.cap) return INVALID_ORDER;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
387
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
388 sel += this->vscroll.pos;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
389
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
390 return (sel <= vehicle->num_orders && sel >= 0) ? sel : INVALID_ORDER;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
391 }
8869
202439e9e12c (svn r12636) -Codechange: make CmdModifyOrder a little more flexible and remove 'hack' that used the full load flag to set the service if needed flag.
rubidium <rubidium@openttd.org>
parents: 8861
diff changeset
392
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
393 bool HandleOrderVehClick(const Vehicle *u)
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
394 {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
395 if (u->type != this->vehicle->type) return false;
8874
a6a05ae5a7da (svn r12641) -Codechange: do not use the same button for two completely distinct tasks, just make an extra button for it and hide them when not needed.
rubidium <rubidium@openttd.org>
parents: 8873
diff changeset
396
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
397 if (!u->IsPrimaryVehicle()) {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
398 u = u->First();
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
399 if (!u->IsPrimaryVehicle()) return false;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
400 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
401
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
402 /* v is vehicle getting orders. Only copy/clone orders if vehicle doesn't have any orders yet
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
403 * obviously if you press CTRL on a non-empty orders vehicle you know what you are doing */
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
404 if (this->vehicle->num_orders != 0 && _ctrl_pressed == 0) return false;
8894
2bcad37f1d27 (svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium <rubidium@openttd.org>
parents: 8893
diff changeset
405
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
406 if (DoCommandP(this->vehicle->tile, this->vehicle->index | (u->index << 16), _ctrl_pressed ? CO_SHARE : CO_COPY, NULL,
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
407 _ctrl_pressed ? CMD_CLONE_ORDER | CMD_MSG(STR_CANT_SHARE_ORDER_LIST) : CMD_CLONE_ORDER | CMD_MSG(STR_CANT_COPY_ORDER_LIST))) {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
408 this->selected_order = -1;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
409 ResetObjectToPlace();
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
410 }
8894
2bcad37f1d27 (svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium <rubidium@openttd.org>
parents: 8893
diff changeset
411
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
412 return true;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
413 }
8900
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
414
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
415 /**
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
416 * Handle the click on the goto button.
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
417 *
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
418 * @param w current window
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
419 */
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
420 static void OrderClick_Goto(OrdersWindow *w, int i)
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
421 {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
422 w->InvalidateWidget(ORDER_WIDGET_GOTO);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
423 w->ToggleWidgetLoweredState(ORDER_WIDGET_GOTO);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
424 if (w->IsWidgetLowered(ORDER_WIDGET_GOTO)) {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
425 _place_clicked_vehicle = NULL;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
426 SetObjectToPlaceWnd(ANIMCURSOR_PICKSTATION, PAL_NONE, VHM_RECT, w);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
427 w->goto_type = OPOS_GOTO;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
428 } else {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
429 ResetObjectToPlace();
8883
23eea6824c4b (svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium <rubidium@openttd.org>
parents: 8882
diff changeset
430 }
23eea6824c4b (svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium <rubidium@openttd.org>
parents: 8882
diff changeset
431 }
23eea6824c4b (svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium <rubidium@openttd.org>
parents: 8882
diff changeset
432
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
433 /**
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
434 * Handle the click on the full load button.
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
435 *
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
436 * @param w current window
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
437 * @param load_type the way to load.
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
438 */
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
439 static void OrderClick_FullLoad(OrdersWindow *w, int load_type)
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
440 {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
441 VehicleOrderID sel_ord = w->OrderGetSel();
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
442 const Order *order = GetVehicleOrder(w->vehicle, sel_ord);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
443
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
444 if (order == NULL || order->GetLoadType() == load_type) return;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
445
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
446 if (load_type < 0) {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
447 switch (order->GetLoadType()) {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
448 case OLF_LOAD_IF_POSSIBLE: load_type = OLFB_FULL_LOAD; break;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
449 case OLFB_FULL_LOAD: load_type = OLF_FULL_LOAD_ANY; break;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
450 case OLF_FULL_LOAD_ANY: load_type = OLFB_NO_LOAD; break;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
451 case OLFB_NO_LOAD: load_type = OLF_LOAD_IF_POSSIBLE; break;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
452 default: NOT_REACHED();
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
453 }
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
454 }
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
455 DoCommandP(w->vehicle->tile, w->vehicle->index + (sel_ord << 16), MOF_LOAD | (load_type << 4), NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER));
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
456 }
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
457
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
458 /**
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
459 * Handle the click on the service.
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
460 *
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
461 * @param w current window
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
462 */
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
463 static void OrderClick_Service(OrdersWindow *w, int i)
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
464 {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
465 DoCommandP(w->vehicle->tile, w->vehicle->index + (w->OrderGetSel() << 16), MOF_DEPOT_ACTION, NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER));
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
466 }
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
467
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
468 /**
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
469 * Handle the click on the service in nearest depot button.
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
470 *
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
471 * @param w current window
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
472 */
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
473 static void OrderClick_NearestDepot(OrdersWindow *w, int i)
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
474 {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
475 Order order;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
476 order.next = NULL;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
477 order.index = 0;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
478 order.MakeGoToDepot(0, ODTFB_PART_OF_ORDERS);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
479 order.SetDepotActionType(ODATFB_NEAREST_DEPOT);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
480
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
481 DoCommandP(w->vehicle->tile, w->vehicle->index + (w->OrderGetSel() << 16), order.Pack(), NULL, CMD_INSERT_ORDER | CMD_MSG(STR_8833_CAN_T_INSERT_NEW_ORDER));
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
482 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
483
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
484 /**
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
485 * Handle the click on the conditional order button.
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
486 *
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
487 * @param w current window
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
488 */
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
489 static void OrderClick_Conditional(OrdersWindow *w, int i)
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
490 {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
491 w->InvalidateWidget(ORDER_WIDGET_GOTO);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
492 w->LowerWidget(ORDER_WIDGET_GOTO);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
493 SetObjectToPlaceWnd(ANIMCURSOR_PICKSTATION, PAL_NONE, VHM_RECT, w);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
494 w->goto_type = OPOS_CONDITIONAL;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
495 }
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
496
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
497 /**
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
498 * Handle the click on the unload button.
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
499 *
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
500 * @param w current window
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
501 */
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
502 static void OrderClick_Unload(OrdersWindow *w, int unload_type)
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
503 {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
504 VehicleOrderID sel_ord = w->OrderGetSel();
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
505 const Order *order = GetVehicleOrder(w->vehicle, sel_ord);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
506
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
507 if (order == NULL || order->GetUnloadType() == unload_type) return;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
508
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
509 if (unload_type < 0) {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
510 switch (order->GetUnloadType()) {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
511 case OUF_UNLOAD_IF_POSSIBLE: unload_type = OUFB_UNLOAD; break;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
512 case OUFB_UNLOAD: unload_type = OUFB_TRANSFER; break;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
513 case OUFB_TRANSFER: unload_type = OUFB_NO_UNLOAD; break;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
514 case OUFB_NO_UNLOAD: unload_type = OUF_UNLOAD_IF_POSSIBLE; break;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
515 default: NOT_REACHED();
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
516 }
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
517 }
8869
202439e9e12c (svn r12636) -Codechange: make CmdModifyOrder a little more flexible and remove 'hack' that used the full load flag to set the service if needed flag.
rubidium <rubidium@openttd.org>
parents: 8861
diff changeset
518
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
519 DoCommandP(w->vehicle->tile, w->vehicle->index + (sel_ord << 16), MOF_UNLOAD | (unload_type << 4), NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER));
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
520 }
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
521
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
522 /**
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
523 * Handle the click on the nonstop button.
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
524 *
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
525 * @param w current window
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
526 * @param non_stop what non-stop type to use; -1 to use the 'next' one.
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
527 */
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
528 static void OrderClick_Nonstop(OrdersWindow *w, int non_stop)
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
529 {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
530 VehicleOrderID sel_ord = w->OrderGetSel();
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
531 const Order *order = GetVehicleOrder(w->vehicle, sel_ord);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
532
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
533 if (order == NULL || order->GetNonStopType() == non_stop) return;
8877
ee31d0131cd1 (svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium <rubidium@openttd.org>
parents: 8876
diff changeset
534
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
535 /* Keypress if negative, so 'toggle' to the next */
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
536 if (non_stop < 0) {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
537 non_stop = (order->GetNonStopType() + 1) % ONSF_END;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
538 }
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
539
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
540 DoCommandP(w->vehicle->tile, w->vehicle->index + (sel_ord << 16), MOF_NON_STOP | non_stop << 4, NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER));
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
541 }
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
542
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
543 /**
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
544 * Handle the click on the transfer button.
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
545 *
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
546 * @param w current window
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
547 */
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
548 static void OrderClick_Transfer(OrdersWindow *w, int i)
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
549 {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
550 VehicleOrderID sel_ord = w->OrderGetSel();
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
551 const Order *order = GetVehicleOrder(w->vehicle, sel_ord);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
552
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
553 if (order == NULL) return;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
554
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
555 DoCommandP(w->vehicle->tile, w->vehicle->index + (sel_ord << 16), MOF_UNLOAD | ((order->GetUnloadType() & ~OUFB_NO_UNLOAD) ^ OUFB_TRANSFER) << 4, NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER));
8877
ee31d0131cd1 (svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium <rubidium@openttd.org>
parents: 8876
diff changeset
556 }
ee31d0131cd1 (svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium <rubidium@openttd.org>
parents: 8876
diff changeset
557
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
558 /**
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
559 * Handle the click on the skip button.
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
560 * If ctrl is pressed skip to selected order.
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
561 * Else skip to current order + 1
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
562 *
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
563 * @param w current window
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
564 */
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
565 static void OrderClick_Skip(OrdersWindow *w, int i)
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
566 {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
567 /* Don't skip when there's nothing to skip */
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
568 if (_ctrl_pressed && w->vehicle->cur_order_index == w->OrderGetSel()) return;
9475
c93ddf309a10 (svn r13409) -Fix: division by zero when one would press 'd' (skip order) when there's no order.
rubidium <rubidium@openttd.org>
parents: 9413
diff changeset
569 if (w->vehicle->num_orders == 0) return;
8869
202439e9e12c (svn r12636) -Codechange: make CmdModifyOrder a little more flexible and remove 'hack' that used the full load flag to set the service if needed flag.
rubidium <rubidium@openttd.org>
parents: 8861
diff changeset
570
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
571 DoCommandP(w->vehicle->tile, w->vehicle->index, _ctrl_pressed ? w->OrderGetSel() : ((w->vehicle->cur_order_index + 1) % w->vehicle->num_orders),
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
572 NULL, CMD_SKIP_TO_ORDER | CMD_MSG(_ctrl_pressed ? STR_CAN_T_SKIP_TO_ORDER : STR_CAN_T_SKIP_ORDER));
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
573 }
6794
4449e9d10ee5 (svn r10033) -Feature [FS#760]: skip to the selected order in the order list when clicking on the "skip" button while pressing CTRL.
rubidium <rubidium@openttd.org>
parents: 6773
diff changeset
574
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
575 /**
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
576 * Handle the click on the unload button.
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
577 *
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
578 * @param w current window
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
579 */
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
580 static void OrderClick_Delete(OrdersWindow *w, int i)
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
581 {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
582 DoCommandP(w->vehicle->tile, w->vehicle->index, w->OrderGetSel(), NULL, CMD_DELETE_ORDER | CMD_MSG(STR_8834_CAN_T_DELETE_THIS_ORDER));
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
583 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
584
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
585 /**
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
586 * Handle the click on the refit button.
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
587 * If ctrl is pressed cancel refitting.
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
588 * Else show the refit window.
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
589 *
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
590 * @param w current window
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
591 */
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
592 static void OrderClick_Refit(OrdersWindow *w, int i)
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
593 {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
594 if (_ctrl_pressed) {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
595 /* Cancel refitting */
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
596 DoCommandP(w->vehicle->tile, w->vehicle->index, (w->OrderGetSel() << 16) | (CT_NO_REFIT << 8) | CT_NO_REFIT, NULL, CMD_ORDER_REFIT);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
597 } else {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
598 ShowVehicleRefitWindow(w->vehicle, w->OrderGetSel());
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
599 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
600 }
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
601 typedef void Handler(OrdersWindow*, int);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
602 struct KeyToEvent {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
603 uint16 keycode;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
604 Handler *proc;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
605 };
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
606
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
607 public:
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
608 OrdersWindow(const WindowDesc *desc, const Vehicle *v) : Window(desc, v->index)
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
609 {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
610 this->caption_color = v->owner;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
611 this->vscroll.cap = 6;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
612 this->resize.step_height = 10;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
613 this->selected_order = -1;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
614 this->vehicle = v;
9413
512ea64da840 (svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium <rubidium@openttd.org>
parents: 9354
diff changeset
615 if (_settings_game.order.timetabling) {
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
616 this->widget[ORDER_WIDGET_CAPTION].right -= 61;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
617 } else {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
618 this->HideWidget(ORDER_WIDGET_TIMETABLE_VIEW);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
619 }
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
620 this->FindWindowPlacementAndResize(desc);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
621 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
622
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
623 virtual void OnPaint()
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
624 {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
625 bool shared_orders = this->vehicle->IsOrderListShared();
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
626
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
627 SetVScrollCount(this, this->vehicle->num_orders + 1);
8871
24e1116b32f6 (svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents: 8869
diff changeset
628
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
629 int sel = OrderGetSel();
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
630 const Order *order = GetVehicleOrder(this->vehicle, sel);
6980
cb6b3e277df0 (svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros <maedhros@openttd.org>
parents: 6923
diff changeset
631
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
632 if (this->vehicle->owner == _local_player) {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
633 /* Set the strings for the dropdown boxes. */
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
634 this->widget[ORDER_WIDGET_NON_STOP].data = _order_non_stop_drowdown[order == NULL ? 0 : order->GetNonStopType()];
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
635 this->widget[ORDER_WIDGET_FULL_LOAD].data = _order_full_load_drowdown[order == NULL ? 0 : order->GetLoadType()];
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
636 this->widget[ORDER_WIDGET_UNLOAD].data = _order_unload_drowdown[order == NULL ? 0 : order->GetUnloadType()];
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
637 this->widget[ORDER_WIDGET_COND_VARIABLE].data = _order_conditional_variable[order == NULL ? 0 : order->GetConditionVariable()];
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
638 this->widget[ORDER_WIDGET_COND_COMPARATOR].data = _order_conditional_condition[order == NULL ? 0 : order->GetConditionComparator()];
6980
cb6b3e277df0 (svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros <maedhros@openttd.org>
parents: 6923
diff changeset
639
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
640 /* skip */
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
641 this->SetWidgetDisabledState(ORDER_WIDGET_SKIP, this->vehicle->num_orders <= 1);
8871
24e1116b32f6 (svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents: 8869
diff changeset
642
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
643 /* delete */
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
644 this->SetWidgetDisabledState(ORDER_WIDGET_DELETE,
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
645 (uint)this->vehicle->num_orders + ((shared_orders || this->vehicle->num_orders != 0) ? 1 : 0) <= (uint)this->selected_order);
8871
24e1116b32f6 (svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents: 8869
diff changeset
646
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
647 /* non-stop only for trains */
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
648 this->SetWidgetDisabledState(ORDER_WIDGET_NON_STOP, (this->vehicle->type != VEH_TRAIN && this->vehicle->type != VEH_ROAD) || order == NULL);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
649 this->SetWidgetDisabledState(ORDER_WIDGET_FULL_LOAD, order == NULL || (order->GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION) != 0); // full load
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
650 this->SetWidgetDisabledState(ORDER_WIDGET_UNLOAD, order == NULL || (order->GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION) != 0); // unload
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
651 /* Disable list of vehicles with the same shared orders if there is no list */
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
652 this->SetWidgetDisabledState(ORDER_WIDGET_SHARED_ORDER_LIST, !shared_orders || this->vehicle->orders == NULL);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
653 this->SetWidgetDisabledState(ORDER_WIDGET_REFIT, order == NULL); // Refit
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
654 this->SetWidgetDisabledState(ORDER_WIDGET_SERVICE, order == NULL); // Refit
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
655 this->HideWidget(ORDER_WIDGET_REFIT); // Refit
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
656 this->HideWidget(ORDER_WIDGET_SERVICE); // Service
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
657
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
658 this->HideWidget(ORDER_WIDGET_COND_VARIABLE);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
659 this->HideWidget(ORDER_WIDGET_COND_COMPARATOR);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
660 this->HideWidget(ORDER_WIDGET_COND_VALUE);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
661 }
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
662
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
663 this->ShowWidget(ORDER_WIDGET_NON_STOP);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
664 this->ShowWidget(ORDER_WIDGET_UNLOAD);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
665 this->ShowWidget(ORDER_WIDGET_FULL_LOAD);
8871
24e1116b32f6 (svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents: 8869
diff changeset
666
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
667 if (order != NULL) {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
668 switch (order->GetType()) {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
669 case OT_GOTO_STATION:
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
670 if (!GetStation(order->GetDestination())->IsBuoy()) break;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
671 /* Fall-through */
8871
24e1116b32f6 (svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents: 8869
diff changeset
672
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
673 case OT_GOTO_WAYPOINT:
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
674 this->DisableWidget(ORDER_WIDGET_FULL_LOAD);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
675 this->DisableWidget(ORDER_WIDGET_UNLOAD);
8871
24e1116b32f6 (svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents: 8869
diff changeset
676 break;
6832
17319fb8c1c3 (svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium <rubidium@openttd.org>
parents: 6807
diff changeset
677
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
678 case OT_GOTO_DEPOT:
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
679 this->DisableWidget(ORDER_WIDGET_FULL_LOAD);
8871
24e1116b32f6 (svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents: 8869
diff changeset
680
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
681 /* Remove unload and replace it with refit */
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
682 this->HideWidget(ORDER_WIDGET_UNLOAD);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
683 this->ShowWidget(ORDER_WIDGET_REFIT);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
684 this->HideWidget(ORDER_WIDGET_FULL_LOAD);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
685 this->ShowWidget(ORDER_WIDGET_SERVICE);
8871
24e1116b32f6 (svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents: 8869
diff changeset
686 break;
24e1116b32f6 (svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents: 8869
diff changeset
687
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
688 case OT_CONDITIONAL: {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
689 this->HideWidget(ORDER_WIDGET_NON_STOP);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
690 this->HideWidget(ORDER_WIDGET_UNLOAD);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
691 this->HideWidget(ORDER_WIDGET_FULL_LOAD);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
692 this->ShowWidget(ORDER_WIDGET_COND_VARIABLE);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
693 this->ShowWidget(ORDER_WIDGET_COND_COMPARATOR);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
694 this->ShowWidget(ORDER_WIDGET_COND_VALUE);
8871
24e1116b32f6 (svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents: 8869
diff changeset
695
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
696 OrderConditionVariable ocv = order->GetConditionVariable();
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
697 this->SetWidgetDisabledState(ORDER_WIDGET_COND_COMPARATOR, ocv == OCV_UNCONDITIONALLY);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
698 this->SetWidgetDisabledState(ORDER_WIDGET_COND_VALUE, ocv == OCV_REQUIRES_SERVICE || ocv == OCV_UNCONDITIONALLY);
8871
24e1116b32f6 (svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents: 8869
diff changeset
699
8900
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
700 uint value = order->GetConditionValue();
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
701 if (order->GetConditionVariable() == OCV_MAX_SPEED) value = ConvertSpeedToDisplaySpeed(value);
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
702 SetDParam(1, value);
8900
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
703 } break;
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
704
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
705 default: // every other orders
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
706 this->DisableWidget(ORDER_WIDGET_NON_STOP);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
707 this->DisableWidget(ORDER_WIDGET_FULL_LOAD);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
708 this->DisableWidget(ORDER_WIDGET_UNLOAD);
8871
24e1116b32f6 (svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents: 8869
diff changeset
709 }
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
710 }
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
711
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
712 SetDParam(0, this->vehicle->index);
9273
72a6d2e60834 (svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium <rubidium@openttd.org>
parents: 9258
diff changeset
713 this->DrawWidgets();
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
714
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
715 int y = 15;
6832
17319fb8c1c3 (svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium <rubidium@openttd.org>
parents: 6807
diff changeset
716
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
717 int i = this->vscroll.pos;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
718 order = GetVehicleOrder(this->vehicle, i);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
719 StringID str;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
720 while (order != NULL) {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
721 /* Don't draw anything if it extends past the end of the window. */
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
722 if (i - this->vscroll.pos >= this->vscroll.cap) break;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
723
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
724 DrawOrderString(this->vehicle, order, i, y, i == this->selected_order, false);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
725 y += 10;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
726
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
727 i++;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
728 order = order->next;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
729 }
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
730
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
731 if (i - this->vscroll.pos < this->vscroll.cap) {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
732 str = shared_orders ? STR_END_OF_SHARED_ORDERS : STR_882A_END_OF_ORDERS;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
733 DrawString(2, y, str, (i == this->selected_order) ? TC_WHITE : TC_BLACK);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
734 }
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
735 }
8900
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
736
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
737 virtual void OnClick(Point pt, int widget)
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
738 {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
739 if (this->widget[widget].type != WWT_DROPDOWN) HideDropDownMenu(this);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
740 switch (widget) {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
741 case ORDER_WIDGET_ORDER_LIST: {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
742 ResetObjectToPlace();
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
743
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
744 int sel = this->GetOrderFromPt(pt.y);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
745
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
746 if (sel == INVALID_ORDER) {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
747 /* This was a click on an empty part of the orders window, so
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
748 * deselect the currently selected order. */
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
749 this->selected_order = -1;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
750 this->SetDirty();
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
751 return;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
752 }
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
753
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
754 if (_ctrl_pressed && sel < this->vehicle->num_orders) {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
755 const Order *ord = GetVehicleOrder(this->vehicle, sel);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
756 TileIndex xy;
8900
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
757
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
758 switch (ord->GetType()) {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
759 case OT_GOTO_STATION: xy = GetStation(ord->GetDestination())->xy ; break;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
760 case OT_GOTO_DEPOT: xy = (this->vehicle->type == VEH_AIRCRAFT) ? GetStation(ord->GetDestination())->xy : GetDepot(ord->GetDestination())->xy; break;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
761 case OT_GOTO_WAYPOINT: xy = GetWaypoint(ord->GetDestination())->xy; break;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
762 default: xy = 0; break;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
763 }
8900
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
764
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
765 if (xy != 0) ScrollMainWindowToTile(xy);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
766 return;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
767 } else {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
768 if (sel == this->selected_order) {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
769 /* Deselect clicked order */
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
770 this->selected_order = -1;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
771 } else {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
772 /* Select clicked order */
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
773 this->selected_order = sel;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
774
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
775 if (this->vehicle->owner == _local_player) {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
776 /* Activate drag and drop */
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
777 SetObjectToPlaceWnd(SPR_CURSOR_MOUSE, PAL_NONE, VHM_DRAG, this);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
778 }
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
779 }
8900
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
780 }
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
781
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
782 this->SetDirty();
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
783 } break;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
784
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
785 case ORDER_WIDGET_SKIP:
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
786 OrderClick_Skip(this, 0);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
787 break;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
788
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
789 case ORDER_WIDGET_DELETE:
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
790 OrderClick_Delete(this, 0);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
791 break;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
792
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
793 case ORDER_WIDGET_NON_STOP: {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
794 const Order *o = GetVehicleOrder(this->vehicle, this->OrderGetSel());
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
795 ShowDropDownMenu(this, _order_non_stop_drowdown, o->GetNonStopType(), ORDER_WIDGET_NON_STOP, 0, o->IsType(OT_GOTO_STATION) ? 0 : (o->IsType(OT_GOTO_WAYPOINT) ? 3 : 12));
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
796 } break;
8877
ee31d0131cd1 (svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium <rubidium@openttd.org>
parents: 8876
diff changeset
797
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
798 case ORDER_WIDGET_GOTO:
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
799 OrderClick_Goto(this, 0);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
800 break;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
801
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
802 case ORDER_WIDGET_GOTO_DROPDOWN:
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
803 ShowDropDownMenu(this, this->vehicle->type == VEH_AIRCRAFT ? _order_goto_dropdown_aircraft : _order_goto_dropdown, 0, ORDER_WIDGET_GOTO, 0, 0, this->widget[ORDER_WIDGET_GOTO_DROPDOWN].right - this->widget[ORDER_WIDGET_GOTO].left);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
804 break;
8883
23eea6824c4b (svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium <rubidium@openttd.org>
parents: 8882
diff changeset
805
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
806 case ORDER_WIDGET_FULL_LOAD:
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
807 ShowDropDownMenu(this, _order_full_load_drowdown, GetVehicleOrder(this->vehicle, this->OrderGetSel())->GetLoadType(), ORDER_WIDGET_FULL_LOAD, 0, 2);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
808 break;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
809
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
810 case ORDER_WIDGET_UNLOAD:
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
811 ShowDropDownMenu(this, _order_unload_drowdown, GetVehicleOrder(this->vehicle, this->OrderGetSel())->GetUnloadType(), ORDER_WIDGET_UNLOAD, 0, 8);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
812 break;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
813
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
814 case ORDER_WIDGET_REFIT:
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
815 OrderClick_Refit(this, 0);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
816 break;
8894
2bcad37f1d27 (svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium <rubidium@openttd.org>
parents: 8893
diff changeset
817
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
818 case ORDER_WIDGET_SERVICE:
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
819 OrderClick_Service(this, 0);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
820 break;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
821
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
822 case ORDER_WIDGET_TIMETABLE_VIEW:
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
823 ShowTimetableWindow(this->vehicle);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
824 break;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
825
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
826 case ORDER_WIDGET_COND_VARIABLE:
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
827 ShowDropDownMenu(this, _order_conditional_variable, GetVehicleOrder(this->vehicle, this->OrderGetSel())->GetConditionVariable(), ORDER_WIDGET_COND_VARIABLE, 0, 0);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
828 break;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
829
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
830 case ORDER_WIDGET_COND_COMPARATOR: {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
831 const Order *o = GetVehicleOrder(this->vehicle, this->OrderGetSel());
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
832 ShowDropDownMenu(this, _order_conditional_condition, o->GetConditionComparator(), ORDER_WIDGET_COND_COMPARATOR, 0, (o->GetConditionVariable() == OCV_REQUIRES_SERVICE) ? 0x3F : 0xC0);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
833 } break;
8900
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
834
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
835 case ORDER_WIDGET_COND_VALUE: {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
836 const Order *order = GetVehicleOrder(this->vehicle, this->OrderGetSel());
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
837 uint value = order->GetConditionValue();
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
838 if (order->GetConditionVariable() == OCV_MAX_SPEED) value = ConvertSpeedToDisplaySpeed(value);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
839 SetDParam(0, value);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
840 ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_ORDER_CONDITIONAL_VALUE_CAPT, 5, 100, this, CS_NUMERAL);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
841 } break;
8900
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
842
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
843 case ORDER_WIDGET_SHARED_ORDER_LIST:
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
844 ShowVehicleListWindow(this->vehicle);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
845 break;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
846 }
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
847 }
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
848
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
849 virtual void OnQueryTextFinished(char *str)
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
850 {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
851 if (!StrEmpty(str)) {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
852 VehicleOrderID sel = this->OrderGetSel();
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
853 uint value = atoi(str);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
854
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
855 switch (GetVehicleOrder(this->vehicle, sel)->GetConditionVariable()) {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
856 case OCV_MAX_SPEED:
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
857 value = ConvertDisplaySpeedToSpeed(value);
8900
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
858 break;
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
859
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
860 case OCV_RELIABILITY:
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
861 case OCV_LOAD_PERCENTAGE:
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
862 value = Clamp(value, 0, 100);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
863
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
864 default:
8900
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
865 break;
8877
ee31d0131cd1 (svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium <rubidium@openttd.org>
parents: 8876
diff changeset
866 }
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
867 DoCommandP(this->vehicle->tile, this->vehicle->index + (sel << 16), MOF_COND_VALUE | Clamp(value, 0, 2047) << 4, NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER));
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
868 }
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
869 }
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
870
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
871 virtual void OnDropdownSelect(int widget, int index)
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
872 {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
873 switch (widget) {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
874 case ORDER_WIDGET_NON_STOP:
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
875 OrderClick_Nonstop(this, index);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
876 break;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
877
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
878 case ORDER_WIDGET_FULL_LOAD:
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
879 OrderClick_FullLoad(this, index);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
880 break;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
881
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
882 case ORDER_WIDGET_UNLOAD:
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
883 OrderClick_Unload(this, index);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
884 break;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
885
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
886 case ORDER_WIDGET_GOTO:
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
887 switch (index) {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
888 case 0:
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
889 this->ToggleWidgetLoweredState(ORDER_WIDGET_GOTO);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
890 OrderClick_Goto(this, 0);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
891 break;
8877
ee31d0131cd1 (svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium <rubidium@openttd.org>
parents: 8876
diff changeset
892
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
893 case 1: OrderClick_NearestDepot(this, 0); break;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
894 case 2: OrderClick_Conditional(this, 0); break;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
895 default: NOT_REACHED();
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
896 }
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
897 break;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
898
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
899 case ORDER_WIDGET_COND_VARIABLE:
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
900 DoCommandP(this->vehicle->tile, this->vehicle->index + (this->OrderGetSel() << 16), MOF_COND_VARIABLE | index << 4, NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER));
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
901 break;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
902
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
903 case ORDER_WIDGET_COND_COMPARATOR:
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
904 DoCommandP(this->vehicle->tile, this->vehicle->index + (this->OrderGetSel() << 16), MOF_COND_COMPARATOR | index << 4, NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER));
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
905 break;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
906 }
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
907 }
8871
24e1116b32f6 (svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents: 8869
diff changeset
908
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
909 virtual void OnDragDrop(Point pt, int widget)
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
910 {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
911 switch (widget) {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
912 case ORDER_WIDGET_ORDER_LIST: {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
913 int from_order = this->OrderGetSel();
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
914 int to_order = this->GetOrderFromPt(pt.y);
8871
24e1116b32f6 (svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents: 8869
diff changeset
915
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
916 if (!(from_order == to_order || from_order == INVALID_ORDER || from_order > this->vehicle->num_orders || to_order == INVALID_ORDER || to_order > this->vehicle->num_orders) &&
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
917 DoCommandP(this->vehicle->tile, this->vehicle->index, from_order | (to_order << 16), NULL, CMD_MOVE_ORDER | CMD_MSG(STR_CAN_T_MOVE_THIS_ORDER))) {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
918 this->selected_order = -1;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
919 }
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
920 } break;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
921
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
922 case ORDER_WIDGET_DELETE:
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
923 OrderClick_Delete(this, 0);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
924 break;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
925 }
8871
24e1116b32f6 (svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents: 8869
diff changeset
926
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
927 ResetObjectToPlace();
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
928 }
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
929
9285
3b3f13cb6db6 (svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium <rubidium@openttd.org>
parents: 9273
diff changeset
930 virtual EventState OnKeyPress(uint16 key, uint16 keycode)
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
931 {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
932 static const KeyToEvent keytoevent[] = {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
933 {'D', OrderClick_Skip},
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
934 {'F', OrderClick_Delete},
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
935 {'G', OrderClick_Goto},
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
936 {'H', OrderClick_Nonstop},
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
937 {'J', OrderClick_FullLoad},
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
938 {'K', OrderClick_Unload},
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
939 //{'?', OrderClick_Transfer},
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
940 //('?', OrderClick_Service},
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
941 };
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
942
9285
3b3f13cb6db6 (svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium <rubidium@openttd.org>
parents: 9273
diff changeset
943 if (this->vehicle->owner != _local_player) return ES_NOT_HANDLED;
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
944
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
945 for (uint i = 0; i < lengthof(keytoevent); i++) {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
946 if (keycode == keytoevent[i].keycode) {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
947 keytoevent[i].proc(this, -1);
9285
3b3f13cb6db6 (svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium <rubidium@openttd.org>
parents: 9273
diff changeset
948 return ES_HANDLED;
6832
17319fb8c1c3 (svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium <rubidium@openttd.org>
parents: 6807
diff changeset
949 }
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
950 }
9285
3b3f13cb6db6 (svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium <rubidium@openttd.org>
parents: 9273
diff changeset
951 return ES_NOT_HANDLED;
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
952 }
6832
17319fb8c1c3 (svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium <rubidium@openttd.org>
parents: 6807
diff changeset
953
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
954 virtual void OnPlaceObject(Point pt, TileIndex tile)
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
955 {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
956 if (this->goto_type == OPOS_GOTO) {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
957 /* check if we're clicking on a vehicle first.. clone orders in that case. */
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
958 const Vehicle *v = CheckMouseOverVehicle();
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
959 if (v != NULL && this->HandleOrderVehClick(v)) return;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
960
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
961 const Order cmd = GetOrderCmdFromTile(this->vehicle, tile);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
962 if (!cmd.IsValid()) return;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
963
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
964 if (DoCommandP(this->vehicle->tile, this->vehicle->index + (this->OrderGetSel() << 16), cmd.Pack(), NULL, CMD_INSERT_ORDER | CMD_MSG(STR_8833_CAN_T_INSERT_NEW_ORDER))) {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
965 if (this->selected_order != -1) this->selected_order++;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
966 ResetObjectToPlace();
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
967 }
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
968 }
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
969 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
970
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
971 virtual void OnPlaceObjectAbort()
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
972 {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
973 if (this->goto_type == OPOS_CONDITIONAL) {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
974 this->goto_type = OPOS_GOTO;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
975 if (_cursor.pos.x >= (this->left + this->widget[ORDER_WIDGET_ORDER_LIST].left) &&
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
976 _cursor.pos.y >= (this->top + this->widget[ORDER_WIDGET_ORDER_LIST].top) &&
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
977 _cursor.pos.x <= (this->left + this->widget[ORDER_WIDGET_ORDER_LIST].right) &&
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
978 _cursor.pos.y <= (this->top + this->widget[ORDER_WIDGET_ORDER_LIST].bottom)) {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
979 int order_id = this->GetOrderFromPt(_cursor.pos.y - this->top);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
980 if (order_id != INVALID_ORDER) {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
981 Order order;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
982 order.next = NULL;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
983 order.index = 0;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
984 order.MakeConditional(order_id);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
985
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
986 DoCommandP(this->vehicle->tile, this->vehicle->index + (this->OrderGetSel() << 16), order.Pack(), NULL, CMD_INSERT_ORDER | CMD_MSG(STR_8833_CAN_T_INSERT_NEW_ORDER));
8871
24e1116b32f6 (svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents: 8869
diff changeset
987 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
988 }
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
989 }
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
990 this->RaiseWidget(ORDER_WIDGET_GOTO);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
991 this->InvalidateWidget(ORDER_WIDGET_GOTO);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
992 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
993
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
994 virtual void OnMouseLoop()
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
995 {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
996 const Vehicle *v = _place_clicked_vehicle;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
997 /*
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
998 * Check if we clicked on a vehicle
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
999 * and if the GOTO button of this window is pressed
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
1000 * This is because of all open order windows WE_MOUSELOOP is called
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
1001 * and if you have 3 windows open, and this check is not done
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
1002 * the order is copied to the last open window instead of the
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
1003 * one where GOTO is enabled
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
1004 */
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
1005 if (v != NULL && this->IsWidgetLowered(ORDER_WIDGET_GOTO)) {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
1006 _place_clicked_vehicle = NULL;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
1007 this->HandleOrderVehClick(v);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
1008 }
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
1009 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1010
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
1011 virtual void OnResize(Point new_size, Point delta)
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
1012 {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
1013 /* Update the scroll + matrix */
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
1014 this->vscroll.cap = (this->widget[ORDER_WIDGET_ORDER_LIST].bottom - this->widget[ORDER_WIDGET_ORDER_LIST].top) / 10;
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
1015 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1016
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
1017 virtual void OnTimeout()
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
1018 {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
1019 /* unclick all buttons except for the 'goto' button (ORDER_WIDGET_GOTO), which is 'persistent' */
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
1020 for (uint i = 0; i < this->widget_count; i++) {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
1021 if (this->IsWidgetLowered(i) && i != ORDER_WIDGET_GOTO) {
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
1022 this->RaiseWidget(i);
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
1023 this->InvalidateWidget(i);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1024 }
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
1025 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1026 }
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
1027 };
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1028
6807
5a9056baabaf (svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium <rubidium@openttd.org>
parents: 6794
diff changeset
1029 /**
5a9056baabaf (svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium <rubidium@openttd.org>
parents: 6794
diff changeset
1030 * Widget definition for player train orders
5a9056baabaf (svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium <rubidium@openttd.org>
parents: 6794
diff changeset
1031 */
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1032 static const Widget _orders_train_widgets[] = {
6807
5a9056baabaf (svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium <rubidium@openttd.org>
parents: 6794
diff changeset
1033 { WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // ORDER_WIDGET_CLOSEBOX
8877
ee31d0131cd1 (svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium <rubidium@openttd.org>
parents: 8876
diff changeset
1034 { WWT_CAPTION, RESIZE_RIGHT, 14, 11, 385, 0, 13, STR_8829_ORDERS, STR_018C_WINDOW_TITLE_DRAG_THIS}, // ORDER_WIDGET_CAPTION
ee31d0131cd1 (svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium <rubidium@openttd.org>
parents: 8876
diff changeset
1035 { WWT_PUSHTXTBTN, RESIZE_LR, 14, 325, 385, 0, 13, STR_TIMETABLE_VIEW, STR_TIMETABLE_VIEW_TOOLTIP}, // ORDER_WIDGET_TIMETABLE_VIEW
6807
5a9056baabaf (svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium <rubidium@openttd.org>
parents: 6794
diff changeset
1036
8877
ee31d0131cd1 (svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium <rubidium@openttd.org>
parents: 8876
diff changeset
1037 { WWT_PANEL, RESIZE_RB, 14, 0, 373, 14, 75, 0x0, STR_8852_ORDERS_LIST_CLICK_ON_ORDER}, // ORDER_WIDGET_ORDER_LIST
6807
5a9056baabaf (svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium <rubidium@openttd.org>
parents: 6794
diff changeset
1038
8877
ee31d0131cd1 (svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium <rubidium@openttd.org>
parents: 8876
diff changeset
1039 { WWT_SCROLLBAR, RESIZE_LRB, 14, 374, 385, 14, 75, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, // ORDER_WIDGET_SCROLLBAR
6807
5a9056baabaf (svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium <rubidium@openttd.org>
parents: 6794
diff changeset
1040
8877
ee31d0131cd1 (svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium <rubidium@openttd.org>
parents: 8876
diff changeset
1041 { WWT_PUSHTXTBTN, RESIZE_TB, 14, 0, 123, 88, 99, STR_8823_SKIP, STR_8853_SKIP_THE_CURRENT_ORDER}, // ORDER_WIDGET_SKIP
ee31d0131cd1 (svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium <rubidium@openttd.org>
parents: 8876
diff changeset
1042 { WWT_PUSHTXTBTN, RESIZE_TB, 14, 124, 247, 88, 99, STR_8824_DELETE, STR_8854_DELETE_THE_HIGHLIGHTED}, // ORDER_WIDGET_DELETE
8889
dfdaa97931c6 (svn r12656) -Fix: tooltips for some order buttons are outdated/incorrect.
rubidium <rubidium@openttd.org>
parents: 8888
diff changeset
1043 { WWT_DROPDOWN, RESIZE_TB, 14, 0, 123, 76, 87, STR_NULL, STR_ORDER_TOOLTIP_NON_STOP}, // ORDER_WIDGET_NON_STOP
8894
2bcad37f1d27 (svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium <rubidium@openttd.org>
parents: 8893
diff changeset
1044 { WWT_TEXTBTN, RESIZE_TB, 14, 248, 359, 88, 99, STR_8826_GO_TO, STR_8856_INSERT_A_NEW_ORDER_BEFORE}, // ORDER_WIDGET_GOTO
2bcad37f1d27 (svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium <rubidium@openttd.org>
parents: 8893
diff changeset
1045 { WWT_DROPDOWN, RESIZE_TB, 14, 360, 371, 88, 99, STR_EMPTY, STR_ORDER_GO_TO_DROPDOWN_TOOLTIP}, // ORDER_WIDGET_GOTO_DROPDOWN
8889
dfdaa97931c6 (svn r12656) -Fix: tooltips for some order buttons are outdated/incorrect.
rubidium <rubidium@openttd.org>
parents: 8888
diff changeset
1046 { WWT_DROPDOWN, RESIZE_TB, 14, 124, 247, 76, 87, STR_NULL, STR_ORDER_TOOLTIP_FULL_LOAD}, // ORDER_WIDGET_FULL_LOAD
dfdaa97931c6 (svn r12656) -Fix: tooltips for some order buttons are outdated/incorrect.
rubidium <rubidium@openttd.org>
parents: 8888
diff changeset
1047 { WWT_DROPDOWN, RESIZE_TB, 14, 248, 371, 76, 87, STR_NULL, STR_ORDER_TOOLTIP_UNLOAD}, // ORDER_WIDGET_UNLOAD
8885
2d7e1a978a1a (svn r12652) -Codechange: rework the order GUI a little more to make it a little more clear that 'transfer' is just an unload type.
rubidium <rubidium@openttd.org>
parents: 8883
diff changeset
1048 { WWT_PUSHTXTBTN, RESIZE_TB, 14, 124, 247, 76, 87, STR_REFIT, STR_REFIT_TIP}, // ORDER_WIDGET_REFIT
8887
37d60c8d4a82 (svn r12654) -Codechange: remove some unneeded right click handling due to the splitting of the load/refit button.
rubidium <rubidium@openttd.org>
parents: 8886
diff changeset
1049 { WWT_PUSHTXTBTN, RESIZE_TB, 14, 248, 371, 76, 87, STR_SERVICE, STR_SERVICE_HINT}, // ORDER_WIDGET_SERVICE
6807
5a9056baabaf (svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium <rubidium@openttd.org>
parents: 6794
diff changeset
1050
8900
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
1051 { WWT_DROPDOWN, RESIZE_TB, 14, 0, 123, 76, 87, STR_NULL, STR_ORDER_CONDITIONAL_VARIABLE_TOOLTIP}, // ORDER_WIDGET_COND_VARIABLE
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
1052 { WWT_DROPDOWN, RESIZE_TB, 14, 124, 247, 76, 87, STR_NULL, STR_ORDER_CONDITIONAL_COMPARATOR_TOOLTIP}, // ORDER_WIDGET_COND_COMPARATOR
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
1053 { WWT_PUSHTXTBTN, RESIZE_TB, 14, 248, 371, 76, 87, STR_CONDITIONAL_VALUE, STR_ORDER_CONDITIONAL_VALUE_TOOLTIP}, // ORDER_WIDGET_COND_VALUE
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
1054
8877
ee31d0131cd1 (svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium <rubidium@openttd.org>
parents: 8876
diff changeset
1055 { WWT_PANEL, RESIZE_RTB, 14, 372, 373, 76, 99, 0x0, STR_NULL}, // ORDER_WIDGET_RESIZE_BAR
ee31d0131cd1 (svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium <rubidium@openttd.org>
parents: 8876
diff changeset
1056 { WWT_PUSHIMGBTN, RESIZE_LRTB, 14, 372, 385, 76, 87, SPR_SHARED_ORDERS_ICON, STR_VEH_WITH_SHARED_ORDERS_LIST_TIP}, // ORDER_WIDGET_SHARED_ORDER_LIST
6807
5a9056baabaf (svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium <rubidium@openttd.org>
parents: 6794
diff changeset
1057
8877
ee31d0131cd1 (svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium <rubidium@openttd.org>
parents: 8876
diff changeset
1058 { WWT_RESIZEBOX, RESIZE_LRTB, 14, 374, 385, 88, 99, 0x0, STR_RESIZE_BUTTON}, // ORDER_WIDGET_RESIZE
6807
5a9056baabaf (svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium <rubidium@openttd.org>
parents: 6794
diff changeset
1059 { WIDGETS_END},
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1060 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1061
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1062 static const WindowDesc _orders_train_desc = {
8877
ee31d0131cd1 (svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium <rubidium@openttd.org>
parents: 8876
diff changeset
1063 WDP_AUTO, WDP_AUTO, 386, 100, 386, 100,
8969
01cc3ee6ecb1 (svn r12761) -Codechange: lots of minor whitespace coding style fixes around operators.
rubidium <rubidium@openttd.org>
parents: 8962
diff changeset
1064 WC_VEHICLE_ORDERS, WC_VEHICLE_VIEW,
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1065 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_RESIZABLE,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1066 _orders_train_widgets,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1067 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1068
6807
5a9056baabaf (svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium <rubidium@openttd.org>
parents: 6794
diff changeset
1069 /**
5a9056baabaf (svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium <rubidium@openttd.org>
parents: 6794
diff changeset
1070 * Widget definition for player orders (!train)
5a9056baabaf (svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium <rubidium@openttd.org>
parents: 6794
diff changeset
1071 */
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1072 static const Widget _orders_widgets[] = {
6807
5a9056baabaf (svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium <rubidium@openttd.org>
parents: 6794
diff changeset
1073 { WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // ORDER_WIDGET_CLOSEBOX
8877
ee31d0131cd1 (svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium <rubidium@openttd.org>
parents: 8876
diff changeset
1074 { WWT_CAPTION, RESIZE_RIGHT, 14, 11, 385, 0, 13, STR_8829_ORDERS, STR_018C_WINDOW_TITLE_DRAG_THIS}, // ORDER_WIDGET_CAPTION
ee31d0131cd1 (svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium <rubidium@openttd.org>
parents: 8876
diff changeset
1075 { WWT_PUSHTXTBTN, RESIZE_LR, 14, 325, 385, 0, 13, STR_TIMETABLE_VIEW, STR_TIMETABLE_VIEW_TOOLTIP}, // ORDER_WIDGET_TIMETABLE_VIEW
6807
5a9056baabaf (svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium <rubidium@openttd.org>
parents: 6794
diff changeset
1076
8877
ee31d0131cd1 (svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium <rubidium@openttd.org>
parents: 8876
diff changeset
1077 { WWT_PANEL, RESIZE_RB, 14, 0, 373, 14, 75, 0x0, STR_8852_ORDERS_LIST_CLICK_ON_ORDER}, // ORDER_WIDGET_ORDER_LIST
6807
5a9056baabaf (svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium <rubidium@openttd.org>
parents: 6794
diff changeset
1078
8877
ee31d0131cd1 (svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium <rubidium@openttd.org>
parents: 8876
diff changeset
1079 { WWT_SCROLLBAR, RESIZE_LRB, 14, 374, 385, 14, 75, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, // ORDER_WIDGET_SCROLLBAR
6807
5a9056baabaf (svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium <rubidium@openttd.org>
parents: 6794
diff changeset
1080
8877
ee31d0131cd1 (svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium <rubidium@openttd.org>
parents: 8876
diff changeset
1081 { WWT_PUSHTXTBTN, RESIZE_TB, 14, 0, 123, 88, 99, STR_8823_SKIP, STR_8853_SKIP_THE_CURRENT_ORDER}, // ORDER_WIDGET_SKIP
ee31d0131cd1 (svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium <rubidium@openttd.org>
parents: 8876
diff changeset
1082 { WWT_PUSHTXTBTN, RESIZE_TB, 14, 124, 247, 88, 99, STR_8824_DELETE, STR_8854_DELETE_THE_HIGHLIGHTED}, // ORDER_WIDGET_DELETE
6807
5a9056baabaf (svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium <rubidium@openttd.org>
parents: 6794
diff changeset
1083 { WWT_EMPTY, RESIZE_TB, 14, 0, 0, 76, 87, 0x0, 0x0}, // ORDER_WIDGET_NON_STOP
8894
2bcad37f1d27 (svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium <rubidium@openttd.org>
parents: 8893
diff changeset
1084 { WWT_TEXTBTN, RESIZE_TB, 14, 248, 359, 88, 99, STR_8826_GO_TO, STR_8856_INSERT_A_NEW_ORDER_BEFORE}, // ORDER_WIDGET_GOTO
2bcad37f1d27 (svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium <rubidium@openttd.org>
parents: 8893
diff changeset
1085 { WWT_DROPDOWN, RESIZE_TB, 14, 360, 371, 88, 99, STR_EMPTY, STR_ORDER_GO_TO_DROPDOWN_TOOLTIP}, // ORDER_WIDGET_GOTO_DROPDOWN
8889
dfdaa97931c6 (svn r12656) -Fix: tooltips for some order buttons are outdated/incorrect.
rubidium <rubidium@openttd.org>
parents: 8888
diff changeset
1086 { WWT_DROPDOWN, RESIZE_TB, 14, 0, 185, 76, 87, STR_NULL, STR_ORDER_TOOLTIP_FULL_LOAD}, // ORDER_WIDGET_FULL_LOAD
8900
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
1087 { WWT_DROPDOWN, RESIZE_TB, 14, 186, 371, 76, 87, STR_NULL, STR_ORDER_TOOLTIP_UNLOAD}, // ORDER_WIDGET_UNLOAD
8885
2d7e1a978a1a (svn r12652) -Codechange: rework the order GUI a little more to make it a little more clear that 'transfer' is just an unload type.
rubidium <rubidium@openttd.org>
parents: 8883
diff changeset
1088 { WWT_PUSHTXTBTN, RESIZE_TB, 14, 0, 185, 76, 87, STR_REFIT, STR_REFIT_TIP}, // ORDER_WIDGET_REFIT
8900
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
1089 { WWT_PUSHTXTBTN, RESIZE_TB, 14, 186, 371, 76, 87, STR_SERVICE, STR_SERVICE_HINT}, // ORDER_WIDGET_SERVICE
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
1090
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
1091 { WWT_DROPDOWN, RESIZE_TB, 14, 0, 123, 76, 87, STR_NULL, STR_ORDER_CONDITIONAL_VARIABLE_TOOLTIP}, // ORDER_WIDGET_COND_VARIABLE
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
1092 { WWT_DROPDOWN, RESIZE_TB, 14, 124, 247, 76, 87, STR_NULL, STR_ORDER_CONDITIONAL_COMPARATOR_TOOLTIP}, // ORDER_WIDGET_COND_COMPARATOR
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
1093 { WWT_PUSHTXTBTN, RESIZE_TB, 14, 248, 371, 76, 87, STR_CONDITIONAL_VALUE, STR_ORDER_CONDITIONAL_VALUE_TOOLTIP}, // ORDER_WIDGET_COND_VALUE
6807
5a9056baabaf (svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium <rubidium@openttd.org>
parents: 6794
diff changeset
1094
8877
ee31d0131cd1 (svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium <rubidium@openttd.org>
parents: 8876
diff changeset
1095 { WWT_PANEL, RESIZE_RTB, 14, 372, 373, 76, 99, 0x0, STR_NULL}, // ORDER_WIDGET_RESIZE_BAR
ee31d0131cd1 (svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium <rubidium@openttd.org>
parents: 8876
diff changeset
1096 { WWT_PUSHIMGBTN, RESIZE_LRTB, 14, 372, 385, 76, 87, SPR_SHARED_ORDERS_ICON, STR_VEH_WITH_SHARED_ORDERS_LIST_TIP}, // ORDER_WIDGET_SHARED_ORDER_LIST
6807
5a9056baabaf (svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium <rubidium@openttd.org>
parents: 6794
diff changeset
1097
8877
ee31d0131cd1 (svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium <rubidium@openttd.org>
parents: 8876
diff changeset
1098 { WWT_RESIZEBOX, RESIZE_LRTB, 14, 374, 385, 88, 99, 0x0, STR_RESIZE_BUTTON}, // ORDER_WIDGET_RESIZE
6807
5a9056baabaf (svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium <rubidium@openttd.org>
parents: 6794
diff changeset
1099 { WIDGETS_END},
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1100 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1101
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1102 static const WindowDesc _orders_desc = {
8877
ee31d0131cd1 (svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium <rubidium@openttd.org>
parents: 8876
diff changeset
1103 WDP_AUTO, WDP_AUTO, 386, 100, 386, 100,
8969
01cc3ee6ecb1 (svn r12761) -Codechange: lots of minor whitespace coding style fixes around operators.
rubidium <rubidium@openttd.org>
parents: 8962
diff changeset
1104 WC_VEHICLE_ORDERS, WC_VEHICLE_VIEW,
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1105 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_RESIZABLE,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1106 _orders_widgets,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1107 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1108
6807
5a9056baabaf (svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium <rubidium@openttd.org>
parents: 6794
diff changeset
1109 /**
5a9056baabaf (svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium <rubidium@openttd.org>
parents: 6794
diff changeset
1110 * Widget definition for competitor orders
5a9056baabaf (svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium <rubidium@openttd.org>
parents: 6794
diff changeset
1111 */
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1112 static const Widget _other_orders_widgets[] = {
6980
cb6b3e277df0 (svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros <maedhros@openttd.org>
parents: 6923
diff changeset
1113 { WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // ORDER_WIDGET_CLOSEBOX
8877
ee31d0131cd1 (svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium <rubidium@openttd.org>
parents: 8876
diff changeset
1114 { WWT_CAPTION, RESIZE_RIGHT, 14, 11, 385, 0, 13, STR_8829_ORDERS, STR_018C_WINDOW_TITLE_DRAG_THIS}, // ORDER_WIDGET_CAPTION
ee31d0131cd1 (svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium <rubidium@openttd.org>
parents: 8876
diff changeset
1115 { WWT_PUSHTXTBTN, RESIZE_LR, 14, 325, 385, 0, 13, STR_TIMETABLE_VIEW, STR_TIMETABLE_VIEW_TOOLTIP}, // ORDER_WIDGET_TIMETABLE_VIEW
6807
5a9056baabaf (svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium <rubidium@openttd.org>
parents: 6794
diff changeset
1116
8877
ee31d0131cd1 (svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium <rubidium@openttd.org>
parents: 8876
diff changeset
1117 { WWT_PANEL, RESIZE_RB, 14, 0, 373, 14, 75, 0x0, STR_8852_ORDERS_LIST_CLICK_ON_ORDER}, // ORDER_WIDGET_ORDER_LIST
6807
5a9056baabaf (svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium <rubidium@openttd.org>
parents: 6794
diff changeset
1118
8877
ee31d0131cd1 (svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium <rubidium@openttd.org>
parents: 8876
diff changeset
1119 { WWT_SCROLLBAR, RESIZE_LRB, 14, 374, 385, 14, 75, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, // ORDER_WIDGET_SCROLLBAR
6807
5a9056baabaf (svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium <rubidium@openttd.org>
parents: 6794
diff changeset
1120
8874
a6a05ae5a7da (svn r12641) -Codechange: do not use the same button for two completely distinct tasks, just make an extra button for it and hide them when not needed.
rubidium <rubidium@openttd.org>
parents: 8873
diff changeset
1121 { WWT_EMPTY, RESIZE_NONE, 14, 0, 0, 76, 87, 0x0, STR_NULL}, // ORDER_WIDGET_SKIP
a6a05ae5a7da (svn r12641) -Codechange: do not use the same button for two completely distinct tasks, just make an extra button for it and hide them when not needed.
rubidium <rubidium@openttd.org>
parents: 8873
diff changeset
1122 { WWT_EMPTY, RESIZE_NONE, 14, 0, 0, 76, 87, 0x0, STR_NULL}, // ORDER_WIDGET_DELETE
a6a05ae5a7da (svn r12641) -Codechange: do not use the same button for two completely distinct tasks, just make an extra button for it and hide them when not needed.
rubidium <rubidium@openttd.org>
parents: 8873
diff changeset
1123 { WWT_EMPTY, RESIZE_NONE, 14, 0, 0, 76, 87, 0x0, STR_NULL}, // ORDER_WIDGET_NON_STOP
a6a05ae5a7da (svn r12641) -Codechange: do not use the same button for two completely distinct tasks, just make an extra button for it and hide them when not needed.
rubidium <rubidium@openttd.org>
parents: 8873
diff changeset
1124 { WWT_EMPTY, RESIZE_NONE, 14, 0, 0, 76, 87, 0x0, STR_NULL}, // ORDER_WIDGET_GOTO
8894
2bcad37f1d27 (svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium <rubidium@openttd.org>
parents: 8893
diff changeset
1125 { WWT_EMPTY, RESIZE_NONE, 14, 0, 0, 76, 87, 0x0, STR_NULL}, // ORDER_WIDGET_GOTO_DROPDOWN
8874
a6a05ae5a7da (svn r12641) -Codechange: do not use the same button for two completely distinct tasks, just make an extra button for it and hide them when not needed.
rubidium <rubidium@openttd.org>
parents: 8873
diff changeset
1126 { WWT_EMPTY, RESIZE_NONE, 14, 0, 0, 76, 87, 0x0, STR_NULL}, // ORDER_WIDGET_FULL_LOAD
a6a05ae5a7da (svn r12641) -Codechange: do not use the same button for two completely distinct tasks, just make an extra button for it and hide them when not needed.
rubidium <rubidium@openttd.org>
parents: 8873
diff changeset
1127 { WWT_EMPTY, RESIZE_NONE, 14, 0, 0, 76, 87, 0x0, STR_NULL}, // ORDER_WIDGET_UNLOAD
a6a05ae5a7da (svn r12641) -Codechange: do not use the same button for two completely distinct tasks, just make an extra button for it and hide them when not needed.
rubidium <rubidium@openttd.org>
parents: 8873
diff changeset
1128 { WWT_EMPTY, RESIZE_NONE, 14, 0, 0, 76, 87, 0x0, STR_NULL}, // ORDER_WIDGET_REFIT
a6a05ae5a7da (svn r12641) -Codechange: do not use the same button for two completely distinct tasks, just make an extra button for it and hide them when not needed.
rubidium <rubidium@openttd.org>
parents: 8873
diff changeset
1129 { WWT_EMPTY, RESIZE_NONE, 14, 0, 0, 76, 87, 0x0, STR_NULL}, // ORDER_WIDGET_SERVICE
6807
5a9056baabaf (svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium <rubidium@openttd.org>
parents: 6794
diff changeset
1130
8900
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
1131 { WWT_EMPTY, RESIZE_NONE, 14, 0, 0, 76, 87, 0x0, STR_NULL}, // ORDER_WIDGET_COND_VARIABLE
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
1132 { WWT_EMPTY, RESIZE_NONE, 14, 0, 0, 76, 87, 0x0, STR_NULL}, // ORDER_WIDGET_COND_COMPARATOR
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
1133 { WWT_EMPTY, RESIZE_NONE, 14, 0, 0, 76, 87, 0x0, STR_NULL}, // ORDER_WIDGET_COND_VALUE
a12b2ec504da (svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents: 8896
diff changeset
1134
8877
ee31d0131cd1 (svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium <rubidium@openttd.org>
parents: 8876
diff changeset
1135 { WWT_PANEL, RESIZE_RTB, 14, 0, 373, 76, 87, 0x0, STR_NULL}, // ORDER_WIDGET_RESIZE_BAR
8874
a6a05ae5a7da (svn r12641) -Codechange: do not use the same button for two completely distinct tasks, just make an extra button for it and hide them when not needed.
rubidium <rubidium@openttd.org>
parents: 8873
diff changeset
1136 { WWT_EMPTY, RESIZE_TB, 14, 0, 0, 76, 87, 0x0, STR_NULL}, // ORDER_WIDGET_SHARED_ORDER_LIST
6807
5a9056baabaf (svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium <rubidium@openttd.org>
parents: 6794
diff changeset
1137
8904
9ef342ceedb7 (svn r12671) -Fix (r12644): orders window of competitors' vehicles was missing a resizebox
smatz <smatz@openttd.org>
parents: 8903
diff changeset
1138 { WWT_RESIZEBOX, RESIZE_LRTB, 14, 374, 385, 76, 87, 0x0, STR_RESIZE_BUTTON}, // ORDER_WIDGET_RESIZE
6807
5a9056baabaf (svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium <rubidium@openttd.org>
parents: 6794
diff changeset
1139 { WIDGETS_END},
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1140 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1141
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1142 static const WindowDesc _other_orders_desc = {
8877
ee31d0131cd1 (svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium <rubidium@openttd.org>
parents: 8876
diff changeset
1143 WDP_AUTO, WDP_AUTO, 386, 88, 386, 88,
8969
01cc3ee6ecb1 (svn r12761) -Codechange: lots of minor whitespace coding style fixes around operators.
rubidium <rubidium@openttd.org>
parents: 8962
diff changeset
1144 WC_VEHICLE_ORDERS, WC_VEHICLE_VIEW,
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1145 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_RESIZABLE,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1146 _other_orders_widgets,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1147 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1148
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1149 void ShowOrdersWindow(const Vehicle *v)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1150 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1151 VehicleID veh = v->index;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1152
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1153 DeleteWindowById(WC_VEHICLE_ORDERS, veh);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1154 DeleteWindowById(WC_VEHICLE_DETAILS, veh);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1155
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1156 if (v->owner != _local_player) {
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
1157 new OrdersWindow(&_other_orders_desc, v);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1158 } else {
9258
1cd16b63b893 (svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents: 9143
diff changeset
1159 new OrdersWindow((v->type == VEH_TRAIN || v->type == VEH_ROAD) ? &_orders_train_desc : &_orders_desc, v);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1160 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1161 }