Mercurial > hg > openttd
annotate src/order_gui.cpp @ 13697:4e2fb4386b62 draft
(svn r18222) -Codechange: make the sign list window big font aware
author | rubidium <rubidium@openttd.org> |
---|---|
date | Sun, 22 Nov 2009 14:40:25 +0000 |
parents | ce197674184d |
children | af90d4bf0785 |
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 |
12778
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12632
diff
changeset
|
3 /* |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12632
diff
changeset
|
4 * This file is part of OpenTTD. |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12632
diff
changeset
|
5 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12632
diff
changeset
|
6 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12632
diff
changeset
|
7 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>. |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12632
diff
changeset
|
8 */ |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12632
diff
changeset
|
9 |
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
|
10 /** @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
|
11 |
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 "stdafx.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
|
13 #include "window_gui.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
|
14 #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
|
15 #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
|
16 #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
|
17 #include "depot_base.h" |
10960
a4e5b5d2837c
(svn r15299) -Cleanup: remove many redundant includes
smatz <smatz@openttd.org>
parents:
10867
diff
changeset
|
18 #include "vehicle_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
|
19 #include "vehicle_gui.h" |
6980
cb6b3e277df0
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros <maedhros@openttd.org>
parents:
6923
diff
changeset
|
20 #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
|
21 #include "cargotype.h" |
8114
2d6af5d7a142
(svn r11675) -Codechange: split the string types from the string functions.
rubidium <rubidium@openttd.org>
parents:
8108
diff
changeset
|
22 #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
|
23 #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
|
24 #include "vehicle_func.h" |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
10207
diff
changeset
|
25 #include "company_func.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
|
26 #include "widgets/dropdown_func.h" |
8900
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8896
diff
changeset
|
27 #include "textbuf_gui.h" |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8896
diff
changeset
|
28 #include "string_func.h" |
9127
428852b86d4d
(svn r12987) -Codechange: split viewport and tile selection.
rubidium <rubidium@openttd.org>
parents:
9116
diff
changeset
|
29 #include "tilehighlight_func.h" |
10184
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
30 #include "network/network.h" |
12228
240adc64d01a
(svn r16643) -Codechange: replace GetStationByTile() by Station::GetByTile()
smatz <smatz@openttd.org>
parents:
11991
diff
changeset
|
31 #include "station_base.h" |
12475
c133b51890f4
(svn r16912) -Codechange: split waypoint.h in waypoint_base.h and waypoint_func.h
rubidium <rubidium@openttd.org>
parents:
12472
diff
changeset
|
32 #include "waypoint_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
|
33 |
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
|
34 #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
|
35 #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
|
36 |
11696
723597e7fea7
(svn r16081) -Doc: Adding/fixing some Doxygen comments.
alberth <alberth@openttd.org>
parents:
11695
diff
changeset
|
37 /** Widget numbers of the order window. */ |
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, |
10562
19596a28a157
(svn r14819) -Change: make details and order menu stickyable, like the timetable window. Also let the detail/order/timetable window close eachther, like the detail and order windows already did, when not stickied.
rubidium <rubidium@openttd.org>
parents:
10550
diff
changeset
|
42 ORDER_WIDGET_STICKY, |
5828
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_ORDER_LIST, |
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_SCROLLBAR, |
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_SKIP, |
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_DELETE, |
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_NON_STOP, |
9dc7252be011
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni <bjarni@openttd.org>
parents:
5745
diff
changeset
|
48 ORDER_WIDGET_GOTO, |
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, |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
56 ORDER_WIDGET_SEL_TOP_LEFT, ///< #NWID_SELECTION widget for left part of the top row of the 'your train' order window. |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
57 ORDER_WIDGET_SEL_TOP_MIDDLE, ///< #NWID_SELECTION widget for middle part of the top row of the 'your train' order window. |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
58 ORDER_WIDGET_SEL_TOP_RIGHT, ///< #NWID_SELECTION widget for right part of the top row of the 'your train' order window. |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
59 ORDER_WIDGET_SEL_TOP_ROW, ///< #NWID_SELECTION widget for the top row of the 'your non-trains' order window. |
5828
9dc7252be011
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni <bjarni@openttd.org>
parents:
5745
diff
changeset
|
60 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
|
61 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
|
62 }; |
9dc7252be011
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni <bjarni@openttd.org>
parents:
5745
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 /** 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
|
65 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
|
66 { |
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
|
67 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
|
68 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
|
69 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
|
70 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
|
71 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
|
72 }, { |
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
|
73 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
|
74 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
|
75 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
|
76 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
|
77 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
|
78 }, { |
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
|
79 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
|
80 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
|
81 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
|
82 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
|
83 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
|
84 }, { |
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 /* 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
|
86 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
|
87 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
|
88 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
|
89 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
|
90 }, { |
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, |
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, |
23eea6824c4b
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium <rubidium@openttd.org>
parents:
8882
diff
changeset
|
93 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
|
94 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
|
95 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
|
96 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
97 }; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
98 |
8888
29207e0e22a0
(svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium <rubidium@openttd.org>
parents:
8887
diff
changeset
|
99 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
|
100 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
|
101 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
|
102 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
|
103 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
|
104 INVALID_STRING_ID |
29207e0e22a0
(svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium <rubidium@openttd.org>
parents:
8887
diff
changeset
|
105 }; |
29207e0e22a0
(svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium <rubidium@openttd.org>
parents:
8887
diff
changeset
|
106 |
29207e0e22a0
(svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium <rubidium@openttd.org>
parents:
8887
diff
changeset
|
107 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
|
108 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
|
109 STR_EMPTY, |
29207e0e22a0
(svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium <rubidium@openttd.org>
parents:
8887
diff
changeset
|
110 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
|
111 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
|
112 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
|
113 INVALID_STRING_ID |
29207e0e22a0
(svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium <rubidium@openttd.org>
parents:
8887
diff
changeset
|
114 }; |
29207e0e22a0
(svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium <rubidium@openttd.org>
parents:
8887
diff
changeset
|
115 |
29207e0e22a0
(svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium <rubidium@openttd.org>
parents:
8887
diff
changeset
|
116 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
|
117 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
|
118 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
|
119 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
|
120 STR_EMPTY, |
29207e0e22a0
(svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium <rubidium@openttd.org>
parents:
8887
diff
changeset
|
121 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
|
122 INVALID_STRING_ID |
29207e0e22a0
(svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium <rubidium@openttd.org>
parents:
8887
diff
changeset
|
123 }; |
29207e0e22a0
(svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium <rubidium@openttd.org>
parents:
8887
diff
changeset
|
124 |
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
|
125 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
|
126 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
|
127 STR_ORDER_GO_TO_NEAREST_DEPOT, |
8900
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8896
diff
changeset
|
128 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
|
129 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
|
130 }; |
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 |
2bcad37f1d27
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium <rubidium@openttd.org>
parents:
8893
diff
changeset
|
132 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
|
133 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
|
134 STR_ORDER_GO_TO_NEAREST_HANGAR, |
8900
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8896
diff
changeset
|
135 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
|
136 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
|
137 }; |
2bcad37f1d27
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium <rubidium@openttd.org>
parents:
8893
diff
changeset
|
138 |
8900
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8896
diff
changeset
|
139 static const StringID _order_conditional_variable[] = { |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8896
diff
changeset
|
140 STR_ORDER_CONDITIONAL_LOAD_PERCENTAGE, |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8896
diff
changeset
|
141 STR_ORDER_CONDITIONAL_RELIABILITY, |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8896
diff
changeset
|
142 STR_ORDER_CONDITIONAL_MAX_SPEED, |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8896
diff
changeset
|
143 STR_ORDER_CONDITIONAL_AGE, |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8896
diff
changeset
|
144 STR_ORDER_CONDITIONAL_REQUIRES_SERVICE, |
8903
d15e125c0b6a
(svn r12670) -Add: unconditional/always order 'jump/skip' variable.
rubidium <rubidium@openttd.org>
parents:
8900
diff
changeset
|
145 STR_ORDER_CONDITIONAL_UNCONDITIONALLY, |
8900
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8896
diff
changeset
|
146 INVALID_STRING_ID, |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8896
diff
changeset
|
147 }; |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8896
diff
changeset
|
148 |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8896
diff
changeset
|
149 static const StringID _order_conditional_condition[] = { |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8896
diff
changeset
|
150 STR_ORDER_CONDITIONAL_COMPARATOR_EQUALS, |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8896
diff
changeset
|
151 STR_ORDER_CONDITIONAL_COMPARATOR_NOT_EQUALS, |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8896
diff
changeset
|
152 STR_ORDER_CONDITIONAL_COMPARATOR_LESS_THAN, |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8896
diff
changeset
|
153 STR_ORDER_CONDITIONAL_COMPARATOR_LESS_EQUALS, |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8896
diff
changeset
|
154 STR_ORDER_CONDITIONAL_COMPARATOR_MORE_THAN, |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8896
diff
changeset
|
155 STR_ORDER_CONDITIONAL_COMPARATOR_MORE_EQUALS, |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8896
diff
changeset
|
156 STR_ORDER_CONDITIONAL_COMPARATOR_IS_TRUE, |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8896
diff
changeset
|
157 STR_ORDER_CONDITIONAL_COMPARATOR_IS_FALSE, |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8896
diff
changeset
|
158 INVALID_STRING_ID, |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8896
diff
changeset
|
159 }; |
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 extern uint ConvertSpeedToDisplaySpeed(uint speed); |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8896
diff
changeset
|
162 extern uint ConvertDisplaySpeedToSpeed(uint speed); |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8896
diff
changeset
|
163 |
10285
615db2678973
(svn r14524) -Add: stop-in-depot as part of orders (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
164 static const StringID _order_depot_action_dropdown[] = { |
615db2678973
(svn r14524) -Add: stop-in-depot as part of orders (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
165 STR_ORDER_DROP_GO_ALWAYS_DEPOT, |
615db2678973
(svn r14524) -Add: stop-in-depot as part of orders (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
166 STR_ORDER_DROP_SERVICE_DEPOT, |
615db2678973
(svn r14524) -Add: stop-in-depot as part of orders (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
167 STR_ORDER_DROP_HALT_DEPOT, |
615db2678973
(svn r14524) -Add: stop-in-depot as part of orders (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
168 INVALID_STRING_ID |
615db2678973
(svn r14524) -Add: stop-in-depot as part of orders (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
169 }; |
615db2678973
(svn r14524) -Add: stop-in-depot as part of orders (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
170 |
615db2678973
(svn r14524) -Add: stop-in-depot as part of orders (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
171 static int DepotActionStringIndex(const Order *order) |
615db2678973
(svn r14524) -Add: stop-in-depot as part of orders (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
172 { |
615db2678973
(svn r14524) -Add: stop-in-depot as part of orders (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
173 if (order->GetDepotActionType() & ODATFB_HALT) { |
615db2678973
(svn r14524) -Add: stop-in-depot as part of orders (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
174 return DA_STOP; |
615db2678973
(svn r14524) -Add: stop-in-depot as part of orders (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
175 } else if (order->GetDepotOrderType() & ODTFB_SERVICE) { |
615db2678973
(svn r14524) -Add: stop-in-depot as part of orders (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
176 return DA_SERVICE; |
615db2678973
(svn r14524) -Add: stop-in-depot as part of orders (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
177 } else { |
615db2678973
(svn r14524) -Add: stop-in-depot as part of orders (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
178 return DA_ALWAYS_GO; |
615db2678973
(svn r14524) -Add: stop-in-depot as part of orders (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
179 } |
615db2678973
(svn r14524) -Add: stop-in-depot as part of orders (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
180 } |
8900
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8896
diff
changeset
|
181 |
13059
da49b7fa34f7
(svn r17557) -Codechange: Pass left and right edge to DrawOrderString().
alberth <alberth@openttd.org>
parents:
13034
diff
changeset
|
182 void DrawOrderString(const Vehicle *v, const Order *order, int order_index, int y, bool selected, bool timetable, int left, int right) |
8929
2b6a37a13245
(svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents:
8919
diff
changeset
|
183 { |
11730
a39da1e4c1f5
(svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents:
11706
diff
changeset
|
184 StringID str = (v->cur_order_index == order_index) ? STR_ORDER_SELECTED : STR_ORDER; |
8929
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_EMPTY); |
2b6a37a13245
(svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents:
8919
diff
changeset
|
186 |
2b6a37a13245
(svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents:
8919
diff
changeset
|
187 switch (order->GetType()) { |
2b6a37a13245
(svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents:
8919
diff
changeset
|
188 case OT_DUMMY: |
2b6a37a13245
(svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents:
8919
diff
changeset
|
189 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
|
190 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
|
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_STATION: { |
2b6a37a13245
(svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents:
8919
diff
changeset
|
194 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
|
195 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
|
196 |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
197 SetDParam(1, STR_ORDER_GO_TO_STATION); |
8929
2b6a37a13245
(svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents:
8919
diff
changeset
|
198 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
|
199 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
|
200 |
2b6a37a13245
(svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents:
8919
diff
changeset
|
201 if (timetable) { |
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 |
2b6a37a13245
(svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents:
8919
diff
changeset
|
204 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
|
205 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
|
206 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
|
207 } |
2b6a37a13245
(svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents:
8919
diff
changeset
|
208 } else { |
2b6a37a13245
(svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents:
8919
diff
changeset
|
209 SetDParam(4, (order->GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION) ? STR_EMPTY : _station_load_types[unload][load]); |
11693
96fd0169a7a5
(svn r16078) -Change: do not show stop location for via orders; they don't stop there
rubidium <rubidium@openttd.org>
parents:
11676
diff
changeset
|
210 if (v->type == VEH_TRAIN && (order->GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION) == 0) { |
11657
ff1084d0d8a0
(svn r16037) -Feature: allow (per order) to let a train stop at the near end, middle or far end of a platform from the point of view of the driver of the train that enters the station.
rubidium <rubidium@openttd.org>
parents:
11524
diff
changeset
|
211 SetDParam(6, order->GetStopLocation() + STR_ORDER_STOP_LOCATION_NEAR_END); |
ff1084d0d8a0
(svn r16037) -Feature: allow (per order) to let a train stop at the near end, middle or far end of a platform from the point of view of the driver of the train that enters the station.
rubidium <rubidium@openttd.org>
parents:
11524
diff
changeset
|
212 } |
8929
2b6a37a13245
(svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents:
8919
diff
changeset
|
213 } |
2b6a37a13245
(svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents:
8919
diff
changeset
|
214 } break; |
2b6a37a13245
(svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents:
8919
diff
changeset
|
215 |
2b6a37a13245
(svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents:
8919
diff
changeset
|
216 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
|
217 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
|
218 if (order->GetDepotActionType() & ODATFB_NEAREST_DEPOT) { |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
219 SetDParam(1, STR_ORDER_GO_TO_NEAREST_DEPOT_FORMAT); |
8929
2b6a37a13245
(svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents:
8919
diff
changeset
|
220 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
|
221 } else { |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
222 SetDParam(1, STR_ORDER_GO_TO_HANGAR_FORMAT); |
8929
2b6a37a13245
(svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents:
8919
diff
changeset
|
223 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
|
224 } |
2b6a37a13245
(svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents:
8919
diff
changeset
|
225 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
|
226 } else { |
2b6a37a13245
(svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents:
8919
diff
changeset
|
227 if (order->GetDepotActionType() & ODATFB_NEAREST_DEPOT) { |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
228 SetDParam(1, STR_ORDER_GO_TO_NEAREST_DEPOT_FORMAT); |
8929
2b6a37a13245
(svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents:
8919
diff
changeset
|
229 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
|
230 } else { |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
231 SetDParam(1, STR_ORDER_GO_TO_DEPOT_FORMAT); |
11922
0a4b63f3f3c3
(svn r16325) -Codechange: replace GetPoolItem(index) by PoolItem::Get(index)
smatz <smatz@openttd.org>
parents:
11809
diff
changeset
|
232 SetDParam(3, Depot::Get(order->GetDestination())->town_index); |
8929
2b6a37a13245
(svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents:
8919
diff
changeset
|
233 } |
2b6a37a13245
(svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents:
8919
diff
changeset
|
234 |
12484
4cdaa2d25b01
(svn r16921) -Codechange: make it more clear what strings are related to road vehicles; only ROAD isn't always enough. Also unify the way of writing it.
rubidium <rubidium@openttd.org>
parents:
12475
diff
changeset
|
235 SetDParam(4, STR_ORDER_TRAIN_DEPOT + v->type); |
8929
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 |
2b6a37a13245
(svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents:
8919
diff
changeset
|
238 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
|
239 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
|
240 } else { |
2b6a37a13245
(svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents:
8919
diff
changeset
|
241 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
|
242 } |
2b6a37a13245
(svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents:
8919
diff
changeset
|
243 |
10285
615db2678973
(svn r14524) -Add: stop-in-depot as part of orders (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
244 if (!timetable && (order->GetDepotActionType() & ODATFB_HALT)) { |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
245 SetDParam(6, STR_ORDER_STOP_ORDER); |
10285
615db2678973
(svn r14524) -Add: stop-in-depot as part of orders (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
246 } |
615db2678973
(svn r14524) -Add: stop-in-depot as part of orders (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
247 |
8929
2b6a37a13245
(svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents:
8919
diff
changeset
|
248 if (!timetable && order->IsRefit()) { |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
249 SetDParam(6, (order->GetDepotActionType() & ODATFB_HALT) ? STR_ORDER_REFIT_STOP_ORDER : STR_ORDER_REFIT_ORDER); |
12415
6a77d1df56e2
(svn r16849) -Codechange: replace GetCargo() by CargoSpec::Get()
smatz <smatz@openttd.org>
parents:
12361
diff
changeset
|
250 SetDParam(7, CargoSpec::Get(order->GetRefitCargo())->name); |
8929
2b6a37a13245
(svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents:
8919
diff
changeset
|
251 } |
2b6a37a13245
(svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents:
8919
diff
changeset
|
252 break; |
2b6a37a13245
(svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents:
8919
diff
changeset
|
253 |
2b6a37a13245
(svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents:
8919
diff
changeset
|
254 case OT_GOTO_WAYPOINT: |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
255 SetDParam(1, (order->GetNonStopType() & ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS) ? STR_ORDER_GO_NON_STOP_TO_WAYPOINT : STR_ORDER_GO_TO_WAYPOINT); |
12472
604a2cfc77ab
(svn r16909) -Fix [FS#2996]: NewGRF stations would be triggering assertions all over the place when using the more advanced station types.
rubidium <rubidium@openttd.org>
parents:
12429
diff
changeset
|
256 SetDParam(2, order->GetDestination()); |
8929
2b6a37a13245
(svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents:
8919
diff
changeset
|
257 break; |
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 case OT_CONDITIONAL: |
2b6a37a13245
(svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents:
8919
diff
changeset
|
260 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
|
261 if (order->GetConditionVariable() == OCV_UNCONDITIONALLY) { |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
262 SetDParam(1, STR_ORDER_CONDITIONAL_UNCONDITIONAL); |
8929
2b6a37a13245
(svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents:
8919
diff
changeset
|
263 } else { |
2b6a37a13245
(svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents:
8919
diff
changeset
|
264 OrderConditionComparator occ = order->GetConditionComparator(); |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
265 SetDParam(1, (occ == OCC_IS_TRUE || occ == OCC_IS_FALSE) ? STR_ORDER_CONDITIONAL_TRUE_FALSE : STR_ORDER_CONDITIONAL_NUM); |
8929
2b6a37a13245
(svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents:
8919
diff
changeset
|
266 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
|
267 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
|
268 |
2b6a37a13245
(svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents:
8919
diff
changeset
|
269 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
|
270 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
|
271 SetDParam(5, value); |
2b6a37a13245
(svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents:
8919
diff
changeset
|
272 } |
9641
d6df5044bb40
(svn r13704) -Fix: make timetables work more sensible when used in conjunction with conditional orders, i.e. make it possibly to tell how long to travel to the next destination if you jump.
rubidium <rubidium@openttd.org>
parents:
9639
diff
changeset
|
273 |
d6df5044bb40
(svn r13704) -Fix: make timetables work more sensible when used in conjunction with conditional orders, i.e. make it possibly to tell how long to travel to the next destination if you jump.
rubidium <rubidium@openttd.org>
parents:
9639
diff
changeset
|
274 if (timetable && order->wait_time > 0) { |
d6df5044bb40
(svn r13704) -Fix: make timetables work more sensible when used in conjunction with conditional orders, i.e. make it possibly to tell how long to travel to the next destination if you jump.
rubidium <rubidium@openttd.org>
parents:
9639
diff
changeset
|
275 SetDParam(6, STR_TIMETABLE_AND_TRAVEL_FOR); |
d6df5044bb40
(svn r13704) -Fix: make timetables work more sensible when used in conjunction with conditional orders, i.e. make it possibly to tell how long to travel to the next destination if you jump.
rubidium <rubidium@openttd.org>
parents:
9639
diff
changeset
|
276 SetTimetableParams(7, 8, order->wait_time); |
d6df5044bb40
(svn r13704) -Fix: make timetables work more sensible when used in conjunction with conditional orders, i.e. make it possibly to tell how long to travel to the next destination if you jump.
rubidium <rubidium@openttd.org>
parents:
9639
diff
changeset
|
277 } else { |
d6df5044bb40
(svn r13704) -Fix: make timetables work more sensible when used in conjunction with conditional orders, i.e. make it possibly to tell how long to travel to the next destination if you jump.
rubidium <rubidium@openttd.org>
parents:
9639
diff
changeset
|
278 SetDParam(6, STR_EMPTY); |
d6df5044bb40
(svn r13704) -Fix: make timetables work more sensible when used in conjunction with conditional orders, i.e. make it possibly to tell how long to travel to the next destination if you jump.
rubidium <rubidium@openttd.org>
parents:
9639
diff
changeset
|
279 } |
8929
2b6a37a13245
(svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents:
8919
diff
changeset
|
280 break; |
2b6a37a13245
(svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents:
8919
diff
changeset
|
281 |
2b6a37a13245
(svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents:
8919
diff
changeset
|
282 default: NOT_REACHED(); |
2b6a37a13245
(svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents:
8919
diff
changeset
|
283 } |
2b6a37a13245
(svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents:
8919
diff
changeset
|
284 |
2b6a37a13245
(svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents:
8919
diff
changeset
|
285 SetDParam(0, order_index + 1); |
13059
da49b7fa34f7
(svn r17557) -Codechange: Pass left and right edge to DrawOrderString().
alberth <alberth@openttd.org>
parents:
13034
diff
changeset
|
286 DrawString(left, right, y, str, selected ? TC_WHITE : TC_BLACK); |
8929
2b6a37a13245
(svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents:
8919
diff
changeset
|
287 } |
2b6a37a13245
(svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents:
8919
diff
changeset
|
288 |
2b6a37a13245
(svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros <maedhros@openttd.org>
parents:
8919
diff
changeset
|
289 |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
290 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
|
291 { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
292 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
|
293 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
|
294 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
|
295 |
8871
24e1116b32f6
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents:
8869
diff
changeset
|
296 /* 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
|
297 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
|
298 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
|
299 case MP_RAILWAY: |
10207
c54d140df948
(svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents:
10185
diff
changeset
|
300 if (v->type == VEH_TRAIN && IsTileOwner(tile, _local_company)) { |
8871
24e1116b32f6
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents:
8869
diff
changeset
|
301 if (IsRailDepot(tile)) { |
13001
c2298b1d3f83
(svn r17495) -Codechange: replace 'Depot::Get(GetDepotIndex(tile))->index' with GetDepotIndex(tile)
rubidium <rubidium@openttd.org>
parents:
12909
diff
changeset
|
302 order.MakeGoToDepot(GetDepotIndex(tile), ODTFB_PART_OF_ORDERS, |
11809
57fd0a8c36cb
(svn r16199) -Codechange: Pass OrderNonStopFlags also to MakeGoToDepotOrder().
frosch <frosch@openttd.org>
parents:
11807
diff
changeset
|
303 _settings_client.gui.new_nonstop ? ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS : ONSF_STOP_EVERYWHERE); |
10570
4ab8ac10807c
(svn r14827) -Feature [FS#1984]: few (optional) optimisations to making (initial) orders (sulai)
rubidium <rubidium@openttd.org>
parents:
10562
diff
changeset
|
304 if (_ctrl_pressed) order.SetDepotOrderType((OrderDepotTypeFlags)(order.GetDepotOrderType() ^ ODTFB_SERVICE)); |
8871
24e1116b32f6
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents:
8869
diff
changeset
|
305 return order; |
24e1116b32f6
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents:
8869
diff
changeset
|
306 } |
24e1116b32f6
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents:
8869
diff
changeset
|
307 } |
24e1116b32f6
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents:
8869
diff
changeset
|
308 break; |
24e1116b32f6
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents:
8869
diff
changeset
|
309 |
24e1116b32f6
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents:
8869
diff
changeset
|
310 case MP_ROAD: |
10207
c54d140df948
(svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents:
10185
diff
changeset
|
311 if (IsRoadDepot(tile) && v->type == VEH_ROAD && IsTileOwner(tile, _local_company)) { |
13001
c2298b1d3f83
(svn r17495) -Codechange: replace 'Depot::Get(GetDepotIndex(tile))->index' with GetDepotIndex(tile)
rubidium <rubidium@openttd.org>
parents:
12909
diff
changeset
|
312 order.MakeGoToDepot(GetDepotIndex(tile), ODTFB_PART_OF_ORDERS, |
11809
57fd0a8c36cb
(svn r16199) -Codechange: Pass OrderNonStopFlags also to MakeGoToDepotOrder().
frosch <frosch@openttd.org>
parents:
11807
diff
changeset
|
313 _settings_client.gui.new_nonstop ? ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS : ONSF_STOP_EVERYWHERE); |
10570
4ab8ac10807c
(svn r14827) -Feature [FS#1984]: few (optional) optimisations to making (initial) orders (sulai)
rubidium <rubidium@openttd.org>
parents:
10562
diff
changeset
|
314 if (_ctrl_pressed) order.SetDepotOrderType((OrderDepotTypeFlags)(order.GetDepotOrderType() ^ ODTFB_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
|
315 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
|
316 } |
8871
24e1116b32f6
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents:
8869
diff
changeset
|
317 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
|
318 |
8871
24e1116b32f6
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents:
8869
diff
changeset
|
319 case MP_STATION: |
24e1116b32f6
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents:
8869
diff
changeset
|
320 if (v->type != VEH_AIRCRAFT) break; |
10207
c54d140df948
(svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents:
10185
diff
changeset
|
321 if (IsHangar(tile) && IsTileOwner(tile, _local_company)) { |
11809
57fd0a8c36cb
(svn r16199) -Codechange: Pass OrderNonStopFlags also to MakeGoToDepotOrder().
frosch <frosch@openttd.org>
parents:
11807
diff
changeset
|
322 order.MakeGoToDepot(GetStationIndex(tile), ODTFB_PART_OF_ORDERS, ONSF_STOP_EVERYWHERE); |
10570
4ab8ac10807c
(svn r14827) -Feature [FS#1984]: few (optional) optimisations to making (initial) orders (sulai)
rubidium <rubidium@openttd.org>
parents:
10562
diff
changeset
|
323 if (_ctrl_pressed) order.SetDepotOrderType((OrderDepotTypeFlags)(order.GetDepotOrderType() ^ ODTFB_SERVICE)); |
8871
24e1116b32f6
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents:
8869
diff
changeset
|
324 return order; |
24e1116b32f6
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents:
8869
diff
changeset
|
325 } |
24e1116b32f6
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents:
8869
diff
changeset
|
326 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
|
327 |
8871
24e1116b32f6
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents:
8869
diff
changeset
|
328 case MP_WATER: |
24e1116b32f6
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents:
8869
diff
changeset
|
329 if (v->type != VEH_SHIP) break; |
10207
c54d140df948
(svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents:
10185
diff
changeset
|
330 if (IsShipDepot(tile) && IsTileOwner(tile, _local_company)) { |
13001
c2298b1d3f83
(svn r17495) -Codechange: replace 'Depot::Get(GetDepotIndex(tile))->index' with GetDepotIndex(tile)
rubidium <rubidium@openttd.org>
parents:
12909
diff
changeset
|
331 order.MakeGoToDepot(GetDepotIndex(tile), ODTFB_PART_OF_ORDERS, ONSF_STOP_EVERYWHERE); |
10570
4ab8ac10807c
(svn r14827) -Feature [FS#1984]: few (optional) optimisations to making (initial) orders (sulai)
rubidium <rubidium@openttd.org>
parents:
10562
diff
changeset
|
332 if (_ctrl_pressed) order.SetDepotOrderType((OrderDepotTypeFlags)(order.GetDepotOrderType() ^ ODTFB_SERVICE)); |
8871
24e1116b32f6
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents:
8869
diff
changeset
|
333 return order; |
24e1116b32f6
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents:
8869
diff
changeset
|
334 } |
5584
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 default: |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
337 break; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
338 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
339 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
340 |
8871
24e1116b32f6
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents:
8869
diff
changeset
|
341 /* check waypoint */ |
10099
3bb7e18e8b0a
(svn r14280) -Codechange: use IsRailWaypointTile() instead of IsTileType() and IsRailWaypoint() checks at several places
smatz <smatz@openttd.org>
parents:
9942
diff
changeset
|
342 if (IsRailWaypointTile(tile) && |
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
|
343 v->type == VEH_TRAIN && |
10207
c54d140df948
(svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents:
10185
diff
changeset
|
344 IsTileOwner(tile, _local_company)) { |
12429
e1e3ec11cd99
(svn r16863) -Codechange: GetWaypointByTile -> Waypoint::GetByTile, like used for e.g. stations
rubidium <rubidium@openttd.org>
parents:
12415
diff
changeset
|
345 order.MakeGoToWaypoint(Waypoint::GetByTile(tile)->index); |
10570
4ab8ac10807c
(svn r14827) -Feature [FS#1984]: few (optional) optimisations to making (initial) orders (sulai)
rubidium <rubidium@openttd.org>
parents:
10562
diff
changeset
|
346 if (_settings_client.gui.new_nonstop != _ctrl_pressed) order.SetNonStopType(ONSF_NO_STOP_AT_ANY_STATION); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
347 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
|
348 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
349 |
12472
604a2cfc77ab
(svn r16909) -Fix [FS#2996]: NewGRF stations would be triggering assertions all over the place when using the more advanced station types.
rubidium <rubidium@openttd.org>
parents:
12429
diff
changeset
|
350 if ((IsBuoyTile(tile) && v->type == VEH_SHIP) || (IsRailWaypointTile(tile) && v->type == VEH_TRAIN)) { |
12361
82830e1cd892
(svn r16785) -Codechange: make ships going to buoys use OT_GOTO_WAYPOINT too
rubidium <rubidium@openttd.org>
parents:
12231
diff
changeset
|
351 order.MakeGoToWaypoint(GetStationIndex(tile)); |
82830e1cd892
(svn r16785) -Codechange: make ships going to buoys use OT_GOTO_WAYPOINT too
rubidium <rubidium@openttd.org>
parents:
12231
diff
changeset
|
352 return order; |
82830e1cd892
(svn r16785) -Codechange: make ships going to buoys use OT_GOTO_WAYPOINT too
rubidium <rubidium@openttd.org>
parents:
12231
diff
changeset
|
353 } |
82830e1cd892
(svn r16785) -Codechange: make ships going to buoys use OT_GOTO_WAYPOINT too
rubidium <rubidium@openttd.org>
parents:
12231
diff
changeset
|
354 |
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 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
|
356 StationID st_index = GetStationIndex(tile); |
11922
0a4b63f3f3c3
(svn r16325) -Codechange: replace GetPoolItem(index) by PoolItem::Get(index)
smatz <smatz@openttd.org>
parents:
11809
diff
changeset
|
357 const Station *st = Station::Get(st_index); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
358 |
10996
ce54bfd52120
(svn r15336) -Fix: do not use _current_company in the GUI as there are no guarantees that _current_company is the same as _local_company.
rubidium <rubidium@openttd.org>
parents:
10973
diff
changeset
|
359 if (st->owner == _local_company || st->owner == OWNER_NONE) { |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
360 byte facil; |
8871
24e1116b32f6
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents:
8869
diff
changeset
|
361 (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
|
362 (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
|
363 (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
|
364 (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
|
365 (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
|
366 if (st->facilities & facil) { |
8836
890a77315801
(svn r12584) -Codechange: do not access the order type directly.
rubidium <rubidium@openttd.org>
parents:
8787
diff
changeset
|
367 order.MakeGoToStation(st_index); |
10570
4ab8ac10807c
(svn r14827) -Feature [FS#1984]: few (optional) optimisations to making (initial) orders (sulai)
rubidium <rubidium@openttd.org>
parents:
10562
diff
changeset
|
368 if (_ctrl_pressed) order.SetLoadType(OLF_FULL_LOAD_ANY); |
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
|
369 if (_settings_client.gui.new_nonstop && (v->type == VEH_TRAIN || v->type == VEH_ROAD)) order.SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS); |
11657
ff1084d0d8a0
(svn r16037) -Feature: allow (per order) to let a train stop at the near end, middle or far end of a platform from the point of view of the driver of the train that enters the station.
rubidium <rubidium@openttd.org>
parents:
11524
diff
changeset
|
370 order.SetStopLocation(v->type == VEH_TRAIN ? (OrderStopLocation)(_settings_client.gui.stop_location) : OSL_PLATFORM_FAR_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
|
371 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
|
372 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
373 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
374 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
375 |
8871
24e1116b32f6
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents:
8869
diff
changeset
|
376 /* 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
|
377 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
|
378 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
|
379 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
380 |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
381 /** %Order window code for all vehicles. |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
382 * |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
383 * At the bottom of the window two button rows are located for changing the orders of the vehicle. |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
384 * |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
385 * \section top-row Top row |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
386 * The top-row is for manipulating an individual order. What row is displayed depends on the type of vehicle, and whether or not you are the owner of the vehicle. |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
387 * |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
388 * The top-row buttons of one of your trains or road vehicles is one of the following three cases: |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
389 * \verbatim |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
390 * +-----------------+-----------------+-----------------+ |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
391 * | NON-STOP | FULL_LOAD | UNLOAD | (normal) |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
392 * +-----------------+-----------------+-----------------+ |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
393 * | COND_VAR | COND_COMPARATOR | COND_VALUE | (for conditional orders) |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
394 * +-----------------+-----------------+-----------------+ |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
395 * | NON-STOP | REFIT | SERVICE | (for depot orders) |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
396 * +-----------------+-----------------+-----------------+ |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
397 * \endverbatim |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
398 * |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
399 * Airplanes and ships have one of the following three top-row button rows: |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
400 * \verbatim |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
401 * +--------------------------+--------------------------+ |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
402 * | FULL_LOAD | UNLOAD | (normal) |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
403 * +-----------------+--------+--------+-----------------+ |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
404 * | COND_VAR | COND_COMPARATOR | COND_VALUE | (for conditional orders) |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
405 * +-----------------+--------+--------+-----------------+ |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
406 * | REFIT | SERVICE | (for depot order) |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
407 * +--------------------------+--------------------------+ |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
408 * \endverbatim |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
409 * |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
410 * \section bottom-row Bottom row |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
411 * The second row (the bottom row) is for manipulating the list of orders: |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
412 * \verbatim |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
413 * +-----------------+-----------------+-----------------+ |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
414 * | SKIP | DELETE | GOTO | |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
415 * +-----------------+-----------------+-----------------+ |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
416 * \endverbatim |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
417 * |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
418 * For vehicles of other companies, both button rows are not displayed. |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
419 */ |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
420 struct OrdersWindow : public Window { |
11801
066e6b5662dc
(svn r16191) -Codechange: Added nested widgets of one order window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
421 private: |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
422 /** 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
|
423 enum OrderPlaceObjectState { |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
424 OPOS_GOTO, |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
425 OPOS_CONDITIONAL, |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
426 }; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
427 |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
428 /** Displayed planes of the #NWID_SELECTION widgets. */ |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
429 enum DisplayPane { |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
430 /* ORDER_WIDGET_SEL_TOP_LEFT */ |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
431 DP_LEFT_NONSTOP = 0, ///< Display 'non stop' in the left button of the top row of the train/rv order window. |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
432 DP_LEFT_CONDVAR = 1, ///< Display condition variable in the left button of the top row of the train/rv order window. |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
433 |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
434 /* ORDER_WIDGET_SEL_TOP_MIDDLE */ |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
435 DP_MIDDLE_LOAD = 0, ///< Display 'load' in the middle button of the top row of the train/rv order window. |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
436 DP_MIDDLE_REFIT = 1, ///< Display 'refit' in the middle button of the top row of the train/rv order window. |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
437 DP_MIDDLE_COMPARE = 2, ///< Display compare operator in the middle button of the top row of the train/rv order window. |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
438 |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
439 /* ORDER_WIDGET_SEL_TOP_RIGHT */ |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
440 DP_RIGHT_UNLOAD = 0, ///< Display 'unload' in the right button of the top row of the train/rv order window. |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
441 DP_RIGHT_SERVICE = 1, ///< Display 'service' in the right button of the top row of the train/rv order window. |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
442 DP_RIGHT_CONDVAL = 2, ///< Display condition value in the right button of the top row of the train/rv order window. |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
443 |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
444 /* ORDER_WIDGET_SEL_TOP_ROW */ |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
445 DP_ROW_LOAD = 0, ///< Display 'load' / 'unload' buttons in the top row of the ship/airplane order window. |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
446 DP_ROW_DEPOT = 1, ///< Display 'refit' / 'service' buttons in the top row of the ship/airplane order window. |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
447 DP_ROW_CONDITIONAL = 2, ///< Display the conditional order buttons in the top row of the ship/airplane order window. |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
448 }; |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
449 |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
450 int selected_order; |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
451 OrderPlaceObjectState goto_type; |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
452 const Vehicle *vehicle; ///< Vehicle owning the orders being displayed and manipulated. |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
453 |
9258
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 * Return the memorised selected order. |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
456 * @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
|
457 * else return the number of orders |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
458 */ |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
459 int OrderGetSel() const |
9258
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 int num = this->selected_order; |
10544
836dfaca2a32
(svn r14801) -Codechange: don't reference Vehicle::num_orders directly but through a method GetNumOrders() (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10527
diff
changeset
|
462 return (num >= 0 && num < vehicle->GetNumOrders()) ? num : vehicle->GetNumOrders(); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
463 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
464 |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
465 /** |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
466 * Calculate the selected order. |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
467 * 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
|
468 * the position of the scrollbar. |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
469 * |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
470 * @param y Y-value of the click relative to the window origin |
11696
723597e7fea7
(svn r16081) -Doc: Adding/fixing some Doxygen comments.
alberth <alberth@openttd.org>
parents:
11695
diff
changeset
|
471 * @return The selected order if the order is valid, else return \c INVALID_ORDER. |
9258
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 int GetOrderFromPt(int y) |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
474 { |
13078
854fcab2b59d
(svn r17578) -Fix (r17572): Some compilers don't like default function template arguments.
alberth <alberth@openttd.org>
parents:
13077
diff
changeset
|
475 int sel = (y - this->GetWidget<NWidgetBase>(ORDER_WIDGET_ORDER_LIST)->pos_y - WD_FRAMERECT_TOP) / this->resize.step_height; // Selected line in the ORDER_WIDGET_ORDER_LIST panel. |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
476 |
12879
225a7fccc489
(svn r17371) -Codechange: make the newgrf, news and order GUIs use the scrollbar wrappers
rubidium <rubidium@openttd.org>
parents:
12789
diff
changeset
|
477 if ((uint)sel >= this->vscroll.GetCapacity()) return INVALID_ORDER; |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
478 |
12879
225a7fccc489
(svn r17371) -Codechange: make the newgrf, news and order GUIs use the scrollbar wrappers
rubidium <rubidium@openttd.org>
parents:
12789
diff
changeset
|
479 sel += this->vscroll.GetPosition(); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
480 |
10544
836dfaca2a32
(svn r14801) -Codechange: don't reference Vehicle::num_orders directly but through a method GetNumOrders() (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10527
diff
changeset
|
481 return (sel <= vehicle->GetNumOrders() && sel >= 0) ? sel : INVALID_ORDER; |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
482 } |
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
|
483 |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
484 bool HandleOrderVehClick(const Vehicle *u) |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
485 { |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
486 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
|
487 |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
488 if (!u->IsPrimaryVehicle()) { |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
489 u = u->First(); |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
490 if (!u->IsPrimaryVehicle()) return false; |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
491 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
492 |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
493 /* 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
|
494 * obviously if you press CTRL on a non-empty orders vehicle you know what you are doing */ |
10544
836dfaca2a32
(svn r14801) -Codechange: don't reference Vehicle::num_orders directly but through a method GetNumOrders() (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10527
diff
changeset
|
495 if (this->vehicle->GetNumOrders() != 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
|
496 |
10499
45ca88a8de7d
(svn r14754) -Codechange: get rid of _cmd_text and just pass it as (optional) parameter.
rubidium <rubidium@openttd.org>
parents:
10285
diff
changeset
|
497 if (DoCommandP(this->vehicle->tile, this->vehicle->index | (u->index << 16), _ctrl_pressed ? CO_SHARE : CO_COPY, |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
498 _ctrl_pressed ? CMD_CLONE_ORDER | CMD_MSG(STR_ERROR_CAN_T_SHARE_ORDER_LIST) : CMD_CLONE_ORDER | CMD_MSG(STR_ERROR_CAN_T_COPY_ORDER_LIST))) { |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
499 this->selected_order = -1; |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
500 ResetObjectToPlace(); |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
501 } |
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
|
502 |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
503 return true; |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
504 } |
8900
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8896
diff
changeset
|
505 |
9258
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 * Handle the click on the goto button. |
13013
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
508 * @param i Dummy parameter. |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
509 */ |
13013
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
510 void OrderClick_Goto(int i) |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
511 { |
13034
6eb3f749890a
(svn r17532) -Codechange: Rename several Invalidate functions to SetDirty for more consistency and distinguishability.
frosch <frosch@openttd.org>
parents:
13013
diff
changeset
|
512 this->SetWidgetDirty(ORDER_WIDGET_GOTO); |
13013
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
513 this->ToggleWidgetLoweredState(ORDER_WIDGET_GOTO); |
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
514 if (this->IsWidgetLowered(ORDER_WIDGET_GOTO)) { |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
515 _place_clicked_vehicle = NULL; |
13013
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
516 SetObjectToPlaceWnd(ANIMCURSOR_PICKSTATION, PAL_NONE, HT_RECT, this); |
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
517 this->goto_type = OPOS_GOTO; |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
518 } else { |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
519 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
|
520 } |
23eea6824c4b
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium <rubidium@openttd.org>
parents:
8882
diff
changeset
|
521 } |
23eea6824c4b
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium <rubidium@openttd.org>
parents:
8882
diff
changeset
|
522 |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
523 /** |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
524 * 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
|
525 * @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
|
526 */ |
13013
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
527 void OrderClick_FullLoad(int load_type) |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
528 { |
13013
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
529 VehicleOrderID sel_ord = this->OrderGetSel(); |
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
530 const Order *order = this->vehicle->GetOrder(sel_ord); |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
531 |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
532 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
|
533 |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
534 if (load_type < 0) { |
9485
963b653e2e61
(svn r13444) -Codechange: make the order GUI somewhat more efficient. The most used options can be done with a single click now.
rubidium <rubidium@openttd.org>
parents:
9475
diff
changeset
|
535 load_type = order->GetLoadType() == OLF_LOAD_IF_POSSIBLE ? OLF_FULL_LOAD_ANY : OLF_LOAD_IF_POSSIBLE; |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
536 } |
13013
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
537 DoCommandP(this->vehicle->tile, this->vehicle->index + (sel_ord << 16), MOF_LOAD | (load_type << 4), CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER)); |
9258
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 /** |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
541 * Handle the click on the service. |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
542 */ |
13013
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
543 void OrderClick_Service(int i) |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
544 { |
13013
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
545 VehicleOrderID sel_ord = this->OrderGetSel(); |
10285
615db2678973
(svn r14524) -Add: stop-in-depot as part of orders (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
546 |
615db2678973
(svn r14524) -Add: stop-in-depot as part of orders (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
547 if (i < 0) { |
13013
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
548 const Order *order = this->vehicle->GetOrder(sel_ord); |
10285
615db2678973
(svn r14524) -Add: stop-in-depot as part of orders (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
549 if (order == NULL) return; |
615db2678973
(svn r14524) -Add: stop-in-depot as part of orders (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
550 i = (order->GetDepotOrderType() & ODTFB_SERVICE) ? DA_ALWAYS_GO : DA_SERVICE; |
615db2678973
(svn r14524) -Add: stop-in-depot as part of orders (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
551 } |
13013
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
552 DoCommandP(this->vehicle->tile, this->vehicle->index + (sel_ord << 16), MOF_DEPOT_ACTION | (i << 4), CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER)); |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
553 } |
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 /** |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
556 * Handle the click on the service in nearest depot button. |
13013
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
557 * @param i Dummy parameter. |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
558 */ |
13013
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
559 void OrderClick_NearestDepot(int i) |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
560 { |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
561 Order order; |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
562 order.next = NULL; |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
563 order.index = 0; |
11809
57fd0a8c36cb
(svn r16199) -Codechange: Pass OrderNonStopFlags also to MakeGoToDepotOrder().
frosch <frosch@openttd.org>
parents:
11807
diff
changeset
|
564 order.MakeGoToDepot(0, ODTFB_PART_OF_ORDERS, |
13013
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
565 _settings_client.gui.new_nonstop && (this->vehicle->type == VEH_TRAIN || this->vehicle->type == VEH_ROAD) ? ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS : ONSF_STOP_EVERYWHERE); |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
566 order.SetDepotActionType(ODATFB_NEAREST_DEPOT); |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
567 |
13013
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
568 DoCommandP(this->vehicle->tile, this->vehicle->index + (this->OrderGetSel() << 16), order.Pack(), CMD_INSERT_ORDER | CMD_MSG(STR_ERROR_CAN_T_INSERT_NEW_ORDER)); |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
569 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
570 |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
571 /** |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
572 * Handle the click on the conditional order button. |
13013
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
573 * @param i Dummy parameter. |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
574 */ |
13013
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
575 void OrderClick_Conditional(int i) |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
576 { |
13034
6eb3f749890a
(svn r17532) -Codechange: Rename several Invalidate functions to SetDirty for more consistency and distinguishability.
frosch <frosch@openttd.org>
parents:
13013
diff
changeset
|
577 this->SetWidgetDirty(ORDER_WIDGET_GOTO); |
13013
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
578 this->LowerWidget(ORDER_WIDGET_GOTO); |
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
579 SetObjectToPlaceWnd(ANIMCURSOR_PICKSTATION, PAL_NONE, HT_RECT, this); |
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
580 this->goto_type = OPOS_CONDITIONAL; |
9258
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 |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
583 /** |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
584 * 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
|
585 */ |
13013
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
586 void OrderClick_Unload(int unload_type) |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
587 { |
13013
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
588 VehicleOrderID sel_ord = this->OrderGetSel(); |
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
589 const Order *order = this->vehicle->GetOrder(sel_ord); |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
590 |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
591 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
|
592 |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
593 if (unload_type < 0) { |
9485
963b653e2e61
(svn r13444) -Codechange: make the order GUI somewhat more efficient. The most used options can be done with a single click now.
rubidium <rubidium@openttd.org>
parents:
9475
diff
changeset
|
594 unload_type = order->GetUnloadType() == OUF_UNLOAD_IF_POSSIBLE ? OUFB_UNLOAD : OUF_UNLOAD_IF_POSSIBLE; |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
595 } |
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
|
596 |
13013
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
597 DoCommandP(this->vehicle->tile, this->vehicle->index + (sel_ord << 16), MOF_UNLOAD | (unload_type << 4), CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER)); |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
598 } |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
599 |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
600 /** |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
601 * 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
|
602 * @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
|
603 */ |
13013
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
604 void OrderClick_Nonstop(int non_stop) |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
605 { |
13013
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
606 VehicleOrderID sel_ord = this->OrderGetSel(); |
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
607 const Order *order = this->vehicle->GetOrder(sel_ord); |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
608 |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
609 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
|
610 |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
611 /* 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
|
612 if (non_stop < 0) { |
9485
963b653e2e61
(svn r13444) -Codechange: make the order GUI somewhat more efficient. The most used options can be done with a single click now.
rubidium <rubidium@openttd.org>
parents:
9475
diff
changeset
|
613 non_stop = order->GetNonStopType() ^ ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS; |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
614 } |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
615 |
13034
6eb3f749890a
(svn r17532) -Codechange: Rename several Invalidate functions to SetDirty for more consistency and distinguishability.
frosch <frosch@openttd.org>
parents:
13013
diff
changeset
|
616 this->SetWidgetDirty(ORDER_WIDGET_NON_STOP); |
13013
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
617 DoCommandP(this->vehicle->tile, this->vehicle->index + (sel_ord << 16), MOF_NON_STOP | non_stop << 4, CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER)); |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
618 } |
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 /** |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
621 * Handle the click on the skip button. |
13013
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
622 * If ctrl is pressed, skip to selected order, else skip to current order + 1 |
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
623 * @param i Dummy parameter. |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
624 */ |
13013
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
625 void OrderClick_Skip(int i) |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
626 { |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
627 /* Don't skip when there's nothing to skip */ |
13013
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
628 if (_ctrl_pressed && this->vehicle->cur_order_index == this->OrderGetSel()) return; |
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
629 if (this->vehicle->GetNumOrders() <= 1) 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
|
630 |
13013
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
631 DoCommandP(this->vehicle->tile, this->vehicle->index, _ctrl_pressed ? this->OrderGetSel() : ((this->vehicle->cur_order_index + 1) % this->vehicle->GetNumOrders()), |
11730
a39da1e4c1f5
(svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents:
11706
diff
changeset
|
632 CMD_SKIP_TO_ORDER | CMD_MSG(_ctrl_pressed ? STR_ERROR_CAN_T_SKIP_TO_ORDER : STR_ERROR_CAN_T_SKIP_ORDER)); |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
633 } |
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
|
634 |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
635 /** |
10184
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
636 * Handle the click on the delete button. |
13013
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
637 * @param i Dummy parameter. |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
638 */ |
13013
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
639 void OrderClick_Delete(int i) |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
640 { |
10184
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
641 /* When networking, move one order lower */ |
13013
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
642 int selected = this->selected_order + (int)_networking; |
10184
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
643 |
13013
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
644 if (DoCommandP(this->vehicle->tile, this->vehicle->index, this->OrderGetSel(), CMD_DELETE_ORDER | CMD_MSG(STR_ERROR_CAN_T_DELETE_THIS_ORDER))) { |
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
645 this->selected_order = selected >= this->vehicle->GetNumOrders() ? -1 : selected; |
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
646 this->UpdateButtonState(); |
10184
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
647 } |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
648 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
649 |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
650 /** |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
651 * Handle the click on the refit button. |
13013
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
652 * If ctrl is pressed, cancel refitting, else show the refit window. |
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
653 * @param i Dummy parameter. |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
654 */ |
13013
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
655 void OrderClick_Refit(int i) |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
656 { |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
657 if (_ctrl_pressed) { |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
658 /* Cancel refitting */ |
13013
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
659 DoCommandP(this->vehicle->tile, this->vehicle->index, (this->OrderGetSel() << 16) | (CT_NO_REFIT << 8) | CT_NO_REFIT, CMD_ORDER_REFIT); |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
660 } else { |
13013
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
661 ShowVehicleRefitWindow(this->vehicle, this->OrderGetSel(), this); |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
662 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
663 } |
13013
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
664 typedef void (OrdersWindow::*Handler)(int); |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
665 struct KeyToEvent { |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
666 uint16 keycode; |
13013
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
667 Handler proc; |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
668 }; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
669 |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
670 public: |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
671 OrdersWindow(const WindowDesc *desc, const Vehicle *v) : Window() |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
672 { |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
673 this->vehicle = v; |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
674 |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
675 this->InitNested(desc, v->index); |
11703
3a65f1d91228
(svn r16089) -Codechange: Removing the ORDER_WIDGET_RESIZE_BAR widget
alberth <alberth@openttd.org>
parents:
11702
diff
changeset
|
676 |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
677 this->selected_order = -1; |
11084
e07c7d3925c8
(svn r15427) -Codechange: give w->caption_color a more sensible name as it holds the owner of whatever is shown in the window
rubidium <rubidium@openttd.org>
parents:
11069
diff
changeset
|
678 this->owner = v->owner; |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
679 |
10867
eede61d2681e
(svn r15202) -Fix (r14827): only make quick goto active for your own company
rubidium <rubidium@openttd.org>
parents:
10582
diff
changeset
|
680 if (_settings_client.gui.quick_goto && v->owner == _local_company) { |
10570
4ab8ac10807c
(svn r14827) -Feature [FS#1984]: few (optional) optimisations to making (initial) orders (sulai)
rubidium <rubidium@openttd.org>
parents:
10562
diff
changeset
|
681 /* If there are less than 2 station, make Go To active. */ |
4ab8ac10807c
(svn r14827) -Feature [FS#1984]: few (optional) optimisations to making (initial) orders (sulai)
rubidium <rubidium@openttd.org>
parents:
10562
diff
changeset
|
682 int station_orders = 0; |
4ab8ac10807c
(svn r14827) -Feature [FS#1984]: few (optional) optimisations to making (initial) orders (sulai)
rubidium <rubidium@openttd.org>
parents:
10562
diff
changeset
|
683 const Order *order; |
4ab8ac10807c
(svn r14827) -Feature [FS#1984]: few (optional) optimisations to making (initial) orders (sulai)
rubidium <rubidium@openttd.org>
parents:
10562
diff
changeset
|
684 FOR_VEHICLE_ORDERS(v, order) { |
4ab8ac10807c
(svn r14827) -Feature [FS#1984]: few (optional) optimisations to making (initial) orders (sulai)
rubidium <rubidium@openttd.org>
parents:
10562
diff
changeset
|
685 if (order->IsType(OT_GOTO_STATION)) station_orders++; |
4ab8ac10807c
(svn r14827) -Feature [FS#1984]: few (optional) optimisations to making (initial) orders (sulai)
rubidium <rubidium@openttd.org>
parents:
10562
diff
changeset
|
686 } |
4ab8ac10807c
(svn r14827) -Feature [FS#1984]: few (optional) optimisations to making (initial) orders (sulai)
rubidium <rubidium@openttd.org>
parents:
10562
diff
changeset
|
687 |
13013
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
688 if (station_orders < 2) this->OrderClick_Goto(0); |
10570
4ab8ac10807c
(svn r14827) -Feature [FS#1984]: few (optional) optimisations to making (initial) orders (sulai)
rubidium <rubidium@openttd.org>
parents:
10562
diff
changeset
|
689 } |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
690 this->OnInvalidateData(-2); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
691 } |
10570
4ab8ac10807c
(svn r14827) -Feature [FS#1984]: few (optional) optimisations to making (initial) orders (sulai)
rubidium <rubidium@openttd.org>
parents:
10562
diff
changeset
|
692 |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
693 virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *resize) |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
694 { |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
695 switch (widget) { |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
696 case ORDER_WIDGET_TIMETABLE_VIEW: |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
697 if (!_settings_game.order.timetabling) size->width = 0; |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
698 break; |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
699 |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
700 case ORDER_WIDGET_ORDER_LIST: |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
701 resize->height = FONT_HEIGHT_NORMAL; |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
702 size->height = 6 * resize->height + WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM; |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
703 break; |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
704 |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
705 case ORDER_WIDGET_COND_VARIABLE: { |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
706 Dimension d = {0, 0}; |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
707 for (int i = 0; _order_conditional_variable[i] != INVALID_STRING_ID; i++) { |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
708 d = maxdim(d, GetStringBoundingBox(_order_conditional_variable[i])); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
709 } |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
710 d.width += padding.width; |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
711 d.height += padding.height; |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
712 *size = maxdim(*size, d); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
713 break; |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
714 } |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
715 |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
716 case ORDER_WIDGET_COND_COMPARATOR: { |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
717 Dimension d = {0, 0}; |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
718 for (int i = 0; _order_conditional_condition[i] != INVALID_STRING_ID; i++) { |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
719 d = maxdim(d, GetStringBoundingBox(_order_conditional_condition[i])); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
720 } |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
721 d.width += padding.width; |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
722 d.height += padding.height; |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
723 *size = maxdim(*size, d); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
724 break; |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
725 } |
9258
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 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
728 |
10184
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
729 virtual void OnInvalidateData(int data) |
9862
699b265b904b
(svn r14007) -Fix [FS#2098]: Notify vehicle windows when their internal state is botched up from outside.
frosch <frosch@openttd.org>
parents:
9760
diff
changeset
|
730 { |
10184
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
731 switch (data) { |
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
732 case 0: |
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
733 /* Autoreplace replaced the vehicle */ |
11922
0a4b63f3f3c3
(svn r16325) -Codechange: replace GetPoolItem(index) by PoolItem::Get(index)
smatz <smatz@openttd.org>
parents:
11809
diff
changeset
|
734 this->vehicle = Vehicle::Get(this->window_number); |
10184
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
735 break; |
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
736 |
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
737 case -1: |
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
738 /* Removed / replaced all orders (after deleting / sharing) */ |
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
739 if (this->selected_order == -1) break; |
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
740 |
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
741 this->DeleteChildWindows(); |
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
742 HideDropDownMenu(this); |
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
743 this->selected_order = -1; |
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
744 break; |
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
745 |
12892
2245b86757b7
(svn r17384) -Fix [FS#2859]: remove all order window state changes out of the drawing routine and call them immediately when changes happen instead of on the next OnPaint. This prevents pressing buttons when they should've been already disabled.
rubidium <rubidium@openttd.org>
parents:
12883
diff
changeset
|
746 case -2: |
2245b86757b7
(svn r17384) -Fix [FS#2859]: remove all order window state changes out of the drawing routine and call them immediately when changes happen instead of on the next OnPaint. This prevents pressing buttons when they should've been already disabled.
rubidium <rubidium@openttd.org>
parents:
12883
diff
changeset
|
747 /* Some other order changes */ |
2245b86757b7
(svn r17384) -Fix [FS#2859]: remove all order window state changes out of the drawing routine and call them immediately when changes happen instead of on the next OnPaint. This prevents pressing buttons when they should've been already disabled.
rubidium <rubidium@openttd.org>
parents:
12883
diff
changeset
|
748 break; |
2245b86757b7
(svn r17384) -Fix [FS#2859]: remove all order window state changes out of the drawing routine and call them immediately when changes happen instead of on the next OnPaint. This prevents pressing buttons when they should've been already disabled.
rubidium <rubidium@openttd.org>
parents:
12883
diff
changeset
|
749 |
10184
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
750 default: { |
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
751 /* Moving an order. If one of these is INVALID_VEH_ORDER_ID, then |
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
752 * the order is being created / removed */ |
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
753 if (this->selected_order == -1) break; |
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
754 |
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
755 VehicleOrderID from = GB(data, 0, 8); |
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
756 VehicleOrderID to = GB(data, 8, 8); |
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
757 |
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
758 if (from == to) break; // no need to change anything |
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
759 |
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
760 if (from != this->selected_order) { |
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
761 /* Moving from preceeding order? */ |
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
762 this->selected_order -= (int)(from <= this->selected_order); |
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
763 /* Moving to preceeding order? */ |
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
764 this->selected_order += (int)(to <= this->selected_order); |
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
765 break; |
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
766 } |
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
767 |
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
768 /* Now we are modifying the selected order */ |
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
769 if (to == INVALID_VEH_ORDER_ID) { |
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
770 /* Deleting selected order */ |
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
771 this->DeleteChildWindows(); |
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
772 HideDropDownMenu(this); |
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
773 this->selected_order = -1; |
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
774 break; |
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
775 } |
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
776 |
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
777 /* Moving selected order */ |
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
778 this->selected_order = to; |
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
779 } break; |
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
780 } |
12892
2245b86757b7
(svn r17384) -Fix [FS#2859]: remove all order window state changes out of the drawing routine and call them immediately when changes happen instead of on the next OnPaint. This prevents pressing buttons when they should've been already disabled.
rubidium <rubidium@openttd.org>
parents:
12883
diff
changeset
|
781 |
2245b86757b7
(svn r17384) -Fix [FS#2859]: remove all order window state changes out of the drawing routine and call them immediately when changes happen instead of on the next OnPaint. This prevents pressing buttons when they should've been already disabled.
rubidium <rubidium@openttd.org>
parents:
12883
diff
changeset
|
782 this->vscroll.SetCount(this->vehicle->GetNumOrders() + 1); |
2245b86757b7
(svn r17384) -Fix [FS#2859]: remove all order window state changes out of the drawing routine and call them immediately when changes happen instead of on the next OnPaint. This prevents pressing buttons when they should've been already disabled.
rubidium <rubidium@openttd.org>
parents:
12883
diff
changeset
|
783 this->UpdateButtonState(); |
9862
699b265b904b
(svn r14007) -Fix [FS#2098]: Notify vehicle windows when their internal state is botched up from outside.
frosch <frosch@openttd.org>
parents:
9760
diff
changeset
|
784 } |
699b265b904b
(svn r14007) -Fix [FS#2098]: Notify vehicle windows when their internal state is botched up from outside.
frosch <frosch@openttd.org>
parents:
9760
diff
changeset
|
785 |
12892
2245b86757b7
(svn r17384) -Fix [FS#2859]: remove all order window state changes out of the drawing routine and call them immediately when changes happen instead of on the next OnPaint. This prevents pressing buttons when they should've been already disabled.
rubidium <rubidium@openttd.org>
parents:
12883
diff
changeset
|
786 void UpdateButtonState() |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
787 { |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
788 if (this->vehicle->owner != _local_company) return; // No buttons are displayed with competitor order windows. |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
789 |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
790 bool shared_orders = this->vehicle->IsOrderListShared(); |
12909
082fb426c8cf
(svn r17401) -Fix [FS#3171] (r17384): order deletion didn't (correctly) update the order window
rubidium <rubidium@openttd.org>
parents:
12892
diff
changeset
|
791 int sel = this->OrderGetSel(); |
11991
a4d3838349e6
(svn r16397) -Codechange: move GetVehicleOrder/GetLastVehicleOrder into Vehicle
rubidium <rubidium@openttd.org>
parents:
11972
diff
changeset
|
792 const Order *order = this->vehicle->GetOrder(sel); |
6980
cb6b3e277df0
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros <maedhros@openttd.org>
parents:
6923
diff
changeset
|
793 |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
794 /* Second row. */ |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
795 /* skip */ |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
796 this->SetWidgetDisabledState(ORDER_WIDGET_SKIP, this->vehicle->GetNumOrders() <= 1); |
8871
24e1116b32f6
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents:
8869
diff
changeset
|
797 |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
798 /* delete */ |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
799 this->SetWidgetDisabledState(ORDER_WIDGET_DELETE, |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
800 (uint)this->vehicle->GetNumOrders() + ((shared_orders || this->vehicle->GetNumOrders() != 0) ? 1 : 0) <= (uint)this->selected_order); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
801 |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
802 /* First row. */ |
9485
963b653e2e61
(svn r13444) -Codechange: make the order GUI somewhat more efficient. The most used options can be done with a single click now.
rubidium <rubidium@openttd.org>
parents:
9475
diff
changeset
|
803 this->RaiseWidget(ORDER_WIDGET_FULL_LOAD); |
963b653e2e61
(svn r13444) -Codechange: make the order GUI somewhat more efficient. The most used options can be done with a single click now.
rubidium <rubidium@openttd.org>
parents:
9475
diff
changeset
|
804 this->RaiseWidget(ORDER_WIDGET_UNLOAD); |
10285
615db2678973
(svn r14524) -Add: stop-in-depot as part of orders (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
805 this->RaiseWidget(ORDER_WIDGET_SERVICE); |
9485
963b653e2e61
(svn r13444) -Codechange: make the order GUI somewhat more efficient. The most used options can be done with a single click now.
rubidium <rubidium@openttd.org>
parents:
9475
diff
changeset
|
806 |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
807 /* Selection widgets. */ |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
808 /* Train or road vehicle. */ |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
809 NWidgetStacked *left_sel = this->GetWidget<NWidgetStacked>(ORDER_WIDGET_SEL_TOP_LEFT); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
810 NWidgetStacked *middle_sel = this->GetWidget<NWidgetStacked>(ORDER_WIDGET_SEL_TOP_MIDDLE); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
811 NWidgetStacked *right_sel = this->GetWidget<NWidgetStacked>(ORDER_WIDGET_SEL_TOP_RIGHT); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
812 /* Ship or airplane. */ |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
813 NWidgetStacked *row_sel = this->GetWidget<NWidgetStacked>(ORDER_WIDGET_SEL_TOP_ROW); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
814 assert(row_sel != NULL || (left_sel != NULL && middle_sel != NULL && right_sel != NULL)); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
815 |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
816 |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
817 if (order == NULL) { |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
818 if (row_sel != NULL) { |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
819 row_sel->SetDisplayedPlane(DP_ROW_LOAD); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
820 } else { |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
821 left_sel->SetDisplayedPlane(DP_LEFT_NONSTOP); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
822 middle_sel->SetDisplayedPlane(DP_MIDDLE_LOAD); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
823 right_sel->SetDisplayedPlane(DP_RIGHT_UNLOAD); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
824 this->DisableWidget(ORDER_WIDGET_NON_STOP); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
825 this->RaiseWidget(ORDER_WIDGET_NON_STOP); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
826 } |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
827 this->DisableWidget(ORDER_WIDGET_FULL_LOAD); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
828 this->DisableWidget(ORDER_WIDGET_UNLOAD); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
829 } else { |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
830 this->SetWidgetDisabledState(ORDER_WIDGET_FULL_LOAD, (order->GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION) != 0); // full load |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
831 this->SetWidgetDisabledState(ORDER_WIDGET_UNLOAD, (order->GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION) != 0); // unload |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
832 |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
833 switch (order->GetType()) { |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
834 case OT_GOTO_STATION: |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
835 if (row_sel != NULL) { |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
836 row_sel->SetDisplayedPlane(DP_ROW_LOAD); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
837 } else { |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
838 left_sel->SetDisplayedPlane(DP_LEFT_NONSTOP); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
839 middle_sel->SetDisplayedPlane(DP_MIDDLE_LOAD); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
840 right_sel->SetDisplayedPlane(DP_RIGHT_UNLOAD); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
841 this->EnableWidget(ORDER_WIDGET_NON_STOP); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
842 this->SetWidgetLoweredState(ORDER_WIDGET_NON_STOP, order->GetNonStopType() & ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
843 } |
12472
604a2cfc77ab
(svn r16909) -Fix [FS#2996]: NewGRF stations would be triggering assertions all over the place when using the more advanced station types.
rubidium <rubidium@openttd.org>
parents:
12429
diff
changeset
|
844 this->SetWidgetLoweredState(ORDER_WIDGET_FULL_LOAD, order->GetLoadType() == OLF_FULL_LOAD_ANY); |
604a2cfc77ab
(svn r16909) -Fix [FS#2996]: NewGRF stations would be triggering assertions all over the place when using the more advanced station types.
rubidium <rubidium@openttd.org>
parents:
12429
diff
changeset
|
845 this->SetWidgetLoweredState(ORDER_WIDGET_UNLOAD, order->GetUnloadType() == OUFB_UNLOAD); |
604a2cfc77ab
(svn r16909) -Fix [FS#2996]: NewGRF stations would be triggering assertions all over the place when using the more advanced station types.
rubidium <rubidium@openttd.org>
parents:
12429
diff
changeset
|
846 break; |
8871
24e1116b32f6
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents:
8869
diff
changeset
|
847 |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
848 case OT_GOTO_WAYPOINT: |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
849 if (row_sel != NULL) { |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
850 row_sel->SetDisplayedPlane(DP_ROW_LOAD); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
851 } else { |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
852 left_sel->SetDisplayedPlane(DP_LEFT_NONSTOP); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
853 middle_sel->SetDisplayedPlane(DP_MIDDLE_LOAD); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
854 right_sel->SetDisplayedPlane(DP_RIGHT_UNLOAD); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
855 this->SetWidgetLoweredState(ORDER_WIDGET_NON_STOP, order->GetNonStopType() & ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
856 } |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
857 this->DisableWidget(ORDER_WIDGET_FULL_LOAD); |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
858 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
|
859 break; |
6832
17319fb8c1c3
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium <rubidium@openttd.org>
parents:
6807
diff
changeset
|
860 |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
861 case OT_GOTO_DEPOT: |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
862 if (row_sel != NULL) { |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
863 row_sel->SetDisplayedPlane(DP_ROW_DEPOT); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
864 } else { |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
865 left_sel->SetDisplayedPlane(DP_LEFT_NONSTOP); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
866 middle_sel->SetDisplayedPlane(DP_MIDDLE_REFIT); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
867 right_sel->SetDisplayedPlane(DP_RIGHT_SERVICE); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
868 this->SetWidgetLoweredState(ORDER_WIDGET_NON_STOP, order->GetNonStopType() & ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
869 } |
9485
963b653e2e61
(svn r13444) -Codechange: make the order GUI somewhat more efficient. The most used options can be done with a single click now.
rubidium <rubidium@openttd.org>
parents:
9475
diff
changeset
|
870 this->SetWidgetLoweredState(ORDER_WIDGET_SERVICE, order->GetDepotOrderType() & ODTFB_SERVICE); |
8871
24e1116b32f6
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents:
8869
diff
changeset
|
871 break; |
24e1116b32f6
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents:
8869
diff
changeset
|
872 |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
873 case OT_CONDITIONAL: { |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
874 if (row_sel != NULL) { |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
875 row_sel->SetDisplayedPlane(DP_ROW_CONDITIONAL); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
876 } else { |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
877 left_sel->SetDisplayedPlane(DP_LEFT_CONDVAR); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
878 middle_sel->SetDisplayedPlane(DP_MIDDLE_COMPARE); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
879 right_sel->SetDisplayedPlane(DP_RIGHT_CONDVAL); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
880 } |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
881 OrderConditionVariable ocv = order->GetConditionVariable(); |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
882 /* Set the strings for the dropdown boxes. */ |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
883 this->GetWidget<NWidgetCore>(ORDER_WIDGET_COND_VARIABLE)->widget_data = _order_conditional_variable[order == NULL ? 0 : ocv]; |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
884 this->GetWidget<NWidgetCore>(ORDER_WIDGET_COND_COMPARATOR)->widget_data = _order_conditional_condition[order == NULL ? 0 : order->GetConditionComparator()]; |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
885 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
|
886 this->SetWidgetDisabledState(ORDER_WIDGET_COND_VALUE, ocv == OCV_REQUIRES_SERVICE || ocv == OCV_UNCONDITIONALLY); |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
887 break; |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
888 } |
8900
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8896
diff
changeset
|
889 |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
890 default: // every other order |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
891 if (row_sel != NULL) { |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
892 row_sel->SetDisplayedPlane(DP_ROW_LOAD); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
893 } else { |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
894 left_sel->SetDisplayedPlane(DP_LEFT_NONSTOP); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
895 middle_sel->SetDisplayedPlane(DP_MIDDLE_LOAD); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
896 right_sel->SetDisplayedPlane(DP_RIGHT_UNLOAD); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
897 this->DisableWidget(ORDER_WIDGET_NON_STOP); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
898 } |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
899 this->DisableWidget(ORDER_WIDGET_FULL_LOAD); |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
900 this->DisableWidget(ORDER_WIDGET_UNLOAD); |
12892
2245b86757b7
(svn r17384) -Fix [FS#2859]: remove all order window state changes out of the drawing routine and call them immediately when changes happen instead of on the next OnPaint. This prevents pressing buttons when they should've been already disabled.
rubidium <rubidium@openttd.org>
parents:
12883
diff
changeset
|
901 break; |
8871
24e1116b32f6
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents:
8869
diff
changeset
|
902 } |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
903 } |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
904 |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
905 /* Disable list of vehicles with the same shared orders if there is no list */ |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
906 this->SetWidgetDisabledState(ORDER_WIDGET_SHARED_ORDER_LIST, !shared_orders); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
907 |
12892
2245b86757b7
(svn r17384) -Fix [FS#2859]: remove all order window state changes out of the drawing routine and call them immediately when changes happen instead of on the next OnPaint. This prevents pressing buttons when they should've been already disabled.
rubidium <rubidium@openttd.org>
parents:
12883
diff
changeset
|
908 this->SetDirty(); |
2245b86757b7
(svn r17384) -Fix [FS#2859]: remove all order window state changes out of the drawing routine and call them immediately when changes happen instead of on the next OnPaint. This prevents pressing buttons when they should've been already disabled.
rubidium <rubidium@openttd.org>
parents:
12883
diff
changeset
|
909 } |
2245b86757b7
(svn r17384) -Fix [FS#2859]: remove all order window state changes out of the drawing routine and call them immediately when changes happen instead of on the next OnPaint. This prevents pressing buttons when they should've been already disabled.
rubidium <rubidium@openttd.org>
parents:
12883
diff
changeset
|
910 |
2245b86757b7
(svn r17384) -Fix [FS#2859]: remove all order window state changes out of the drawing routine and call them immediately when changes happen instead of on the next OnPaint. This prevents pressing buttons when they should've been already disabled.
rubidium <rubidium@openttd.org>
parents:
12883
diff
changeset
|
911 virtual void OnPaint() |
2245b86757b7
(svn r17384) -Fix [FS#2859]: remove all order window state changes out of the drawing routine and call them immediately when changes happen instead of on the next OnPaint. This prevents pressing buttons when they should've been already disabled.
rubidium <rubidium@openttd.org>
parents:
12883
diff
changeset
|
912 { |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
913 this->DrawWidgets(); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
914 } |
12892
2245b86757b7
(svn r17384) -Fix [FS#2859]: remove all order window state changes out of the drawing routine and call them immediately when changes happen instead of on the next OnPaint. This prevents pressing buttons when they should've been already disabled.
rubidium <rubidium@openttd.org>
parents:
12883
diff
changeset
|
915 |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
916 virtual void DrawWidget(const Rect &r, int widget) const |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
917 { |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
918 if (widget != ORDER_WIDGET_ORDER_LIST) return; |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
919 |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
920 int y = r.top + WD_FRAMERECT_TOP; |
6832
17319fb8c1c3
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium <rubidium@openttd.org>
parents:
6807
diff
changeset
|
921 |
12879
225a7fccc489
(svn r17371) -Codechange: make the newgrf, news and order GUIs use the scrollbar wrappers
rubidium <rubidium@openttd.org>
parents:
12789
diff
changeset
|
922 int i = this->vscroll.GetPosition(); |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
923 const Order *order = this->vehicle->GetOrder(i); |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
924 StringID str; |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
925 while (order != NULL) { |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
926 /* Don't draw anything if it extends past the end of the window. */ |
12879
225a7fccc489
(svn r17371) -Codechange: make the newgrf, news and order GUIs use the scrollbar wrappers
rubidium <rubidium@openttd.org>
parents:
12789
diff
changeset
|
927 if (!this->vscroll.IsVisible(i)) break; |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
928 |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
929 DrawOrderString(this->vehicle, order, i, y, i == this->selected_order, false, r.left + WD_FRAMETEXT_LEFT, r.right - WD_FRAMETEXT_RIGHT); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
930 y += this->resize.step_height; |
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 i++; |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
933 order = order->next; |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
934 } |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
935 |
12879
225a7fccc489
(svn r17371) -Codechange: make the newgrf, news and order GUIs use the scrollbar wrappers
rubidium <rubidium@openttd.org>
parents:
12789
diff
changeset
|
936 if (this->vscroll.IsVisible(i)) { |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
937 str = this->vehicle->IsOrderListShared() ? STR_ORDERS_END_OF_SHARED_ORDERS : STR_ORDERS_END_OF_ORDERS; |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
938 DrawString(r.left + WD_FRAMETEXT_LEFT, r.right - WD_FRAMETEXT_RIGHT, y, str, (i == this->selected_order) ? TC_WHITE : TC_BLACK); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
939 } |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
940 } |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
941 |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
942 virtual void SetStringParameters(int widget) const |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
943 { |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
944 switch (widget) { |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
945 case ORDER_WIDGET_COND_VALUE: { |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
946 int sel = this->OrderGetSel(); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
947 const Order *order = this->vehicle->GetOrder(sel); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
948 |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
949 if (order != NULL && order->IsType(OT_CONDITIONAL)) { |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
950 uint value = order->GetConditionValue(); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
951 if (order->GetConditionVariable() == OCV_MAX_SPEED) value = ConvertSpeedToDisplaySpeed(value); |
13550
e1bc91682918
(svn r18072) -Codechange: remove the need for {SKIP} (and a string) from the order window
rubidium <rubidium@openttd.org>
parents:
13466
diff
changeset
|
952 SetDParam(0, value); |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
953 } |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
954 break; |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
955 } |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
956 |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
957 case ORDER_WIDGET_CAPTION: |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
958 SetDParam(0, this->vehicle->index); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
959 break; |
9258
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 } |
8900
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8896
diff
changeset
|
962 |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
963 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
|
964 { |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
965 switch (widget) { |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
966 case ORDER_WIDGET_ORDER_LIST: { |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
967 ResetObjectToPlace(); |
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 int sel = this->GetOrderFromPt(pt.y); |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
970 |
10544
836dfaca2a32
(svn r14801) -Codechange: don't reference Vehicle::num_orders directly but through a method GetNumOrders() (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10527
diff
changeset
|
971 if (_ctrl_pressed && sel < this->vehicle->GetNumOrders()) { |
11991
a4d3838349e6
(svn r16397) -Codechange: move GetVehicleOrder/GetLastVehicleOrder into Vehicle
rubidium <rubidium@openttd.org>
parents:
11972
diff
changeset
|
972 const Order *ord = this->vehicle->GetOrder(sel); |
10550
98e8bc97ec6b
(svn r14807) -Codechange: use INVALID_TILE instead of 0 to mark invalid depots, industries, towns and waypoints
smatz <smatz@openttd.org>
parents:
10544
diff
changeset
|
973 TileIndex xy = INVALID_TILE; |
8900
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8896
diff
changeset
|
974 |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
975 switch (ord->GetType()) { |
12361
82830e1cd892
(svn r16785) -Codechange: make ships going to buoys use OT_GOTO_WAYPOINT too
rubidium <rubidium@openttd.org>
parents:
12231
diff
changeset
|
976 case OT_GOTO_WAYPOINT: |
82830e1cd892
(svn r16785) -Codechange: make ships going to buoys use OT_GOTO_WAYPOINT too
rubidium <rubidium@openttd.org>
parents:
12231
diff
changeset
|
977 if (this->vehicle->type == VEH_TRAIN) { |
82830e1cd892
(svn r16785) -Codechange: make ships going to buoys use OT_GOTO_WAYPOINT too
rubidium <rubidium@openttd.org>
parents:
12231
diff
changeset
|
978 xy = Waypoint::Get(ord->GetDestination())->xy; |
82830e1cd892
(svn r16785) -Codechange: make ships going to buoys use OT_GOTO_WAYPOINT too
rubidium <rubidium@openttd.org>
parents:
12231
diff
changeset
|
979 break; |
82830e1cd892
(svn r16785) -Codechange: make ships going to buoys use OT_GOTO_WAYPOINT too
rubidium <rubidium@openttd.org>
parents:
12231
diff
changeset
|
980 } |
82830e1cd892
(svn r16785) -Codechange: make ships going to buoys use OT_GOTO_WAYPOINT too
rubidium <rubidium@openttd.org>
parents:
12231
diff
changeset
|
981 /* FALL THROUGH */ |
82830e1cd892
(svn r16785) -Codechange: make ships going to buoys use OT_GOTO_WAYPOINT too
rubidium <rubidium@openttd.org>
parents:
12231
diff
changeset
|
982 case OT_GOTO_STATION: |
82830e1cd892
(svn r16785) -Codechange: make ships going to buoys use OT_GOTO_WAYPOINT too
rubidium <rubidium@openttd.org>
parents:
12231
diff
changeset
|
983 xy = Station::Get(ord->GetDestination())->xy; |
82830e1cd892
(svn r16785) -Codechange: make ships going to buoys use OT_GOTO_WAYPOINT too
rubidium <rubidium@openttd.org>
parents:
12231
diff
changeset
|
984 break; |
82830e1cd892
(svn r16785) -Codechange: make ships going to buoys use OT_GOTO_WAYPOINT too
rubidium <rubidium@openttd.org>
parents:
12231
diff
changeset
|
985 |
10185
c1ef0b49a1cd
(svn r14396) -Fix: ctrl+right click at 'Go to nearest depot' order scrolled to depot with DepotID == 0
smatz <smatz@openttd.org>
parents:
10184
diff
changeset
|
986 case OT_GOTO_DEPOT: |
c1ef0b49a1cd
(svn r14396) -Fix: ctrl+right click at 'Go to nearest depot' order scrolled to depot with DepotID == 0
smatz <smatz@openttd.org>
parents:
10184
diff
changeset
|
987 if ((ord->GetDepotActionType() & ODATFB_NEAREST_DEPOT) != 0) break; |
11922
0a4b63f3f3c3
(svn r16325) -Codechange: replace GetPoolItem(index) by PoolItem::Get(index)
smatz <smatz@openttd.org>
parents:
11809
diff
changeset
|
988 xy = (this->vehicle->type == VEH_AIRCRAFT) ? Station::Get(ord->GetDestination())->xy : Depot::Get(ord->GetDestination())->xy; |
10185
c1ef0b49a1cd
(svn r14396) -Fix: ctrl+right click at 'Go to nearest depot' order scrolled to depot with DepotID == 0
smatz <smatz@openttd.org>
parents:
10184
diff
changeset
|
989 break; |
c1ef0b49a1cd
(svn r14396) -Fix: ctrl+right click at 'Go to nearest depot' order scrolled to depot with DepotID == 0
smatz <smatz@openttd.org>
parents:
10184
diff
changeset
|
990 default: |
c1ef0b49a1cd
(svn r14396) -Fix: ctrl+right click at 'Go to nearest depot' order scrolled to depot with DepotID == 0
smatz <smatz@openttd.org>
parents:
10184
diff
changeset
|
991 break; |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
992 } |
8900
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8896
diff
changeset
|
993 |
10550
98e8bc97ec6b
(svn r14807) -Codechange: use INVALID_TILE instead of 0 to mark invalid depots, industries, towns and waypoints
smatz <smatz@openttd.org>
parents:
10544
diff
changeset
|
994 if (xy != INVALID_TILE) ScrollMainWindowToTile(xy); |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
995 return; |
10184
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
996 } |
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
997 |
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
998 /* This order won't be selected any more, close all child windows and dropdowns */ |
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
999 this->DeleteChildWindows(); |
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
1000 HideDropDownMenu(this); |
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
1001 |
11657
ff1084d0d8a0
(svn r16037) -Feature: allow (per order) to let a train stop at the near end, middle or far end of a platform from the point of view of the driver of the train that enters the station.
rubidium <rubidium@openttd.org>
parents:
11524
diff
changeset
|
1002 if (sel == INVALID_ORDER) { |
10184
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
1003 /* Deselect clicked order */ |
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
1004 this->selected_order = -1; |
11657
ff1084d0d8a0
(svn r16037) -Feature: allow (per order) to let a train stop at the near end, middle or far end of a platform from the point of view of the driver of the train that enters the station.
rubidium <rubidium@openttd.org>
parents:
11524
diff
changeset
|
1005 } else if (sel == this->selected_order) { |
11676
638b09679c29
(svn r16056) -Fix (r16037): clicking twice on the "end of orders" crashed.
rubidium <rubidium@openttd.org>
parents:
11657
diff
changeset
|
1006 if (this->vehicle->type == VEH_TRAIN && sel < this->vehicle->GetNumOrders()) { |
11657
ff1084d0d8a0
(svn r16037) -Feature: allow (per order) to let a train stop at the near end, middle or far end of a platform from the point of view of the driver of the train that enters the station.
rubidium <rubidium@openttd.org>
parents:
11524
diff
changeset
|
1007 DoCommandP(this->vehicle->tile, this->vehicle->index + (sel << 16), |
11991
a4d3838349e6
(svn r16397) -Codechange: move GetVehicleOrder/GetLastVehicleOrder into Vehicle
rubidium <rubidium@openttd.org>
parents:
11972
diff
changeset
|
1008 MOF_STOP_LOCATION | ((this->vehicle->GetOrder(sel)->GetStopLocation() + 1) % OSL_END) << 4, |
11730
a39da1e4c1f5
(svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents:
11706
diff
changeset
|
1009 CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER)); |
11657
ff1084d0d8a0
(svn r16037) -Feature: allow (per order) to let a train stop at the near end, middle or far end of a platform from the point of view of the driver of the train that enters the station.
rubidium <rubidium@openttd.org>
parents:
11524
diff
changeset
|
1010 } |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1011 } else { |
10184
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
1012 /* Select clicked order */ |
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
1013 this->selected_order = sel; |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1014 |
10207
c54d140df948
(svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents:
10185
diff
changeset
|
1015 if (this->vehicle->owner == _local_company) { |
10184
fbd1b77a2509
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz <smatz@openttd.org>
parents:
10168
diff
changeset
|
1016 /* Activate drag and drop */ |
11702
cdaad565efe5
(svn r16088) -Codechange: merge HighLightStyle and ViewportHighlightMode as they are basically the same thing
rubidium <rubidium@openttd.org>
parents:
11696
diff
changeset
|
1017 SetObjectToPlaceWnd(SPR_CURSOR_MOUSE, PAL_NONE, HT_DRAG, this); |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1018 } |
8900
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8896
diff
changeset
|
1019 } |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8896
diff
changeset
|
1020 |
12892
2245b86757b7
(svn r17384) -Fix [FS#2859]: remove all order window state changes out of the drawing routine and call them immediately when changes happen instead of on the next OnPaint. This prevents pressing buttons when they should've been already disabled.
rubidium <rubidium@openttd.org>
parents:
12883
diff
changeset
|
1021 this->UpdateButtonState(); |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1022 } break; |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1023 |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1024 case ORDER_WIDGET_SKIP: |
13013
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
1025 this->OrderClick_Skip(0); |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1026 break; |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1027 |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1028 case ORDER_WIDGET_DELETE: |
13013
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
1029 this->OrderClick_Delete(0); |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1030 break; |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1031 |
9485
963b653e2e61
(svn r13444) -Codechange: make the order GUI somewhat more efficient. The most used options can be done with a single click now.
rubidium <rubidium@openttd.org>
parents:
9475
diff
changeset
|
1032 case ORDER_WIDGET_NON_STOP: |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1033 if (GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) { |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1034 this->OrderClick_Nonstop(-1); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1035 } else { |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1036 const Order *o = this->vehicle->GetOrder(this->OrderGetSel()); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1037 ShowDropDownMenu(this, _order_non_stop_drowdown, o->GetNonStopType(), ORDER_WIDGET_NON_STOP, 0, |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1038 o->IsType(OT_GOTO_STATION) ? 0 : (o->IsType(OT_GOTO_WAYPOINT) ? 3 : 12)); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1039 } |
9485
963b653e2e61
(svn r13444) -Codechange: make the order GUI somewhat more efficient. The most used options can be done with a single click now.
rubidium <rubidium@openttd.org>
parents:
9475
diff
changeset
|
1040 break; |
963b653e2e61
(svn r13444) -Codechange: make the order GUI somewhat more efficient. The most used options can be done with a single click now.
rubidium <rubidium@openttd.org>
parents:
9475
diff
changeset
|
1041 |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1042 case ORDER_WIDGET_GOTO: |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1043 if (GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) { |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1044 this->OrderClick_Goto(0); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1045 } else { |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1046 ShowDropDownMenu(this, this->vehicle->type == VEH_AIRCRAFT ? _order_goto_dropdown_aircraft : _order_goto_dropdown, 0, ORDER_WIDGET_GOTO, 0, 0); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1047 } |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1048 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
|
1049 |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1050 case ORDER_WIDGET_FULL_LOAD: |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1051 if (GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) { |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1052 this->OrderClick_FullLoad(-1); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1053 } else { |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1054 ShowDropDownMenu(this, _order_full_load_drowdown, this->vehicle->GetOrder(this->OrderGetSel())->GetLoadType(), ORDER_WIDGET_FULL_LOAD, 0, 2); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1055 } |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1056 break; |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1057 |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1058 case ORDER_WIDGET_UNLOAD: |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1059 if (GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) { |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1060 this->OrderClick_Unload(-1); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1061 } else { |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1062 ShowDropDownMenu(this, _order_unload_drowdown, this->vehicle->GetOrder(this->OrderGetSel())->GetUnloadType(), ORDER_WIDGET_UNLOAD, 0, 8); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1063 } |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1064 break; |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1065 |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1066 case ORDER_WIDGET_REFIT: |
13013
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
1067 this->OrderClick_Refit(0); |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1068 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
|
1069 |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1070 case ORDER_WIDGET_SERVICE: |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1071 if (GetWidget<NWidgetLeaf>(widget)->ButtonHit(pt)) { |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1072 this->OrderClick_Service(-1); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1073 } else { |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1074 ShowDropDownMenu(this, _order_depot_action_dropdown, DepotActionStringIndex(this->vehicle->GetOrder(this->OrderGetSel())), ORDER_WIDGET_SERVICE, 0, 0); |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1075 } |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1076 break; |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1077 |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1078 case ORDER_WIDGET_TIMETABLE_VIEW: |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1079 ShowTimetableWindow(this->vehicle); |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1080 break; |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1081 |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1082 case ORDER_WIDGET_COND_VARIABLE: |
11991
a4d3838349e6
(svn r16397) -Codechange: move GetVehicleOrder/GetLastVehicleOrder into Vehicle
rubidium <rubidium@openttd.org>
parents:
11972
diff
changeset
|
1083 ShowDropDownMenu(this, _order_conditional_variable, this->vehicle->GetOrder(this->OrderGetSel())->GetConditionVariable(), ORDER_WIDGET_COND_VARIABLE, 0, 0); |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1084 break; |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1085 |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1086 case ORDER_WIDGET_COND_COMPARATOR: { |
11991
a4d3838349e6
(svn r16397) -Codechange: move GetVehicleOrder/GetLastVehicleOrder into Vehicle
rubidium <rubidium@openttd.org>
parents:
11972
diff
changeset
|
1087 const Order *o = this->vehicle->GetOrder(this->OrderGetSel()); |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1088 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
|
1089 } break; |
8900
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8896
diff
changeset
|
1090 |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1091 case ORDER_WIDGET_COND_VALUE: { |
11991
a4d3838349e6
(svn r16397) -Codechange: move GetVehicleOrder/GetLastVehicleOrder into Vehicle
rubidium <rubidium@openttd.org>
parents:
11972
diff
changeset
|
1092 const Order *order = this->vehicle->GetOrder(this->OrderGetSel()); |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1093 uint value = order->GetConditionValue(); |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1094 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
|
1095 SetDParam(0, value); |
12493
32e2de3d509a
(svn r16930) -Codechange: more StringID name unification and grouping
rubidium <rubidium@openttd.org>
parents:
12484
diff
changeset
|
1096 ShowQueryString(STR_JUST_INT, STR_ORDER_CONDITIONAL_VALUE_CAPT, 5, 100, this, CS_NUMERAL, QSF_NONE); |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1097 } break; |
8900
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8896
diff
changeset
|
1098 |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1099 case ORDER_WIDGET_SHARED_ORDER_LIST: |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1100 ShowVehicleListWindow(this->vehicle); |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1101 break; |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1102 } |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1103 } |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1104 |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1105 virtual void OnQueryTextFinished(char *str) |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1106 { |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1107 if (!StrEmpty(str)) { |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1108 VehicleOrderID sel = this->OrderGetSel(); |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1109 uint value = atoi(str); |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1110 |
11991
a4d3838349e6
(svn r16397) -Codechange: move GetVehicleOrder/GetLastVehicleOrder into Vehicle
rubidium <rubidium@openttd.org>
parents:
11972
diff
changeset
|
1111 switch (this->vehicle->GetOrder(sel)->GetConditionVariable()) { |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1112 case OCV_MAX_SPEED: |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1113 value = ConvertDisplaySpeedToSpeed(value); |
8900
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8896
diff
changeset
|
1114 break; |
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8896
diff
changeset
|
1115 |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1116 case OCV_RELIABILITY: |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1117 case OCV_LOAD_PERCENTAGE: |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1118 value = Clamp(value, 0, 100); |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1119 |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1120 default: |
8900
a12b2ec504da
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium <rubidium@openttd.org>
parents:
8896
diff
changeset
|
1121 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
|
1122 } |
11730
a39da1e4c1f5
(svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents:
11706
diff
changeset
|
1123 DoCommandP(this->vehicle->tile, this->vehicle->index + (sel << 16), MOF_COND_VALUE | Clamp(value, 0, 2047) << 4, CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER)); |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1124 } |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1125 } |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1126 |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1127 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
|
1128 { |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1129 switch (widget) { |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1130 case ORDER_WIDGET_NON_STOP: |
13013
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
1131 this->OrderClick_Nonstop(index); |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1132 break; |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1133 |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1134 case ORDER_WIDGET_FULL_LOAD: |
13013
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
1135 this->OrderClick_FullLoad(index); |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1136 break; |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1137 |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1138 case ORDER_WIDGET_UNLOAD: |
13013
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
1139 this->OrderClick_Unload(index); |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1140 break; |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1141 |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1142 case ORDER_WIDGET_GOTO: |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1143 switch (index) { |
13013
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
1144 case 0: this->OrderClick_Goto(0); break; |
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
1145 case 1: this->OrderClick_NearestDepot(0); break; |
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
1146 case 2: this->OrderClick_Conditional(0); break; |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1147 default: NOT_REACHED(); |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1148 } |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1149 break; |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1150 |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1151 case ORDER_WIDGET_SERVICE: |
13013
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
1152 this->OrderClick_Service(index); |
10285
615db2678973
(svn r14524) -Add: stop-in-depot as part of orders (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
1153 break; |
615db2678973
(svn r14524) -Add: stop-in-depot as part of orders (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
1154 |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1155 case ORDER_WIDGET_COND_VARIABLE: |
11730
a39da1e4c1f5
(svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents:
11706
diff
changeset
|
1156 DoCommandP(this->vehicle->tile, this->vehicle->index + (this->OrderGetSel() << 16), MOF_COND_VARIABLE | index << 4, CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER)); |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1157 break; |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1158 |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1159 case ORDER_WIDGET_COND_COMPARATOR: |
11730
a39da1e4c1f5
(svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents:
11706
diff
changeset
|
1160 DoCommandP(this->vehicle->tile, this->vehicle->index + (this->OrderGetSel() << 16), MOF_COND_COMPARATOR | index << 4, CMD_MODIFY_ORDER | CMD_MSG(STR_ERROR_CAN_T_MODIFY_THIS_ORDER)); |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1161 break; |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1162 } |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1163 } |
8871
24e1116b32f6
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents:
8869
diff
changeset
|
1164 |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1165 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
|
1166 { |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1167 switch (widget) { |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1168 case ORDER_WIDGET_ORDER_LIST: { |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1169 int from_order = this->OrderGetSel(); |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1170 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
|
1171 |
10544
836dfaca2a32
(svn r14801) -Codechange: don't reference Vehicle::num_orders directly but through a method GetNumOrders() (PhilSophus)
rubidium <rubidium@openttd.org>
parents:
10527
diff
changeset
|
1172 if (!(from_order == to_order || from_order == INVALID_ORDER || from_order > this->vehicle->GetNumOrders() || to_order == INVALID_ORDER || to_order > this->vehicle->GetNumOrders()) && |
11730
a39da1e4c1f5
(svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents:
11706
diff
changeset
|
1173 DoCommandP(this->vehicle->tile, this->vehicle->index, from_order | (to_order << 16), CMD_MOVE_ORDER | CMD_MSG(STR_ERROR_CAN_T_MOVE_THIS_ORDER))) { |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1174 this->selected_order = -1; |
12909
082fb426c8cf
(svn r17401) -Fix [FS#3171] (r17384): order deletion didn't (correctly) update the order window
rubidium <rubidium@openttd.org>
parents:
12892
diff
changeset
|
1175 this->UpdateButtonState(); |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1176 } |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1177 } break; |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1178 |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1179 case ORDER_WIDGET_DELETE: |
13013
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
1180 this->OrderClick_Delete(0); |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1181 break; |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1182 } |
8871
24e1116b32f6
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium <rubidium@openttd.org>
parents:
8869
diff
changeset
|
1183 |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1184 ResetObjectToPlace(); |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1185 } |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1186 |
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
|
1187 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
|
1188 { |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1189 static const KeyToEvent keytoevent[] = { |
13013
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
1190 {'D', &OrdersWindow::OrderClick_Skip}, |
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
1191 {'F', &OrdersWindow::OrderClick_Delete}, |
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
1192 {'G', &OrdersWindow::OrderClick_Goto}, |
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
1193 {'H', &OrdersWindow::OrderClick_Nonstop}, |
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
1194 {'J', &OrdersWindow::OrderClick_FullLoad}, |
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
1195 {'K', &OrdersWindow::OrderClick_Unload}, |
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
1196 //('?', &OrdersWindow::OrderClick_Service}, |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1197 }; |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1198 |
10207
c54d140df948
(svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents:
10185
diff
changeset
|
1199 if (this->vehicle->owner != _local_company) return ES_NOT_HANDLED; |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1200 |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1201 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
|
1202 if (keycode == keytoevent[i].keycode) { |
13013
17c2478c4fe1
(svn r17507) -Codechange: Make some methods of the OrdersWindow non-static.
alberth <alberth@openttd.org>
parents:
13001
diff
changeset
|
1203 (this->*(keytoevent[i].proc))(-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
|
1204 return ES_HANDLED; |
6832
17319fb8c1c3
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium <rubidium@openttd.org>
parents:
6807
diff
changeset
|
1205 } |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1206 } |
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
|
1207 return ES_NOT_HANDLED; |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1208 } |
6832
17319fb8c1c3
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium <rubidium@openttd.org>
parents:
6807
diff
changeset
|
1209 |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1210 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
|
1211 { |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1212 if (this->goto_type == OPOS_GOTO) { |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1213 /* 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
|
1214 const Vehicle *v = CheckMouseOverVehicle(); |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1215 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
|
1216 |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1217 const Order cmd = GetOrderCmdFromTile(this->vehicle, tile); |
11972
fd10870d74d4
(svn r16378) -Codechange: replace OldPool with simpler Pool. Compilation time, binary size and run time (with asserts disabled) should be improved
smatz <smatz@openttd.org>
parents:
11922
diff
changeset
|
1218 if (cmd.IsType(OT_NOTHING)) return; |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1219 |
11730
a39da1e4c1f5
(svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents:
11706
diff
changeset
|
1220 if (DoCommandP(this->vehicle->tile, this->vehicle->index + (this->OrderGetSel() << 16), cmd.Pack(), CMD_INSERT_ORDER | CMD_MSG(STR_ERROR_CAN_T_INSERT_NEW_ORDER))) { |
10570
4ab8ac10807c
(svn r14827) -Feature [FS#1984]: few (optional) optimisations to making (initial) orders (sulai)
rubidium <rubidium@openttd.org>
parents:
10562
diff
changeset
|
1221 /* With quick goto the Go To button stays active */ |
4ab8ac10807c
(svn r14827) -Feature [FS#1984]: few (optional) optimisations to making (initial) orders (sulai)
rubidium <rubidium@openttd.org>
parents:
10562
diff
changeset
|
1222 if (!_settings_client.gui.quick_goto) ResetObjectToPlace(); |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1223 } |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1224 } |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1225 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1226 |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1227 virtual void OnPlaceObjectAbort() |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1228 { |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1229 if (this->goto_type == OPOS_CONDITIONAL) { |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1230 this->goto_type = OPOS_GOTO; |
13078
854fcab2b59d
(svn r17578) -Fix (r17572): Some compilers don't like default function template arguments.
alberth <alberth@openttd.org>
parents:
13077
diff
changeset
|
1231 NWidgetBase *nwid = this->GetWidget<NWidgetBase>(ORDER_WIDGET_ORDER_LIST); |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1232 if (IsInsideBS(_cursor.pos.x, this->left + nwid->pos_x, nwid->current_x) && IsInsideBS(_cursor.pos.y, this->top + nwid->pos_y, nwid->current_y)) { |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1233 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
|
1234 if (order_id != INVALID_ORDER) { |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1235 Order order; |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1236 order.next = NULL; |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1237 order.index = 0; |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1238 order.MakeConditional(order_id); |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1239 |
11730
a39da1e4c1f5
(svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents:
11706
diff
changeset
|
1240 DoCommandP(this->vehicle->tile, this->vehicle->index + (this->OrderGetSel() << 16), order.Pack(), CMD_INSERT_ORDER | CMD_MSG(STR_ERROR_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
|
1241 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1242 } |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1243 } |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1244 this->RaiseWidget(ORDER_WIDGET_GOTO); |
13034
6eb3f749890a
(svn r17532) -Codechange: Rename several Invalidate functions to SetDirty for more consistency and distinguishability.
frosch <frosch@openttd.org>
parents:
13013
diff
changeset
|
1245 this->SetWidgetDirty(ORDER_WIDGET_GOTO); |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1246 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1247 |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1248 virtual void OnMouseLoop() |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1249 { |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1250 const Vehicle *v = _place_clicked_vehicle; |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1251 /* |
11361
02313cc6114e
(svn r15711) -Codechange: lots of whitespace cleanup/fixes
rubidium <rubidium@openttd.org>
parents:
11084
diff
changeset
|
1252 * Check if we clicked on a vehicle |
02313cc6114e
(svn r15711) -Codechange: lots of whitespace cleanup/fixes
rubidium <rubidium@openttd.org>
parents:
11084
diff
changeset
|
1253 * and if the GOTO button of this window is pressed |
02313cc6114e
(svn r15711) -Codechange: lots of whitespace cleanup/fixes
rubidium <rubidium@openttd.org>
parents:
11084
diff
changeset
|
1254 * This is because of all open order windows WE_MOUSELOOP is called |
02313cc6114e
(svn r15711) -Codechange: lots of whitespace cleanup/fixes
rubidium <rubidium@openttd.org>
parents:
11084
diff
changeset
|
1255 * and if you have 3 windows open, and this check is not done |
02313cc6114e
(svn r15711) -Codechange: lots of whitespace cleanup/fixes
rubidium <rubidium@openttd.org>
parents:
11084
diff
changeset
|
1256 * the order is copied to the last open window instead of the |
02313cc6114e
(svn r15711) -Codechange: lots of whitespace cleanup/fixes
rubidium <rubidium@openttd.org>
parents:
11084
diff
changeset
|
1257 * one where GOTO is enabled |
02313cc6114e
(svn r15711) -Codechange: lots of whitespace cleanup/fixes
rubidium <rubidium@openttd.org>
parents:
11084
diff
changeset
|
1258 */ |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1259 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
|
1260 _place_clicked_vehicle = NULL; |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1261 this->HandleOrderVehClick(v); |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1262 } |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1263 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1264 |
13344
04b02b2cfa2b
(svn r17853) -Codechange: remove the 'delta' parameter from OnResize; it was used in ways that aren't always wanted, causing bugs and the like. Also with nested widgets most reasons for handling OnResize have gone.
rubidium <rubidium@openttd.org>
parents:
13277
diff
changeset
|
1265 virtual void OnResize() |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1266 { |
13277
fe0462278733
(svn r17786) -Fix [FS#3265]: graphical glitches (matrices/scrollbars with wrong 'size') upon reiniting windows
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
1267 /* Update the scroll bar */ |
fe0462278733
(svn r17786) -Fix [FS#3265]: graphical glitches (matrices/scrollbars with wrong 'size') upon reiniting windows
rubidium <rubidium@openttd.org>
parents:
13186
diff
changeset
|
1268 this->vscroll.SetCapacity(this->GetWidget<NWidgetBase>(ORDER_WIDGET_ORDER_LIST)->current_y / this->resize.step_height); |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1269 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1270 |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1271 virtual void OnTimeout() |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1272 { |
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1273 /* unclick all buttons except for the 'goto' button (ORDER_WIDGET_GOTO), which is 'persistent' */ |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1274 for (uint i = 0; i < this->nested_array_size; i++) { |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1275 if (this->nested_array[i] != NULL && i != ORDER_WIDGET_GOTO && |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1276 i != ORDER_WIDGET_SEL_TOP_LEFT && i != ORDER_WIDGET_SEL_TOP_MIDDLE && i != ORDER_WIDGET_SEL_TOP_RIGHT && |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1277 i != ORDER_WIDGET_SEL_TOP_ROW && this->IsWidgetLowered(i)) { |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1278 this->RaiseWidget(i); |
13034
6eb3f749890a
(svn r17532) -Codechange: Rename several Invalidate functions to SetDirty for more consistency and distinguishability.
frosch <frosch@openttd.org>
parents:
13013
diff
changeset
|
1279 this->SetWidgetDirty(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
|
1280 } |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1281 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1282 } |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1283 }; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1284 |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1285 /** Nested widget definition for "your" train orders. */ |
11801
066e6b5662dc
(svn r16191) -Codechange: Added nested widgets of one order window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1286 static const NWidgetPart _nested_orders_train_widgets[] = { |
066e6b5662dc
(svn r16191) -Codechange: Added nested widgets of one order window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1287 NWidget(NWID_HORIZONTAL), |
066e6b5662dc
(svn r16191) -Codechange: Added nested widgets of one order window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1288 NWidget(WWT_CLOSEBOX, COLOUR_GREY, ORDER_WIDGET_CLOSEBOX), |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1289 NWidget(WWT_CAPTION, COLOUR_GREY, ORDER_WIDGET_CAPTION), SetDataTip(STR_ORDERS_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1290 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, ORDER_WIDGET_TIMETABLE_VIEW), SetMinimalSize(61, 14), SetDataTip(STR_ORDERS_TIMETABLE_VIEW, STR_ORDERS_TIMETABLE_VIEW_TOOLTIP), |
11801
066e6b5662dc
(svn r16191) -Codechange: Added nested widgets of one order window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1291 NWidget(WWT_STICKYBOX, COLOUR_GREY, ORDER_WIDGET_STICKY), |
066e6b5662dc
(svn r16191) -Codechange: Added nested widgets of one order window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1292 EndContainer(), |
066e6b5662dc
(svn r16191) -Codechange: Added nested widgets of one order window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1293 NWidget(NWID_HORIZONTAL), |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1294 NWidget(WWT_PANEL, COLOUR_GREY, ORDER_WIDGET_ORDER_LIST), SetMinimalSize(372, 62), SetDataTip(0x0, STR_ORDERS_LIST_TOOLTIP), SetResize(1, 1), EndContainer(), |
11801
066e6b5662dc
(svn r16191) -Codechange: Added nested widgets of one order window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1295 NWidget(WWT_SCROLLBAR, COLOUR_GREY, ORDER_WIDGET_SCROLLBAR), |
066e6b5662dc
(svn r16191) -Codechange: Added nested widgets of one order window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1296 EndContainer(), |
066e6b5662dc
(svn r16191) -Codechange: Added nested widgets of one order window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1297 |
066e6b5662dc
(svn r16191) -Codechange: Added nested widgets of one order window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1298 /* First button row. */ |
066e6b5662dc
(svn r16191) -Codechange: Added nested widgets of one order window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1299 NWidget(NWID_HORIZONTAL), |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1300 NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1301 NWidget(NWID_SELECTION, INVALID_COLOUR, ORDER_WIDGET_SEL_TOP_LEFT), |
13664
ce197674184d
(svn r18188) -Codechange: s/NWID_BUTTON_DRPDOWN/NWID_BUTTON_DROPDOWN/g
rubidium <rubidium@openttd.org>
parents:
13628
diff
changeset
|
1302 NWidget(NWID_BUTTON_DROPDOWN, COLOUR_GREY, ORDER_WIDGET_NON_STOP), SetMinimalSize(124, 12), SetFill(true, false), |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1303 SetDataTip(STR_ORDER_NON_STOP, STR_ORDER_TOOLTIP_NON_STOP), SetResize(1, 0), |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1304 NWidget(WWT_DROPDOWN, COLOUR_GREY, ORDER_WIDGET_COND_VARIABLE), SetMinimalSize(124, 12), SetFill(true, false), |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1305 SetDataTip(STR_NULL, STR_ORDER_CONDITIONAL_VARIABLE_TOOLTIP), SetResize(1, 0), |
11801
066e6b5662dc
(svn r16191) -Codechange: Added nested widgets of one order window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1306 EndContainer(), |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1307 NWidget(NWID_SELECTION, INVALID_COLOUR, ORDER_WIDGET_SEL_TOP_MIDDLE), |
13664
ce197674184d
(svn r18188) -Codechange: s/NWID_BUTTON_DRPDOWN/NWID_BUTTON_DROPDOWN/g
rubidium <rubidium@openttd.org>
parents:
13628
diff
changeset
|
1308 NWidget(NWID_BUTTON_DROPDOWN, COLOUR_GREY, ORDER_WIDGET_FULL_LOAD), SetMinimalSize(124, 12), SetFill(true, false), |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1309 SetDataTip(STR_ORDER_TOGGLE_FULL_LOAD, STR_ORDER_TOOLTIP_FULL_LOAD), SetResize(1, 0), |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1310 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, ORDER_WIDGET_REFIT), SetMinimalSize(124, 12), SetFill(true, false), |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1311 SetDataTip(STR_ORDER_REFIT, STR_ORDER_REFIT_TOOLTIP), SetResize(1, 0), |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1312 NWidget(WWT_DROPDOWN, COLOUR_GREY, ORDER_WIDGET_COND_COMPARATOR), SetMinimalSize(124, 12), SetFill(true, false), |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1313 SetDataTip(STR_NULL, STR_ORDER_CONDITIONAL_COMPARATOR_TOOLTIP), SetResize(1, 0), |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1314 EndContainer(), |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1315 NWidget(NWID_SELECTION, INVALID_COLOUR, ORDER_WIDGET_SEL_TOP_RIGHT), |
13664
ce197674184d
(svn r18188) -Codechange: s/NWID_BUTTON_DRPDOWN/NWID_BUTTON_DROPDOWN/g
rubidium <rubidium@openttd.org>
parents:
13628
diff
changeset
|
1316 NWidget(NWID_BUTTON_DROPDOWN, COLOUR_GREY, ORDER_WIDGET_UNLOAD), SetMinimalSize(124, 12), SetFill(true, false), |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1317 SetDataTip(STR_ORDER_TOGGLE_UNLOAD, STR_ORDER_TOOLTIP_UNLOAD), SetResize(1, 0), |
13664
ce197674184d
(svn r18188) -Codechange: s/NWID_BUTTON_DRPDOWN/NWID_BUTTON_DROPDOWN/g
rubidium <rubidium@openttd.org>
parents:
13628
diff
changeset
|
1318 NWidget(NWID_BUTTON_DROPDOWN, COLOUR_GREY, ORDER_WIDGET_SERVICE), SetMinimalSize(124, 12), SetFill(true, false), |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1319 SetDataTip(STR_ORDER_SERVICE, STR_ORDER_SERVICE_TOOLTIP), SetResize(1, 0), |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1320 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, ORDER_WIDGET_COND_VALUE), SetMinimalSize(124, 12), SetFill(true, false), |
13550
e1bc91682918
(svn r18072) -Codechange: remove the need for {SKIP} (and a string) from the order window
rubidium <rubidium@openttd.org>
parents:
13466
diff
changeset
|
1321 SetDataTip(STR_BLACK_COMMA, STR_ORDER_CONDITIONAL_VALUE_TOOLTIP), SetResize(1, 0), |
11801
066e6b5662dc
(svn r16191) -Codechange: Added nested widgets of one order window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1322 EndContainer(), |
066e6b5662dc
(svn r16191) -Codechange: Added nested widgets of one order window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1323 EndContainer(), |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
1324 NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, ORDER_WIDGET_SHARED_ORDER_LIST), SetMinimalSize(12, 12), SetDataTip(SPR_SHARED_ORDERS_ICON, STR_ORDERS_VEH_WITH_SHARED_ORDERS_LIST_TOOLTIP), |
11801
066e6b5662dc
(svn r16191) -Codechange: Added nested widgets of one order window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1325 EndContainer(), |
066e6b5662dc
(svn r16191) -Codechange: Added nested widgets of one order window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1326 |
066e6b5662dc
(svn r16191) -Codechange: Added nested widgets of one order window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1327 /* Second button row. */ |
066e6b5662dc
(svn r16191) -Codechange: Added nested widgets of one order window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1328 NWidget(NWID_HORIZONTAL), |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1329 NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1330 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, ORDER_WIDGET_SKIP), SetMinimalSize(124, 12), SetFill(true, false), |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1331 SetDataTip(STR_ORDERS_SKIP_BUTTON, STR_ORDERS_SKIP_TOOLTIP), SetResize(1, 0), |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1332 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, ORDER_WIDGET_DELETE), SetMinimalSize(124, 12), SetFill(true, false), |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1333 SetDataTip(STR_ORDERS_DELETE_BUTTON, STR_ORDERS_DELETE_TOOLTIP), SetResize(1, 0), |
13664
ce197674184d
(svn r18188) -Codechange: s/NWID_BUTTON_DRPDOWN/NWID_BUTTON_DROPDOWN/g
rubidium <rubidium@openttd.org>
parents:
13628
diff
changeset
|
1334 NWidget(NWID_BUTTON_DROPDOWN, COLOUR_GREY, ORDER_WIDGET_GOTO), SetMinimalSize(124, 12), SetFill(true, false), |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1335 SetDataTip(STR_ORDERS_GO_TO_BUTTON, STR_ORDERS_GO_TO_TOOLTIP), SetResize(1, 0), |
11801
066e6b5662dc
(svn r16191) -Codechange: Added nested widgets of one order window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1336 EndContainer(), |
066e6b5662dc
(svn r16191) -Codechange: Added nested widgets of one order window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1337 NWidget(WWT_RESIZEBOX, COLOUR_GREY, ORDER_WIDGET_RESIZE), |
066e6b5662dc
(svn r16191) -Codechange: Added nested widgets of one order window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1338 EndContainer(), |
066e6b5662dc
(svn r16191) -Codechange: Added nested widgets of one order window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1339 }; |
066e6b5662dc
(svn r16191) -Codechange: Added nested widgets of one order window.
alberth <alberth@openttd.org>
parents:
11730
diff
changeset
|
1340 |
11373
474ba6cc0946
(svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents:
11361
diff
changeset
|
1341 static const WindowDesc _orders_train_desc( |
13628
2123810ad874
(svn r18152) -Codechange: remove the 'minimum window size' from the WindowDesc; it's determined from the (nested) widgets
rubidium <rubidium@openttd.org>
parents:
13602
diff
changeset
|
1342 WDP_AUTO, WDP_AUTO, 384, 100, |
8969
01cc3ee6ecb1
(svn r12761) -Codechange: lots of minor whitespace coding style fixes around operators.
rubidium <rubidium@openttd.org>
parents:
8962
diff
changeset
|
1343 WC_VEHICLE_ORDERS, WC_VEHICLE_VIEW, |
10562
19596a28a157
(svn r14819) -Change: make details and order menu stickyable, like the timetable window. Also let the detail/order/timetable window close eachther, like the detail and order windows already did, when not stickied.
rubidium <rubidium@openttd.org>
parents:
10550
diff
changeset
|
1344 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON | WDF_RESIZABLE, |
13564
bae287664b02
(svn r18086) -Codechange: remove 'widget' from WindowDesc
rubidium <rubidium@openttd.org>
parents:
13550
diff
changeset
|
1345 _nested_orders_train_widgets, lengthof(_nested_orders_train_widgets) |
11373
474ba6cc0946
(svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents:
11361
diff
changeset
|
1346 ); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1347 |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1348 /** Nested widget definition for "your" orders (non-train). */ |
11806
4f616845597d
(svn r16196) -Codechange: Added nested widgets for non-train and other-companies order windows.
alberth <alberth@openttd.org>
parents:
11805
diff
changeset
|
1349 static const NWidgetPart _nested_orders_widgets[] = { |
4f616845597d
(svn r16196) -Codechange: Added nested widgets for non-train and other-companies order windows.
alberth <alberth@openttd.org>
parents:
11805
diff
changeset
|
1350 NWidget(NWID_HORIZONTAL), |
4f616845597d
(svn r16196) -Codechange: Added nested widgets for non-train and other-companies order windows.
alberth <alberth@openttd.org>
parents:
11805
diff
changeset
|
1351 NWidget(WWT_CLOSEBOX, COLOUR_GREY, ORDER_WIDGET_CLOSEBOX), |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1352 NWidget(WWT_CAPTION, COLOUR_GREY, ORDER_WIDGET_CAPTION), SetDataTip(STR_ORDERS_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1353 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, ORDER_WIDGET_TIMETABLE_VIEW), SetMinimalSize(61, 14), SetDataTip(STR_ORDERS_TIMETABLE_VIEW, STR_ORDERS_TIMETABLE_VIEW_TOOLTIP), |
11806
4f616845597d
(svn r16196) -Codechange: Added nested widgets for non-train and other-companies order windows.
alberth <alberth@openttd.org>
parents:
11805
diff
changeset
|
1354 NWidget(WWT_STICKYBOX, COLOUR_GREY, ORDER_WIDGET_STICKY), |
4f616845597d
(svn r16196) -Codechange: Added nested widgets for non-train and other-companies order windows.
alberth <alberth@openttd.org>
parents:
11805
diff
changeset
|
1355 EndContainer(), |
4f616845597d
(svn r16196) -Codechange: Added nested widgets for non-train and other-companies order windows.
alberth <alberth@openttd.org>
parents:
11805
diff
changeset
|
1356 NWidget(NWID_HORIZONTAL), |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1357 NWidget(WWT_PANEL, COLOUR_GREY, ORDER_WIDGET_ORDER_LIST), SetMinimalSize(372, 62), SetDataTip(0x0, STR_ORDERS_LIST_TOOLTIP), SetResize(1, 1), EndContainer(), |
11806
4f616845597d
(svn r16196) -Codechange: Added nested widgets for non-train and other-companies order windows.
alberth <alberth@openttd.org>
parents:
11805
diff
changeset
|
1358 NWidget(WWT_SCROLLBAR, COLOUR_GREY, ORDER_WIDGET_SCROLLBAR), |
4f616845597d
(svn r16196) -Codechange: Added nested widgets for non-train and other-companies order windows.
alberth <alberth@openttd.org>
parents:
11805
diff
changeset
|
1359 EndContainer(), |
4f616845597d
(svn r16196) -Codechange: Added nested widgets for non-train and other-companies order windows.
alberth <alberth@openttd.org>
parents:
11805
diff
changeset
|
1360 |
4f616845597d
(svn r16196) -Codechange: Added nested widgets for non-train and other-companies order windows.
alberth <alberth@openttd.org>
parents:
11805
diff
changeset
|
1361 /* First button row. */ |
4f616845597d
(svn r16196) -Codechange: Added nested widgets for non-train and other-companies order windows.
alberth <alberth@openttd.org>
parents:
11805
diff
changeset
|
1362 NWidget(NWID_HORIZONTAL), |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1363 NWidget(NWID_SELECTION, INVALID_COLOUR, ORDER_WIDGET_SEL_TOP_ROW), |
11806
4f616845597d
(svn r16196) -Codechange: Added nested widgets for non-train and other-companies order windows.
alberth <alberth@openttd.org>
parents:
11805
diff
changeset
|
1364 /* load + unload buttons. */ |
4f616845597d
(svn r16196) -Codechange: Added nested widgets for non-train and other-companies order windows.
alberth <alberth@openttd.org>
parents:
11805
diff
changeset
|
1365 NWidget(NWID_HORIZONTAL), |
13664
ce197674184d
(svn r18188) -Codechange: s/NWID_BUTTON_DRPDOWN/NWID_BUTTON_DROPDOWN/g
rubidium <rubidium@openttd.org>
parents:
13628
diff
changeset
|
1366 NWidget(NWID_BUTTON_DROPDOWN, COLOUR_GREY, ORDER_WIDGET_FULL_LOAD), SetMinimalSize(186, 12), SetFill(true, false), |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1367 SetDataTip(STR_ORDER_TOGGLE_FULL_LOAD, STR_ORDER_TOOLTIP_FULL_LOAD), SetResize(1, 0), |
13664
ce197674184d
(svn r18188) -Codechange: s/NWID_BUTTON_DRPDOWN/NWID_BUTTON_DROPDOWN/g
rubidium <rubidium@openttd.org>
parents:
13628
diff
changeset
|
1368 NWidget(NWID_BUTTON_DROPDOWN, COLOUR_GREY, ORDER_WIDGET_UNLOAD), SetMinimalSize(186, 12), SetFill(true, false), |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1369 SetDataTip(STR_ORDER_TOGGLE_UNLOAD, STR_ORDER_TOOLTIP_UNLOAD), SetResize(1, 0), |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1370 EndContainer(), |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1371 /* Refit + service buttons. */ |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1372 NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1373 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, ORDER_WIDGET_REFIT), SetMinimalSize(186, 12), SetFill(true, false), |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1374 SetDataTip(STR_ORDER_REFIT, STR_ORDER_REFIT_TOOLTIP), SetResize(1, 0), |
13664
ce197674184d
(svn r18188) -Codechange: s/NWID_BUTTON_DRPDOWN/NWID_BUTTON_DROPDOWN/g
rubidium <rubidium@openttd.org>
parents:
13628
diff
changeset
|
1375 NWidget(NWID_BUTTON_DROPDOWN, COLOUR_GREY, ORDER_WIDGET_SERVICE), SetMinimalSize(124, 12), SetFill(true, false), |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1376 SetDataTip(STR_ORDER_SERVICE, STR_ORDER_SERVICE_TOOLTIP), SetResize(1, 0), |
11806
4f616845597d
(svn r16196) -Codechange: Added nested widgets for non-train and other-companies order windows.
alberth <alberth@openttd.org>
parents:
11805
diff
changeset
|
1377 EndContainer(), |
4f616845597d
(svn r16196) -Codechange: Added nested widgets for non-train and other-companies order windows.
alberth <alberth@openttd.org>
parents:
11805
diff
changeset
|
1378 |
4f616845597d
(svn r16196) -Codechange: Added nested widgets for non-train and other-companies order windows.
alberth <alberth@openttd.org>
parents:
11805
diff
changeset
|
1379 /* Buttons for setting a condition. */ |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1380 NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1381 NWidget(WWT_DROPDOWN, COLOUR_GREY, ORDER_WIDGET_COND_VARIABLE), SetMinimalSize(124, 12), SetFill(true, false), |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1382 SetDataTip(STR_NULL, STR_ORDER_CONDITIONAL_VARIABLE_TOOLTIP), SetResize(1, 0), |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1383 NWidget(WWT_DROPDOWN, COLOUR_GREY, ORDER_WIDGET_COND_COMPARATOR), SetMinimalSize(124, 12), SetFill(true, false), |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1384 SetDataTip(STR_NULL, STR_ORDER_CONDITIONAL_COMPARATOR_TOOLTIP), SetResize(1, 0), |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1385 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, ORDER_WIDGET_COND_VALUE), SetMinimalSize(124, 12), SetFill(true, false), |
13550
e1bc91682918
(svn r18072) -Codechange: remove the need for {SKIP} (and a string) from the order window
rubidium <rubidium@openttd.org>
parents:
13466
diff
changeset
|
1386 SetDataTip(STR_BLACK_COMMA, STR_ORDER_CONDITIONAL_VALUE_TOOLTIP), SetResize(1, 0), |
11806
4f616845597d
(svn r16196) -Codechange: Added nested widgets for non-train and other-companies order windows.
alberth <alberth@openttd.org>
parents:
11805
diff
changeset
|
1387 EndContainer(), |
4f616845597d
(svn r16196) -Codechange: Added nested widgets for non-train and other-companies order windows.
alberth <alberth@openttd.org>
parents:
11805
diff
changeset
|
1388 EndContainer(), |
4f616845597d
(svn r16196) -Codechange: Added nested widgets for non-train and other-companies order windows.
alberth <alberth@openttd.org>
parents:
11805
diff
changeset
|
1389 |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
1390 NWidget(WWT_PUSHIMGBTN, COLOUR_GREY, ORDER_WIDGET_SHARED_ORDER_LIST), SetMinimalSize(12, 12), SetDataTip(SPR_SHARED_ORDERS_ICON, STR_ORDERS_VEH_WITH_SHARED_ORDERS_LIST_TOOLTIP), |
11806
4f616845597d
(svn r16196) -Codechange: Added nested widgets for non-train and other-companies order windows.
alberth <alberth@openttd.org>
parents:
11805
diff
changeset
|
1391 EndContainer(), |
4f616845597d
(svn r16196) -Codechange: Added nested widgets for non-train and other-companies order windows.
alberth <alberth@openttd.org>
parents:
11805
diff
changeset
|
1392 |
4f616845597d
(svn r16196) -Codechange: Added nested widgets for non-train and other-companies order windows.
alberth <alberth@openttd.org>
parents:
11805
diff
changeset
|
1393 /* Second button row. */ |
4f616845597d
(svn r16196) -Codechange: Added nested widgets for non-train and other-companies order windows.
alberth <alberth@openttd.org>
parents:
11805
diff
changeset
|
1394 NWidget(NWID_HORIZONTAL), |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1395 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, ORDER_WIDGET_SKIP), SetMinimalSize(124, 12), SetFill(true, false), |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1396 SetDataTip(STR_ORDERS_SKIP_BUTTON, STR_ORDERS_SKIP_TOOLTIP), SetResize(1, 0), |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1397 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, ORDER_WIDGET_DELETE), SetMinimalSize(124, 12), SetFill(true, false), |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1398 SetDataTip(STR_ORDERS_DELETE_BUTTON, STR_ORDERS_DELETE_TOOLTIP), SetResize(1, 0), |
13664
ce197674184d
(svn r18188) -Codechange: s/NWID_BUTTON_DRPDOWN/NWID_BUTTON_DROPDOWN/g
rubidium <rubidium@openttd.org>
parents:
13628
diff
changeset
|
1399 NWidget(NWID_BUTTON_DROPDOWN, COLOUR_GREY, ORDER_WIDGET_GOTO), SetMinimalSize(124, 12), SetFill(true, false), |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1400 SetDataTip(STR_ORDERS_GO_TO_BUTTON, STR_ORDERS_GO_TO_TOOLTIP), SetResize(1, 0), |
11806
4f616845597d
(svn r16196) -Codechange: Added nested widgets for non-train and other-companies order windows.
alberth <alberth@openttd.org>
parents:
11805
diff
changeset
|
1401 NWidget(WWT_RESIZEBOX, COLOUR_GREY, ORDER_WIDGET_RESIZE), |
4f616845597d
(svn r16196) -Codechange: Added nested widgets for non-train and other-companies order windows.
alberth <alberth@openttd.org>
parents:
11805
diff
changeset
|
1402 EndContainer(), |
4f616845597d
(svn r16196) -Codechange: Added nested widgets for non-train and other-companies order windows.
alberth <alberth@openttd.org>
parents:
11805
diff
changeset
|
1403 }; |
4f616845597d
(svn r16196) -Codechange: Added nested widgets for non-train and other-companies order windows.
alberth <alberth@openttd.org>
parents:
11805
diff
changeset
|
1404 |
11373
474ba6cc0946
(svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents:
11361
diff
changeset
|
1405 static const WindowDesc _orders_desc( |
13628
2123810ad874
(svn r18152) -Codechange: remove the 'minimum window size' from the WindowDesc; it's determined from the (nested) widgets
rubidium <rubidium@openttd.org>
parents:
13602
diff
changeset
|
1406 WDP_AUTO, WDP_AUTO, 384, 100, |
8969
01cc3ee6ecb1
(svn r12761) -Codechange: lots of minor whitespace coding style fixes around operators.
rubidium <rubidium@openttd.org>
parents:
8962
diff
changeset
|
1407 WC_VEHICLE_ORDERS, WC_VEHICLE_VIEW, |
10562
19596a28a157
(svn r14819) -Change: make details and order menu stickyable, like the timetable window. Also let the detail/order/timetable window close eachther, like the detail and order windows already did, when not stickied.
rubidium <rubidium@openttd.org>
parents:
10550
diff
changeset
|
1408 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON | WDF_RESIZABLE, |
13564
bae287664b02
(svn r18086) -Codechange: remove 'widget' from WindowDesc
rubidium <rubidium@openttd.org>
parents:
13550
diff
changeset
|
1409 _nested_orders_widgets, lengthof(_nested_orders_widgets) |
11373
474ba6cc0946
(svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents:
11361
diff
changeset
|
1410 ); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1411 |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1412 /** Nested widget definition for competitor orders. */ |
11806
4f616845597d
(svn r16196) -Codechange: Added nested widgets for non-train and other-companies order windows.
alberth <alberth@openttd.org>
parents:
11805
diff
changeset
|
1413 static const NWidgetPart _nested_other_orders_widgets[] = { |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1414 NWidget(NWID_VERTICAL), |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1415 NWidget(NWID_HORIZONTAL), |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1416 NWidget(WWT_CLOSEBOX, COLOUR_GREY, ORDER_WIDGET_CLOSEBOX), |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1417 NWidget(WWT_CAPTION, COLOUR_GREY, ORDER_WIDGET_CAPTION), SetDataTip(STR_ORDERS_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1418 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, ORDER_WIDGET_TIMETABLE_VIEW), SetMinimalSize(61, 14), SetDataTip(STR_ORDERS_TIMETABLE_VIEW, STR_ORDERS_TIMETABLE_VIEW_TOOLTIP), |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1419 NWidget(WWT_STICKYBOX, COLOUR_GREY, ORDER_WIDGET_STICKY), |
11806
4f616845597d
(svn r16196) -Codechange: Added nested widgets for non-train and other-companies order windows.
alberth <alberth@openttd.org>
parents:
11805
diff
changeset
|
1420 EndContainer(), |
13077
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1421 NWidget(NWID_HORIZONTAL), |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1422 NWidget(WWT_PANEL, COLOUR_GREY, ORDER_WIDGET_ORDER_LIST), SetMinimalSize(372, 72), SetDataTip(0x0, STR_ORDERS_LIST_TOOLTIP), SetResize(1, 1), EndContainer(), |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1423 NWidget(NWID_VERTICAL), |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1424 NWidget(WWT_SCROLLBAR, COLOUR_GREY, ORDER_WIDGET_SCROLLBAR), |
7e8fe82936af
(svn r17577) -Codechange: Order window uses pure nested widgets.
alberth <alberth@openttd.org>
parents:
13073
diff
changeset
|
1425 NWidget(WWT_RESIZEBOX, COLOUR_GREY, ORDER_WIDGET_RESIZE), |
11806
4f616845597d
(svn r16196) -Codechange: Added nested widgets for non-train and other-companies order windows.
alberth <alberth@openttd.org>
parents:
11805
diff
changeset
|
1426 EndContainer(), |
4f616845597d
(svn r16196) -Codechange: Added nested widgets for non-train and other-companies order windows.
alberth <alberth@openttd.org>
parents:
11805
diff
changeset
|
1427 EndContainer(), |
4f616845597d
(svn r16196) -Codechange: Added nested widgets for non-train and other-companies order windows.
alberth <alberth@openttd.org>
parents:
11805
diff
changeset
|
1428 EndContainer(), |
4f616845597d
(svn r16196) -Codechange: Added nested widgets for non-train and other-companies order windows.
alberth <alberth@openttd.org>
parents:
11805
diff
changeset
|
1429 }; |
4f616845597d
(svn r16196) -Codechange: Added nested widgets for non-train and other-companies order windows.
alberth <alberth@openttd.org>
parents:
11805
diff
changeset
|
1430 |
11373
474ba6cc0946
(svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents:
11361
diff
changeset
|
1431 static const WindowDesc _other_orders_desc( |
13628
2123810ad874
(svn r18152) -Codechange: remove the 'minimum window size' from the WindowDesc; it's determined from the (nested) widgets
rubidium <rubidium@openttd.org>
parents:
13602
diff
changeset
|
1432 WDP_AUTO, WDP_AUTO, 384, 86, |
8969
01cc3ee6ecb1
(svn r12761) -Codechange: lots of minor whitespace coding style fixes around operators.
rubidium <rubidium@openttd.org>
parents:
8962
diff
changeset
|
1433 WC_VEHICLE_ORDERS, WC_VEHICLE_VIEW, |
10998
a1d256bf72e0
(svn r15338) -Fix [FS#2598]: close all construction related windows whenever changing company.
rubidium <rubidium@openttd.org>
parents:
10996
diff
changeset
|
1434 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE | WDF_CONSTRUCTION, |
13564
bae287664b02
(svn r18086) -Codechange: remove 'widget' from WindowDesc
rubidium <rubidium@openttd.org>
parents:
13550
diff
changeset
|
1435 _nested_other_orders_widgets, lengthof(_nested_other_orders_widgets) |
11373
474ba6cc0946
(svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents:
11361
diff
changeset
|
1436 ); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1437 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1438 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
|
1439 { |
10562
19596a28a157
(svn r14819) -Change: make details and order menu stickyable, like the timetable window. Also let the detail/order/timetable window close eachther, like the detail and order windows already did, when not stickied.
rubidium <rubidium@openttd.org>
parents:
10550
diff
changeset
|
1440 DeleteWindowById(WC_VEHICLE_DETAILS, v->index, false); |
19596a28a157
(svn r14819) -Change: make details and order menu stickyable, like the timetable window. Also let the detail/order/timetable window close eachther, like the detail and order windows already did, when not stickied.
rubidium <rubidium@openttd.org>
parents:
10550
diff
changeset
|
1441 DeleteWindowById(WC_VEHICLE_TIMETABLE, v->index, false); |
10527
4009f0225cef
(svn r14784) -Change: don't close and reopen the vehicle order/detail windows, just refocus them instead.
rubidium <rubidium@openttd.org>
parents:
10499
diff
changeset
|
1442 if (BringWindowToFrontById(WC_VEHICLE_ORDERS, v->index) != NULL) return; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1443 |
10207
c54d140df948
(svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents:
10185
diff
changeset
|
1444 if (v->owner != _local_company) { |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1445 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
|
1446 } else { |
9258
1cd16b63b893
(svn r13124) -Codechange: make a class of the OrdersWindow.
glx <glx@openttd.org>
parents:
9143
diff
changeset
|
1447 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
|
1448 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1449 } |