author | rubidium |
Sun, 13 Apr 2008 16:50:55 +0000 | |
changeset 10157 | c6c508d9e164 |
parent 10140 | 70db180c1072 |
child 10158 | e4e8e74d96c7 |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
6677
0578c2e31ed1
(svn r9390) -Documentation : correct Doxygen of comments and @file inclusion. This time, brought to you by the letter O
belugas
parents:
6655
diff
changeset
|
3 |
/** @file order_gui.cpp */ |
0578c2e31ed1
(svn r9390) -Documentation : correct Doxygen of comments and @file inclusion. This time, brought to you by the letter O
belugas
parents:
6655
diff
changeset
|
4 |
|
0 | 5 |
#include "stdafx.h" |
1891
92a3b0aa0946
(svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents:
1857
diff
changeset
|
6 |
#include "openttd.h" |
3144
426b825578f9
(svn r3763) Adapt to the new 'map accessors go in foo_map.h'-scheme
tron
parents:
3071
diff
changeset
|
7 |
#include "road_map.h" |
3315
1f65f8260092
(svn r4079) Add GetSation{Index,ByTile}() to get the station index resp. the station from a tile
tron
parents:
3269
diff
changeset
|
8 |
#include "station_map.h" |
0 | 9 |
#include "gui.h" |
8603
88c5ce6a5215
(svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents:
8602
diff
changeset
|
10 |
#include "window_gui.h" |
9281
d8cd9ac52a68
(svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
9280
diff
changeset
|
11 |
#include "station_base.h" |
0 | 12 |
#include "town.h" |
8612
6414fc21c2f3
(svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
8610
diff
changeset
|
13 |
#include "command_func.h" |
8720
4e60c30e2006
(svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents:
8707
diff
changeset
|
14 |
#include "viewport_func.h" |
4e60c30e2006
(svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents:
8707
diff
changeset
|
15 |
#include "gfx_func.h" |
1313
bba6afb8a995
(svn r1817) -Codechange: Moved depot-functions to depot.c
truelight
parents:
1256
diff
changeset
|
16 |
#include "depot.h" |
1542
2ca6d1624e6d
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
1530
diff
changeset
|
17 |
#include "waypoint.h" |
2676
2ba71e034d97
(svn r3218) -Feature: Multiheaded train engines will now stay in the same train
bjarni
parents:
2668
diff
changeset
|
18 |
#include "train.h" |
3392
7c330e18dfe1
(svn r4200) -Codechange: Make use of water map accessors when getting the Index of a Ship Depot. TODO: Store the depot index in the map
celestar
parents:
3387
diff
changeset
|
19 |
#include "water_map.h" |
4668
8b6035c51188
(svn r6562) -Codechange: merged the vehicle list window widget arrays
bjarni
parents:
4634
diff
changeset
|
20 |
#include "vehicle_gui.h" |
7476
7f086e4b2a76
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
7419
diff
changeset
|
21 |
#include "timetable.h" |
6417
26acff62d001
(svn r8826) -Codechange: Replace _cargoc's separate arrays with a regular struct array (with accessor) and implement new initialization method using cargo labels.
peter1138
parents:
6310
diff
changeset
|
22 |
#include "cargotype.h" |
8610
17cc343a23dd
(svn r11675) -Codechange: split the string types from the string functions.
rubidium
parents:
8604
diff
changeset
|
23 |
#include "strings_func.h" |
8627
448ebf3a8291
(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
parents:
8617
diff
changeset
|
24 |
#include "window_func.h" |
8640
1e93b81e96d2
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
8635
diff
changeset
|
25 |
#include "vehicle_func.h" |
8707
55835d8fbfcd
(svn r11774) -Change: do not include variables.h in a header when it is not needed.
rubidium
parents:
8640
diff
changeset
|
26 |
#include "settings_type.h" |
8750
fdd6054e7bae
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
8733
diff
changeset
|
27 |
#include "player_func.h" |
9283
624272490f5a
(svn r12495) -Codechange: reduce the dependency on newgrf_station.h (especially because newgrf_station.h includes a lot of stuff).
rubidium
parents:
9281
diff
changeset
|
28 |
#include "newgrf_cargo.h" |
10113
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
29 |
#include "widgets/dropdown_func.h" |
10136
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
30 |
#include "textbuf_gui.h" |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
31 |
#include "string_func.h" |
0 | 32 |
|
8760
ce0891c412ce
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8750
diff
changeset
|
33 |
#include "table/sprites.h" |
ce0891c412ce
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8750
diff
changeset
|
34 |
#include "table/strings.h" |
ce0891c412ce
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8750
diff
changeset
|
35 |
|
6079
46605a85887c
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5996
diff
changeset
|
36 |
enum OrderWindowWidgets { |
46605a85887c
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5996
diff
changeset
|
37 |
ORDER_WIDGET_CLOSEBOX = 0, |
46605a85887c
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5996
diff
changeset
|
38 |
ORDER_WIDGET_CAPTION, |
7476
7f086e4b2a76
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
7419
diff
changeset
|
39 |
ORDER_WIDGET_TIMETABLE_VIEW, |
6079
46605a85887c
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5996
diff
changeset
|
40 |
ORDER_WIDGET_ORDER_LIST, |
46605a85887c
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5996
diff
changeset
|
41 |
ORDER_WIDGET_SCROLLBAR, |
46605a85887c
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5996
diff
changeset
|
42 |
ORDER_WIDGET_SKIP, |
46605a85887c
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5996
diff
changeset
|
43 |
ORDER_WIDGET_DELETE, |
46605a85887c
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5996
diff
changeset
|
44 |
ORDER_WIDGET_NON_STOP, |
46605a85887c
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5996
diff
changeset
|
45 |
ORDER_WIDGET_GOTO, |
10130
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
46 |
ORDER_WIDGET_GOTO_DROPDOWN, |
6079
46605a85887c
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5996
diff
changeset
|
47 |
ORDER_WIDGET_FULL_LOAD, |
46605a85887c
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5996
diff
changeset
|
48 |
ORDER_WIDGET_UNLOAD, |
6080
a56f432ef1b1
(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
parents:
6079
diff
changeset
|
49 |
ORDER_WIDGET_REFIT, |
10110
d0cd5452bbe9
(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
parents:
10109
diff
changeset
|
50 |
ORDER_WIDGET_SERVICE, |
10136
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
51 |
ORDER_WIDGET_COND_VARIABLE, |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
52 |
ORDER_WIDGET_COND_COMPARATOR, |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
53 |
ORDER_WIDGET_COND_VALUE, |
10110
d0cd5452bbe9
(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
parents:
10109
diff
changeset
|
54 |
ORDER_WIDGET_RESIZE_BAR, |
6079
46605a85887c
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5996
diff
changeset
|
55 |
ORDER_WIDGET_SHARED_ORDER_LIST, |
46605a85887c
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5996
diff
changeset
|
56 |
ORDER_WIDGET_RESIZE, |
46605a85887c
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5996
diff
changeset
|
57 |
}; |
46605a85887c
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5996
diff
changeset
|
58 |
|
10136
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
59 |
/** Under what reason are we using the PlaceObject functionality? */ |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
60 |
enum OrderPlaceObjectState { |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
61 |
OPOS_GOTO, |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
62 |
OPOS_CONDITIONAL, |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
63 |
}; |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
64 |
|
10132
797415496aaa
(svn r12663) -Codechange: move the definition from 'order_d' to a more appropriate place and do not misuse it for the time table GUI.
rubidium
parents:
10130
diff
changeset
|
65 |
struct order_d { |
797415496aaa
(svn r12663) -Codechange: move the definition from 'order_d' to a more appropriate place and do not misuse it for the time table GUI.
rubidium
parents:
10130
diff
changeset
|
66 |
int sel; |
10136
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
67 |
OrderPlaceObjectState goto_type; |
10132
797415496aaa
(svn r12663) -Codechange: move the definition from 'order_d' to a more appropriate place and do not misuse it for the time table GUI.
rubidium
parents:
10130
diff
changeset
|
68 |
}; |
797415496aaa
(svn r12663) -Codechange: move the definition from 'order_d' to a more appropriate place and do not misuse it for the time table GUI.
rubidium
parents:
10130
diff
changeset
|
69 |
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(order_d)); |
797415496aaa
(svn r12663) -Codechange: move the definition from 'order_d' to a more appropriate place and do not misuse it for the time table GUI.
rubidium
parents:
10130
diff
changeset
|
70 |
|
7328
8ac64204c17f
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
7303
diff
changeset
|
71 |
/** |
8ac64204c17f
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
7303
diff
changeset
|
72 |
* Return the memorised selected order. |
8ac64204c17f
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
7303
diff
changeset
|
73 |
* |
8ac64204c17f
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
7303
diff
changeset
|
74 |
* @param w current window |
8ac64204c17f
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
7303
diff
changeset
|
75 |
* @return the memorised order if it is a vaild one |
8ac64204c17f
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
7303
diff
changeset
|
76 |
* else return the number of orders |
8ac64204c17f
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
7303
diff
changeset
|
77 |
*/ |
4171 | 78 |
static int OrderGetSel(const Window *w) |
0 | 79 |
{ |
4171 | 80 |
const Vehicle *v = GetVehicle(w->window_number); |
8578
55218950ce2d
(svn r11643) -Codechange: conform with the coding style for the WP macro uses.
rubidium
parents:
8560
diff
changeset
|
81 |
int num = WP(w, order_d).sel; |
0 | 82 |
|
2549 | 83 |
return (num >= 0 && num < v->num_orders) ? num : v->num_orders; |
0 | 84 |
} |
85 |
||
7328
8ac64204c17f
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
7303
diff
changeset
|
86 |
/** |
8ac64204c17f
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
7303
diff
changeset
|
87 |
* Calculate the selected order. |
8ac64204c17f
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
7303
diff
changeset
|
88 |
* The calculation is based on the relative (to the window) y click position and |
8ac64204c17f
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
7303
diff
changeset
|
89 |
* the position of the scrollbar. |
8ac64204c17f
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
7303
diff
changeset
|
90 |
* |
8ac64204c17f
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
7303
diff
changeset
|
91 |
* @param w current window |
8ac64204c17f
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
7303
diff
changeset
|
92 |
* @param y Y-value of the click relative to the window origin |
8ac64204c17f
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
7303
diff
changeset
|
93 |
* @param v current vehicle |
8ac64204c17f
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
7303
diff
changeset
|
94 |
* @return the new selected order if the order is valid else return that |
8ac64204c17f
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
7303
diff
changeset
|
95 |
* an invalid one has been selected. |
8ac64204c17f
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
7303
diff
changeset
|
96 |
*/ |
8ac64204c17f
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
7303
diff
changeset
|
97 |
static int GetOrderFromOrderWndPt(Window *w, int y, const Vehicle *v) |
8ac64204c17f
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
7303
diff
changeset
|
98 |
{ |
8ac64204c17f
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
7303
diff
changeset
|
99 |
/* |
8ac64204c17f
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
7303
diff
changeset
|
100 |
* Calculation description: |
8ac64204c17f
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
7303
diff
changeset
|
101 |
* 15 = 14 (w->widget[ORDER_WIDGET_ORDER_LIST].top) + 1 (frame-line) |
8ac64204c17f
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
7303
diff
changeset
|
102 |
* 10 = order text hight |
8ac64204c17f
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
7303
diff
changeset
|
103 |
*/ |
10136
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
104 |
int sel = (y - w->widget[ORDER_WIDGET_ORDER_LIST].top - 1) / 10; |
7328
8ac64204c17f
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
7303
diff
changeset
|
105 |
|
8ac64204c17f
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
7303
diff
changeset
|
106 |
if ((uint)sel >= w->vscroll.cap) return INVALID_ORDER; |
8ac64204c17f
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
7303
diff
changeset
|
107 |
|
8ac64204c17f
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
7303
diff
changeset
|
108 |
sel += w->vscroll.pos; |
8ac64204c17f
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
7303
diff
changeset
|
109 |
|
8ac64204c17f
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
7303
diff
changeset
|
110 |
return (sel <= v->num_orders && sel >= 0) ? sel : INVALID_ORDER; |
8ac64204c17f
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
7303
diff
changeset
|
111 |
} |
8ac64204c17f
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
7303
diff
changeset
|
112 |
|
10112
4cff0d575f0b
(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
parents:
10110
diff
changeset
|
113 |
/** Order load types that could be given to station orders. */ |
4cff0d575f0b
(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
parents:
10110
diff
changeset
|
114 |
static const StringID _station_load_types[][5] = { |
9341
00c8dbaaf0ee
(svn r12595) -Codechange: hide Order's flags in the last few cases.
rubidium
parents:
9339
diff
changeset
|
115 |
{ |
10112
4cff0d575f0b
(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
parents:
10110
diff
changeset
|
116 |
STR_EMPTY, |
10121
b82006b98b4a
(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
parents:
10119
diff
changeset
|
117 |
INVALID_STRING_ID, |
10112
4cff0d575f0b
(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
parents:
10110
diff
changeset
|
118 |
STR_ORDER_FULL_LOAD, |
4cff0d575f0b
(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
parents:
10110
diff
changeset
|
119 |
STR_ORDER_FULL_LOAD_ANY, |
4cff0d575f0b
(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
parents:
10110
diff
changeset
|
120 |
STR_ORDER_NO_LOAD, |
9341
00c8dbaaf0ee
(svn r12595) -Codechange: hide Order's flags in the last few cases.
rubidium
parents:
9339
diff
changeset
|
121 |
}, { |
10121
b82006b98b4a
(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
parents:
10119
diff
changeset
|
122 |
STR_ORDER_UNLOAD, |
b82006b98b4a
(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
parents:
10119
diff
changeset
|
123 |
INVALID_STRING_ID, |
b82006b98b4a
(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
parents:
10119
diff
changeset
|
124 |
STR_ORDER_UNLOAD_FULL_LOAD, |
b82006b98b4a
(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
parents:
10119
diff
changeset
|
125 |
STR_ORDER_UNLOAD_FULL_LOAD_ANY, |
b82006b98b4a
(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
parents:
10119
diff
changeset
|
126 |
STR_ORDER_UNLOAD_NO_LOAD, |
b82006b98b4a
(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
parents:
10119
diff
changeset
|
127 |
}, { |
10112
4cff0d575f0b
(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
parents:
10110
diff
changeset
|
128 |
STR_ORDER_TRANSFER, |
10121
b82006b98b4a
(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
parents:
10119
diff
changeset
|
129 |
INVALID_STRING_ID, |
10112
4cff0d575f0b
(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
parents:
10110
diff
changeset
|
130 |
STR_ORDER_TRANSFER_FULL_LOAD, |
4cff0d575f0b
(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
parents:
10110
diff
changeset
|
131 |
STR_ORDER_TRANSFER_FULL_LOAD_ANY, |
10121
b82006b98b4a
(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
parents:
10119
diff
changeset
|
132 |
STR_ORDER_TRANSFER_NO_LOAD, |
b82006b98b4a
(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
parents:
10119
diff
changeset
|
133 |
}, { |
b82006b98b4a
(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
parents:
10119
diff
changeset
|
134 |
/* Unload and transfer do not work together. */ |
b82006b98b4a
(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
parents:
10119
diff
changeset
|
135 |
INVALID_STRING_ID, |
b82006b98b4a
(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
parents:
10119
diff
changeset
|
136 |
INVALID_STRING_ID, |
b82006b98b4a
(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
parents:
10119
diff
changeset
|
137 |
INVALID_STRING_ID, |
10112
4cff0d575f0b
(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
parents:
10110
diff
changeset
|
138 |
INVALID_STRING_ID, |
10119
9b29b2296969
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
10118
diff
changeset
|
139 |
}, { |
9b29b2296969
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
10118
diff
changeset
|
140 |
STR_ORDER_NO_UNLOAD, |
9b29b2296969
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
10118
diff
changeset
|
141 |
INVALID_STRING_ID, |
9b29b2296969
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
10118
diff
changeset
|
142 |
STR_ORDER_NO_UNLOAD_FULL_LOAD, |
9b29b2296969
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
10118
diff
changeset
|
143 |
STR_ORDER_NO_UNLOAD_FULL_LOAD_ANY, |
9b29b2296969
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
10118
diff
changeset
|
144 |
INVALID_STRING_ID, |
9341
00c8dbaaf0ee
(svn r12595) -Codechange: hide Order's flags in the last few cases.
rubidium
parents:
9339
diff
changeset
|
145 |
} |
1935
f43f062c9498
(svn r2441) -Feature: You can now give transfer order to set up feeder systems
celestar
parents:
1901
diff
changeset
|
146 |
}; |
f43f062c9498
(svn r2441) -Feature: You can now give transfer order to set up feeder systems
celestar
parents:
1901
diff
changeset
|
147 |
|
10124
a6b11d4d67b3
(svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium
parents:
10123
diff
changeset
|
148 |
static const StringID _order_non_stop_drowdown[] = { |
a6b11d4d67b3
(svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium
parents:
10123
diff
changeset
|
149 |
STR_ORDER_GO_TO, |
a6b11d4d67b3
(svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium
parents:
10123
diff
changeset
|
150 |
STR_ORDER_GO_NON_STOP_TO, |
a6b11d4d67b3
(svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium
parents:
10123
diff
changeset
|
151 |
STR_ORDER_GO_VIA, |
a6b11d4d67b3
(svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium
parents:
10123
diff
changeset
|
152 |
STR_ORDER_GO_NON_STOP_VIA, |
a6b11d4d67b3
(svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium
parents:
10123
diff
changeset
|
153 |
INVALID_STRING_ID |
a6b11d4d67b3
(svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium
parents:
10123
diff
changeset
|
154 |
}; |
a6b11d4d67b3
(svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium
parents:
10123
diff
changeset
|
155 |
|
a6b11d4d67b3
(svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium
parents:
10123
diff
changeset
|
156 |
static const StringID _order_full_load_drowdown[] = { |
a6b11d4d67b3
(svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium
parents:
10123
diff
changeset
|
157 |
STR_ORDER_DROP_LOAD_IF_POSSIBLE, |
a6b11d4d67b3
(svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium
parents:
10123
diff
changeset
|
158 |
STR_EMPTY, |
a6b11d4d67b3
(svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium
parents:
10123
diff
changeset
|
159 |
STR_ORDER_DROP_FULL_LOAD_ALL, |
a6b11d4d67b3
(svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium
parents:
10123
diff
changeset
|
160 |
STR_ORDER_DROP_FULL_LOAD_ANY, |
a6b11d4d67b3
(svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium
parents:
10123
diff
changeset
|
161 |
STR_ORDER_DROP_NO_LOADING, |
a6b11d4d67b3
(svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium
parents:
10123
diff
changeset
|
162 |
INVALID_STRING_ID |
a6b11d4d67b3
(svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium
parents:
10123
diff
changeset
|
163 |
}; |
a6b11d4d67b3
(svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium
parents:
10123
diff
changeset
|
164 |
|
a6b11d4d67b3
(svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium
parents:
10123
diff
changeset
|
165 |
static const StringID _order_unload_drowdown[] = { |
a6b11d4d67b3
(svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium
parents:
10123
diff
changeset
|
166 |
STR_ORDER_DROP_UNLOAD_IF_ACCEPTED, |
a6b11d4d67b3
(svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium
parents:
10123
diff
changeset
|
167 |
STR_ORDER_DROP_UNLOAD, |
a6b11d4d67b3
(svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium
parents:
10123
diff
changeset
|
168 |
STR_ORDER_DROP_TRANSFER, |
a6b11d4d67b3
(svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium
parents:
10123
diff
changeset
|
169 |
STR_EMPTY, |
a6b11d4d67b3
(svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium
parents:
10123
diff
changeset
|
170 |
STR_ORDER_DROP_NO_UNLOADING, |
a6b11d4d67b3
(svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium
parents:
10123
diff
changeset
|
171 |
INVALID_STRING_ID |
a6b11d4d67b3
(svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium
parents:
10123
diff
changeset
|
172 |
}; |
a6b11d4d67b3
(svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium
parents:
10123
diff
changeset
|
173 |
|
10130
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
174 |
static const StringID _order_goto_dropdown[] = { |
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
175 |
STR_ORDER_GO_TO, |
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
176 |
STR_ORDER_GO_TO_NEAREST_DEPOT, |
10136
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
177 |
STR_ORDER_CONDITIONAL, |
10130
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
178 |
INVALID_STRING_ID |
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
179 |
}; |
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
180 |
|
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
181 |
static const StringID _order_goto_dropdown_aircraft[] = { |
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
182 |
STR_ORDER_GO_TO, |
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
183 |
STR_ORDER_GO_TO_NEAREST_HANGAR, |
10136
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
184 |
STR_ORDER_CONDITIONAL, |
10130
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
185 |
INVALID_STRING_ID |
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
186 |
}; |
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
187 |
|
10136
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
188 |
static const StringID _order_conditional_variable[] = { |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
189 |
STR_ORDER_CONDITIONAL_LOAD_PERCENTAGE, |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
190 |
STR_ORDER_CONDITIONAL_RELIABILITY, |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
191 |
STR_ORDER_CONDITIONAL_MAX_SPEED, |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
192 |
STR_ORDER_CONDITIONAL_AGE, |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
193 |
STR_ORDER_CONDITIONAL_REQUIRES_SERVICE, |
10139
448ed1614a14
(svn r12670) -Add: unconditional/always order 'jump/skip' variable.
rubidium
parents:
10136
diff
changeset
|
194 |
STR_ORDER_CONDITIONAL_UNCONDITIONALLY, |
10136
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
195 |
INVALID_STRING_ID, |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
196 |
}; |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
197 |
|
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
198 |
static const StringID _order_conditional_condition[] = { |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
199 |
STR_ORDER_CONDITIONAL_COMPARATOR_EQUALS, |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
200 |
STR_ORDER_CONDITIONAL_COMPARATOR_NOT_EQUALS, |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
201 |
STR_ORDER_CONDITIONAL_COMPARATOR_LESS_THAN, |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
202 |
STR_ORDER_CONDITIONAL_COMPARATOR_LESS_EQUALS, |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
203 |
STR_ORDER_CONDITIONAL_COMPARATOR_MORE_THAN, |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
204 |
STR_ORDER_CONDITIONAL_COMPARATOR_MORE_EQUALS, |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
205 |
STR_ORDER_CONDITIONAL_COMPARATOR_IS_TRUE, |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
206 |
STR_ORDER_CONDITIONAL_COMPARATOR_IS_FALSE, |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
207 |
INVALID_STRING_ID, |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
208 |
}; |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
209 |
|
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
210 |
extern uint ConvertSpeedToDisplaySpeed(uint speed); |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
211 |
extern uint ConvertDisplaySpeedToSpeed(uint speed); |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
212 |
|
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
213 |
|
0 | 214 |
static void DrawOrdersWindow(Window *w) |
215 |
{ |
|
10107
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
216 |
const Vehicle *v = GetVehicle(w->window_number); |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
217 |
bool shared_orders = v->IsOrderListShared(); |
0 | 218 |
|
1024
9b06b01490a4
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
219 |
SetVScrollCount(w, v->num_orders + 1); |
0 | 220 |
|
10107
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
221 |
int sel = OrderGetSel(w); |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
222 |
const Order *order = GetVehicleOrder(v, sel); |
725 | 223 |
|
4949
fa564e9c2aea
(svn r6938) -Codechange: Comments, typo, variable naming, whitespace, strecpy and simplification
Darkvater
parents:
4935
diff
changeset
|
224 |
if (v->owner == _local_player) { |
10124
a6b11d4d67b3
(svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium
parents:
10123
diff
changeset
|
225 |
/* Set the strings for the dropdown boxes. */ |
10136
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
226 |
w->widget[ORDER_WIDGET_NON_STOP].data = _order_non_stop_drowdown[order == NULL ? 0 : order->GetNonStopType()]; |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
227 |
w->widget[ORDER_WIDGET_FULL_LOAD].data = _order_full_load_drowdown[order == NULL ? 0 : order->GetLoadType()]; |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
228 |
w->widget[ORDER_WIDGET_UNLOAD].data = _order_unload_drowdown[order == NULL ? 0 : order->GetUnloadType()]; |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
229 |
w->widget[ORDER_WIDGET_COND_VARIABLE].data = _order_conditional_variable[order == NULL ? 0 : order->GetConditionVariable()]; |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
230 |
w->widget[ORDER_WIDGET_COND_COMPARATOR].data = _order_conditional_condition[order == NULL ? 0 : order->GetConditionComparator()]; |
10124
a6b11d4d67b3
(svn r12655) -Change: show the current state in the drop down 'buttons'.
rubidium
parents:
10123
diff
changeset
|
231 |
|
4949
fa564e9c2aea
(svn r6938) -Codechange: Comments, typo, variable naming, whitespace, strecpy and simplification
Darkvater
parents:
4935
diff
changeset
|
232 |
/* skip */ |
8493
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8385
diff
changeset
|
233 |
w->SetWidgetDisabledState(ORDER_WIDGET_SKIP, v->num_orders <= 1); |
4709
eff35edfb653
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4668
diff
changeset
|
234 |
|
4949
fa564e9c2aea
(svn r6938) -Codechange: Comments, typo, variable naming, whitespace, strecpy and simplification
Darkvater
parents:
4935
diff
changeset
|
235 |
/* delete */ |
8493
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8385
diff
changeset
|
236 |
w->SetWidgetDisabledState(ORDER_WIDGET_DELETE, |
6310
076a4a571714
(svn r8685) -Feature: selecting "end of orders" and clicking delete will delete all the vehicle's orders
bjarni
parents:
6215
diff
changeset
|
237 |
(uint)v->num_orders + ((shared_orders || v->num_orders != 0) ? 1 : 0) <= (uint)WP(w, order_d).sel); |
4712
273ec3b182bf
(svn r6624) -Feature: added ability to add refit commands to vehicle orders (can only be done in goto depot orders)
bjarni
parents:
4709
diff
changeset
|
238 |
|
4949
fa564e9c2aea
(svn r6938) -Codechange: Comments, typo, variable naming, whitespace, strecpy and simplification
Darkvater
parents:
4935
diff
changeset
|
239 |
/* non-stop only for trains */ |
8493
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8385
diff
changeset
|
240 |
w->SetWidgetDisabledState(ORDER_WIDGET_NON_STOP, v->type != VEH_TRAIN || order == NULL); |
10122
c2be39747438
(svn r12653) -Codechange: disable load/unload dropdowns when there is a 'via' non-stop order to emphasize that loading/unloading will not be done.
rubidium
parents:
10121
diff
changeset
|
241 |
w->SetWidgetDisabledState(ORDER_WIDGET_FULL_LOAD, order == NULL || (order->GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION) != 0); // full load |
c2be39747438
(svn r12653) -Codechange: disable load/unload dropdowns when there is a 'via' non-stop order to emphasize that loading/unloading will not be done.
rubidium
parents:
10121
diff
changeset
|
242 |
w->SetWidgetDisabledState(ORDER_WIDGET_UNLOAD, order == NULL || (order->GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION) != 0); // unload |
4949
fa564e9c2aea
(svn r6938) -Codechange: Comments, typo, variable naming, whitespace, strecpy and simplification
Darkvater
parents:
4935
diff
changeset
|
243 |
/* Disable list of vehicles with the same shared orders if there is no list */ |
8493
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8385
diff
changeset
|
244 |
w->SetWidgetDisabledState(ORDER_WIDGET_SHARED_ORDER_LIST, !shared_orders || v->orders == NULL); |
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8385
diff
changeset
|
245 |
w->SetWidgetDisabledState(ORDER_WIDGET_REFIT, order == NULL); // Refit |
10110
d0cd5452bbe9
(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
parents:
10109
diff
changeset
|
246 |
w->SetWidgetDisabledState(ORDER_WIDGET_SERVICE, order == NULL); // Refit |
8493
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8385
diff
changeset
|
247 |
w->HideWidget(ORDER_WIDGET_REFIT); // Refit |
10110
d0cd5452bbe9
(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
parents:
10109
diff
changeset
|
248 |
w->HideWidget(ORDER_WIDGET_SERVICE); // Service |
10136
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
249 |
|
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
250 |
w->HideWidget(ORDER_WIDGET_COND_VARIABLE); |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
251 |
w->HideWidget(ORDER_WIDGET_COND_COMPARATOR); |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
252 |
w->HideWidget(ORDER_WIDGET_COND_VALUE); |
4949
fa564e9c2aea
(svn r6938) -Codechange: Comments, typo, variable naming, whitespace, strecpy and simplification
Darkvater
parents:
4935
diff
changeset
|
253 |
} |
4712
273ec3b182bf
(svn r6624) -Feature: added ability to add refit commands to vehicle orders (can only be done in goto depot orders)
bjarni
parents:
4709
diff
changeset
|
254 |
|
10136
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
255 |
w->ShowWidget(ORDER_WIDGET_NON_STOP); |
10110
d0cd5452bbe9
(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
parents:
10109
diff
changeset
|
256 |
w->ShowWidget(ORDER_WIDGET_UNLOAD); |
10121
b82006b98b4a
(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
parents:
10119
diff
changeset
|
257 |
w->ShowWidget(ORDER_WIDGET_FULL_LOAD); |
4709
eff35edfb653
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4668
diff
changeset
|
258 |
|
1024
9b06b01490a4
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
259 |
if (order != NULL) { |
9332
2e120d0bd632
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
9283
diff
changeset
|
260 |
switch (order->GetType()) { |
8553
66a54e0c1c4a
(svn r11618) -Fix: buoys are just waypoints, so don't allow load/unload/transfert for them
glx
parents:
8524
diff
changeset
|
261 |
case OT_GOTO_STATION: |
9336
3f75a2c5e0d3
(svn r12588) -Codechange: do not access the destination of an order directly.
rubidium
parents:
9335
diff
changeset
|
262 |
if (!GetStation(order->GetDestination())->IsBuoy()) break; |
8553
66a54e0c1c4a
(svn r11618) -Fix: buoys are just waypoints, so don't allow load/unload/transfert for them
glx
parents:
8524
diff
changeset
|
263 |
/* Fall-through */ |
66a54e0c1c4a
(svn r11618) -Fix: buoys are just waypoints, so don't allow load/unload/transfert for them
glx
parents:
8524
diff
changeset
|
264 |
|
66a54e0c1c4a
(svn r11618) -Fix: buoys are just waypoints, so don't allow load/unload/transfert for them
glx
parents:
8524
diff
changeset
|
265 |
case OT_GOTO_WAYPOINT: |
66a54e0c1c4a
(svn r11618) -Fix: buoys are just waypoints, so don't allow load/unload/transfert for them
glx
parents:
8524
diff
changeset
|
266 |
w->DisableWidget(ORDER_WIDGET_FULL_LOAD); |
66a54e0c1c4a
(svn r11618) -Fix: buoys are just waypoints, so don't allow load/unload/transfert for them
glx
parents:
8524
diff
changeset
|
267 |
w->DisableWidget(ORDER_WIDGET_UNLOAD); |
66a54e0c1c4a
(svn r11618) -Fix: buoys are just waypoints, so don't allow load/unload/transfert for them
glx
parents:
8524
diff
changeset
|
268 |
break; |
2549 | 269 |
|
1024
9b06b01490a4
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
270 |
case OT_GOTO_DEPOT: |
10110
d0cd5452bbe9
(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
parents:
10109
diff
changeset
|
271 |
w->DisableWidget(ORDER_WIDGET_FULL_LOAD); |
4712
273ec3b182bf
(svn r6624) -Feature: added ability to add refit commands to vehicle orders (can only be done in goto depot orders)
bjarni
parents:
4709
diff
changeset
|
272 |
|
273ec3b182bf
(svn r6624) -Feature: added ability to add refit commands to vehicle orders (can only be done in goto depot orders)
bjarni
parents:
4709
diff
changeset
|
273 |
/* Remove unload and replace it with refit */ |
8493
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8385
diff
changeset
|
274 |
w->HideWidget(ORDER_WIDGET_UNLOAD); |
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8385
diff
changeset
|
275 |
w->ShowWidget(ORDER_WIDGET_REFIT); |
10121
b82006b98b4a
(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
parents:
10119
diff
changeset
|
276 |
w->HideWidget(ORDER_WIDGET_FULL_LOAD); |
10110
d0cd5452bbe9
(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
parents:
10109
diff
changeset
|
277 |
w->ShowWidget(ORDER_WIDGET_SERVICE); |
1024
9b06b01490a4
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
278 |
break; |
725 | 279 |
|
10136
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
280 |
case OT_CONDITIONAL: { |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
281 |
w->HideWidget(ORDER_WIDGET_NON_STOP); |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
282 |
w->HideWidget(ORDER_WIDGET_UNLOAD); |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
283 |
w->HideWidget(ORDER_WIDGET_FULL_LOAD); |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
284 |
w->ShowWidget(ORDER_WIDGET_COND_VARIABLE); |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
285 |
w->ShowWidget(ORDER_WIDGET_COND_COMPARATOR); |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
286 |
w->ShowWidget(ORDER_WIDGET_COND_VALUE); |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
287 |
|
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
288 |
OrderConditionVariable ocv = order->GetConditionVariable(); |
10139
448ed1614a14
(svn r12670) -Add: unconditional/always order 'jump/skip' variable.
rubidium
parents:
10136
diff
changeset
|
289 |
w->SetWidgetDisabledState(ORDER_WIDGET_COND_COMPARATOR, ocv == OCV_UNCONDITIONALLY); |
448ed1614a14
(svn r12670) -Add: unconditional/always order 'jump/skip' variable.
rubidium
parents:
10136
diff
changeset
|
290 |
w->SetWidgetDisabledState(ORDER_WIDGET_COND_VALUE, ocv == OCV_REQUIRES_SERVICE || ocv == OCV_UNCONDITIONALLY); |
10136
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
291 |
|
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
292 |
uint value = order->GetConditionValue(); |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
293 |
if (order->GetConditionVariable() == OCV_MAX_SPEED) value = ConvertSpeedToDisplaySpeed(value); |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
294 |
SetDParam(1, value); |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
295 |
} break; |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
296 |
|
4709
eff35edfb653
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4668
diff
changeset
|
297 |
default: // every other orders |
8493
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8385
diff
changeset
|
298 |
w->DisableWidget(ORDER_WIDGET_NON_STOP); |
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8385
diff
changeset
|
299 |
w->DisableWidget(ORDER_WIDGET_FULL_LOAD); |
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8385
diff
changeset
|
300 |
w->DisableWidget(ORDER_WIDGET_UNLOAD); |
1024
9b06b01490a4
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
301 |
} |
0 | 302 |
} |
303 |
||
7545
9a4834d48970
(svn r10314) -Codechange: Refer to vehicle names by index
peter1138
parents:
7476
diff
changeset
|
304 |
SetDParam(0, v->index); |
0 | 305 |
DrawWindowWidgets(w); |
306 |
||
10107
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
307 |
int y = 15; |
0 | 308 |
|
10107
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
309 |
int i = w->vscroll.pos; |
1024
9b06b01490a4
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
310 |
order = GetVehicleOrder(v, i); |
10107
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
311 |
StringID str; |
1024
9b06b01490a4
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
312 |
while (order != NULL) { |
9b06b01490a4
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
313 |
str = (v->cur_order_index == i) ? STR_8805 : STR_8804; |
10136
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
314 |
SetDParam(6, STR_EMPTY); |
0 | 315 |
|
1242
bd3e74f757b4
(svn r1746) - Feature: [GUI] [ 1107690 ] Resizable orders GUI (nzhook)
darkvater
parents:
1214
diff
changeset
|
316 |
if (i - w->vscroll.pos < w->vscroll.cap) { |
9332
2e120d0bd632
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
9283
diff
changeset
|
317 |
switch (order->GetType()) { |
7808
70bb84732406
(svn r10664) -Codechange: simplify a small piece of code (skidd13)
truelight
parents:
7762
diff
changeset
|
318 |
case OT_DUMMY: |
70bb84732406
(svn r10664) -Codechange: simplify a small piece of code (skidd13)
truelight
parents:
7762
diff
changeset
|
319 |
SetDParam(1, STR_INVALID_ORDER); |
9336
3f75a2c5e0d3
(svn r12588) -Codechange: do not access the destination of an order directly.
rubidium
parents:
9335
diff
changeset
|
320 |
SetDParam(2, order->GetDestination()); |
7808
70bb84732406
(svn r10664) -Codechange: simplify a small piece of code (skidd13)
truelight
parents:
7762
diff
changeset
|
321 |
break; |
70bb84732406
(svn r10664) -Codechange: simplify a small piece of code (skidd13)
truelight
parents:
7762
diff
changeset
|
322 |
|
10112
4cff0d575f0b
(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
parents:
10110
diff
changeset
|
323 |
case OT_GOTO_STATION: { |
4cff0d575f0b
(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
parents:
10110
diff
changeset
|
324 |
OrderLoadFlags load = order->GetLoadType(); |
4cff0d575f0b
(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
parents:
10110
diff
changeset
|
325 |
OrderUnloadFlags unload = order->GetUnloadType(); |
4cff0d575f0b
(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
parents:
10110
diff
changeset
|
326 |
|
4cff0d575f0b
(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
parents:
10110
diff
changeset
|
327 |
SetDParam(1, STR_GO_TO_STATION); |
4cff0d575f0b
(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
parents:
10110
diff
changeset
|
328 |
SetDParam(2, STR_ORDER_GO_TO + (v->type == VEH_TRAIN ? order->GetNonStopType() : 0)); |
4cff0d575f0b
(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
parents:
10110
diff
changeset
|
329 |
SetDParam(3, order->GetDestination()); |
10122
c2be39747438
(svn r12653) -Codechange: disable load/unload dropdowns when there is a 'via' non-stop order to emphasize that loading/unloading will not be done.
rubidium
parents:
10121
diff
changeset
|
330 |
SetDParam(4, (order->GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION) ? STR_EMPTY : _station_load_types[unload][load]); |
10112
4cff0d575f0b
(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
parents:
10110
diff
changeset
|
331 |
} break; |
1935
f43f062c9498
(svn r2441) -Feature: You can now give transfer order to set up feeder systems
celestar
parents:
1901
diff
changeset
|
332 |
|
10129
7bfdb41c1482
(svn r12660) -Codechange: make the creation of depot order strings a little more modular (instead of causing a string explosion).
rubidium
parents:
10125
diff
changeset
|
333 |
case OT_GOTO_DEPOT: |
6585
7da94b26498a
(svn r9068) -Codechange: capitalize the VEH_Train etc. enums to match the coding style (and rest of the code).
rubidium
parents:
6417
diff
changeset
|
334 |
if (v->type == VEH_AIRCRAFT) { |
10130
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
335 |
if (order->GetDepotActionType() & ODATFB_NEAREST_DEPOT) { |
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
336 |
SetDParam(1, STR_GO_TO_NEAREST_DEPOT); |
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
337 |
SetDParam(3, STR_ORDER_NEAREST_HANGAR); |
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
338 |
} else { |
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
339 |
SetDParam(1, STR_GO_TO_HANGAR); |
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
340 |
SetDParam(3, order->GetDestination()); |
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
341 |
} |
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
342 |
SetDParam(4, STR_EMPTY); |
2631
13daba67f217
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2549
diff
changeset
|
343 |
} else { |
10130
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
344 |
if (order->GetDepotActionType() & ODATFB_NEAREST_DEPOT) { |
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
345 |
SetDParam(1, STR_GO_TO_NEAREST_DEPOT); |
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
346 |
SetDParam(3, STR_ORDER_NEAREST_DEPOT); |
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
347 |
} else { |
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
348 |
SetDParam(1, STR_GO_TO_DEPOT); |
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
349 |
SetDParam(3, GetDepot(order->GetDestination())->town_index); |
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
350 |
} |
2631
13daba67f217
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2549
diff
changeset
|
351 |
|
13daba67f217
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2549
diff
changeset
|
352 |
switch (v->type) { |
10129
7bfdb41c1482
(svn r12660) -Codechange: make the creation of depot order strings a little more modular (instead of causing a string explosion).
rubidium
parents:
10125
diff
changeset
|
353 |
case VEH_TRAIN: SetDParam(4, STR_ORDER_TRAIN_DEPOT); break; |
7bfdb41c1482
(svn r12660) -Codechange: make the creation of depot order strings a little more modular (instead of causing a string explosion).
rubidium
parents:
10125
diff
changeset
|
354 |
case VEH_ROAD: SetDParam(4, STR_ORDER_ROAD_DEPOT); break; |
7bfdb41c1482
(svn r12660) -Codechange: make the creation of depot order strings a little more modular (instead of causing a string explosion).
rubidium
parents:
10125
diff
changeset
|
355 |
case VEH_SHIP: SetDParam(4, STR_ORDER_SHIP_DEPOT); break; |
7bfdb41c1482
(svn r12660) -Codechange: make the creation of depot order strings a little more modular (instead of causing a string explosion).
rubidium
parents:
10125
diff
changeset
|
356 |
default: NOT_REACHED(); |
2631
13daba67f217
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2549
diff
changeset
|
357 |
} |
0 | 358 |
} |
1935
f43f062c9498
(svn r2441) -Feature: You can now give transfer order to set up feeder systems
celestar
parents:
1901
diff
changeset
|
359 |
|
10129
7bfdb41c1482
(svn r12660) -Codechange: make the creation of depot order strings a little more modular (instead of causing a string explosion).
rubidium
parents:
10125
diff
changeset
|
360 |
if (order->GetDepotOrderType() & ODTFB_SERVICE) { |
7bfdb41c1482
(svn r12660) -Codechange: make the creation of depot order strings a little more modular (instead of causing a string explosion).
rubidium
parents:
10125
diff
changeset
|
361 |
SetDParam(2, (order->GetNonStopType() & ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS) ? STR_ORDER_SERVICE_NON_STOP_AT : STR_ORDER_SERVICE_AT); |
7bfdb41c1482
(svn r12660) -Codechange: make the creation of depot order strings a little more modular (instead of causing a string explosion).
rubidium
parents:
10125
diff
changeset
|
362 |
} else { |
7bfdb41c1482
(svn r12660) -Codechange: make the creation of depot order strings a little more modular (instead of causing a string explosion).
rubidium
parents:
10125
diff
changeset
|
363 |
SetDParam(2, (order->GetNonStopType() & ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS) ? STR_ORDER_GO_NON_STOP_TO : STR_ORDER_GO_TO); |
7bfdb41c1482
(svn r12660) -Codechange: make the creation of depot order strings a little more modular (instead of causing a string explosion).
rubidium
parents:
10125
diff
changeset
|
364 |
} |
2631
13daba67f217
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2549
diff
changeset
|
365 |
|
9334
db2f5161fcba
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium
parents:
9332
diff
changeset
|
366 |
if (order->IsRefit()) { |
10136
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
367 |
SetDParam(6, STR_REFIT_ORDER); |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
368 |
SetDParam(7, GetCargo(order->GetRefitCargo())->name); |
4712
273ec3b182bf
(svn r6624) -Feature: added ability to add refit commands to vehicle orders (can only be done in goto depot orders)
bjarni
parents:
4709
diff
changeset
|
369 |
} |
2631
13daba67f217
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2549
diff
changeset
|
370 |
break; |
1024
9b06b01490a4
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
371 |
|
2631
13daba67f217
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2549
diff
changeset
|
372 |
case OT_GOTO_WAYPOINT: |
9344
1be7ac6bd504
(svn r12600) -Codechange: make GetNonStopType return a more augmented type; not is there a non-stop order but the kind of non-stop order, so one doesn't need to check _patches.new_nonstop type everywhere.
rubidium
parents:
9341
diff
changeset
|
373 |
SetDParam(1, (order->GetNonStopType() & ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS) ? STR_GO_NON_STOP_TO_WAYPOINT : STR_GO_TO_WAYPOINT); |
9336
3f75a2c5e0d3
(svn r12588) -Codechange: do not access the destination of an order directly.
rubidium
parents:
9335
diff
changeset
|
374 |
SetDParam(2, order->GetDestination()); |
2631
13daba67f217
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2549
diff
changeset
|
375 |
break; |
4351
63ae31104f07
(svn r6052) -Codechange: change OrderType (order->type) in a typedef
truelight
parents:
4344
diff
changeset
|
376 |
|
10139
448ed1614a14
(svn r12670) -Add: unconditional/always order 'jump/skip' variable.
rubidium
parents:
10136
diff
changeset
|
377 |
case OT_CONDITIONAL: |
10136
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
378 |
SetDParam(2, order->GetConditionSkipToOrder() + 1); |
10139
448ed1614a14
(svn r12670) -Add: unconditional/always order 'jump/skip' variable.
rubidium
parents:
10136
diff
changeset
|
379 |
if (order->GetConditionVariable() == OCV_UNCONDITIONALLY) { |
448ed1614a14
(svn r12670) -Add: unconditional/always order 'jump/skip' variable.
rubidium
parents:
10136
diff
changeset
|
380 |
SetDParam(1, STR_CONDITIONAL_UNCONDITIONAL); |
448ed1614a14
(svn r12670) -Add: unconditional/always order 'jump/skip' variable.
rubidium
parents:
10136
diff
changeset
|
381 |
} else { |
448ed1614a14
(svn r12670) -Add: unconditional/always order 'jump/skip' variable.
rubidium
parents:
10136
diff
changeset
|
382 |
OrderConditionComparator occ = order->GetConditionComparator(); |
448ed1614a14
(svn r12670) -Add: unconditional/always order 'jump/skip' variable.
rubidium
parents:
10136
diff
changeset
|
383 |
SetDParam(1, (occ == OCC_IS_TRUE || occ == OCC_IS_FALSE) ? STR_CONDITIONAL_TRUE_FALSE : STR_CONDITIONAL_NUM); |
448ed1614a14
(svn r12670) -Add: unconditional/always order 'jump/skip' variable.
rubidium
parents:
10136
diff
changeset
|
384 |
SetDParam(3, STR_ORDER_CONDITIONAL_LOAD_PERCENTAGE + order->GetConditionVariable()); |
448ed1614a14
(svn r12670) -Add: unconditional/always order 'jump/skip' variable.
rubidium
parents:
10136
diff
changeset
|
385 |
SetDParam(4, STR_ORDER_CONDITIONAL_COMPARATOR_EQUALS + occ); |
10136
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
386 |
|
10139
448ed1614a14
(svn r12670) -Add: unconditional/always order 'jump/skip' variable.
rubidium
parents:
10136
diff
changeset
|
387 |
uint value = order->GetConditionValue(); |
448ed1614a14
(svn r12670) -Add: unconditional/always order 'jump/skip' variable.
rubidium
parents:
10136
diff
changeset
|
388 |
if (order->GetConditionVariable() == OCV_MAX_SPEED) value = ConvertSpeedToDisplaySpeed(value); |
448ed1614a14
(svn r12670) -Add: unconditional/always order 'jump/skip' variable.
rubidium
parents:
10136
diff
changeset
|
389 |
SetDParam(5, value); |
448ed1614a14
(svn r12670) -Add: unconditional/always order 'jump/skip' variable.
rubidium
parents:
10136
diff
changeset
|
390 |
} |
448ed1614a14
(svn r12670) -Add: unconditional/always order 'jump/skip' variable.
rubidium
parents:
10136
diff
changeset
|
391 |
break; |
10136
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
392 |
|
10129
7bfdb41c1482
(svn r12660) -Codechange: make the creation of depot order strings a little more modular (instead of causing a string explosion).
rubidium
parents:
10125
diff
changeset
|
393 |
default: NOT_REACHED(); |
0 | 394 |
} |
1024
9b06b01490a4
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
395 |
|
9b06b01490a4
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
396 |
SetDParam(0, i + 1); |
8578
55218950ce2d
(svn r11643) -Codechange: conform with the coding style for the WP macro uses.
rubidium
parents:
8560
diff
changeset
|
397 |
DrawString(2, y, str, (i == WP(w, order_d).sel) ? TC_WHITE : TC_BLACK); |
7808
70bb84732406
(svn r10664) -Codechange: simplify a small piece of code (skidd13)
truelight
parents:
7762
diff
changeset
|
398 |
|
0 | 399 |
y += 10; |
400 |
} |
|
401 |
||
402 |
i++; |
|
1024
9b06b01490a4
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
403 |
order = order->next; |
9b06b01490a4
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
404 |
} |
0 | 405 |
|
1242
bd3e74f757b4
(svn r1746) - Feature: [GUI] [ 1107690 ] Resizable orders GUI (nzhook)
darkvater
parents:
1214
diff
changeset
|
406 |
if (i - w->vscroll.pos < w->vscroll.cap) { |
1024
9b06b01490a4
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
407 |
str = shared_orders ? STR_END_OF_SHARED_ORDERS : STR_882A_END_OF_ORDERS; |
8578
55218950ce2d
(svn r11643) -Codechange: conform with the coding style for the WP macro uses.
rubidium
parents:
8560
diff
changeset
|
408 |
DrawString(2, y, str, (i == WP(w, order_d).sel) ? TC_WHITE : TC_BLACK); |
0 | 409 |
} |
410 |
} |
|
411 |
||
2436
177cb6a8339f
(svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents:
2186
diff
changeset
|
412 |
static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile) |
0 | 413 |
{ |
558
9b115b39c515
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
414 |
Order order; |
3387
5d14492dce35
(svn r4195) - Codechange: Initialize order variables to avoid a compiler warning. These are unused anyway... (smells of r3476-7, but not the same)
peter1138
parents:
3338
diff
changeset
|
415 |
order.next = NULL; |
5d14492dce35
(svn r4195) - Codechange: Initialize order variables to avoid a compiler warning. These are unused anyway... (smells of r3476-7, but not the same)
peter1138
parents:
3338
diff
changeset
|
416 |
order.index = 0; |
0 | 417 |
|
10107
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
418 |
/* check depot first */ |
0 | 419 |
if (_patches.gotodepot) { |
1214
33e07bbb7779
(svn r1718) Use the enum TileType as parameter/return type for [GS]etTileType() instead of plain int.
tron
parents:
1209
diff
changeset
|
420 |
switch (GetTileType(tile)) { |
10107
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
421 |
case MP_RAILWAY: |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
422 |
if (v->type == VEH_TRAIN && IsTileOwner(tile, _local_player)) { |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
423 |
if (IsRailDepot(tile)) { |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
424 |
order.MakeGoToDepot(GetDepotByTile(tile)->index, ODTFB_PART_OF_ORDERS); |
10157
c6c508d9e164
(svn r12688) -Change: make default non-stop for depot/waypoint orders the same as for stations.
rubidium
parents:
10140
diff
changeset
|
425 |
if (_patches.new_nonstop) order.SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS); |
10107
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
426 |
return order; |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
427 |
} |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
428 |
} |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
429 |
break; |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
430 |
|
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
431 |
case MP_ROAD: |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
432 |
if (IsRoadDepot(tile) && v->type == VEH_ROAD && IsTileOwner(tile, _local_player)) { |
10079
99aba130db3c
(svn r12615) -Codechange: rename some enums related to depot orders to make it more clear that they are no loading/unloading flags. Also add more type strictness.
rubidium
parents:
9344
diff
changeset
|
433 |
order.MakeGoToDepot(GetDepotByTile(tile)->index, ODTFB_PART_OF_ORDERS); |
558
9b115b39c515
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
434 |
return order; |
560
bd8a572dc8b9
(svn r962) Fixed a problem with the new order system due to missing '{}' (another place)
Celestar
parents:
559
diff
changeset
|
435 |
} |
10107
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
436 |
break; |
0 | 437 |
|
10107
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
438 |
case MP_STATION: |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
439 |
if (v->type != VEH_AIRCRAFT) break; |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
440 |
if (IsHangar(tile) && IsTileOwner(tile, _local_player)) { |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
441 |
order.MakeGoToDepot(GetStationIndex(tile), ODTFB_PART_OF_ORDERS); |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
442 |
return order; |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
443 |
} |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
444 |
break; |
0 | 445 |
|
10107
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
446 |
case MP_WATER: |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
447 |
if (v->type != VEH_SHIP) break; |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
448 |
if (IsTileDepotType(tile, TRANSPORT_WATER) && |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
449 |
IsTileOwner(tile, _local_player)) { |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
450 |
TileIndex tile2 = GetOtherShipDepotTile(tile); |
3392
7c330e18dfe1
(svn r4200) -Codechange: Make use of water map accessors when getting the Index of a Ship Depot. TODO: Store the depot index in the map
celestar
parents:
3387
diff
changeset
|
451 |
|
10107
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
452 |
order.MakeGoToDepot(GetDepotByTile(tile < tile2 ? tile : tile2)->index, ODTFB_PART_OF_ORDERS); |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
453 |
return order; |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
454 |
} |
1214
33e07bbb7779
(svn r1718) Use the enum TileType as parameter/return type for [GS]etTileType() instead of plain int.
tron
parents:
1209
diff
changeset
|
455 |
|
33e07bbb7779
(svn r1718) Use the enum TileType as parameter/return type for [GS]etTileType() instead of plain int.
tron
parents:
1209
diff
changeset
|
456 |
default: |
33e07bbb7779
(svn r1718) Use the enum TileType as parameter/return type for [GS]etTileType() instead of plain int.
tron
parents:
1209
diff
changeset
|
457 |
break; |
0 | 458 |
} |
459 |
} |
|
460 |
||
10107
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
461 |
/* check waypoint */ |
1901
fb05044cf5c3
(svn r2407) Use {Get,Is}TileOwner to get/check the owner of a tile and fix some bogus reads of _map_owner
tron
parents:
1891
diff
changeset
|
462 |
if (IsTileType(tile, MP_RAILWAY) && |
6585
7da94b26498a
(svn r9068) -Codechange: capitalize the VEH_Train etc. enums to match the coding style (and rest of the code).
rubidium
parents:
6417
diff
changeset
|
463 |
v->type == VEH_TRAIN && |
1901
fb05044cf5c3
(svn r2407) Use {Get,Is}TileOwner to get/check the owner of a tile and fix some bogus reads of _map_owner
tron
parents:
1891
diff
changeset
|
464 |
IsTileOwner(tile, _local_player) && |
2668
54d9f9d4dca3
(svn r3210) -Codechange: use IsRailWaypoint where possible (instead of magicnumbers)
truelight
parents:
2643
diff
changeset
|
465 |
IsRailWaypoint(tile)) { |
9332
2e120d0bd632
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
9283
diff
changeset
|
466 |
order.MakeGoToWaypoint(GetWaypointByTile(tile)->index); |
10157
c6c508d9e164
(svn r12688) -Change: make default non-stop for depot/waypoint orders the same as for stations.
rubidium
parents:
10140
diff
changeset
|
467 |
if (_patches.new_nonstop) order.SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS); |
558
9b115b39c515
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
468 |
return order; |
9b115b39c515
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
469 |
} |
319
1891d07574d6
(svn r329) Fix: [ 1035066 ] 'Allow goto depot' turned off, no checkpoints in orders
dominik
parents:
193
diff
changeset
|
470 |
|
1035
0a170deb6e33
(svn r1536) Move GET_TILEHEIGHT, GET_TILETYPE and IS_TILETYPE to map.h, turn them into inline functions and add some asserts
tron
parents:
1024
diff
changeset
|
471 |
if (IsTileType(tile, MP_STATION)) { |
3315
1f65f8260092
(svn r4079) Add GetSation{Index,ByTile}() to get the station index resp. the station from a tile
tron
parents:
3269
diff
changeset
|
472 |
StationID st_index = GetStationIndex(tile); |
4171 | 473 |
const Station *st = GetStation(st_index); |
0 | 474 |
|
475 |
if (st->owner == _current_player || st->owner == OWNER_NONE) { |
|
476 |
byte facil; |
|
10107
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
477 |
(facil = FACIL_DOCK, v->type == VEH_SHIP) || |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
478 |
(facil = FACIL_TRAIN, v->type == VEH_TRAIN) || |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
479 |
(facil = FACIL_AIRPORT, v->type == VEH_AIRCRAFT) || |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
480 |
(facil = FACIL_BUS_STOP, v->type == VEH_ROAD && IsCargoInClass(v->cargo_type, CC_PASSENGERS)) || |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
481 |
(facil = FACIL_TRUCK_STOP, 1); |
558
9b115b39c515
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
482 |
if (st->facilities & facil) { |
9332
2e120d0bd632
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
9283
diff
changeset
|
483 |
order.MakeGoToStation(st_index); |
10117
6a796f06bff4
(svn r12648) -Feature: allow four different non-stop types in a single game instead of two. The "TTDP compatible order" setting now only sets the default behaviour of new trains.
rubidium
parents:
10113
diff
changeset
|
484 |
if (_patches.new_nonstop && v->type == VEH_TRAIN) order.SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS); |
558
9b115b39c515
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
485 |
return order; |
9b115b39c515
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
486 |
} |
0 | 487 |
} |
488 |
} |
|
489 |
||
10107
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
490 |
/* not found */ |
6589
addf4b6946d0
(svn r9072) -Codechange: [Orders] added methods to orders to free them and check if they are in use
bjarni
parents:
6585
diff
changeset
|
491 |
order.Free(); |
558
9b115b39c515
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
492 |
return order; |
0 | 493 |
} |
494 |
||
4171 | 495 |
static bool HandleOrderVehClick(const Vehicle *v, const Vehicle *u, Window *w) |
0 | 496 |
{ |
2549 | 497 |
if (u->type != v->type) return false; |
0 | 498 |
|
8044
72c3e2bc6429
(svn r11068) -Codechange: remove Vehicle::HasFront as all vehicles have the Vehicle::first pointer correctly set.
rubidium
parents:
7993
diff
changeset
|
499 |
if (!u->IsPrimaryVehicle()) { |
7993
76b0eb3e19c9
(svn r11011) -Fix [FS#1129]: GetFirstVehicleInChain did change the game state while being marked const.
rubidium
parents:
7866
diff
changeset
|
500 |
u = u->First(); |
7269
c7f39d91255e
(svn r10009) -Codechange: Add and use Vehicle::IsPrimaryVehicle to replace individual checks depending on the vehicle type.
maedhros
parents:
6988
diff
changeset
|
501 |
if (!u->IsPrimaryVehicle()) return false; |
0 | 502 |
} |
503 |
||
10107
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
504 |
/* v is vehicle getting orders. Only copy/clone orders if vehicle doesn't have any orders yet |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
505 |
* obviously if you press CTRL on a non-empty orders vehicle you know what you are doing */ |
2549 | 506 |
if (v->num_orders != 0 && _ctrl_pressed == 0) return false; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
507 |
|
8560
8472721356cf
(svn r11625) -Codechange: add CO_* enum at some places, add includes of order.h too
smatz
parents:
8553
diff
changeset
|
508 |
if (DoCommandP(v->tile, v->index | (u->index << 16), _ctrl_pressed ? CO_SHARE : CO_COPY, NULL, |
0 | 509 |
_ctrl_pressed ? CMD_CLONE_ORDER | CMD_MSG(STR_CANT_SHARE_ORDER_LIST) : CMD_CLONE_ORDER | CMD_MSG(STR_CANT_COPY_ORDER_LIST))) { |
8578
55218950ce2d
(svn r11643) -Codechange: conform with the coding style for the WP macro uses.
rubidium
parents:
8560
diff
changeset
|
510 |
WP(w, order_d).sel = -1; |
0 | 511 |
ResetObjectToPlace(); |
512 |
} |
|
513 |
||
514 |
return true; |
|
515 |
} |
|
516 |
||
4171 | 517 |
static void OrdersPlaceObj(const Vehicle *v, TileIndex tile, Window *w) |
0 | 518 |
{ |
10107
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
519 |
/* check if we're clicking on a vehicle first.. clone orders in that case. */ |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
520 |
const Vehicle *u = CheckMouseOverVehicle(); |
2549 | 521 |
if (u != NULL && HandleOrderVehClick(v, u, w)) return; |
0 | 522 |
|
10107
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
523 |
const Order cmd = GetOrderCmdFromTile(v, tile); |
6589
addf4b6946d0
(svn r9072) -Codechange: [Orders] added methods to orders to free them and check if they are in use
bjarni
parents:
6585
diff
changeset
|
524 |
if (!cmd.IsValid()) return; |
0 | 525 |
|
9335
18d3658adc60
(svn r12587) -Codechange: unduplicate some code in the Unpack*Order functions and move the 'normal' case Pack/Unpack to Order.
rubidium
parents:
9334
diff
changeset
|
526 |
if (DoCommandP(v->tile, v->index + (OrderGetSel(w) << 16), cmd.Pack(), NULL, CMD_INSERT_ORDER | CMD_MSG(STR_8833_CAN_T_INSERT_NEW_ORDER))) { |
8578
55218950ce2d
(svn r11643) -Codechange: conform with the coding style for the WP macro uses.
rubidium
parents:
8560
diff
changeset
|
527 |
if (WP(w, order_d).sel != -1) WP(w,order_d).sel++; |
0 | 528 |
ResetObjectToPlace(); |
529 |
} |
|
530 |
} |
|
531 |
||
7303
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
532 |
/** |
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
533 |
* Handle the click on the goto button. |
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
534 |
* |
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
535 |
* @param w current window |
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
536 |
* @param v current vehicle |
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
537 |
*/ |
10113
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
538 |
static void OrderClick_Goto(Window *w, const Vehicle *v, int i) |
1000
a418026097f6
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
539 |
{ |
8524
baf4ab1ba18d
(svn r11588) -Codechange: use the new member introduced in r11551
glx
parents:
8493
diff
changeset
|
540 |
w->InvalidateWidget(ORDER_WIDGET_GOTO); |
8493
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8385
diff
changeset
|
541 |
w->ToggleWidgetLoweredState(ORDER_WIDGET_GOTO); |
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8385
diff
changeset
|
542 |
if (w->IsWidgetLowered(ORDER_WIDGET_GOTO)) { |
1000
a418026097f6
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
543 |
_place_clicked_vehicle = NULL; |
8385
aedd7656cfd1
(svn r11440) -Codechange: replace magic numbers with enumified WindowHighlightMode constants. Patch by SmatZ.
rubidium
parents:
8320
diff
changeset
|
544 |
SetObjectToPlaceWnd(ANIMCURSOR_PICKSTATION, PAL_NONE, VHM_RECT, w); |
10136
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
545 |
WP(w, order_d).goto_type = OPOS_GOTO; |
1000
a418026097f6
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
546 |
} else { |
a418026097f6
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
547 |
ResetObjectToPlace(); |
a418026097f6
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
548 |
} |
a418026097f6
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
549 |
} |
a418026097f6
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
550 |
|
7303
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
551 |
/** |
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
552 |
* Handle the click on the full load button. |
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
553 |
* |
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
554 |
* @param w current window |
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
555 |
* @param v current vehicle |
10113
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
556 |
* @param load_type the way to load. |
7303
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
557 |
*/ |
10113
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
558 |
static void OrderClick_FullLoad(Window *w, const Vehicle *v, int load_type) |
1000
a418026097f6
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
559 |
{ |
10105
f0d50efea303
(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
parents:
10097
diff
changeset
|
560 |
VehicleOrderID sel_ord = OrderGetSel(w); |
f0d50efea303
(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
parents:
10097
diff
changeset
|
561 |
const Order *order = GetVehicleOrder(v, sel_ord); |
f0d50efea303
(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
parents:
10097
diff
changeset
|
562 |
|
10121
b82006b98b4a
(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
parents:
10119
diff
changeset
|
563 |
if (order->GetLoadType() == load_type) return; |
10117
6a796f06bff4
(svn r12648) -Feature: allow four different non-stop types in a single game instead of two. The "TTDP compatible order" setting now only sets the default behaviour of new trains.
rubidium
parents:
10113
diff
changeset
|
564 |
|
6a796f06bff4
(svn r12648) -Feature: allow four different non-stop types in a single game instead of two. The "TTDP compatible order" setting now only sets the default behaviour of new trains.
rubidium
parents:
10113
diff
changeset
|
565 |
if (load_type < 0) { |
6a796f06bff4
(svn r12648) -Feature: allow four different non-stop types in a single game instead of two. The "TTDP compatible order" setting now only sets the default behaviour of new trains.
rubidium
parents:
10113
diff
changeset
|
566 |
switch (order->GetLoadType()) { |
6a796f06bff4
(svn r12648) -Feature: allow four different non-stop types in a single game instead of two. The "TTDP compatible order" setting now only sets the default behaviour of new trains.
rubidium
parents:
10113
diff
changeset
|
567 |
case OLF_LOAD_IF_POSSIBLE: load_type = OLFB_FULL_LOAD; break; |
6a796f06bff4
(svn r12648) -Feature: allow four different non-stop types in a single game instead of two. The "TTDP compatible order" setting now only sets the default behaviour of new trains.
rubidium
parents:
10113
diff
changeset
|
568 |
case OLFB_FULL_LOAD: load_type = OLF_FULL_LOAD_ANY; break; |
10119
9b29b2296969
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
10118
diff
changeset
|
569 |
case OLF_FULL_LOAD_ANY: load_type = OLFB_NO_LOAD; break; |
9b29b2296969
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
10118
diff
changeset
|
570 |
case OLFB_NO_LOAD: load_type = OLF_LOAD_IF_POSSIBLE; break; |
10117
6a796f06bff4
(svn r12648) -Feature: allow four different non-stop types in a single game instead of two. The "TTDP compatible order" setting now only sets the default behaviour of new trains.
rubidium
parents:
10113
diff
changeset
|
571 |
default: NOT_REACHED(); |
6a796f06bff4
(svn r12648) -Feature: allow four different non-stop types in a single game instead of two. The "TTDP compatible order" setting now only sets the default behaviour of new trains.
rubidium
parents:
10113
diff
changeset
|
572 |
} |
6a796f06bff4
(svn r12648) -Feature: allow four different non-stop types in a single game instead of two. The "TTDP compatible order" setting now only sets the default behaviour of new trains.
rubidium
parents:
10113
diff
changeset
|
573 |
} |
10136
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
574 |
DoCommandP(v->tile, v->index + (sel_ord << 16), MOF_LOAD | (load_type << 4), NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER)); |
10110
d0cd5452bbe9
(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
parents:
10109
diff
changeset
|
575 |
} |
d0cd5452bbe9
(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
parents:
10109
diff
changeset
|
576 |
|
d0cd5452bbe9
(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
parents:
10109
diff
changeset
|
577 |
/** |
d0cd5452bbe9
(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
parents:
10109
diff
changeset
|
578 |
* Handle the click on the service. |
d0cd5452bbe9
(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
parents:
10109
diff
changeset
|
579 |
* |
d0cd5452bbe9
(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
parents:
10109
diff
changeset
|
580 |
* @param w current window |
d0cd5452bbe9
(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
parents:
10109
diff
changeset
|
581 |
* @param v current vehicle |
d0cd5452bbe9
(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
parents:
10109
diff
changeset
|
582 |
*/ |
10113
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
583 |
static void OrderClick_Service(Window *w, const Vehicle *v, int i) |
10110
d0cd5452bbe9
(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
parents:
10109
diff
changeset
|
584 |
{ |
d0cd5452bbe9
(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
parents:
10109
diff
changeset
|
585 |
DoCommandP(v->tile, v->index + (OrderGetSel(w) << 16), MOF_DEPOT_ACTION, NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER)); |
1000
a418026097f6
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
586 |
} |
a418026097f6
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
587 |
|
7303
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
588 |
/** |
10130
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
589 |
* Handle the click on the service in nearest depot button. |
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
590 |
* |
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
591 |
* @param w current window |
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
592 |
* @param v current vehicle |
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
593 |
*/ |
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
594 |
static void OrderClick_NearestDepot(Window *w, const Vehicle *v, int i) |
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
595 |
{ |
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
596 |
Order order; |
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
597 |
order.next = NULL; |
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
598 |
order.index = 0; |
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
599 |
order.MakeGoToDepot(0, ODTFB_PART_OF_ORDERS); |
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
600 |
order.SetDepotActionType(ODATFB_NEAREST_DEPOT); |
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
601 |
|
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
602 |
DoCommandP(v->tile, v->index + (OrderGetSel(w) << 16), order.Pack(), NULL, CMD_INSERT_ORDER | CMD_MSG(STR_8833_CAN_T_INSERT_NEW_ORDER)); |
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
603 |
} |
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
604 |
|
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
605 |
/** |
10136
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
606 |
* Handle the click on the conditional order button. |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
607 |
* |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
608 |
* @param w current window |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
609 |
* @param v current vehicle |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
610 |
*/ |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
611 |
static void OrderClick_Conditional(Window *w, const Vehicle *v, int i) |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
612 |
{ |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
613 |
w->InvalidateWidget(ORDER_WIDGET_GOTO); |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
614 |
w->LowerWidget(ORDER_WIDGET_GOTO); |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
615 |
SetObjectToPlaceWnd(ANIMCURSOR_PICKSTATION, PAL_NONE, VHM_RECT, w); |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
616 |
WP(w, order_d).goto_type = OPOS_CONDITIONAL; |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
617 |
} |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
618 |
|
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
619 |
/** |
7303
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
620 |
* Handle the click on the unload button. |
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
621 |
* |
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
622 |
* @param w current window |
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
623 |
* @param v current vehicle |
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
624 |
*/ |
10119
9b29b2296969
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
10118
diff
changeset
|
625 |
static void OrderClick_Unload(Window *w, const Vehicle *v, int unload_type) |
1000
a418026097f6
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
626 |
{ |
10105
f0d50efea303
(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
parents:
10097
diff
changeset
|
627 |
VehicleOrderID sel_ord = OrderGetSel(w); |
f0d50efea303
(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
parents:
10097
diff
changeset
|
628 |
const Order *order = GetVehicleOrder(v, sel_ord); |
f0d50efea303
(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
parents:
10097
diff
changeset
|
629 |
|
10121
b82006b98b4a
(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
parents:
10119
diff
changeset
|
630 |
if (order->GetUnloadType() == unload_type) return; |
b82006b98b4a
(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
parents:
10119
diff
changeset
|
631 |
|
10119
9b29b2296969
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
10118
diff
changeset
|
632 |
if (unload_type < 0) { |
9b29b2296969
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
10118
diff
changeset
|
633 |
switch (order->GetUnloadType()) { |
9b29b2296969
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
10118
diff
changeset
|
634 |
case OUF_UNLOAD_IF_POSSIBLE: unload_type = OUFB_UNLOAD; break; |
10121
b82006b98b4a
(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
parents:
10119
diff
changeset
|
635 |
case OUFB_UNLOAD: unload_type = OUFB_TRANSFER; break; |
b82006b98b4a
(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
parents:
10119
diff
changeset
|
636 |
case OUFB_TRANSFER: unload_type = OUFB_NO_UNLOAD; break; |
10119
9b29b2296969
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
10118
diff
changeset
|
637 |
case OUFB_NO_UNLOAD: unload_type = OUF_UNLOAD_IF_POSSIBLE; break; |
9b29b2296969
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
10118
diff
changeset
|
638 |
default: NOT_REACHED(); |
9b29b2296969
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
10118
diff
changeset
|
639 |
} |
9b29b2296969
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
10118
diff
changeset
|
640 |
} |
9b29b2296969
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
10118
diff
changeset
|
641 |
|
10136
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
642 |
DoCommandP(v->tile, v->index + (sel_ord << 16), MOF_UNLOAD | (unload_type << 4), NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER)); |
1024
9b06b01490a4
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
643 |
} |
9b06b01490a4
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
644 |
|
7303
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
645 |
/** |
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
646 |
* Handle the click on the nonstop button. |
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
647 |
* |
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
648 |
* @param w current window |
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
649 |
* @param v current vehicle |
10113
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
650 |
* @param non_stop what non-stop type to use; -1 to use the 'next' one. |
7303
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
651 |
*/ |
10113
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
652 |
static void OrderClick_Nonstop(Window *w, const Vehicle *v, int non_stop) |
1024
9b06b01490a4
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
653 |
{ |
10105
f0d50efea303
(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
parents:
10097
diff
changeset
|
654 |
VehicleOrderID sel_ord = OrderGetSel(w); |
f0d50efea303
(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
parents:
10097
diff
changeset
|
655 |
const Order *order = GetVehicleOrder(v, sel_ord); |
f0d50efea303
(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
parents:
10097
diff
changeset
|
656 |
|
10113
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
657 |
if (order->GetNonStopType() == non_stop) return; |
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
658 |
|
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
659 |
/* Keypress if negative, so 'toggle' to the next */ |
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
660 |
if (non_stop < 0) { |
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
661 |
non_stop = (order->GetNonStopType() + 1) % ONSF_END; |
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
662 |
} |
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
663 |
|
10136
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
664 |
DoCommandP(v->tile, v->index + (sel_ord << 16), MOF_NON_STOP | non_stop << 4, NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER)); |
1000
a418026097f6
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
665 |
} |
a418026097f6
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
666 |
|
7303
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
667 |
/** |
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
668 |
* Handle the click on the transfer button. |
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
669 |
* |
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
670 |
* @param w current window |
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
671 |
* @param v current vehicle |
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
672 |
*/ |
10113
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
673 |
static void OrderClick_Transfer(Window *w, const Vehicle *v, int i) |
1935
f43f062c9498
(svn r2441) -Feature: You can now give transfer order to set up feeder systems
celestar
parents:
1901
diff
changeset
|
674 |
{ |
10105
f0d50efea303
(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
parents:
10097
diff
changeset
|
675 |
VehicleOrderID sel_ord = OrderGetSel(w); |
f0d50efea303
(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
parents:
10097
diff
changeset
|
676 |
const Order *order = GetVehicleOrder(v, sel_ord); |
f0d50efea303
(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
parents:
10097
diff
changeset
|
677 |
|
10136
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
678 |
DoCommandP(v->tile, v->index + (sel_ord << 16), MOF_UNLOAD | ((order->GetUnloadType() & ~OUFB_NO_UNLOAD) ^ OUFB_TRANSFER) << 4, NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER)); |
1935
f43f062c9498
(svn r2441) -Feature: You can now give transfer order to set up feeder systems
celestar
parents:
1901
diff
changeset
|
679 |
} |
f43f062c9498
(svn r2441) -Feature: You can now give transfer order to set up feeder systems
celestar
parents:
1901
diff
changeset
|
680 |
|
7303
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
681 |
/** |
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
682 |
* Handle the click on the skip button. |
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
683 |
* If ctrl is pressed skip to selected order. |
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
684 |
* Else skip to current order + 1 |
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
685 |
* |
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
686 |
* @param w current window |
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
687 |
* @param v current vehicle |
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
688 |
*/ |
10113
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
689 |
static void OrderClick_Skip(Window *w, const Vehicle *v, int i) |
1000
a418026097f6
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
690 |
{ |
7290
647d6416cdfe
(svn r10033) -Feature [FS#760]: skip to the selected order in the order list when clicking on the "skip" button while pressing CTRL.
rubidium
parents:
7269
diff
changeset
|
691 |
/* Don't skip when there's nothing to skip */ |
647d6416cdfe
(svn r10033) -Feature [FS#760]: skip to the selected order in the order list when clicking on the "skip" button while pressing CTRL.
rubidium
parents:
7269
diff
changeset
|
692 |
if (_ctrl_pressed && v->cur_order_index == OrderGetSel(w)) return; |
647d6416cdfe
(svn r10033) -Feature [FS#760]: skip to the selected order in the order list when clicking on the "skip" button while pressing CTRL.
rubidium
parents:
7269
diff
changeset
|
693 |
|
647d6416cdfe
(svn r10033) -Feature [FS#760]: skip to the selected order in the order list when clicking on the "skip" button while pressing CTRL.
rubidium
parents:
7269
diff
changeset
|
694 |
DoCommandP(v->tile, v->index, _ctrl_pressed ? OrderGetSel(w) : ((v->cur_order_index + 1) % v->num_orders), |
647d6416cdfe
(svn r10033) -Feature [FS#760]: skip to the selected order in the order list when clicking on the "skip" button while pressing CTRL.
rubidium
parents:
7269
diff
changeset
|
695 |
NULL, CMD_SKIP_TO_ORDER | CMD_MSG(_ctrl_pressed ? STR_CAN_T_SKIP_TO_ORDER : STR_CAN_T_SKIP_ORDER)); |
1000
a418026097f6
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
696 |
} |
a418026097f6
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
697 |
|
7303
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
698 |
/** |
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
699 |
* Handle the click on the unload button. |
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
700 |
* |
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
701 |
* @param w current window |
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
702 |
* @param v current vehicle |
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
703 |
*/ |
10113
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
704 |
static void OrderClick_Delete(Window *w, const Vehicle *v, int i) |
1000
a418026097f6
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
705 |
{ |
1024
9b06b01490a4
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
706 |
DoCommandP(v->tile, v->index, OrderGetSel(w), NULL, CMD_DELETE_ORDER | CMD_MSG(STR_8834_CAN_T_DELETE_THIS_ORDER)); |
1000
a418026097f6
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
707 |
} |
a418026097f6
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
708 |
|
7303
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
709 |
/** |
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
710 |
* Handle the click on the refit button. |
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
711 |
* If ctrl is pressed cancel refitting. |
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
712 |
* Else show the refit window. |
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
713 |
* |
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
714 |
* @param w current window |
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
715 |
* @param v current vehicle |
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
716 |
*/ |
10113
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
717 |
static void OrderClick_Refit(Window *w, const Vehicle *v, int i) |
4712
273ec3b182bf
(svn r6624) -Feature: added ability to add refit commands to vehicle orders (can only be done in goto depot orders)
bjarni
parents:
4709
diff
changeset
|
718 |
{ |
273ec3b182bf
(svn r6624) -Feature: added ability to add refit commands to vehicle orders (can only be done in goto depot orders)
bjarni
parents:
4709
diff
changeset
|
719 |
if (_ctrl_pressed) { |
273ec3b182bf
(svn r6624) -Feature: added ability to add refit commands to vehicle orders (can only be done in goto depot orders)
bjarni
parents:
4709
diff
changeset
|
720 |
/* Cancel refitting */ |
8578
55218950ce2d
(svn r11643) -Codechange: conform with the coding style for the WP macro uses.
rubidium
parents:
8560
diff
changeset
|
721 |
DoCommandP(v->tile, v->index, (WP(w, order_d).sel << 16) | (CT_NO_REFIT << 8) | CT_NO_REFIT, NULL, CMD_ORDER_REFIT); |
4712
273ec3b182bf
(svn r6624) -Feature: added ability to add refit commands to vehicle orders (can only be done in goto depot orders)
bjarni
parents:
4709
diff
changeset
|
722 |
} else { |
8578
55218950ce2d
(svn r11643) -Codechange: conform with the coding style for the WP macro uses.
rubidium
parents:
8560
diff
changeset
|
723 |
ShowVehicleRefitWindow(v, WP(w, order_d).sel); |
4712
273ec3b182bf
(svn r6624) -Feature: added ability to add refit commands to vehicle orders (can only be done in goto depot orders)
bjarni
parents:
4709
diff
changeset
|
724 |
} |
273ec3b182bf
(svn r6624) -Feature: added ability to add refit commands to vehicle orders (can only be done in goto depot orders)
bjarni
parents:
4709
diff
changeset
|
725 |
} |
273ec3b182bf
(svn r6624) -Feature: added ability to add refit commands to vehicle orders (can only be done in goto depot orders)
bjarni
parents:
4709
diff
changeset
|
726 |
|
10113
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
727 |
typedef void OnButtonVehClick(Window *w, const Vehicle *v, int i); |
1000
a418026097f6
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
728 |
|
7303
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
729 |
/** |
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
730 |
* Keycode function mapping. |
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
731 |
* |
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
732 |
* @see _order_keycodes[] |
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
733 |
* @note Keep them allways in sync with _order_keycodes[]! |
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
734 |
*/ |
4171 | 735 |
static OnButtonVehClick* const _order_button_proc[] = { |
1000
a418026097f6
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
736 |
OrderClick_Skip, |
a418026097f6
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
737 |
OrderClick_Delete, |
a418026097f6
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
738 |
OrderClick_Nonstop, |
a418026097f6
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
739 |
OrderClick_Goto, |
a418026097f6
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
740 |
OrderClick_FullLoad, |
1935
f43f062c9498
(svn r2441) -Feature: You can now give transfer order to set up feeder systems
celestar
parents:
1901
diff
changeset
|
741 |
OrderClick_Unload, |
10110
d0cd5452bbe9
(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
parents:
10109
diff
changeset
|
742 |
OrderClick_Transfer, |
d0cd5452bbe9
(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
parents:
10109
diff
changeset
|
743 |
OrderClick_Service, |
1000
a418026097f6
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
744 |
}; |
a418026097f6
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
745 |
|
a418026097f6
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
746 |
static const uint16 _order_keycodes[] = { |
a418026097f6
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
747 |
'D', //skip order |
a418026097f6
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
748 |
'F', //delete order |
a418026097f6
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
749 |
'G', //non-stop |
a418026097f6
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
750 |
'H', //goto order |
a418026097f6
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
751 |
'J', //full load |
a418026097f6
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
752 |
'K' //unload |
a418026097f6
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
753 |
}; |
0 | 754 |
|
755 |
static void OrdersWndProc(Window *w, WindowEvent *e) |
|
756 |
{ |
|
10107
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
757 |
const Vehicle *v = GetVehicle(w->window_number); |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
758 |
|
2549 | 759 |
switch (e->event) { |
4712
273ec3b182bf
(svn r6624) -Feature: added ability to add refit commands to vehicle orders (can only be done in goto depot orders)
bjarni
parents:
4709
diff
changeset
|
760 |
case WE_CREATE: |
7476
7f086e4b2a76
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
7419
diff
changeset
|
761 |
if (_patches.timetabling) { |
7f086e4b2a76
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
7419
diff
changeset
|
762 |
w->widget[ORDER_WIDGET_CAPTION].right -= 61; |
7f086e4b2a76
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
7419
diff
changeset
|
763 |
} else { |
8493
3ab458f7cff4
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
8385
diff
changeset
|
764 |
w->HideWidget(ORDER_WIDGET_TIMETABLE_VIEW); |
7476
7f086e4b2a76
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
7419
diff
changeset
|
765 |
} |
7f086e4b2a76
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
7419
diff
changeset
|
766 |
|
4712
273ec3b182bf
(svn r6624) -Feature: added ability to add refit commands to vehicle orders (can only be done in goto depot orders)
bjarni
parents:
4709
diff
changeset
|
767 |
break; |
273ec3b182bf
(svn r6624) -Feature: added ability to add refit commands to vehicle orders (can only be done in goto depot orders)
bjarni
parents:
4709
diff
changeset
|
768 |
|
10107
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
769 |
case WE_PAINT: |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
770 |
DrawOrdersWindow(w); |
7476
7f086e4b2a76
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
7419
diff
changeset
|
771 |
break; |
7f086e4b2a76
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
7419
diff
changeset
|
772 |
|
10107
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
773 |
case WE_CLICK: |
10123
ff39ffbaa043
(svn r12654) -Codechange: remove some unneeded right click handling due to the splitting of the load/refit button.
rubidium
parents:
10122
diff
changeset
|
774 |
if (w->widget[e->we.click.widget].type != WWT_DROPDOWN) HideDropDownMenu(w); |
10107
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
775 |
switch (e->we.click.widget) { |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
776 |
case ORDER_WIDGET_ORDER_LIST: { |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
777 |
ResetObjectToPlace(); |
7328
8ac64204c17f
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
7303
diff
changeset
|
778 |
|
10107
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
779 |
int sel = GetOrderFromOrderWndPt(w, e->we.click.pt.y, v); |
7328
8ac64204c17f
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
7303
diff
changeset
|
780 |
|
10107
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
781 |
if (sel == INVALID_ORDER) { |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
782 |
/* This was a click on an empty part of the orders window, so |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
783 |
* deselect the currently selected order. */ |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
784 |
WP(w, order_d).sel = -1; |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
785 |
SetWindowDirty(w); |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
786 |
return; |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
787 |
} |
7328
8ac64204c17f
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
7303
diff
changeset
|
788 |
|
10107
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
789 |
if (_ctrl_pressed && sel < v->num_orders) { |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
790 |
const Order *ord = GetVehicleOrder(v, sel); |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
791 |
TileIndex xy; |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
792 |
|
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
793 |
switch (ord->GetType()) { |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
794 |
case OT_GOTO_STATION: xy = GetStation(ord->GetDestination())->xy ; break; |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
795 |
case OT_GOTO_DEPOT: xy = (v->type == VEH_AIRCRAFT) ? GetStation(ord->GetDestination())->xy : GetDepot(ord->GetDestination())->xy; break; |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
796 |
case OT_GOTO_WAYPOINT: xy = GetWaypoint(ord->GetDestination())->xy; break; |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
797 |
default: xy = 0; break; |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
798 |
} |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
799 |
|
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
800 |
if (xy != 0) ScrollMainWindowToTile(xy); |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
801 |
return; |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
802 |
} else { |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
803 |
if (sel == WP(w, order_d).sel) { |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
804 |
/* Deselect clicked order */ |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
805 |
WP(w, order_d).sel = -1; |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
806 |
} else { |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
807 |
/* Select clicked order */ |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
808 |
WP(w, order_d).sel = sel; |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
809 |
|
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
810 |
if (v->owner == _local_player) { |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
811 |
/* Activate drag and drop */ |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
812 |
SetObjectToPlaceWnd(SPR_CURSOR_MOUSE, PAL_NONE, VHM_DRAG, w); |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
813 |
} |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
814 |
} |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
815 |
} |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
816 |
|
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
817 |
SetWindowDirty(w); |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
818 |
} break; |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
819 |
|
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
820 |
case ORDER_WIDGET_SKIP: |
10113
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
821 |
OrderClick_Skip(w, v, 0); |
10107
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
822 |
break; |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
823 |
|
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
824 |
case ORDER_WIDGET_DELETE: |
10113
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
825 |
OrderClick_Delete(w, v, 0); |
10107
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
826 |
break; |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
827 |
|
10118
8f5246e74ecf
(svn r12649) -Fix: refit orders not being shown.
rubidium
parents:
10117
diff
changeset
|
828 |
case ORDER_WIDGET_NON_STOP: { |
8f5246e74ecf
(svn r12649) -Fix: refit orders not being shown.
rubidium
parents:
10117
diff
changeset
|
829 |
const Order *o = GetVehicleOrder(v, OrderGetSel(w)); |
10121
b82006b98b4a
(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
parents:
10119
diff
changeset
|
830 |
ShowDropDownMenu(w, _order_non_stop_drowdown, o->GetNonStopType(), ORDER_WIDGET_NON_STOP, 0, o->IsType(OT_GOTO_STATION) ? 0 : (o->IsType(OT_GOTO_WAYPOINT) ? 3 : 12)); |
10118
8f5246e74ecf
(svn r12649) -Fix: refit orders not being shown.
rubidium
parents:
10117
diff
changeset
|
831 |
} break; |
10107
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
832 |
|
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
833 |
case ORDER_WIDGET_GOTO: |
10113
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
834 |
OrderClick_Goto(w, v, 0); |
10107
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
835 |
break; |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
836 |
|
10130
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
837 |
case ORDER_WIDGET_GOTO_DROPDOWN: |
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
838 |
ShowDropDownMenu(w, v->type == VEH_AIRCRAFT ? _order_goto_dropdown_aircraft : _order_goto_dropdown, 0, ORDER_WIDGET_GOTO, 0, 0, w->widget[ORDER_WIDGET_GOTO_DROPDOWN].right - w->widget[ORDER_WIDGET_GOTO].left); |
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
839 |
break; |
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
840 |
|
10107
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
841 |
case ORDER_WIDGET_FULL_LOAD: |
10121
b82006b98b4a
(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
parents:
10119
diff
changeset
|
842 |
ShowDropDownMenu(w, _order_full_load_drowdown, GetVehicleOrder(v, OrderGetSel(w))->GetLoadType(), ORDER_WIDGET_FULL_LOAD, 0, 2); |
10107
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
843 |
break; |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
844 |
|
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
845 |
case ORDER_WIDGET_UNLOAD: |
10121
b82006b98b4a
(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
parents:
10119
diff
changeset
|
846 |
ShowDropDownMenu(w, _order_unload_drowdown, GetVehicleOrder(v, OrderGetSel(w))->GetUnloadType(), ORDER_WIDGET_UNLOAD, 0, 8); |
10107
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
847 |
break; |
10110
d0cd5452bbe9
(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
parents:
10109
diff
changeset
|
848 |
|
10107
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
849 |
case ORDER_WIDGET_REFIT: |
10113
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
850 |
OrderClick_Refit(w, v, 0); |
10107
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
851 |
break; |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
852 |
|
10110
d0cd5452bbe9
(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
parents:
10109
diff
changeset
|
853 |
case ORDER_WIDGET_SERVICE: |
10113
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
854 |
OrderClick_Service(w, v, 0); |
10110
d0cd5452bbe9
(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
parents:
10109
diff
changeset
|
855 |
break; |
d0cd5452bbe9
(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
parents:
10109
diff
changeset
|
856 |
|
10107
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
857 |
case ORDER_WIDGET_TIMETABLE_VIEW: |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
858 |
ShowTimetableWindow(v); |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
859 |
break; |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
860 |
|
10136
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
861 |
case ORDER_WIDGET_COND_VARIABLE: |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
862 |
ShowDropDownMenu(w, _order_conditional_variable, GetVehicleOrder(v, OrderGetSel(w))->GetConditionVariable(), ORDER_WIDGET_COND_VARIABLE, 0, 0); |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
863 |
break; |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
864 |
|
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
865 |
case ORDER_WIDGET_COND_COMPARATOR: { |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
866 |
const Order *o = GetVehicleOrder(v, OrderGetSel(w)); |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
867 |
ShowDropDownMenu(w, _order_conditional_condition, o->GetConditionComparator(), ORDER_WIDGET_COND_COMPARATOR, 0, (o->GetConditionVariable() == OCV_REQUIRES_SERVICE) ? 0x3F : 0xC0); |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
868 |
} break; |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
869 |
|
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
870 |
case ORDER_WIDGET_COND_VALUE: { |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
871 |
const Order *order = GetVehicleOrder(v, OrderGetSel(w)); |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
872 |
uint value = order->GetConditionValue(); |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
873 |
if (order->GetConditionVariable() == OCV_MAX_SPEED) value = ConvertSpeedToDisplaySpeed(value); |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
874 |
SetDParam(0, value); |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
875 |
ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_ORDER_CONDITIONAL_VALUE_CAPT, 5, 100, w, CS_NUMERAL); |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
876 |
} break; |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
877 |
|
10107
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
878 |
case ORDER_WIDGET_SHARED_ORDER_LIST: |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
879 |
ShowVehicleListWindow(v); |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
880 |
break; |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
881 |
} |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
882 |
break; |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
883 |
|
10136
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
884 |
case WE_ON_EDIT_TEXT: |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
885 |
if (!StrEmpty(e->we.edittext.str)) { |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
886 |
VehicleOrderID sel = OrderGetSel(w); |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
887 |
uint value = atoi(e->we.edittext.str); |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
888 |
|
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
889 |
switch (GetVehicleOrder(v, sel)->GetConditionVariable()) { |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
890 |
case OCV_MAX_SPEED: |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
891 |
value = ConvertDisplaySpeedToSpeed(value); |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
892 |
break; |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
893 |
|
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
894 |
case OCV_RELIABILITY: |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
895 |
case OCV_LOAD_PERCENTAGE: |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
896 |
value = Clamp(value, 0, 100); |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
897 |
|
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
898 |
default: |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
899 |
break; |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
900 |
} |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
901 |
DoCommandP(v->tile, v->index + (sel << 16), MOF_COND_VALUE | Clamp(value, 0, 2047) << 4, NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER)); |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
902 |
} |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
903 |
break; |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
904 |
|
10113
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
905 |
case WE_DROPDOWN_SELECT: // we have selected a dropdown item in the list |
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
906 |
switch (e->we.dropdown.button) { |
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
907 |
case ORDER_WIDGET_NON_STOP: |
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
908 |
OrderClick_Nonstop(w, v, e->we.dropdown.index); |
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
909 |
break; |
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
910 |
|
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
911 |
case ORDER_WIDGET_FULL_LOAD: |
10119
9b29b2296969
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
10118
diff
changeset
|
912 |
OrderClick_FullLoad(w, v, e->we.dropdown.index); |
9b29b2296969
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
10118
diff
changeset
|
913 |
break; |
9b29b2296969
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
10118
diff
changeset
|
914 |
|
9b29b2296969
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
10118
diff
changeset
|
915 |
case ORDER_WIDGET_UNLOAD: |
9b29b2296969
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
10118
diff
changeset
|
916 |
OrderClick_Unload(w, v, e->we.dropdown.index); |
10113
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
917 |
break; |
10130
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
918 |
|
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
919 |
case ORDER_WIDGET_GOTO: |
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
920 |
switch (e->we.dropdown.index) { |
10136
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
921 |
case 0: |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
922 |
w->ToggleWidgetLoweredState(ORDER_WIDGET_GOTO); |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
923 |
OrderClick_Goto(w, v, 0); |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
924 |
break; |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
925 |
|
10130
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
926 |
case 1: OrderClick_NearestDepot(w, v, 0); break; |
10136
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
927 |
case 2: OrderClick_Conditional(w, v, 0); break; |
10130
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
928 |
default: NOT_REACHED(); |
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
929 |
} |
10136
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
930 |
break; |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
931 |
|
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
932 |
case ORDER_WIDGET_COND_VARIABLE: |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
933 |
DoCommandP(v->tile, v->index + (OrderGetSel(w) << 16), MOF_COND_VARIABLE | e->we.dropdown.index << 4, NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER)); |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
934 |
break; |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
935 |
|
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
936 |
case ORDER_WIDGET_COND_COMPARATOR: |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
937 |
DoCommandP(v->tile, v->index + (OrderGetSel(w) << 16), MOF_COND_COMPARATOR | e->we.dropdown.index << 4, NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER)); |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
938 |
break; |
10113
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
939 |
} |
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
940 |
break; |
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
941 |
|
10107
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
942 |
case WE_DRAGDROP: |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
943 |
switch (e->we.click.widget) { |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
944 |
case ORDER_WIDGET_ORDER_LIST: { |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
945 |
int from_order = OrderGetSel(w); |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
946 |
int to_order = GetOrderFromOrderWndPt(w, e->we.dragdrop.pt.y, v); |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
947 |
|
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
948 |
if (!(from_order == to_order || from_order == INVALID_ORDER || from_order > v->num_orders || to_order == INVALID_ORDER || to_order > v->num_orders) && |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
949 |
DoCommandP(v->tile, v->index, from_order | (to_order << 16), NULL, CMD_MOVE_ORDER | CMD_MSG(STR_CAN_T_MOVE_THIS_ORDER))) { |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
950 |
WP(w, order_d).sel = -1; |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
951 |
} |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
952 |
|
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
953 |
} break; |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
954 |
|
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
955 |
case ORDER_WIDGET_DELETE: |
10113
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
956 |
OrderClick_Delete(w, v, 0); |
10107
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
957 |
break; |
7328
8ac64204c17f
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
7303
diff
changeset
|
958 |
} |
8ac64204c17f
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
7303
diff
changeset
|
959 |
|
10107
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
960 |
ResetObjectToPlace(); |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
961 |
break; |
0 | 962 |
|
10107
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
963 |
case WE_KEYPRESS: |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
964 |
if (v->owner != _local_player) break; |
0 | 965 |
|
10107
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
966 |
for (uint i = 0; i < lengthof(_order_keycodes); i++) { |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
967 |
if (e->we.keypress.keycode == _order_keycodes[i]) { |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
968 |
e->we.keypress.cont = false; |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
969 |
/* see if the button is disabled */ |
10113
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
970 |
if (!w->IsWidgetDisabled(i + ORDER_WIDGET_SKIP)) _order_button_proc[i](w, v, -1); |
10107
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
971 |
break; |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
972 |
} |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
973 |
} |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
974 |
break; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
975 |
|
10107
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
976 |
case WE_PLACE_OBJ: |
10136
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
977 |
if (WP(w, order_d).goto_type == OPOS_GOTO) { |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
978 |
OrdersPlaceObj(GetVehicle(w->window_number), e->we.place.tile, w); |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
979 |
} |
10107
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
980 |
break; |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
981 |
|
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
982 |
case WE_ABORT_PLACE_OBJ: |
10136
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
983 |
if (WP(w, order_d).goto_type == OPOS_CONDITIONAL) { |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
984 |
WP(w, order_d).goto_type = OPOS_GOTO; |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
985 |
if (_cursor.pos.x >= (w->left + w->widget[ORDER_WIDGET_ORDER_LIST].left) && |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
986 |
_cursor.pos.y >= (w->top + w->widget[ORDER_WIDGET_ORDER_LIST].top) && |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
987 |
_cursor.pos.x <= (w->left + w->widget[ORDER_WIDGET_ORDER_LIST].right) && |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
988 |
_cursor.pos.y <= (w->top + w->widget[ORDER_WIDGET_ORDER_LIST].bottom)) { |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
989 |
int order_id = GetOrderFromOrderWndPt(w, _cursor.pos.y - w->top, v); |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
990 |
if (order_id != INVALID_ORDER) { |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
991 |
Order order; |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
992 |
order.next = NULL; |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
993 |
order.index = 0; |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
994 |
order.MakeConditional(order_id); |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
995 |
|
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
996 |
DoCommandP(v->tile, v->index + (OrderGetSel(w) << 16), order.Pack(), NULL, CMD_INSERT_ORDER | CMD_MSG(STR_8833_CAN_T_INSERT_NEW_ORDER)); |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
997 |
} |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
998 |
} |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
999 |
} |
10107
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
1000 |
w->RaiseWidget(ORDER_WIDGET_GOTO); |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
1001 |
w->InvalidateWidget(ORDER_WIDGET_GOTO); |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
1002 |
break; |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
1003 |
|
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
1004 |
/* check if a vehicle in a depot was clicked.. */ |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
1005 |
case WE_MOUSELOOP: |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
1006 |
v = _place_clicked_vehicle; |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
1007 |
/* |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
1008 |
* Check if we clicked on a vehicle |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
1009 |
* and if the GOTO button of this window is pressed |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
1010 |
* This is because of all open order windows WE_MOUSELOOP is called |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
1011 |
* and if you have 3 windows open, and this check is not done |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
1012 |
* the order is copied to the last open window instead of the |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
1013 |
* one where GOTO is enabled |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
1014 |
*/ |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
1015 |
if (v != NULL && w->IsWidgetLowered(ORDER_WIDGET_GOTO)) { |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
1016 |
_place_clicked_vehicle = NULL; |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
1017 |
HandleOrderVehClick(GetVehicle(w->window_number), v, w); |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
1018 |
} |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
1019 |
break; |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
1020 |
|
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
1021 |
case WE_RESIZE: |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
1022 |
/* Update the scroll + matrix */ |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
1023 |
w->vscroll.cap = (w->widget[ORDER_WIDGET_ORDER_LIST].bottom - w->widget[ORDER_WIDGET_ORDER_LIST].top) / 10; |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
1024 |
break; |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
1025 |
|
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
1026 |
case WE_TIMEOUT: // handle button unclick ourselves... |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
1027 |
/* unclick all buttons except for the 'goto' button (ORDER_WIDGET_GOTO), which is 'persistent' */ |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
1028 |
for (uint i = 0; i < w->widget_count; i++) { |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
1029 |
if (w->IsWidgetLowered(i) && i != ORDER_WIDGET_GOTO) { |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
1030 |
w->RaiseWidget(i); |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
1031 |
w->InvalidateWidget(i); |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
1032 |
} |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
1033 |
} |
2a94b97270e3
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
10105
diff
changeset
|
1034 |
break; |
0 | 1035 |
} |
1036 |
} |
|
1037 |
||
7303
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
1038 |
/** |
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
1039 |
* Widget definition for player train orders |
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
1040 |
*/ |
1081
b22fd4020122
(svn r1582) Fix: Only the train orders GUI has a non-stop button now.
dominik
parents:
1067
diff
changeset
|
1041 |
static const Widget _orders_train_widgets[] = { |
7303
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
1042 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // ORDER_WIDGET_CLOSEBOX |
10113
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
1043 |
{ WWT_CAPTION, RESIZE_RIGHT, 14, 11, 385, 0, 13, STR_8829_ORDERS, STR_018C_WINDOW_TITLE_DRAG_THIS}, // ORDER_WIDGET_CAPTION |
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
1044 |
{ WWT_PUSHTXTBTN, RESIZE_LR, 14, 325, 385, 0, 13, STR_TIMETABLE_VIEW, STR_TIMETABLE_VIEW_TOOLTIP}, // ORDER_WIDGET_TIMETABLE_VIEW |
7303
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
1045 |
|
10113
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
1046 |
{ WWT_PANEL, RESIZE_RB, 14, 0, 373, 14, 75, 0x0, STR_8852_ORDERS_LIST_CLICK_ON_ORDER}, // ORDER_WIDGET_ORDER_LIST |
7303
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
1047 |
|
10113
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
1048 |
{ WWT_SCROLLBAR, RESIZE_LRB, 14, 374, 385, 14, 75, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, // ORDER_WIDGET_SCROLLBAR |
7303
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
1049 |
|
10113
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
1050 |
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 0, 123, 88, 99, STR_8823_SKIP, STR_8853_SKIP_THE_CURRENT_ORDER}, // ORDER_WIDGET_SKIP |
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
1051 |
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 124, 247, 88, 99, STR_8824_DELETE, STR_8854_DELETE_THE_HIGHLIGHTED}, // ORDER_WIDGET_DELETE |
10125
64de1e83efa8
(svn r12656) -Fix: tooltips for some order buttons are outdated/incorrect.
rubidium
parents:
10124
diff
changeset
|
1052 |
{ WWT_DROPDOWN, RESIZE_TB, 14, 0, 123, 76, 87, STR_NULL, STR_ORDER_TOOLTIP_NON_STOP}, // ORDER_WIDGET_NON_STOP |
10130
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
1053 |
{ WWT_TEXTBTN, RESIZE_TB, 14, 248, 359, 88, 99, STR_8826_GO_TO, STR_8856_INSERT_A_NEW_ORDER_BEFORE}, // ORDER_WIDGET_GOTO |
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
1054 |
{ WWT_DROPDOWN, RESIZE_TB, 14, 360, 371, 88, 99, STR_EMPTY, STR_ORDER_GO_TO_DROPDOWN_TOOLTIP}, // ORDER_WIDGET_GOTO_DROPDOWN |
10125
64de1e83efa8
(svn r12656) -Fix: tooltips for some order buttons are outdated/incorrect.
rubidium
parents:
10124
diff
changeset
|
1055 |
{ WWT_DROPDOWN, RESIZE_TB, 14, 124, 247, 76, 87, STR_NULL, STR_ORDER_TOOLTIP_FULL_LOAD}, // ORDER_WIDGET_FULL_LOAD |
64de1e83efa8
(svn r12656) -Fix: tooltips for some order buttons are outdated/incorrect.
rubidium
parents:
10124
diff
changeset
|
1056 |
{ WWT_DROPDOWN, RESIZE_TB, 14, 248, 371, 76, 87, STR_NULL, STR_ORDER_TOOLTIP_UNLOAD}, // ORDER_WIDGET_UNLOAD |
10121
b82006b98b4a
(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
parents:
10119
diff
changeset
|
1057 |
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 124, 247, 76, 87, STR_REFIT, STR_REFIT_TIP}, // ORDER_WIDGET_REFIT |
10123
ff39ffbaa043
(svn r12654) -Codechange: remove some unneeded right click handling due to the splitting of the load/refit button.
rubidium
parents:
10122
diff
changeset
|
1058 |
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 248, 371, 76, 87, STR_SERVICE, STR_SERVICE_HINT}, // ORDER_WIDGET_SERVICE |
10113
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
1059 |
|
10136
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
1060 |
{ WWT_DROPDOWN, RESIZE_TB, 14, 0, 123, 76, 87, STR_NULL, STR_ORDER_CONDITIONAL_VARIABLE_TOOLTIP}, // ORDER_WIDGET_COND_VARIABLE |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
1061 |
{ WWT_DROPDOWN, RESIZE_TB, 14, 124, 247, 76, 87, STR_NULL, STR_ORDER_CONDITIONAL_COMPARATOR_TOOLTIP}, // ORDER_WIDGET_COND_COMPARATOR |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
1062 |
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 248, 371, 76, 87, STR_CONDITIONAL_VALUE, STR_ORDER_CONDITIONAL_VALUE_TOOLTIP}, // ORDER_WIDGET_COND_VALUE |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
1063 |
|
10113
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
1064 |
{ WWT_PANEL, RESIZE_RTB, 14, 372, 373, 76, 99, 0x0, STR_NULL}, // ORDER_WIDGET_RESIZE_BAR |
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
1065 |
{ WWT_PUSHIMGBTN, RESIZE_LRTB, 14, 372, 385, 76, 87, SPR_SHARED_ORDERS_ICON, STR_VEH_WITH_SHARED_ORDERS_LIST_TIP}, // ORDER_WIDGET_SHARED_ORDER_LIST |
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
1066 |
|
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
1067 |
{ WWT_RESIZEBOX, RESIZE_LRTB, 14, 374, 385, 88, 99, 0x0, STR_RESIZE_BUTTON}, // ORDER_WIDGET_RESIZE |
7303
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
1068 |
{ WIDGETS_END}, |
0 | 1069 |
}; |
1070 |
||
1081
b22fd4020122
(svn r1582) Fix: Only the train orders GUI has a non-stop button now.
dominik
parents:
1067
diff
changeset
|
1071 |
static const WindowDesc _orders_train_desc = { |
10113
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
1072 |
WDP_AUTO, WDP_AUTO, 386, 100, 386, 100, |
1081
b22fd4020122
(svn r1582) Fix: Only the train orders GUI has a non-stop button now.
dominik
parents:
1067
diff
changeset
|
1073 |
WC_VEHICLE_ORDERS,WC_VEHICLE_VIEW, |
5013
79a6e510c41f
(svn r7046) -Fix [FS#311]: 'Goto' button in orders window got depressed along with all other
Darkvater
parents:
4968
diff
changeset
|
1074 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_RESIZABLE, |
1081
b22fd4020122
(svn r1582) Fix: Only the train orders GUI has a non-stop button now.
dominik
parents:
1067
diff
changeset
|
1075 |
_orders_train_widgets, |
b22fd4020122
(svn r1582) Fix: Only the train orders GUI has a non-stop button now.
dominik
parents:
1067
diff
changeset
|
1076 |
OrdersWndProc |
b22fd4020122
(svn r1582) Fix: Only the train orders GUI has a non-stop button now.
dominik
parents:
1067
diff
changeset
|
1077 |
}; |
b22fd4020122
(svn r1582) Fix: Only the train orders GUI has a non-stop button now.
dominik
parents:
1067
diff
changeset
|
1078 |
|
7303
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
1079 |
/** |
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
1080 |
* Widget definition for player orders (!train) |
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
1081 |
*/ |
1081
b22fd4020122
(svn r1582) Fix: Only the train orders GUI has a non-stop button now.
dominik
parents:
1067
diff
changeset
|
1082 |
static const Widget _orders_widgets[] = { |
7303
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
1083 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // ORDER_WIDGET_CLOSEBOX |
10113
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
1084 |
{ WWT_CAPTION, RESIZE_RIGHT, 14, 11, 385, 0, 13, STR_8829_ORDERS, STR_018C_WINDOW_TITLE_DRAG_THIS}, // ORDER_WIDGET_CAPTION |
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
1085 |
{ WWT_PUSHTXTBTN, RESIZE_LR, 14, 325, 385, 0, 13, STR_TIMETABLE_VIEW, STR_TIMETABLE_VIEW_TOOLTIP}, // ORDER_WIDGET_TIMETABLE_VIEW |
7303
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
1086 |
|
10113
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
1087 |
{ WWT_PANEL, RESIZE_RB, 14, 0, 373, 14, 75, 0x0, STR_8852_ORDERS_LIST_CLICK_ON_ORDER}, // ORDER_WIDGET_ORDER_LIST |
7303
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
1088 |
|
10113
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
1089 |
{ WWT_SCROLLBAR, RESIZE_LRB, 14, 374, 385, 14, 75, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, // ORDER_WIDGET_SCROLLBAR |
7303
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
1090 |
|
10113
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
1091 |
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 0, 123, 88, 99, STR_8823_SKIP, STR_8853_SKIP_THE_CURRENT_ORDER}, // ORDER_WIDGET_SKIP |
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
1092 |
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 124, 247, 88, 99, STR_8824_DELETE, STR_8854_DELETE_THE_HIGHLIGHTED}, // ORDER_WIDGET_DELETE |
7303
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
1093 |
{ WWT_EMPTY, RESIZE_TB, 14, 0, 0, 76, 87, 0x0, 0x0}, // ORDER_WIDGET_NON_STOP |
10130
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
1094 |
{ WWT_TEXTBTN, RESIZE_TB, 14, 248, 359, 88, 99, STR_8826_GO_TO, STR_8856_INSERT_A_NEW_ORDER_BEFORE}, // ORDER_WIDGET_GOTO |
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
1095 |
{ WWT_DROPDOWN, RESIZE_TB, 14, 360, 371, 88, 99, STR_EMPTY, STR_ORDER_GO_TO_DROPDOWN_TOOLTIP}, // ORDER_WIDGET_GOTO_DROPDOWN |
10125
64de1e83efa8
(svn r12656) -Fix: tooltips for some order buttons are outdated/incorrect.
rubidium
parents:
10124
diff
changeset
|
1096 |
{ WWT_DROPDOWN, RESIZE_TB, 14, 0, 185, 76, 87, STR_NULL, STR_ORDER_TOOLTIP_FULL_LOAD}, // ORDER_WIDGET_FULL_LOAD |
10136
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
1097 |
{ WWT_DROPDOWN, RESIZE_TB, 14, 186, 371, 76, 87, STR_NULL, STR_ORDER_TOOLTIP_UNLOAD}, // ORDER_WIDGET_UNLOAD |
10121
b82006b98b4a
(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
parents:
10119
diff
changeset
|
1098 |
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 0, 185, 76, 87, STR_REFIT, STR_REFIT_TIP}, // ORDER_WIDGET_REFIT |
10136
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
1099 |
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 186, 371, 76, 87, STR_SERVICE, STR_SERVICE_HINT}, // ORDER_WIDGET_SERVICE |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
1100 |
|
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
1101 |
{ WWT_DROPDOWN, RESIZE_TB, 14, 0, 123, 76, 87, STR_NULL, STR_ORDER_CONDITIONAL_VARIABLE_TOOLTIP}, // ORDER_WIDGET_COND_VARIABLE |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
1102 |
{ WWT_DROPDOWN, RESIZE_TB, 14, 124, 247, 76, 87, STR_NULL, STR_ORDER_CONDITIONAL_COMPARATOR_TOOLTIP}, // ORDER_WIDGET_COND_COMPARATOR |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
1103 |
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 248, 371, 76, 87, STR_CONDITIONAL_VALUE, STR_ORDER_CONDITIONAL_VALUE_TOOLTIP}, // ORDER_WIDGET_COND_VALUE |
7303
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
1104 |
|
10113
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
1105 |
{ WWT_PANEL, RESIZE_RTB, 14, 372, 373, 76, 99, 0x0, STR_NULL}, // ORDER_WIDGET_RESIZE_BAR |
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
1106 |
{ WWT_PUSHIMGBTN, RESIZE_LRTB, 14, 372, 385, 76, 87, SPR_SHARED_ORDERS_ICON, STR_VEH_WITH_SHARED_ORDERS_LIST_TIP}, // ORDER_WIDGET_SHARED_ORDER_LIST |
7303
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
1107 |
|
10113
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
1108 |
{ WWT_RESIZEBOX, RESIZE_LRTB, 14, 374, 385, 88, 99, 0x0, STR_RESIZE_BUTTON}, // ORDER_WIDGET_RESIZE |
7303
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
1109 |
{ WIDGETS_END}, |
1081
b22fd4020122
(svn r1582) Fix: Only the train orders GUI has a non-stop button now.
dominik
parents:
1067
diff
changeset
|
1110 |
}; |
b22fd4020122
(svn r1582) Fix: Only the train orders GUI has a non-stop button now.
dominik
parents:
1067
diff
changeset
|
1111 |
|
995
96e9f70280d7
(svn r1493) -Codechange: Removed redundancy in the order GUI. Currently we had most
celestar
parents:
919
diff
changeset
|
1112 |
static const WindowDesc _orders_desc = { |
10113
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
1113 |
WDP_AUTO, WDP_AUTO, 386, 100, 386, 100, |
0 | 1114 |
WC_VEHICLE_ORDERS,WC_VEHICLE_VIEW, |
5013
79a6e510c41f
(svn r7046) -Fix [FS#311]: 'Goto' button in orders window got depressed along with all other
Darkvater
parents:
4968
diff
changeset
|
1115 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_RESIZABLE, |
995
96e9f70280d7
(svn r1493) -Codechange: Removed redundancy in the order GUI. Currently we had most
celestar
parents:
919
diff
changeset
|
1116 |
_orders_widgets, |
0 | 1117 |
OrdersWndProc |
1118 |
}; |
|
1119 |
||
7303
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
1120 |
/** |
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
1121 |
* Widget definition for competitor orders |
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
1122 |
*/ |
995
96e9f70280d7
(svn r1493) -Codechange: Removed redundancy in the order GUI. Currently we had most
celestar
parents:
919
diff
changeset
|
1123 |
static const Widget _other_orders_widgets[] = { |
7476
7f086e4b2a76
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
7419
diff
changeset
|
1124 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // ORDER_WIDGET_CLOSEBOX |
10113
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
1125 |
{ WWT_CAPTION, RESIZE_RIGHT, 14, 11, 385, 0, 13, STR_8829_ORDERS, STR_018C_WINDOW_TITLE_DRAG_THIS}, // ORDER_WIDGET_CAPTION |
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
1126 |
{ WWT_PUSHTXTBTN, RESIZE_LR, 14, 325, 385, 0, 13, STR_TIMETABLE_VIEW, STR_TIMETABLE_VIEW_TOOLTIP}, // ORDER_WIDGET_TIMETABLE_VIEW |
7303
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
1127 |
|
10113
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
1128 |
{ WWT_PANEL, RESIZE_RB, 14, 0, 373, 14, 75, 0x0, STR_8852_ORDERS_LIST_CLICK_ON_ORDER}, // ORDER_WIDGET_ORDER_LIST |
7303
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
1129 |
|
10113
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
1130 |
{ WWT_SCROLLBAR, RESIZE_LRB, 14, 374, 385, 14, 75, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, // ORDER_WIDGET_SCROLLBAR |
7303
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
1131 |
|
10110
d0cd5452bbe9
(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
parents:
10109
diff
changeset
|
1132 |
{ WWT_EMPTY, RESIZE_NONE, 14, 0, 0, 76, 87, 0x0, STR_NULL}, // ORDER_WIDGET_SKIP |
d0cd5452bbe9
(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
parents:
10109
diff
changeset
|
1133 |
{ WWT_EMPTY, RESIZE_NONE, 14, 0, 0, 76, 87, 0x0, STR_NULL}, // ORDER_WIDGET_DELETE |
d0cd5452bbe9
(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
parents:
10109
diff
changeset
|
1134 |
{ WWT_EMPTY, RESIZE_NONE, 14, 0, 0, 76, 87, 0x0, STR_NULL}, // ORDER_WIDGET_NON_STOP |
d0cd5452bbe9
(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
parents:
10109
diff
changeset
|
1135 |
{ WWT_EMPTY, RESIZE_NONE, 14, 0, 0, 76, 87, 0x0, STR_NULL}, // ORDER_WIDGET_GOTO |
10130
906ffae618b0
(svn r12661) -Add: ability to send a vehicle (using default orders) to the nearest depot.
rubidium
parents:
10129
diff
changeset
|
1136 |
{ WWT_EMPTY, RESIZE_NONE, 14, 0, 0, 76, 87, 0x0, STR_NULL}, // ORDER_WIDGET_GOTO_DROPDOWN |
10110
d0cd5452bbe9
(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
parents:
10109
diff
changeset
|
1137 |
{ WWT_EMPTY, RESIZE_NONE, 14, 0, 0, 76, 87, 0x0, STR_NULL}, // ORDER_WIDGET_FULL_LOAD |
d0cd5452bbe9
(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
parents:
10109
diff
changeset
|
1138 |
{ WWT_EMPTY, RESIZE_NONE, 14, 0, 0, 76, 87, 0x0, STR_NULL}, // ORDER_WIDGET_UNLOAD |
d0cd5452bbe9
(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
parents:
10109
diff
changeset
|
1139 |
{ WWT_EMPTY, RESIZE_NONE, 14, 0, 0, 76, 87, 0x0, STR_NULL}, // ORDER_WIDGET_REFIT |
d0cd5452bbe9
(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
parents:
10109
diff
changeset
|
1140 |
{ WWT_EMPTY, RESIZE_NONE, 14, 0, 0, 76, 87, 0x0, STR_NULL}, // ORDER_WIDGET_SERVICE |
7476
7f086e4b2a76
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
7419
diff
changeset
|
1141 |
|
10136
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
1142 |
{ WWT_EMPTY, RESIZE_NONE, 14, 0, 0, 76, 87, 0x0, STR_NULL}, // ORDER_WIDGET_COND_VARIABLE |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
1143 |
{ WWT_EMPTY, RESIZE_NONE, 14, 0, 0, 76, 87, 0x0, STR_NULL}, // ORDER_WIDGET_COND_COMPARATOR |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
1144 |
{ WWT_EMPTY, RESIZE_NONE, 14, 0, 0, 76, 87, 0x0, STR_NULL}, // ORDER_WIDGET_COND_VALUE |
d808af13bf7a
(svn r12667) -Feature: conditional 'skip/jump' orders.
rubidium
parents:
10132
diff
changeset
|
1145 |
|
10113
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
1146 |
{ WWT_PANEL, RESIZE_RTB, 14, 0, 373, 76, 87, 0x0, STR_NULL}, // ORDER_WIDGET_RESIZE_BAR |
10110
d0cd5452bbe9
(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
parents:
10109
diff
changeset
|
1147 |
{ WWT_EMPTY, RESIZE_TB, 14, 0, 0, 76, 87, 0x0, STR_NULL}, // ORDER_WIDGET_SHARED_ORDER_LIST |
7476
7f086e4b2a76
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
7419
diff
changeset
|
1148 |
|
10140
70db180c1072
(svn r12671) -Fix (r12644): orders window of competitors' vehicles was missing a resizebox
smatz
parents:
10139
diff
changeset
|
1149 |
{ WWT_RESIZEBOX, RESIZE_LRTB, 14, 374, 385, 76, 87, 0x0, STR_RESIZE_BUTTON}, // ORDER_WIDGET_RESIZE |
7303
be60ddc5a626
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
7290
diff
changeset
|
1150 |
{ WIDGETS_END}, |
0 | 1151 |
}; |
1152 |
||
995
96e9f70280d7
(svn r1493) -Codechange: Removed redundancy in the order GUI. Currently we had most
celestar
parents:
919
diff
changeset
|
1153 |
static const WindowDesc _other_orders_desc = { |
10113
0233cd056e70
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
10112
diff
changeset
|
1154 |
WDP_AUTO, WDP_AUTO, 386, 88, 386, 88, |
0 | 1155 |
WC_VEHICLE_ORDERS,WC_VEHICLE_VIEW, |
1242
bd3e74f757b4
(svn r1746) - Feature: [GUI] [ 1107690 ] Resizable orders GUI (nzhook)
darkvater
parents:
1214
diff
changeset
|
1156 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_RESIZABLE, |
995
96e9f70280d7
(svn r1493) -Codechange: Removed redundancy in the order GUI. Currently we had most
celestar
parents:
919
diff
changeset
|
1157 |
_other_orders_widgets, |
0 | 1158 |
OrdersWndProc |
1159 |
}; |
|
1160 |
||
4171 | 1161 |
void ShowOrdersWindow(const Vehicle *v) |
0 | 1162 |
{ |
1163 |
Window *w; |
|
1164 |
VehicleID veh = v->index; |
|
1165 |
||
1166 |
DeleteWindowById(WC_VEHICLE_ORDERS, veh); |
|
1167 |
DeleteWindowById(WC_VEHICLE_DETAILS, veh); |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
1168 |
|
1081
b22fd4020122
(svn r1582) Fix: Only the train orders GUI has a non-stop button now.
dominik
parents:
1067
diff
changeset
|
1169 |
if (v->owner != _local_player) { |
5071
14f432b47034
(svn r7129) -Codechange: Get rid of a global variable that only sets a window's number.
Darkvater
parents:
5070
diff
changeset
|
1170 |
w = AllocateWindowDescFront(&_other_orders_desc, veh); |
2549 | 1171 |
} else { |
6585
7da94b26498a
(svn r9068) -Codechange: capitalize the VEH_Train etc. enums to match the coding style (and rest of the code).
rubidium
parents:
6417
diff
changeset
|
1172 |
w = AllocateWindowDescFront((v->type == VEH_TRAIN) ? &_orders_train_desc : &_orders_desc, veh); |
2549 | 1173 |
} |
0 | 1174 |
|
1242
bd3e74f757b4
(svn r1746) - Feature: [GUI] [ 1107690 ] Resizable orders GUI (nzhook)
darkvater
parents:
1214
diff
changeset
|
1175 |
if (w != NULL) { |
bd3e74f757b4
(svn r1746) - Feature: [GUI] [ 1107690 ] Resizable orders GUI (nzhook)
darkvater
parents:
1214
diff
changeset
|
1176 |
w->caption_color = v->owner; |
bd3e74f757b4
(svn r1746) - Feature: [GUI] [ 1107690 ] Resizable orders GUI (nzhook)
darkvater
parents:
1214
diff
changeset
|
1177 |
w->vscroll.cap = 6; |
bd3e74f757b4
(svn r1746) - Feature: [GUI] [ 1107690 ] Resizable orders GUI (nzhook)
darkvater
parents:
1214
diff
changeset
|
1178 |
w->resize.step_height = 10; |
8578
55218950ce2d
(svn r11643) -Codechange: conform with the coding style for the WP macro uses.
rubidium
parents:
8560
diff
changeset
|
1179 |
WP(w, order_d).sel = -1; |
1242
bd3e74f757b4
(svn r1746) - Feature: [GUI] [ 1107690 ] Resizable orders GUI (nzhook)
darkvater
parents:
1214
diff
changeset
|
1180 |
} |
0 | 1181 |
} |