author | rubidium |
Sat, 05 Apr 2008 23:36:54 +0000 | |
changeset 8836 | f6f1ea3d7e93 |
parent 8787 | 41d9d5adbe87 |
child 8838 | 068d63397dc3 |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
6351
8d0b6cce8d6d
(svn r9390) -Documentation : correct Doxygen of comments and @file inclusion. This time, brought to you by the letter O
belugas
parents:
6329
diff
changeset
|
3 |
/** @file order_gui.cpp */ |
8d0b6cce8d6d
(svn r9390) -Documentation : correct Doxygen of comments and @file inclusion. This time, brought to you by the letter O
belugas
parents:
6329
diff
changeset
|
4 |
|
0 | 5 |
#include "stdafx.h" |
1891
862800791170
(svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents:
1857
diff
changeset
|
6 |
#include "openttd.h" |
3144
33e42feae531
(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
c9d989783c55
(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" |
8107
bb7deea89175
(svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents:
8106
diff
changeset
|
10 |
#include "window_gui.h" |
8785
871586967963
(svn r12489) -Codechange: split station.h into station_base.h and station_func.h.
rubidium
parents:
8784
diff
changeset
|
11 |
#include "station_base.h" |
0 | 12 |
#include "town.h" |
8116
8da76dcb3287
(svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
8114
diff
changeset
|
13 |
#include "command_func.h" |
8224
c5a64d87cc54
(svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents:
8211
diff
changeset
|
14 |
#include "viewport_func.h" |
c5a64d87cc54
(svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents:
8211
diff
changeset
|
15 |
#include "gfx_func.h" |
1313
f1013ec3d318
(svn r1817) -Codechange: Moved depot-functions to depot.c
truelight
parents:
1256
diff
changeset
|
16 |
#include "depot.h" |
1542
62a03537ad0b
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
1530
diff
changeset
|
17 |
#include "waypoint.h" |
2676
59b65b4fb480
(svn r3218) -Feature: Multiheaded train engines will now stay in the same train
bjarni
parents:
2668
diff
changeset
|
18 |
#include "train.h" |
3392
469942e8a0ca
(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
f7256d0e7682
(svn r6562) -Codechange: merged the vehicle list window widget arrays
bjarni
parents:
4634
diff
changeset
|
20 |
#include "vehicle_gui.h" |
6980
c7c4f3bf5901
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
6923
diff
changeset
|
21 |
#include "timetable.h" |
6091
c8827d9ae04a
(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:
5984
diff
changeset
|
22 |
#include "cargotype.h" |
8114
dd6d21dc99c1
(svn r11675) -Codechange: split the string types from the string functions.
rubidium
parents:
8108
diff
changeset
|
23 |
#include "strings_func.h" |
8131
160939e24ed3
(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:
8121
diff
changeset
|
24 |
#include "window_func.h" |
8144
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
8139
diff
changeset
|
25 |
#include "vehicle_func.h" |
8211
29a8510dfd62
(svn r11774) -Change: do not include variables.h in a header when it is not needed.
rubidium
parents:
8144
diff
changeset
|
26 |
#include "settings_type.h" |
8254
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
8237
diff
changeset
|
27 |
#include "player_func.h" |
8787
41d9d5adbe87
(svn r12495) -Codechange: reduce the dependency on newgrf_station.h (especially because newgrf_station.h includes a lot of stuff).
rubidium
parents:
8785
diff
changeset
|
28 |
#include "newgrf_cargo.h" |
0 | 29 |
|
8264
b1e85998c7d3
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8254
diff
changeset
|
30 |
#include "table/sprites.h" |
b1e85998c7d3
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8254
diff
changeset
|
31 |
#include "table/strings.h" |
b1e85998c7d3
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8254
diff
changeset
|
32 |
|
5828
e7b332dac5e8
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5745
diff
changeset
|
33 |
enum OrderWindowWidgets { |
e7b332dac5e8
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5745
diff
changeset
|
34 |
ORDER_WIDGET_CLOSEBOX = 0, |
e7b332dac5e8
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5745
diff
changeset
|
35 |
ORDER_WIDGET_CAPTION, |
6980
c7c4f3bf5901
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
6923
diff
changeset
|
36 |
ORDER_WIDGET_TIMETABLE_VIEW, |
5828
e7b332dac5e8
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5745
diff
changeset
|
37 |
ORDER_WIDGET_ORDER_LIST, |
e7b332dac5e8
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5745
diff
changeset
|
38 |
ORDER_WIDGET_SCROLLBAR, |
e7b332dac5e8
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5745
diff
changeset
|
39 |
ORDER_WIDGET_SKIP, |
e7b332dac5e8
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5745
diff
changeset
|
40 |
ORDER_WIDGET_DELETE, |
e7b332dac5e8
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5745
diff
changeset
|
41 |
ORDER_WIDGET_NON_STOP, |
e7b332dac5e8
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5745
diff
changeset
|
42 |
ORDER_WIDGET_GOTO, |
e7b332dac5e8
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5745
diff
changeset
|
43 |
ORDER_WIDGET_FULL_LOAD, |
e7b332dac5e8
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5745
diff
changeset
|
44 |
ORDER_WIDGET_UNLOAD, |
5829
580c0b309122
(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:
5828
diff
changeset
|
45 |
ORDER_WIDGET_REFIT, |
5828
e7b332dac5e8
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5745
diff
changeset
|
46 |
ORDER_WIDGET_TRANSFER, |
e7b332dac5e8
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5745
diff
changeset
|
47 |
ORDER_WIDGET_SHARED_ORDER_LIST, |
e7b332dac5e8
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5745
diff
changeset
|
48 |
ORDER_WIDGET_RESIZE_BAR, |
e7b332dac5e8
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5745
diff
changeset
|
49 |
ORDER_WIDGET_RESIZE, |
e7b332dac5e8
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5745
diff
changeset
|
50 |
}; |
e7b332dac5e8
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5745
diff
changeset
|
51 |
|
6832
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
52 |
/** |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
53 |
* Return the memorised selected order. |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
54 |
* |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
55 |
* @param w current window |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
56 |
* @return the memorised order if it is a vaild one |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
57 |
* else return the number of orders |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
58 |
*/ |
4171 | 59 |
static int OrderGetSel(const Window *w) |
0 | 60 |
{ |
4171 | 61 |
const Vehicle *v = GetVehicle(w->window_number); |
8082
63240e1bd6cc
(svn r11643) -Codechange: conform with the coding style for the WP macro uses.
rubidium
parents:
8064
diff
changeset
|
62 |
int num = WP(w, order_d).sel; |
0 | 63 |
|
2549 | 64 |
return (num >= 0 && num < v->num_orders) ? num : v->num_orders; |
0 | 65 |
} |
66 |
||
6832
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
67 |
/** |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
68 |
* Calculate the selected order. |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
69 |
* The calculation is based on the relative (to the window) y click position and |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
70 |
* the position of the scrollbar. |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
71 |
* |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
72 |
* @param w current window |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
73 |
* @param y Y-value of the click relative to the window origin |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
74 |
* @param v current vehicle |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
75 |
* @return the new selected order if the order is valid else return that |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
76 |
* an invalid one has been selected. |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
77 |
*/ |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
78 |
static int GetOrderFromOrderWndPt(Window *w, int y, const Vehicle *v) |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
79 |
{ |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
80 |
/* |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
81 |
* Calculation description: |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
82 |
* 15 = 14 (w->widget[ORDER_WIDGET_ORDER_LIST].top) + 1 (frame-line) |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
83 |
* 10 = order text hight |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
84 |
*/ |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
85 |
int sel = (y - 15) / 10; |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
86 |
|
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
87 |
if ((uint)sel >= w->vscroll.cap) return INVALID_ORDER; |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
88 |
|
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
89 |
sel += w->vscroll.pos; |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
90 |
|
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
91 |
return (sel <= v->num_orders && sel >= 0) ? sel : INVALID_ORDER; |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
92 |
} |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
93 |
|
1935
164d58b9137c
(svn r2441) -Feature: You can now give transfer order to set up feeder systems
celestar
parents:
1901
diff
changeset
|
94 |
static StringID StationOrderStrings[] = { |
1937
8497de87e4a2
(svn r2443) -Fix: somehow I delete one line too many :(
celestar
parents:
1935
diff
changeset
|
95 |
STR_8806_GO_TO, |
8424
c3477565c975
(svn r11994) -Codechange: Remove numbers from string names where the strings aren't present in TTD, since they don't correspond to either TTD's TextIDs or OpenTTD's StringIDs.
maedhros
parents:
8302
diff
changeset
|
96 |
STR_GO_TO_TRANSFER, |
c3477565c975
(svn r11994) -Codechange: Remove numbers from string names where the strings aren't present in TTD, since they don't correspond to either TTD's TextIDs or OpenTTD's StringIDs.
maedhros
parents:
8302
diff
changeset
|
97 |
STR_8807_GO_TO_UNLOAD, |
c3477565c975
(svn r11994) -Codechange: Remove numbers from string names where the strings aren't present in TTD, since they don't correspond to either TTD's TextIDs or OpenTTD's StringIDs.
maedhros
parents:
8302
diff
changeset
|
98 |
STR_GO_TO_TRANSFER_UNLOAD, |
c3477565c975
(svn r11994) -Codechange: Remove numbers from string names where the strings aren't present in TTD, since they don't correspond to either TTD's TextIDs or OpenTTD's StringIDs.
maedhros
parents:
8302
diff
changeset
|
99 |
STR_8808_GO_TO_LOAD, |
c3477565c975
(svn r11994) -Codechange: Remove numbers from string names where the strings aren't present in TTD, since they don't correspond to either TTD's TextIDs or OpenTTD's StringIDs.
maedhros
parents:
8302
diff
changeset
|
100 |
STR_GO_TO_TRANSFER_LOAD, |
1935
164d58b9137c
(svn r2441) -Feature: You can now give transfer order to set up feeder systems
celestar
parents:
1901
diff
changeset
|
101 |
STR_NULL, |
164d58b9137c
(svn r2441) -Feature: You can now give transfer order to set up feeder systems
celestar
parents:
1901
diff
changeset
|
102 |
STR_NULL, |
8424
c3477565c975
(svn r11994) -Codechange: Remove numbers from string names where the strings aren't present in TTD, since they don't correspond to either TTD's TextIDs or OpenTTD's StringIDs.
maedhros
parents:
8302
diff
changeset
|
103 |
STR_880A_GO_NON_STOP_TO, |
c3477565c975
(svn r11994) -Codechange: Remove numbers from string names where the strings aren't present in TTD, since they don't correspond to either TTD's TextIDs or OpenTTD's StringIDs.
maedhros
parents:
8302
diff
changeset
|
104 |
STR_GO_TO_NON_STOP_TRANSFER, |
c3477565c975
(svn r11994) -Codechange: Remove numbers from string names where the strings aren't present in TTD, since they don't correspond to either TTD's TextIDs or OpenTTD's StringIDs.
maedhros
parents:
8302
diff
changeset
|
105 |
STR_880B_GO_NON_STOP_TO_UNLOAD, |
c3477565c975
(svn r11994) -Codechange: Remove numbers from string names where the strings aren't present in TTD, since they don't correspond to either TTD's TextIDs or OpenTTD's StringIDs.
maedhros
parents:
8302
diff
changeset
|
106 |
STR_GO_TO_NON_STOP_TRANSFER_UNLOAD, |
c3477565c975
(svn r11994) -Codechange: Remove numbers from string names where the strings aren't present in TTD, since they don't correspond to either TTD's TextIDs or OpenTTD's StringIDs.
maedhros
parents:
8302
diff
changeset
|
107 |
STR_880C_GO_NON_STOP_TO_LOAD, |
c3477565c975
(svn r11994) -Codechange: Remove numbers from string names where the strings aren't present in TTD, since they don't correspond to either TTD's TextIDs or OpenTTD's StringIDs.
maedhros
parents:
8302
diff
changeset
|
108 |
STR_GO_TO_NON_STOP_TRANSFER_LOAD, |
1935
164d58b9137c
(svn r2441) -Feature: You can now give transfer order to set up feeder systems
celestar
parents:
1901
diff
changeset
|
109 |
STR_NULL |
164d58b9137c
(svn r2441) -Feature: You can now give transfer order to set up feeder systems
celestar
parents:
1901
diff
changeset
|
110 |
}; |
164d58b9137c
(svn r2441) -Feature: You can now give transfer order to set up feeder systems
celestar
parents:
1901
diff
changeset
|
111 |
|
0 | 112 |
static void DrawOrdersWindow(Window *w) |
113 |
{ |
|
1024
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
114 |
const Vehicle *v; |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
115 |
const Order *order; |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
116 |
StringID str; |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
117 |
int sel; |
0 | 118 |
int y, i; |
1024
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
119 |
bool shared_orders; |
0 | 120 |
|
919
544f374ee392
(svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns and _industries
truelight
parents:
893
diff
changeset
|
121 |
v = GetVehicle(w->window_number); |
1019
6bae6c11e865
(svn r1520) Trim 134 (!) lines with trailing whitespace ):
tron
parents:
1000
diff
changeset
|
122 |
|
8469
c3621b1a6454
(svn r12040) -Codechange: Change IsOrderListShared from a simple function to a class member(MagicBuzz).
belugas
parents:
8424
diff
changeset
|
123 |
shared_orders = v->IsOrderListShared(); |
0 | 124 |
|
1024
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
125 |
SetVScrollCount(w, v->num_orders + 1); |
0 | 126 |
|
127 |
sel = OrderGetSel(w); |
|
1024
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
128 |
SetDParam(2, STR_8827_FULL_LOAD); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
129 |
|
1024
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
130 |
order = GetVehicleOrder(v, sel); |
725 | 131 |
|
4949
6bf60913767f
(svn r6938) -Codechange: Comments, typo, variable naming, whitespace, strecpy and simplification
Darkvater
parents:
4935
diff
changeset
|
132 |
if (v->owner == _local_player) { |
6bf60913767f
(svn r6938) -Codechange: Comments, typo, variable naming, whitespace, strecpy and simplification
Darkvater
parents:
4935
diff
changeset
|
133 |
/* skip */ |
7997
df87ccd00a96
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
7889
diff
changeset
|
134 |
w->SetWidgetDisabledState(ORDER_WIDGET_SKIP, v->num_orders <= 1); |
4709
a81ab800c25b
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4668
diff
changeset
|
135 |
|
4949
6bf60913767f
(svn r6938) -Codechange: Comments, typo, variable naming, whitespace, strecpy and simplification
Darkvater
parents:
4935
diff
changeset
|
136 |
/* delete */ |
7997
df87ccd00a96
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
7889
diff
changeset
|
137 |
w->SetWidgetDisabledState(ORDER_WIDGET_DELETE, |
5984
58184c417aec
(svn r8685) -Feature: selecting "end of orders" and clicking delete will delete all the vehicle's orders
bjarni
parents:
5964
diff
changeset
|
138 |
(uint)v->num_orders + ((shared_orders || v->num_orders != 0) ? 1 : 0) <= (uint)WP(w, order_d).sel); |
4712
4335ad42e163
(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
|
139 |
|
4949
6bf60913767f
(svn r6938) -Codechange: Comments, typo, variable naming, whitespace, strecpy and simplification
Darkvater
parents:
4935
diff
changeset
|
140 |
/* non-stop only for trains */ |
7997
df87ccd00a96
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
7889
diff
changeset
|
141 |
w->SetWidgetDisabledState(ORDER_WIDGET_NON_STOP, v->type != VEH_TRAIN || order == NULL); |
df87ccd00a96
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
7889
diff
changeset
|
142 |
w->SetWidgetDisabledState(ORDER_WIDGET_FULL_LOAD, order == NULL); // full load |
df87ccd00a96
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
7889
diff
changeset
|
143 |
w->SetWidgetDisabledState(ORDER_WIDGET_UNLOAD, order == NULL); // unload |
df87ccd00a96
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
7889
diff
changeset
|
144 |
w->SetWidgetDisabledState(ORDER_WIDGET_TRANSFER, order == NULL); // transfer |
4949
6bf60913767f
(svn r6938) -Codechange: Comments, typo, variable naming, whitespace, strecpy and simplification
Darkvater
parents:
4935
diff
changeset
|
145 |
/* Disable list of vehicles with the same shared orders if there is no list */ |
7997
df87ccd00a96
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
7889
diff
changeset
|
146 |
w->SetWidgetDisabledState(ORDER_WIDGET_SHARED_ORDER_LIST, !shared_orders || v->orders == NULL); |
df87ccd00a96
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
7889
diff
changeset
|
147 |
w->SetWidgetDisabledState(ORDER_WIDGET_REFIT, order == NULL); // Refit |
df87ccd00a96
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
7889
diff
changeset
|
148 |
w->HideWidget(ORDER_WIDGET_REFIT); // Refit |
4949
6bf60913767f
(svn r6938) -Codechange: Comments, typo, variable naming, whitespace, strecpy and simplification
Darkvater
parents:
4935
diff
changeset
|
149 |
} else { |
7997
df87ccd00a96
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
7889
diff
changeset
|
150 |
w->DisableWidget(ORDER_WIDGET_TRANSFER); |
4949
6bf60913767f
(svn r6938) -Codechange: Comments, typo, variable naming, whitespace, strecpy and simplification
Darkvater
parents:
4935
diff
changeset
|
151 |
} |
4712
4335ad42e163
(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
|
152 |
|
7997
df87ccd00a96
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
7889
diff
changeset
|
153 |
w->ShowWidget(ORDER_WIDGET_UNLOAD); // Unload |
4709
a81ab800c25b
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4668
diff
changeset
|
154 |
|
1024
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
155 |
if (order != NULL) { |
8836
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8787
diff
changeset
|
156 |
switch (order->GetType()) { |
8057
9a378e86100b
(svn r11618) -Fix: buoys are just waypoints, so don't allow load/unload/transfert for them
glx
parents:
8028
diff
changeset
|
157 |
case OT_GOTO_STATION: |
9a378e86100b
(svn r11618) -Fix: buoys are just waypoints, so don't allow load/unload/transfert for them
glx
parents:
8028
diff
changeset
|
158 |
if (!GetStation(order->dest)->IsBuoy()) break; |
9a378e86100b
(svn r11618) -Fix: buoys are just waypoints, so don't allow load/unload/transfert for them
glx
parents:
8028
diff
changeset
|
159 |
/* Fall-through */ |
9a378e86100b
(svn r11618) -Fix: buoys are just waypoints, so don't allow load/unload/transfert for them
glx
parents:
8028
diff
changeset
|
160 |
|
9a378e86100b
(svn r11618) -Fix: buoys are just waypoints, so don't allow load/unload/transfert for them
glx
parents:
8028
diff
changeset
|
161 |
case OT_GOTO_WAYPOINT: |
9a378e86100b
(svn r11618) -Fix: buoys are just waypoints, so don't allow load/unload/transfert for them
glx
parents:
8028
diff
changeset
|
162 |
w->DisableWidget(ORDER_WIDGET_FULL_LOAD); |
9a378e86100b
(svn r11618) -Fix: buoys are just waypoints, so don't allow load/unload/transfert for them
glx
parents:
8028
diff
changeset
|
163 |
w->DisableWidget(ORDER_WIDGET_UNLOAD); |
9a378e86100b
(svn r11618) -Fix: buoys are just waypoints, so don't allow load/unload/transfert for them
glx
parents:
8028
diff
changeset
|
164 |
w->DisableWidget(ORDER_WIDGET_TRANSFER); |
9a378e86100b
(svn r11618) -Fix: buoys are just waypoints, so don't allow load/unload/transfert for them
glx
parents:
8028
diff
changeset
|
165 |
break; |
2549 | 166 |
|
1024
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
167 |
case OT_GOTO_DEPOT: |
7997
df87ccd00a96
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
7889
diff
changeset
|
168 |
w->DisableWidget(ORDER_WIDGET_TRANSFER); |
4712
4335ad42e163
(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
|
169 |
|
4335ad42e163
(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
|
170 |
/* Remove unload and replace it with refit */ |
7997
df87ccd00a96
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
7889
diff
changeset
|
171 |
w->HideWidget(ORDER_WIDGET_UNLOAD); |
df87ccd00a96
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
7889
diff
changeset
|
172 |
w->ShowWidget(ORDER_WIDGET_REFIT); |
1024
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
173 |
SetDParam(2,STR_SERVICE); |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
174 |
break; |
725 | 175 |
|
4709
a81ab800c25b
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4668
diff
changeset
|
176 |
default: // every other orders |
7997
df87ccd00a96
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
7889
diff
changeset
|
177 |
w->DisableWidget(ORDER_WIDGET_NON_STOP); |
df87ccd00a96
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
7889
diff
changeset
|
178 |
w->DisableWidget(ORDER_WIDGET_FULL_LOAD); |
df87ccd00a96
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
7889
diff
changeset
|
179 |
w->DisableWidget(ORDER_WIDGET_UNLOAD); |
1024
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
180 |
} |
0 | 181 |
} |
182 |
||
7049
0ebe47348074
(svn r10314) -Codechange: Refer to vehicle names by index
peter1138
parents:
6980
diff
changeset
|
183 |
SetDParam(0, v->index); |
0 | 184 |
DrawWindowWidgets(w); |
185 |
||
186 |
y = 15; |
|
187 |
||
1024
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
188 |
i = w->vscroll.pos; |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
189 |
order = GetVehicleOrder(v, i); |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
190 |
while (order != NULL) { |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
191 |
str = (v->cur_order_index == i) ? STR_8805 : STR_8804; |
4712
4335ad42e163
(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
|
192 |
SetDParam(3, STR_EMPTY); |
0 | 193 |
|
1242
1ca216c50426
(svn r1746) - Feature: [GUI] [ 1107690 ] Resizable orders GUI (nzhook)
darkvater
parents:
1214
diff
changeset
|
194 |
if (i - w->vscroll.pos < w->vscroll.cap) { |
1024
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
195 |
SetDParam(1, 6); |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
196 |
|
8836
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8787
diff
changeset
|
197 |
switch (order->GetType()) { |
7312
9e89be4bc9a2
(svn r10664) -Codechange: simplify a small piece of code (skidd13)
truelight
parents:
7266
diff
changeset
|
198 |
case OT_DUMMY: |
9e89be4bc9a2
(svn r10664) -Codechange: simplify a small piece of code (skidd13)
truelight
parents:
7266
diff
changeset
|
199 |
SetDParam(1, STR_INVALID_ORDER); |
9e89be4bc9a2
(svn r10664) -Codechange: simplify a small piece of code (skidd13)
truelight
parents:
7266
diff
changeset
|
200 |
SetDParam(2, order->dest); |
9e89be4bc9a2
(svn r10664) -Codechange: simplify a small piece of code (skidd13)
truelight
parents:
7266
diff
changeset
|
201 |
break; |
9e89be4bc9a2
(svn r10664) -Codechange: simplify a small piece of code (skidd13)
truelight
parents:
7266
diff
changeset
|
202 |
|
2631
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2549
diff
changeset
|
203 |
case OT_GOTO_STATION: |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2549
diff
changeset
|
204 |
SetDParam(1, StationOrderStrings[order->flags]); |
4527
fa30d19685c2
(svn r6353) -Codechange: Make DestinationID a typedef of uin16, which is as large as any type of destinataion (StationID, DepotID, WaypointID) it can hold
tron
parents:
4408
diff
changeset
|
205 |
SetDParam(2, order->dest); |
2631
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2549
diff
changeset
|
206 |
break; |
1935
164d58b9137c
(svn r2441) -Feature: You can now give transfer order to set up feeder systems
celestar
parents:
1901
diff
changeset
|
207 |
|
2631
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2549
diff
changeset
|
208 |
case OT_GOTO_DEPOT: { |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2549
diff
changeset
|
209 |
StringID s = STR_NULL; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2549
diff
changeset
|
210 |
|
6259
471b91a4b1d8
(svn r9068) -Codechange: capitalize the VEH_Train etc. enums to match the coding style (and rest of the code).
rubidium
parents:
6091
diff
changeset
|
211 |
if (v->type == VEH_AIRCRAFT) { |
2631
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2549
diff
changeset
|
212 |
s = STR_GO_TO_AIRPORT_HANGAR; |
4527
fa30d19685c2
(svn r6353) -Codechange: Make DestinationID a typedef of uin16, which is as large as any type of destinataion (StationID, DepotID, WaypointID) it can hold
tron
parents:
4408
diff
changeset
|
213 |
SetDParam(2, order->dest); |
2631
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2549
diff
changeset
|
214 |
} else { |
4527
fa30d19685c2
(svn r6353) -Codechange: Make DestinationID a typedef of uin16, which is as large as any type of destinataion (StationID, DepotID, WaypointID) it can hold
tron
parents:
4408
diff
changeset
|
215 |
SetDParam(2, GetDepot(order->dest)->town_index); |
2631
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2549
diff
changeset
|
216 |
|
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2549
diff
changeset
|
217 |
switch (v->type) { |
8302
ed068d41cf1e
(svn r11866) -Codechange: swap OFB_* and OF_* so it conceptually in sync with other cases of *B_* vs *_* like VETSB_* and VETS_*.
rubidium
parents:
8264
diff
changeset
|
218 |
case VEH_TRAIN: s = (order->flags & OFB_NON_STOP) ? STR_880F_GO_NON_STOP_TO_TRAIN_DEPOT : STR_GO_TO_TRAIN_DEPOT; break; |
8424
c3477565c975
(svn r11994) -Codechange: Remove numbers from string names where the strings aren't present in TTD, since they don't correspond to either TTD's TextIDs or OpenTTD's StringIDs.
maedhros
parents:
8302
diff
changeset
|
219 |
case VEH_ROAD: s = STR_GO_TO_ROADVEH_DEPOT; break; |
6259
471b91a4b1d8
(svn r9068) -Codechange: capitalize the VEH_Train etc. enums to match the coding style (and rest of the code).
rubidium
parents:
6091
diff
changeset
|
220 |
case VEH_SHIP: s = STR_GO_TO_SHIP_DEPOT; break; |
2631
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2549
diff
changeset
|
221 |
default: break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2549
diff
changeset
|
222 |
} |
0 | 223 |
} |
1935
164d58b9137c
(svn r2441) -Feature: You can now give transfer order to set up feeder systems
celestar
parents:
1901
diff
changeset
|
224 |
|
8302
ed068d41cf1e
(svn r11866) -Codechange: swap OFB_* and OF_* so it conceptually in sync with other cases of *B_* vs *_* like VETSB_* and VETS_*.
rubidium
parents:
8264
diff
changeset
|
225 |
if (order->flags & OFB_FULL_LOAD) s++; /* service at */ |
2631
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2549
diff
changeset
|
226 |
|
1935
164d58b9137c
(svn r2441) -Feature: You can now give transfer order to set up feeder systems
celestar
parents:
1901
diff
changeset
|
227 |
SetDParam(1, s); |
4782
6aa485b21dae
(svn r6696) -Codechange: changed all comparision for refit cargo in orders against CT_NO_REFIT to checks for valid cargo IDs
bjarni
parents:
4719
diff
changeset
|
228 |
if (order->refit_cargo < NUM_CARGO) { |
4712
4335ad42e163
(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
|
229 |
SetDParam(3, STR_REFIT_ORDER); |
6091
c8827d9ae04a
(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:
5984
diff
changeset
|
230 |
SetDParam(4, GetCargo(order->refit_cargo)->name); |
4782
6aa485b21dae
(svn r6696) -Codechange: changed all comparision for refit cargo in orders against CT_NO_REFIT to checks for valid cargo IDs
bjarni
parents:
4719
diff
changeset
|
231 |
} else { |
6aa485b21dae
(svn r6696) -Codechange: changed all comparision for refit cargo in orders against CT_NO_REFIT to checks for valid cargo IDs
bjarni
parents:
4719
diff
changeset
|
232 |
SetDParam(3, STR_EMPTY); |
4712
4335ad42e163
(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
|
233 |
} |
2631
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2549
diff
changeset
|
234 |
break; |
0 | 235 |
} |
1024
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
236 |
|
2631
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2549
diff
changeset
|
237 |
case OT_GOTO_WAYPOINT: |
8302
ed068d41cf1e
(svn r11866) -Codechange: swap OFB_* and OF_* so it conceptually in sync with other cases of *B_* vs *_* like VETSB_* and VETS_*.
rubidium
parents:
8264
diff
changeset
|
238 |
SetDParam(1, (order->flags & OFB_NON_STOP) ? STR_GO_NON_STOP_TO_WAYPOINT : STR_GO_TO_WAYPOINT); |
4527
fa30d19685c2
(svn r6353) -Codechange: Make DestinationID a typedef of uin16, which is as large as any type of destinataion (StationID, DepotID, WaypointID) it can hold
tron
parents:
4408
diff
changeset
|
239 |
SetDParam(2, order->dest); |
2631
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2549
diff
changeset
|
240 |
break; |
4351
c9799dd53eec
(svn r6052) -Codechange: change OrderType (order->type) in a typedef
truelight
parents:
4344
diff
changeset
|
241 |
|
c9799dd53eec
(svn r6052) -Codechange: change OrderType (order->type) in a typedef
truelight
parents:
4344
diff
changeset
|
242 |
default: break; |
0 | 243 |
} |
1024
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
244 |
|
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
245 |
SetDParam(0, i + 1); |
8082
63240e1bd6cc
(svn r11643) -Codechange: conform with the coding style for the WP macro uses.
rubidium
parents:
8064
diff
changeset
|
246 |
DrawString(2, y, str, (i == WP(w, order_d).sel) ? TC_WHITE : TC_BLACK); |
7312
9e89be4bc9a2
(svn r10664) -Codechange: simplify a small piece of code (skidd13)
truelight
parents:
7266
diff
changeset
|
247 |
|
0 | 248 |
y += 10; |
249 |
} |
|
250 |
||
251 |
i++; |
|
1024
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
252 |
order = order->next; |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
253 |
} |
0 | 254 |
|
1242
1ca216c50426
(svn r1746) - Feature: [GUI] [ 1107690 ] Resizable orders GUI (nzhook)
darkvater
parents:
1214
diff
changeset
|
255 |
if (i - w->vscroll.pos < w->vscroll.cap) { |
1024
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
256 |
str = shared_orders ? STR_END_OF_SHARED_ORDERS : STR_882A_END_OF_ORDERS; |
8082
63240e1bd6cc
(svn r11643) -Codechange: conform with the coding style for the WP macro uses.
rubidium
parents:
8064
diff
changeset
|
257 |
DrawString(2, y, str, (i == WP(w, order_d).sel) ? TC_WHITE : TC_BLACK); |
0 | 258 |
} |
259 |
} |
|
260 |
||
2436
7d5df545bd5d
(svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents:
2186
diff
changeset
|
261 |
static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile) |
0 | 262 |
{ |
558
1ae2a752501e
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
263 |
Order order; |
3387
a779ba33aab4
(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
|
264 |
order.next = NULL; |
a779ba33aab4
(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
|
265 |
order.index = 0; |
4715 | 266 |
order.refit_cargo = CT_INVALID; |
267 |
order.refit_subtype = 0; |
|
0 | 268 |
|
269 |
// check depot first |
|
270 |
if (_patches.gotodepot) { |
|
1214
8262981ac274
(svn r1718) Use the enum TileType as parameter/return type for [GS]etTileType() instead of plain int.
tron
parents:
1209
diff
changeset
|
271 |
switch (GetTileType(tile)) { |
0 | 272 |
case MP_RAILWAY: |
6259
471b91a4b1d8
(svn r9068) -Codechange: capitalize the VEH_Train etc. enums to match the coding style (and rest of the code).
rubidium
parents:
6091
diff
changeset
|
273 |
if (v->type == VEH_TRAIN && IsTileOwner(tile, _local_player)) { |
4182
48dba107ff43
(svn r5624) Use {IsPlainRailTile,IsRailDepot,IsRailWaypoint,HasSignals}() instead of GetRailTile{T,Subt}ype() - this is more concise and a bit more flexible if/when the rail tile encoding changes
tron
parents:
4171
diff
changeset
|
274 |
if (IsRailDepot(tile)) { |
8836
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8787
diff
changeset
|
275 |
order.MakeGoToDepot(GetDepotByTile(tile)->index, true); |
558
1ae2a752501e
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
276 |
return order; |
560
60e198893a41
(svn r962) Fixed a problem with the new order system due to missing '{}' (another place)
Celestar
parents:
559
diff
changeset
|
277 |
} |
0 | 278 |
} |
279 |
break; |
|
280 |
||
7370
41adc721b1fa
(svn r10733) -Codechange: change MP_STREET into MP_ROAD as we use the word "road" everywhere except in the tile type.
rubidium
parents:
7341
diff
changeset
|
281 |
case MP_ROAD: |
8563
13b1a41e46f1
(svn r12141) -Codechange: Introduce IsNormalRoad[Tile](), IsRoadDepot[Tile]() and HasTileRoadType(); and use them.
frosch
parents:
8469
diff
changeset
|
282 |
if (IsRoadDepot(tile) && v->type == VEH_ROAD && IsTileOwner(tile, _local_player)) { |
8836
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8787
diff
changeset
|
283 |
order.MakeGoToDepot(GetDepotByTile(tile)->index, true); |
558
1ae2a752501e
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
284 |
return order; |
560
60e198893a41
(svn r962) Fixed a problem with the new order system due to missing '{}' (another place)
Celestar
parents:
559
diff
changeset
|
285 |
} |
0 | 286 |
break; |
287 |
||
288 |
case MP_STATION: |
|
6259
471b91a4b1d8
(svn r9068) -Codechange: capitalize the VEH_Train etc. enums to match the coding style (and rest of the code).
rubidium
parents:
6091
diff
changeset
|
289 |
if (v->type != VEH_AIRCRAFT) break; |
3338
7cff208f0446
(svn r4120) Use the new station functions where appropriate
tron
parents:
3315
diff
changeset
|
290 |
if (IsHangar(tile) && IsTileOwner(tile, _local_player)) { |
8836
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8787
diff
changeset
|
291 |
order.MakeGoToDepot(GetStationIndex(tile), true); |
558
1ae2a752501e
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
292 |
return order; |
560
60e198893a41
(svn r962) Fixed a problem with the new order system due to missing '{}' (another place)
Celestar
parents:
559
diff
changeset
|
293 |
} |
0 | 294 |
break; |
295 |
||
296 |
case MP_WATER: |
|
6259
471b91a4b1d8
(svn r9068) -Codechange: capitalize the VEH_Train etc. enums to match the coding style (and rest of the code).
rubidium
parents:
6091
diff
changeset
|
297 |
if (v->type != VEH_SHIP) break; |
1334 | 298 |
if (IsTileDepotType(tile, TRANSPORT_WATER) && |
299 |
IsTileOwner(tile, _local_player)) { |
|
3392
469942e8a0ca
(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
|
300 |
TileIndex tile2 = GetOtherShipDepotTile(tile); |
469942e8a0ca
(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
|
301 |
|
8836
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8787
diff
changeset
|
302 |
order.MakeGoToDepot(GetDepotByTile(tile < tile2 ? tile : tile2)->index, true); |
558
1ae2a752501e
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
303 |
return order; |
0 | 304 |
} |
1214
8262981ac274
(svn r1718) Use the enum TileType as parameter/return type for [GS]etTileType() instead of plain int.
tron
parents:
1209
diff
changeset
|
305 |
|
8262981ac274
(svn r1718) Use the enum TileType as parameter/return type for [GS]etTileType() instead of plain int.
tron
parents:
1209
diff
changeset
|
306 |
default: |
8262981ac274
(svn r1718) Use the enum TileType as parameter/return type for [GS]etTileType() instead of plain int.
tron
parents:
1209
diff
changeset
|
307 |
break; |
0 | 308 |
} |
309 |
} |
|
310 |
||
395
788a9bba0889
(svn r587) -newgrf: Rename all /Checkpoint/i tokens to 'Waypoint's. The name actually makes some sense and is also compatible with TTDPatch (pasky).
darkvater
parents:
319
diff
changeset
|
311 |
// check waypoint |
1901
03bf9bf99319
(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
|
312 |
if (IsTileType(tile, MP_RAILWAY) && |
6259
471b91a4b1d8
(svn r9068) -Codechange: capitalize the VEH_Train etc. enums to match the coding style (and rest of the code).
rubidium
parents:
6091
diff
changeset
|
313 |
v->type == VEH_TRAIN && |
1901
03bf9bf99319
(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
|
314 |
IsTileOwner(tile, _local_player) && |
2668
c0f1828b89e4
(svn r3210) -Codechange: use IsRailWaypoint where possible (instead of magicnumbers)
truelight
parents:
2643
diff
changeset
|
315 |
IsRailWaypoint(tile)) { |
8836
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8787
diff
changeset
|
316 |
order.MakeGoToWaypoint(GetWaypointByTile(tile)->index); |
558
1ae2a752501e
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
317 |
return order; |
1ae2a752501e
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
318 |
} |
319
1769185de5f5
(svn r329) Fix: [ 1035066 ] 'Allow goto depot' turned off, no checkpoints in orders
dominik
parents:
193
diff
changeset
|
319 |
|
1035
812f837ee03f
(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
|
320 |
if (IsTileType(tile, MP_STATION)) { |
3315
c9d989783c55
(svn r4079) Add GetSation{Index,ByTile}() to get the station index resp. the station from a tile
tron
parents:
3269
diff
changeset
|
321 |
StationID st_index = GetStationIndex(tile); |
4171 | 322 |
const Station *st = GetStation(st_index); |
0 | 323 |
|
324 |
if (st->owner == _current_player || st->owner == OWNER_NONE) { |
|
325 |
byte facil; |
|
6259
471b91a4b1d8
(svn r9068) -Codechange: capitalize the VEH_Train etc. enums to match the coding style (and rest of the code).
rubidium
parents:
6091
diff
changeset
|
326 |
(facil=FACIL_DOCK, v->type == VEH_SHIP) || |
471b91a4b1d8
(svn r9068) -Codechange: capitalize the VEH_Train etc. enums to match the coding style (and rest of the code).
rubidium
parents:
6091
diff
changeset
|
327 |
(facil=FACIL_TRAIN, v->type == VEH_TRAIN) || |
471b91a4b1d8
(svn r9068) -Codechange: capitalize the VEH_Train etc. enums to match the coding style (and rest of the code).
rubidium
parents:
6091
diff
changeset
|
328 |
(facil=FACIL_AIRPORT, v->type == VEH_AIRCRAFT) || |
6329
a492d5e61d7b
(svn r9301) -Codechange: Use cargo class to determine if a road vehicle can stop in bus or truck stops.
peter1138
parents:
6263
diff
changeset
|
329 |
(facil=FACIL_BUS_STOP, v->type == VEH_ROAD && IsCargoInClass(v->cargo_type, CC_PASSENGERS)) || |
0 | 330 |
(facil=FACIL_TRUCK_STOP, 1); |
558
1ae2a752501e
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
331 |
if (st->facilities & facil) { |
8836
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8787
diff
changeset
|
332 |
order.MakeGoToStation(st_index); |
558
1ae2a752501e
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
333 |
return order; |
1ae2a752501e
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
334 |
} |
0 | 335 |
} |
336 |
} |
|
337 |
||
338 |
// not found |
|
6263
6bd0726c74e2
(svn r9072) -Codechange: [Orders] added methods to orders to free them and check if they are in use
bjarni
parents:
6259
diff
changeset
|
339 |
order.Free(); |
4527
fa30d19685c2
(svn r6353) -Codechange: Make DestinationID a typedef of uin16, which is as large as any type of destinataion (StationID, DepotID, WaypointID) it can hold
tron
parents:
4408
diff
changeset
|
340 |
order.dest = INVALID_STATION; |
558
1ae2a752501e
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
341 |
return order; |
0 | 342 |
} |
343 |
||
4171 | 344 |
static bool HandleOrderVehClick(const Vehicle *v, const Vehicle *u, Window *w) |
0 | 345 |
{ |
2549 | 346 |
if (u->type != v->type) return false; |
0 | 347 |
|
7548
3a679b6e8b30
(svn r11068) -Codechange: remove Vehicle::HasFront as all vehicles have the Vehicle::first pointer correctly set.
rubidium
parents:
7497
diff
changeset
|
348 |
if (!u->IsPrimaryVehicle()) { |
7497
40e457c0a8ac
(svn r11011) -Fix [FS#1129]: GetFirstVehicleInChain did change the game state while being marked const.
rubidium
parents:
7370
diff
changeset
|
349 |
u = u->First(); |
6773
bc98b0b16ec4
(svn r10009) -Codechange: Add and use Vehicle::IsPrimaryVehicle to replace individual checks depending on the vehicle type.
maedhros
parents:
6492
diff
changeset
|
350 |
if (!u->IsPrimaryVehicle()) return false; |
0 | 351 |
} |
352 |
||
353 |
// v is vehicle getting orders. Only copy/clone orders if vehicle doesn't have any orders yet |
|
354 |
// obviously if you press CTRL on a non-empty orders vehicle you know what you are doing |
|
2549 | 355 |
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
|
356 |
|
8064
fef5cd447a5a
(svn r11625) -Codechange: add CO_* enum at some places, add includes of order.h too
smatz
parents:
8057
diff
changeset
|
357 |
if (DoCommandP(v->tile, v->index | (u->index << 16), _ctrl_pressed ? CO_SHARE : CO_COPY, NULL, |
0 | 358 |
_ctrl_pressed ? CMD_CLONE_ORDER | CMD_MSG(STR_CANT_SHARE_ORDER_LIST) : CMD_CLONE_ORDER | CMD_MSG(STR_CANT_COPY_ORDER_LIST))) { |
8082
63240e1bd6cc
(svn r11643) -Codechange: conform with the coding style for the WP macro uses.
rubidium
parents:
8064
diff
changeset
|
359 |
WP(w, order_d).sel = -1; |
0 | 360 |
ResetObjectToPlace(); |
361 |
} |
|
362 |
||
363 |
return true; |
|
364 |
} |
|
365 |
||
4171 | 366 |
static void OrdersPlaceObj(const Vehicle *v, TileIndex tile, Window *w) |
0 | 367 |
{ |
558
1ae2a752501e
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
368 |
Order cmd; |
4171 | 369 |
const Vehicle *u; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
370 |
|
0 | 371 |
// check if we're clicking on a vehicle first.. clone orders in that case. |
372 |
u = CheckMouseOverVehicle(); |
|
2549 | 373 |
if (u != NULL && HandleOrderVehClick(v, u, w)) return; |
0 | 374 |
|
375 |
cmd = GetOrderCmdFromTile(v, tile); |
|
6263
6bd0726c74e2
(svn r9072) -Codechange: [Orders] added methods to orders to free them and check if they are in use
bjarni
parents:
6259
diff
changeset
|
376 |
if (!cmd.IsValid()) return; |
0 | 377 |
|
558
1ae2a752501e
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
378 |
if (DoCommandP(v->tile, v->index + (OrderGetSel(w) << 16), PackOrder(&cmd), NULL, CMD_INSERT_ORDER | CMD_MSG(STR_8833_CAN_T_INSERT_NEW_ORDER))) { |
8082
63240e1bd6cc
(svn r11643) -Codechange: conform with the coding style for the WP macro uses.
rubidium
parents:
8064
diff
changeset
|
379 |
if (WP(w, order_d).sel != -1) WP(w,order_d).sel++; |
0 | 380 |
ResetObjectToPlace(); |
381 |
} |
|
382 |
} |
|
383 |
||
6807
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
384 |
/** |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
385 |
* Handle the click on the goto button. |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
386 |
* |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
387 |
* @param w current window |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
388 |
* @param v current vehicle |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
389 |
*/ |
4171 | 390 |
static void OrderClick_Goto(Window *w, const Vehicle *v) |
1000
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
391 |
{ |
8028
e578ea22f371
(svn r11588) -Codechange: use the new member introduced in r11551
glx
parents:
7997
diff
changeset
|
392 |
w->InvalidateWidget(ORDER_WIDGET_GOTO); |
7997
df87ccd00a96
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
7889
diff
changeset
|
393 |
w->ToggleWidgetLoweredState(ORDER_WIDGET_GOTO); |
df87ccd00a96
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
7889
diff
changeset
|
394 |
if (w->IsWidgetLowered(ORDER_WIDGET_GOTO)) { |
1000
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
395 |
_place_clicked_vehicle = NULL; |
7889
e74ce8853ba7
(svn r11440) -Codechange: replace magic numbers with enumified WindowHighlightMode constants. Patch by SmatZ.
rubidium
parents:
7824
diff
changeset
|
396 |
SetObjectToPlaceWnd(ANIMCURSOR_PICKSTATION, PAL_NONE, VHM_RECT, w); |
1000
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
397 |
} else { |
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
398 |
ResetObjectToPlace(); |
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
399 |
} |
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
400 |
} |
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
401 |
|
6807
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
402 |
/** |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
403 |
* Handle the click on the full load button. |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
404 |
* |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
405 |
* @param w current window |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
406 |
* @param v current vehicle |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
407 |
*/ |
4171 | 408 |
static void OrderClick_FullLoad(Window *w, const Vehicle *v) |
1000
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
409 |
{ |
8302
ed068d41cf1e
(svn r11866) -Codechange: swap OFB_* and OF_* so it conceptually in sync with other cases of *B_* vs *_* like VETSB_* and VETS_*.
rubidium
parents:
8264
diff
changeset
|
410 |
DoCommandP(v->tile, v->index + (OrderGetSel(w) << 16), OF_FULL_LOAD, NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER)); |
1000
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
411 |
} |
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
412 |
|
6807
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
413 |
/** |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
414 |
* Handle the click on the unload button. |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
415 |
* |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
416 |
* @param w current window |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
417 |
* @param v current vehicle |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
418 |
*/ |
4171 | 419 |
static void OrderClick_Unload(Window *w, const Vehicle *v) |
1000
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
420 |
{ |
8302
ed068d41cf1e
(svn r11866) -Codechange: swap OFB_* and OF_* so it conceptually in sync with other cases of *B_* vs *_* like VETSB_* and VETS_*.
rubidium
parents:
8264
diff
changeset
|
421 |
DoCommandP(v->tile, v->index + (OrderGetSel(w) << 16), OF_UNLOAD, NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER)); |
1024
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
422 |
} |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
423 |
|
6807
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
424 |
/** |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
425 |
* Handle the click on the nonstop button. |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
426 |
* |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
427 |
* @param w current window |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
428 |
* @param v current vehicle |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
429 |
*/ |
4171 | 430 |
static void OrderClick_Nonstop(Window *w, const Vehicle *v) |
1024
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
431 |
{ |
8302
ed068d41cf1e
(svn r11866) -Codechange: swap OFB_* and OF_* so it conceptually in sync with other cases of *B_* vs *_* like VETSB_* and VETS_*.
rubidium
parents:
8264
diff
changeset
|
432 |
DoCommandP(v->tile, v->index + (OrderGetSel(w) << 16), OF_NON_STOP, NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER)); |
1000
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
433 |
} |
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
434 |
|
6807
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
435 |
/** |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
436 |
* Handle the click on the transfer button. |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
437 |
* |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
438 |
* @param w current window |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
439 |
* @param v current vehicle |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
440 |
*/ |
2549 | 441 |
static void OrderClick_Transfer(Window* w, const Vehicle* v) |
1935
164d58b9137c
(svn r2441) -Feature: You can now give transfer order to set up feeder systems
celestar
parents:
1901
diff
changeset
|
442 |
{ |
8302
ed068d41cf1e
(svn r11866) -Codechange: swap OFB_* and OF_* so it conceptually in sync with other cases of *B_* vs *_* like VETSB_* and VETS_*.
rubidium
parents:
8264
diff
changeset
|
443 |
DoCommandP(v->tile, v->index + (OrderGetSel(w) << 16), OF_TRANSFER, NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER)); |
1935
164d58b9137c
(svn r2441) -Feature: You can now give transfer order to set up feeder systems
celestar
parents:
1901
diff
changeset
|
444 |
} |
164d58b9137c
(svn r2441) -Feature: You can now give transfer order to set up feeder systems
celestar
parents:
1901
diff
changeset
|
445 |
|
6807
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
446 |
/** |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
447 |
* Handle the click on the skip button. |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
448 |
* If ctrl is pressed skip to selected order. |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
449 |
* Else skip to current order + 1 |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
450 |
* |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
451 |
* @param w current window |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
452 |
* @param v current vehicle |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
453 |
*/ |
4171 | 454 |
static void OrderClick_Skip(Window *w, const Vehicle *v) |
1000
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
455 |
{ |
6794
feec0fe8e824
(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:
6773
diff
changeset
|
456 |
/* Don't skip when there's nothing to skip */ |
feec0fe8e824
(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:
6773
diff
changeset
|
457 |
if (_ctrl_pressed && v->cur_order_index == OrderGetSel(w)) return; |
feec0fe8e824
(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:
6773
diff
changeset
|
458 |
|
feec0fe8e824
(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:
6773
diff
changeset
|
459 |
DoCommandP(v->tile, v->index, _ctrl_pressed ? OrderGetSel(w) : ((v->cur_order_index + 1) % v->num_orders), |
feec0fe8e824
(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:
6773
diff
changeset
|
460 |
NULL, CMD_SKIP_TO_ORDER | CMD_MSG(_ctrl_pressed ? STR_CAN_T_SKIP_TO_ORDER : STR_CAN_T_SKIP_ORDER)); |
1000
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
461 |
} |
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
462 |
|
6807
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
463 |
/** |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
464 |
* Handle the click on the unload button. |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
465 |
* |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
466 |
* @param w current window |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
467 |
* @param v current vehicle |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
468 |
*/ |
4171 | 469 |
static void OrderClick_Delete(Window *w, const Vehicle *v) |
1000
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
470 |
{ |
1024
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
471 |
DoCommandP(v->tile, v->index, OrderGetSel(w), NULL, CMD_DELETE_ORDER | CMD_MSG(STR_8834_CAN_T_DELETE_THIS_ORDER)); |
1000
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
472 |
} |
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
473 |
|
6807
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
474 |
/** |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
475 |
* Handle the click on the refit button. |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
476 |
* If ctrl is pressed cancel refitting. |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
477 |
* Else show the refit window. |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
478 |
* |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
479 |
* @param w current window |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
480 |
* @param v current vehicle |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
481 |
*/ |
4712
4335ad42e163
(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
|
482 |
static void OrderClick_Refit(Window *w, const Vehicle *v) |
4335ad42e163
(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
|
483 |
{ |
4335ad42e163
(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
|
484 |
if (_ctrl_pressed) { |
4335ad42e163
(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
|
485 |
/* Cancel refitting */ |
8082
63240e1bd6cc
(svn r11643) -Codechange: conform with the coding style for the WP macro uses.
rubidium
parents:
8064
diff
changeset
|
486 |
DoCommandP(v->tile, v->index, (WP(w, order_d).sel << 16) | (CT_NO_REFIT << 8) | CT_NO_REFIT, NULL, CMD_ORDER_REFIT); |
4712
4335ad42e163
(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
|
487 |
} else { |
8082
63240e1bd6cc
(svn r11643) -Codechange: conform with the coding style for the WP macro uses.
rubidium
parents:
8064
diff
changeset
|
488 |
ShowVehicleRefitWindow(v, WP(w, order_d).sel); |
4712
4335ad42e163
(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
|
489 |
} |
4335ad42e163
(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
|
490 |
} |
4335ad42e163
(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
|
491 |
|
4171 | 492 |
typedef void OnButtonVehClick(Window *w, const Vehicle *v); |
1000
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
493 |
|
6807
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
494 |
/** |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
495 |
* Keycode function mapping. |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
496 |
* |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
497 |
* @see _order_keycodes[] |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
498 |
* @note Keep them allways in sync with _order_keycodes[]! |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
499 |
*/ |
4171 | 500 |
static OnButtonVehClick* const _order_button_proc[] = { |
1000
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
501 |
OrderClick_Skip, |
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
502 |
OrderClick_Delete, |
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
503 |
OrderClick_Nonstop, |
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
504 |
OrderClick_Goto, |
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
505 |
OrderClick_FullLoad, |
1935
164d58b9137c
(svn r2441) -Feature: You can now give transfer order to set up feeder systems
celestar
parents:
1901
diff
changeset
|
506 |
OrderClick_Unload, |
164d58b9137c
(svn r2441) -Feature: You can now give transfer order to set up feeder systems
celestar
parents:
1901
diff
changeset
|
507 |
OrderClick_Transfer |
1000
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
508 |
}; |
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
509 |
|
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
510 |
static const uint16 _order_keycodes[] = { |
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
511 |
'D', //skip order |
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
512 |
'F', //delete order |
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
513 |
'G', //non-stop |
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
514 |
'H', //goto order |
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
515 |
'J', //full load |
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
516 |
'K' //unload |
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
517 |
}; |
0 | 518 |
|
519 |
static void OrdersWndProc(Window *w, WindowEvent *e) |
|
520 |
{ |
|
2549 | 521 |
switch (e->event) { |
4712
4335ad42e163
(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
|
522 |
case WE_CREATE: |
5831
203e589f1c52
(svn r8397) -Codechange: [orders window] don't move the refit button to the same location as the unload button
bjarni
parents:
5829
diff
changeset
|
523 |
/* Ensure that the refit and unload buttons always remain at the same location. |
203e589f1c52
(svn r8397) -Codechange: [orders window] don't move the refit button to the same location as the unload button
bjarni
parents:
5829
diff
changeset
|
524 |
* Only one of them can be active at any one time and takes turns on being disabled. |
203e589f1c52
(svn r8397) -Codechange: [orders window] don't move the refit button to the same location as the unload button
bjarni
parents:
5829
diff
changeset
|
525 |
* To ensure that they stay at the same location, we also verify that they behave the same |
203e589f1c52
(svn r8397) -Codechange: [orders window] don't move the refit button to the same location as the unload button
bjarni
parents:
5829
diff
changeset
|
526 |
* when resizing. */ |
203e589f1c52
(svn r8397) -Codechange: [orders window] don't move the refit button to the same location as the unload button
bjarni
parents:
5829
diff
changeset
|
527 |
if (GetVehicle(w->window_number)->owner == _local_player) { // only the vehicle owner got these buttons |
203e589f1c52
(svn r8397) -Codechange: [orders window] don't move the refit button to the same location as the unload button
bjarni
parents:
5829
diff
changeset
|
528 |
assert(w->widget[ORDER_WIDGET_REFIT].left == w->widget[ORDER_WIDGET_UNLOAD].left); |
203e589f1c52
(svn r8397) -Codechange: [orders window] don't move the refit button to the same location as the unload button
bjarni
parents:
5829
diff
changeset
|
529 |
assert(w->widget[ORDER_WIDGET_REFIT].right == w->widget[ORDER_WIDGET_UNLOAD].right); |
203e589f1c52
(svn r8397) -Codechange: [orders window] don't move the refit button to the same location as the unload button
bjarni
parents:
5829
diff
changeset
|
530 |
assert(w->widget[ORDER_WIDGET_REFIT].top == w->widget[ORDER_WIDGET_UNLOAD].top); |
203e589f1c52
(svn r8397) -Codechange: [orders window] don't move the refit button to the same location as the unload button
bjarni
parents:
5829
diff
changeset
|
531 |
assert(w->widget[ORDER_WIDGET_REFIT].bottom == w->widget[ORDER_WIDGET_UNLOAD].bottom); |
203e589f1c52
(svn r8397) -Codechange: [orders window] don't move the refit button to the same location as the unload button
bjarni
parents:
5829
diff
changeset
|
532 |
assert(w->widget[ORDER_WIDGET_REFIT].display_flags == w->widget[ORDER_WIDGET_UNLOAD].display_flags); |
203e589f1c52
(svn r8397) -Codechange: [orders window] don't move the refit button to the same location as the unload button
bjarni
parents:
5829
diff
changeset
|
533 |
} |
6980
c7c4f3bf5901
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
6923
diff
changeset
|
534 |
|
c7c4f3bf5901
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
6923
diff
changeset
|
535 |
if (_patches.timetabling) { |
c7c4f3bf5901
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
6923
diff
changeset
|
536 |
w->widget[ORDER_WIDGET_CAPTION].right -= 61; |
c7c4f3bf5901
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
6923
diff
changeset
|
537 |
} else { |
7997
df87ccd00a96
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
7889
diff
changeset
|
538 |
w->HideWidget(ORDER_WIDGET_TIMETABLE_VIEW); |
6980
c7c4f3bf5901
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
6923
diff
changeset
|
539 |
} |
c7c4f3bf5901
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
6923
diff
changeset
|
540 |
|
4712
4335ad42e163
(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
|
541 |
break; |
4335ad42e163
(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
|
542 |
|
0 | 543 |
case WE_PAINT: |
544 |
DrawOrdersWindow(w); |
|
545 |
break; |
|
546 |
||
547 |
case WE_CLICK: { |
|
6832
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
548 |
const Vehicle *v = GetVehicle(w->window_number); |
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
549 |
switch (e->we.click.widget) { |
5828
e7b332dac5e8
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5745
diff
changeset
|
550 |
case ORDER_WIDGET_ORDER_LIST: { |
6832
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
551 |
ResetObjectToPlace(); |
0 | 552 |
|
6832
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
553 |
int sel = GetOrderFromOrderWndPt(w, e->we.click.pt.y, v); |
0 | 554 |
|
6923
a8f85a57a0ef
(svn r10176) -Fix (r10071): Deselect the currently selected order when clicking on an empty part of the orders window.
maedhros
parents:
6832
diff
changeset
|
555 |
if (sel == INVALID_ORDER) { |
a8f85a57a0ef
(svn r10176) -Fix (r10071): Deselect the currently selected order when clicking on an empty part of the orders window.
maedhros
parents:
6832
diff
changeset
|
556 |
/* This was a click on an empty part of the orders window, so |
a8f85a57a0ef
(svn r10176) -Fix (r10071): Deselect the currently selected order when clicking on an empty part of the orders window.
maedhros
parents:
6832
diff
changeset
|
557 |
* deselect the currently selected order. */ |
8082
63240e1bd6cc
(svn r11643) -Codechange: conform with the coding style for the WP macro uses.
rubidium
parents:
8064
diff
changeset
|
558 |
WP(w, order_d).sel = -1; |
6923
a8f85a57a0ef
(svn r10176) -Fix (r10071): Deselect the currently selected order when clicking on an empty part of the orders window.
maedhros
parents:
6832
diff
changeset
|
559 |
SetWindowDirty(w); |
a8f85a57a0ef
(svn r10176) -Fix (r10071): Deselect the currently selected order when clicking on an empty part of the orders window.
maedhros
parents:
6832
diff
changeset
|
560 |
return; |
a8f85a57a0ef
(svn r10176) -Fix (r10071): Deselect the currently selected order when clicking on an empty part of the orders window.
maedhros
parents:
6832
diff
changeset
|
561 |
} |
0 | 562 |
|
1024
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
563 |
if (_ctrl_pressed && sel < v->num_orders) { |
1043
44508ede2f92
(svn r1544) -Fix: SwapOrder did not use AssignOrder, which caused the saveroutine to
truelight
parents:
1035
diff
changeset
|
564 |
const Order *ord = GetVehicleOrder(v, sel); |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4012
diff
changeset
|
565 |
TileIndex xy; |
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4012
diff
changeset
|
566 |
|
8836
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8787
diff
changeset
|
567 |
switch (ord->GetType()) { |
4527
fa30d19685c2
(svn r6353) -Codechange: Make DestinationID a typedef of uin16, which is as large as any type of destinataion (StationID, DepotID, WaypointID) it can hold
tron
parents:
4408
diff
changeset
|
568 |
case OT_GOTO_STATION: xy = GetStation(ord->dest)->xy ; break; |
6259
471b91a4b1d8
(svn r9068) -Codechange: capitalize the VEH_Train etc. enums to match the coding style (and rest of the code).
rubidium
parents:
6091
diff
changeset
|
569 |
case OT_GOTO_DEPOT: xy = (v->type == VEH_AIRCRAFT) ? GetStation(ord->dest)->xy : GetDepot(ord->dest)->xy; break; |
4527
fa30d19685c2
(svn r6353) -Codechange: Make DestinationID a typedef of uin16, which is as large as any type of destinataion (StationID, DepotID, WaypointID) it can hold
tron
parents:
4408
diff
changeset
|
570 |
case OT_GOTO_WAYPOINT: xy = GetWaypoint(ord->dest)->xy; break; |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4012
diff
changeset
|
571 |
default: xy = 0; break; |
44
1923acc255d1
(svn r45) -Feature [992998] Scrollto Station in Orders. CTRL click on orders of a vehicle and main-window scrolls to that station. (chrishuebsch)
darkvater
parents:
25
diff
changeset
|
572 |
} |
1923acc255d1
(svn r45) -Feature [992998] Scrollto Station in Orders. CTRL click on orders of a vehicle and main-window scrolls to that station. (chrishuebsch)
darkvater
parents:
25
diff
changeset
|
573 |
|
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4012
diff
changeset
|
574 |
if (xy != 0) ScrollMainWindowToTile(xy); |
44
1923acc255d1
(svn r45) -Feature [992998] Scrollto Station in Orders. CTRL click on orders of a vehicle and main-window scrolls to that station. (chrishuebsch)
darkvater
parents:
25
diff
changeset
|
575 |
return; |
6832
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
576 |
} else { |
8082
63240e1bd6cc
(svn r11643) -Codechange: conform with the coding style for the WP macro uses.
rubidium
parents:
8064
diff
changeset
|
577 |
if (sel == WP(w, order_d).sel) { |
6832
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
578 |
/* Deselect clicked order */ |
8082
63240e1bd6cc
(svn r11643) -Codechange: conform with the coding style for the WP macro uses.
rubidium
parents:
8064
diff
changeset
|
579 |
WP(w, order_d).sel = -1; |
6832
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
580 |
} else { |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
581 |
/* Select clicked order */ |
8082
63240e1bd6cc
(svn r11643) -Codechange: conform with the coding style for the WP macro uses.
rubidium
parents:
8064
diff
changeset
|
582 |
WP(w, order_d).sel = sel; |
6832
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
583 |
|
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
584 |
if (v->owner == _local_player) { |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
585 |
/* Activate drag and drop */ |
7889
e74ce8853ba7
(svn r11440) -Codechange: replace magic numbers with enumified WindowHighlightMode constants. Patch by SmatZ.
rubidium
parents:
7824
diff
changeset
|
586 |
SetObjectToPlaceWnd(SPR_CURSOR_MOUSE, PAL_NONE, VHM_DRAG, w); |
6832
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
587 |
} |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
588 |
} |
44
1923acc255d1
(svn r45) -Feature [992998] Scrollto Station in Orders. CTRL click on orders of a vehicle and main-window scrolls to that station. (chrishuebsch)
darkvater
parents:
25
diff
changeset
|
589 |
} |
1923acc255d1
(svn r45) -Feature [992998] Scrollto Station in Orders. CTRL click on orders of a vehicle and main-window scrolls to that station. (chrishuebsch)
darkvater
parents:
25
diff
changeset
|
590 |
|
0 | 591 |
SetWindowDirty(w); |
6492
286a52449b54
(svn r9673) -Cleanup: remove spaces before tabs and replace non-indenting tabs with spaces.
rubidium
parents:
6351
diff
changeset
|
592 |
} break; |
0 | 593 |
|
5828
e7b332dac5e8
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5745
diff
changeset
|
594 |
case ORDER_WIDGET_SKIP: |
1000
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
595 |
OrderClick_Skip(w, v); |
0 | 596 |
break; |
597 |
||
5828
e7b332dac5e8
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5745
diff
changeset
|
598 |
case ORDER_WIDGET_DELETE: |
1000
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
599 |
OrderClick_Delete(w, v); |
0 | 600 |
break; |
601 |
||
5828
e7b332dac5e8
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5745
diff
changeset
|
602 |
case ORDER_WIDGET_NON_STOP: |
1000
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
603 |
OrderClick_Nonstop(w, v); |
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
604 |
break; |
1019
6bae6c11e865
(svn r1520) Trim 134 (!) lines with trailing whitespace ):
tron
parents:
1000
diff
changeset
|
605 |
|
5828
e7b332dac5e8
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5745
diff
changeset
|
606 |
case ORDER_WIDGET_GOTO: |
1000
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
607 |
OrderClick_Goto(w, v); |
0 | 608 |
break; |
609 |
||
5828
e7b332dac5e8
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5745
diff
changeset
|
610 |
case ORDER_WIDGET_FULL_LOAD: |
1000
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
611 |
OrderClick_FullLoad(w, v); |
0 | 612 |
break; |
613 |
||
5828
e7b332dac5e8
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5745
diff
changeset
|
614 |
case ORDER_WIDGET_UNLOAD: |
1000
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
615 |
OrderClick_Unload(w, v); |
0 | 616 |
break; |
5829
580c0b309122
(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:
5828
diff
changeset
|
617 |
case ORDER_WIDGET_REFIT: |
580c0b309122
(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:
5828
diff
changeset
|
618 |
OrderClick_Refit(w, v); |
580c0b309122
(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:
5828
diff
changeset
|
619 |
break; |
580c0b309122
(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:
5828
diff
changeset
|
620 |
|
5828
e7b332dac5e8
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5745
diff
changeset
|
621 |
case ORDER_WIDGET_TRANSFER: |
1935
164d58b9137c
(svn r2441) -Feature: You can now give transfer order to set up feeder systems
celestar
parents:
1901
diff
changeset
|
622 |
OrderClick_Transfer(w, v); |
164d58b9137c
(svn r2441) -Feature: You can now give transfer order to set up feeder systems
celestar
parents:
1901
diff
changeset
|
623 |
break; |
6980
c7c4f3bf5901
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
6923
diff
changeset
|
624 |
|
c7c4f3bf5901
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
6923
diff
changeset
|
625 |
case ORDER_WIDGET_TIMETABLE_VIEW: |
c7c4f3bf5901
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
6923
diff
changeset
|
626 |
ShowTimetableWindow(v); |
c7c4f3bf5901
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
6923
diff
changeset
|
627 |
break; |
c7c4f3bf5901
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
6923
diff
changeset
|
628 |
|
5828
e7b332dac5e8
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5745
diff
changeset
|
629 |
case ORDER_WIDGET_SHARED_ORDER_LIST: |
5745
c8069ea3af5d
(svn r8293) -Codechange: overloaded ShowVehicleListWindow() so it can open all types of vehicle lists (depending on arguments)
bjarni
parents:
5668
diff
changeset
|
630 |
ShowVehicleListWindow(v); |
4408
db2afc41002a
(svn r6161) -Feature: List of vehicles with the same shared orders
bjarni
parents:
4389
diff
changeset
|
631 |
break; |
0 | 632 |
} |
633 |
} break; |
|
1019
6bae6c11e865
(svn r1520) Trim 134 (!) lines with trailing whitespace ):
tron
parents:
1000
diff
changeset
|
634 |
|
6832
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
635 |
case WE_DRAGDROP: { |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
636 |
const Vehicle *v = GetVehicle(w->window_number); |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
637 |
|
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
638 |
switch (e->we.click.widget) { |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
639 |
case ORDER_WIDGET_ORDER_LIST: { |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
640 |
int from_order = OrderGetSel(w); |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
641 |
int to_order = GetOrderFromOrderWndPt(w, e->we.dragdrop.pt.y, v); |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
642 |
|
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
643 |
if (!(from_order == to_order || from_order == INVALID_ORDER || from_order > v->num_orders || to_order == INVALID_ORDER || to_order > v->num_orders) && |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
644 |
DoCommandP(v->tile, v->index, from_order | (to_order << 16), NULL, CMD_MOVE_ORDER | CMD_MSG(STR_CAN_T_MOVE_THIS_ORDER))) { |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
645 |
WP(w, order_d).sel = -1; |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
646 |
} |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
647 |
|
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
648 |
break; |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
649 |
} |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
650 |
|
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
651 |
case ORDER_WIDGET_DELETE: |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
652 |
OrderClick_Delete(w, v); |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
653 |
break; |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
654 |
} |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
655 |
|
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
656 |
ResetObjectToPlace(); |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
657 |
break; |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
658 |
} |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
659 |
|
1000
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
660 |
case WE_KEYPRESS: { |
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
661 |
Vehicle *v = GetVehicle(w->window_number); |
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
662 |
uint i; |
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
663 |
|
4949
6bf60913767f
(svn r6938) -Codechange: Comments, typo, variable naming, whitespace, strecpy and simplification
Darkvater
parents:
4935
diff
changeset
|
664 |
if (v->owner != _local_player) break; |
6bf60913767f
(svn r6938) -Codechange: Comments, typo, variable naming, whitespace, strecpy and simplification
Darkvater
parents:
4935
diff
changeset
|
665 |
|
2952 | 666 |
for (i = 0; i < lengthof(_order_keycodes); i++) { |
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
667 |
if (e->we.keypress.keycode == _order_keycodes[i]) { |
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
668 |
e->we.keypress.cont = false; |
1019
6bae6c11e865
(svn r1520) Trim 134 (!) lines with trailing whitespace ):
tron
parents:
1000
diff
changeset
|
669 |
//see if the button is disabled |
7997
df87ccd00a96
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
7889
diff
changeset
|
670 |
if (!w->IsWidgetDisabled(i + ORDER_WIDGET_SKIP)) _order_button_proc[i](w, v); |
1000
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
671 |
break; |
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
672 |
} |
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
673 |
} |
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
674 |
break; |
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
675 |
} |
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
676 |
|
0 | 677 |
case WE_RCLICK: { |
4171 | 678 |
const Vehicle *v = GetVehicle(w->window_number); |
2639 | 679 |
int s = OrderGetSel(w); |
680 |
||
5828
e7b332dac5e8
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5745
diff
changeset
|
681 |
if (e->we.click.widget != ORDER_WIDGET_FULL_LOAD) break; |
8836
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8787
diff
changeset
|
682 |
if (s == v->num_orders || !GetVehicleOrder(v, s)->IsType(OT_GOTO_DEPOT)) { |
1256
5b4916eb49ff
(svn r1760) -Fix: [ 1113399 ] Game no longer crashes when right-clicking a disabled Full Load button
celestar
parents:
1242
diff
changeset
|
683 |
GuiShowTooltips(STR_8857_MAKE_THE_HIGHLIGHTED_ORDER); |
2639 | 684 |
} else { |
0 | 685 |
GuiShowTooltips(STR_SERVICE_HINT); |
2639 | 686 |
} |
1242
1ca216c50426
(svn r1746) - Feature: [GUI] [ 1107690 ] Resizable orders GUI (nzhook)
darkvater
parents:
1214
diff
changeset
|
687 |
} break; |
0 | 688 |
|
689 |
case WE_PLACE_OBJ: { |
|
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4547
diff
changeset
|
690 |
OrdersPlaceObj(GetVehicle(w->window_number), e->we.place.tile, w); |
0 | 691 |
} break; |
692 |
||
693 |
case WE_ABORT_PLACE_OBJ: { |
|
7997
df87ccd00a96
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
7889
diff
changeset
|
694 |
w->RaiseWidget(ORDER_WIDGET_GOTO); |
8028
e578ea22f371
(svn r11588) -Codechange: use the new member introduced in r11551
glx
parents:
7997
diff
changeset
|
695 |
w->InvalidateWidget(ORDER_WIDGET_GOTO); |
0 | 696 |
} break; |
697 |
||
698 |
// check if a vehicle in a depot was clicked.. |
|
699 |
case WE_MOUSELOOP: { |
|
4171 | 700 |
const Vehicle *v = _place_clicked_vehicle; |
25 | 701 |
/* |
702 |
* Check if we clicked on a vehicle |
|
703 |
* and if the GOTO button of this window is pressed |
|
704 |
* This is because of all open order windows WE_MOUSELOOP is called |
|
705 |
* and if you have 3 windows open, and this check is not done |
|
706 |
* the order is copied to the last open window instead of the |
|
4949
6bf60913767f
(svn r6938) -Codechange: Comments, typo, variable naming, whitespace, strecpy and simplification
Darkvater
parents:
4935
diff
changeset
|
707 |
* one where GOTO is enabled |
25 | 708 |
*/ |
7997
df87ccd00a96
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
7889
diff
changeset
|
709 |
if (v != NULL && w->IsWidgetLowered(ORDER_WIDGET_GOTO)) { |
0 | 710 |
_place_clicked_vehicle = NULL; |
919
544f374ee392
(svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns and _industries
truelight
parents:
893
diff
changeset
|
711 |
HandleOrderVehClick(GetVehicle(w->window_number), v, w); |
0 | 712 |
} |
713 |
} break; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
714 |
|
1242
1ca216c50426
(svn r1746) - Feature: [GUI] [ 1107690 ] Resizable orders GUI (nzhook)
darkvater
parents:
1214
diff
changeset
|
715 |
case WE_RESIZE: |
1ca216c50426
(svn r1746) - Feature: [GUI] [ 1107690 ] Resizable orders GUI (nzhook)
darkvater
parents:
1214
diff
changeset
|
716 |
/* Update the scroll + matrix */ |
5828
e7b332dac5e8
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5745
diff
changeset
|
717 |
w->vscroll.cap = (w->widget[ORDER_WIDGET_ORDER_LIST].bottom - w->widget[ORDER_WIDGET_ORDER_LIST].top) / 10; |
1242
1ca216c50426
(svn r1746) - Feature: [GUI] [ 1107690 ] Resizable orders GUI (nzhook)
darkvater
parents:
1214
diff
changeset
|
718 |
break; |
5013
1d20ebec3510
(svn r7046) -Fix [FS#311]: 'Goto' button in orders window got depressed along with all other
Darkvater
parents:
4968
diff
changeset
|
719 |
|
1d20ebec3510
(svn r7046) -Fix [FS#311]: 'Goto' button in orders window got depressed along with all other
Darkvater
parents:
4968
diff
changeset
|
720 |
case WE_TIMEOUT: { // handle button unclick ourselves... |
5828
e7b332dac5e8
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5745
diff
changeset
|
721 |
// unclick all buttons except for the 'goto' button (ORDER_WIDGET_GOTO), which is 'persistent' |
5235
2313d53f426a
(svn r7355) -Codechange: replace 'for (i = 0; w->widget[i].type != WWT_TYPE; i++)'-type for loops with 'for (i = 0; i < w->widget_count; i++)'-type for loops
rubidium
parents:
5071
diff
changeset
|
722 |
uint i; |
2313d53f426a
(svn r7355) -Codechange: replace 'for (i = 0; w->widget[i].type != WWT_TYPE; i++)'-type for loops with 'for (i = 0; i < w->widget_count; i++)'-type for loops
rubidium
parents:
5071
diff
changeset
|
723 |
for (i = 0; i < w->widget_count; i++) { |
7997
df87ccd00a96
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
7889
diff
changeset
|
724 |
if (w->IsWidgetLowered(i) && i != ORDER_WIDGET_GOTO) { |
df87ccd00a96
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
7889
diff
changeset
|
725 |
w->RaiseWidget(i); |
8028
e578ea22f371
(svn r11588) -Codechange: use the new member introduced in r11551
glx
parents:
7997
diff
changeset
|
726 |
w->InvalidateWidget(i); |
5013
1d20ebec3510
(svn r7046) -Fix [FS#311]: 'Goto' button in orders window got depressed along with all other
Darkvater
parents:
4968
diff
changeset
|
727 |
} |
1d20ebec3510
(svn r7046) -Fix [FS#311]: 'Goto' button in orders window got depressed along with all other
Darkvater
parents:
4968
diff
changeset
|
728 |
} |
1d20ebec3510
(svn r7046) -Fix [FS#311]: 'Goto' button in orders window got depressed along with all other
Darkvater
parents:
4968
diff
changeset
|
729 |
} break; |
0 | 730 |
} |
731 |
} |
|
732 |
||
6807
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
733 |
/** |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
734 |
* Widget definition for player train orders |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
735 |
*/ |
1081
0d79fc43fae2
(svn r1582) Fix: Only the train orders GUI has a non-stop button now.
dominik
parents:
1067
diff
changeset
|
736 |
static const Widget _orders_train_widgets[] = { |
6807
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
737 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // ORDER_WIDGET_CLOSEBOX |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
738 |
{ WWT_CAPTION, RESIZE_RIGHT, 14, 11, 398, 0, 13, STR_8829_ORDERS, STR_018C_WINDOW_TITLE_DRAG_THIS}, // ORDER_WIDGET_CAPTION |
6980
c7c4f3bf5901
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
6923
diff
changeset
|
739 |
{ WWT_PUSHTXTBTN, RESIZE_LR, 14, 338, 398, 0, 13, STR_TIMETABLE_VIEW, STR_TIMETABLE_VIEW_TOOLTIP}, // ORDER_WIDGET_TIMETABLE_VIEW |
6807
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
740 |
|
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
741 |
{ WWT_PANEL, RESIZE_RB, 14, 0, 386, 14, 75, 0x0, STR_8852_ORDERS_LIST_CLICK_ON_ORDER}, // ORDER_WIDGET_ORDER_LIST |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
742 |
|
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
743 |
{ WWT_SCROLLBAR, RESIZE_LRB, 14, 387, 398, 14, 75, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, // ORDER_WIDGET_SCROLLBAR |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
744 |
|
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
745 |
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 0, 52, 76, 87, STR_8823_SKIP, STR_8853_SKIP_THE_CURRENT_ORDER}, // ORDER_WIDGET_SKIP |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
746 |
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 53, 105, 76, 87, STR_8824_DELETE, STR_8854_DELETE_THE_HIGHLIGHTED}, // ORDER_WIDGET_DELETE |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
747 |
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 106, 158, 76, 87, STR_8825_NON_STOP, STR_8855_MAKE_THE_HIGHLIGHTED_ORDER}, // ORDER_WIDGET_NON_STOP |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
748 |
{ WWT_TEXTBTN, RESIZE_TB, 14, 159, 211, 76, 87, STR_8826_GO_TO, STR_8856_INSERT_A_NEW_ORDER_BEFORE}, // ORDER_WIDGET_GOTO |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
749 |
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 212, 264, 76, 87, STR_FULLLOAD_OR_SERVICE, STR_NULL}, // ORDER_WIDGET_FULL_LOAD |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
750 |
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 265, 319, 76, 87, STR_8828_UNLOAD, STR_8858_MAKE_THE_HIGHLIGHTED_ORDER}, // ORDER_WIDGET_UNLOAD |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
751 |
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 265, 319, 76, 87, STR_REFIT, STR_REFIT_TIP}, // ORDER_WIDGET_REFIT |
8424
c3477565c975
(svn r11994) -Codechange: Remove numbers from string names where the strings aren't present in TTD, since they don't correspond to either TTD's TextIDs or OpenTTD's StringIDs.
maedhros
parents:
8302
diff
changeset
|
752 |
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 320, 372, 76, 87, STR_TRANSFER, STR_MAKE_THE_HIGHLIGHTED_ORDER}, // ORDER_WIDGET_TRANSFER |
6807
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
753 |
|
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
754 |
{ WWT_PUSHIMGBTN, RESIZE_TB, 14, 373, 386, 76, 87, SPR_SHARED_ORDERS_ICON, STR_VEH_WITH_SHARED_ORDERS_LIST_TIP}, // ORDER_WIDGET_SHARED_ORDER_LIST |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
755 |
|
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
756 |
{ WWT_PANEL, RESIZE_RTB, 14, 387, 386, 76, 87, 0x0, STR_NULL}, // ORDER_WIDGET_RESIZE_BAR |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
757 |
|
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
758 |
{ WWT_RESIZEBOX, RESIZE_LRTB, 14, 387, 398, 76, 87, 0x0, STR_RESIZE_BUTTON}, // ORDER_WIDGET_RESIZE |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
759 |
{ WIDGETS_END}, |
0 | 760 |
}; |
761 |
||
1081
0d79fc43fae2
(svn r1582) Fix: Only the train orders GUI has a non-stop button now.
dominik
parents:
1067
diff
changeset
|
762 |
static const WindowDesc _orders_train_desc = { |
7341
02515d0d4ced
(svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium
parents:
7312
diff
changeset
|
763 |
WDP_AUTO, WDP_AUTO, 399, 88, 399, 88, |
1081
0d79fc43fae2
(svn r1582) Fix: Only the train orders GUI has a non-stop button now.
dominik
parents:
1067
diff
changeset
|
764 |
WC_VEHICLE_ORDERS,WC_VEHICLE_VIEW, |
5013
1d20ebec3510
(svn r7046) -Fix [FS#311]: 'Goto' button in orders window got depressed along with all other
Darkvater
parents:
4968
diff
changeset
|
765 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_RESIZABLE, |
1081
0d79fc43fae2
(svn r1582) Fix: Only the train orders GUI has a non-stop button now.
dominik
parents:
1067
diff
changeset
|
766 |
_orders_train_widgets, |
0d79fc43fae2
(svn r1582) Fix: Only the train orders GUI has a non-stop button now.
dominik
parents:
1067
diff
changeset
|
767 |
OrdersWndProc |
0d79fc43fae2
(svn r1582) Fix: Only the train orders GUI has a non-stop button now.
dominik
parents:
1067
diff
changeset
|
768 |
}; |
0d79fc43fae2
(svn r1582) Fix: Only the train orders GUI has a non-stop button now.
dominik
parents:
1067
diff
changeset
|
769 |
|
6807
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
770 |
/** |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
771 |
* Widget definition for player orders (!train) |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
772 |
*/ |
1081
0d79fc43fae2
(svn r1582) Fix: Only the train orders GUI has a non-stop button now.
dominik
parents:
1067
diff
changeset
|
773 |
static const Widget _orders_widgets[] = { |
6807
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
774 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // ORDER_WIDGET_CLOSEBOX |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
775 |
{ WWT_CAPTION, RESIZE_RIGHT, 14, 11, 409, 0, 13, STR_8829_ORDERS, STR_018C_WINDOW_TITLE_DRAG_THIS}, // ORDER_WIDGET_CAPTION |
6980
c7c4f3bf5901
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
6923
diff
changeset
|
776 |
{ WWT_PUSHTXTBTN, RESIZE_LR, 14, 349, 409, 0, 13, STR_TIMETABLE_VIEW, STR_TIMETABLE_VIEW_TOOLTIP}, // ORDER_WIDGET_TIMETABLE_VIEW |
6807
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
777 |
|
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
778 |
{ WWT_PANEL, RESIZE_RB, 14, 0, 397, 14, 75, 0x0, STR_8852_ORDERS_LIST_CLICK_ON_ORDER}, // ORDER_WIDGET_ORDER_LIST |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
779 |
|
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
780 |
{ WWT_SCROLLBAR, RESIZE_LRB, 14, 398, 409, 14, 75, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, // ORDER_WIDGET_SCROLLBAR |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
781 |
|
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
782 |
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 0, 63, 76, 87, STR_8823_SKIP, STR_8853_SKIP_THE_CURRENT_ORDER}, // ORDER_WIDGET_SKIP |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
783 |
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 64, 128, 76, 87, STR_8824_DELETE, STR_8854_DELETE_THE_HIGHLIGHTED}, // ORDER_WIDGET_DELETE |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
784 |
{ WWT_EMPTY, RESIZE_TB, 14, 0, 0, 76, 87, 0x0, 0x0}, // ORDER_WIDGET_NON_STOP |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
785 |
{ WWT_TEXTBTN, RESIZE_TB, 14, 129, 192, 76, 87, STR_8826_GO_TO, STR_8856_INSERT_A_NEW_ORDER_BEFORE}, // ORDER_WIDGET_GOTO |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
786 |
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 193, 256, 76, 87, STR_FULLLOAD_OR_SERVICE, STR_NULL}, // ORDER_WIDGET_FULL_LOAD |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
787 |
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 257, 319, 76, 87, STR_8828_UNLOAD, STR_8858_MAKE_THE_HIGHLIGHTED_ORDER}, // ORDER_WIDGET_UNLOAD |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
788 |
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 257, 319, 76, 87, STR_REFIT, STR_REFIT_TIP}, // ORDER_WIDGET_REFIT |
8424
c3477565c975
(svn r11994) -Codechange: Remove numbers from string names where the strings aren't present in TTD, since they don't correspond to either TTD's TextIDs or OpenTTD's StringIDs.
maedhros
parents:
8302
diff
changeset
|
789 |
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 320, 383, 76, 87, STR_TRANSFER, STR_MAKE_THE_HIGHLIGHTED_ORDER}, // ORDER_WIDGET_TRANSFER |
6807
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
790 |
|
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
791 |
{ WWT_PUSHIMGBTN, RESIZE_TB, 14, 384, 397, 76, 87, SPR_SHARED_ORDERS_ICON, STR_VEH_WITH_SHARED_ORDERS_LIST_TIP}, // ORDER_WIDGET_SHARED_ORDER_LIST |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
792 |
|
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
793 |
{ WWT_PANEL, RESIZE_RTB, 14, 397, 396, 76, 87, 0x0, STR_NULL}, // ORDER_WIDGET_RESIZE_BAR |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
794 |
|
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
795 |
{ WWT_RESIZEBOX, RESIZE_LRTB, 14, 398, 409, 76, 87, 0x0, STR_RESIZE_BUTTON}, // ORDER_WIDGET_RESIZE |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
796 |
{ WIDGETS_END}, |
1081
0d79fc43fae2
(svn r1582) Fix: Only the train orders GUI has a non-stop button now.
dominik
parents:
1067
diff
changeset
|
797 |
}; |
0d79fc43fae2
(svn r1582) Fix: Only the train orders GUI has a non-stop button now.
dominik
parents:
1067
diff
changeset
|
798 |
|
995
0a8d27dcc231
(svn r1493) -Codechange: Removed redundancy in the order GUI. Currently we had most
celestar
parents:
919
diff
changeset
|
799 |
static const WindowDesc _orders_desc = { |
7341
02515d0d4ced
(svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium
parents:
7312
diff
changeset
|
800 |
WDP_AUTO, WDP_AUTO, 410, 88, 410, 88, |
0 | 801 |
WC_VEHICLE_ORDERS,WC_VEHICLE_VIEW, |
5013
1d20ebec3510
(svn r7046) -Fix [FS#311]: 'Goto' button in orders window got depressed along with all other
Darkvater
parents:
4968
diff
changeset
|
802 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_RESIZABLE, |
995
0a8d27dcc231
(svn r1493) -Codechange: Removed redundancy in the order GUI. Currently we had most
celestar
parents:
919
diff
changeset
|
803 |
_orders_widgets, |
0 | 804 |
OrdersWndProc |
805 |
}; |
|
806 |
||
6807
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
807 |
/** |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
808 |
* Widget definition for competitor orders |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
809 |
*/ |
995
0a8d27dcc231
(svn r1493) -Codechange: Removed redundancy in the order GUI. Currently we had most
celestar
parents:
919
diff
changeset
|
810 |
static const Widget _other_orders_widgets[] = { |
6980
c7c4f3bf5901
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
6923
diff
changeset
|
811 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // ORDER_WIDGET_CLOSEBOX |
c7c4f3bf5901
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
6923
diff
changeset
|
812 |
{ WWT_CAPTION, RESIZE_RIGHT, 14, 11, 331, 0, 13, STR_A00B_ORDERS, STR_018C_WINDOW_TITLE_DRAG_THIS}, // ORDER_WIDGET_CAPTION |
c7c4f3bf5901
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
6923
diff
changeset
|
813 |
{ WWT_PUSHTXTBTN, RESIZE_LR, 14, 271, 331, 0, 13, STR_TIMETABLE_VIEW, STR_TIMETABLE_VIEW_TOOLTIP}, // ORDER_WIDGET_TIMETABLE_VIEW |
6807
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
814 |
|
6980
c7c4f3bf5901
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
6923
diff
changeset
|
815 |
{ WWT_PANEL, RESIZE_RB, 14, 0, 319, 14, 75, 0x0, STR_8852_ORDERS_LIST_CLICK_ON_ORDER}, // ORDER_WIDGET_ORDER_LIST |
6807
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
816 |
|
6980
c7c4f3bf5901
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
6923
diff
changeset
|
817 |
{ WWT_SCROLLBAR, RESIZE_LRB, 14, 320, 331, 14, 75, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, // ORDER_WIDGET_SCROLLBAR |
6807
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
818 |
|
6980
c7c4f3bf5901
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
6923
diff
changeset
|
819 |
{ WWT_EMPTY, RESIZE_NONE, 14, 0, 319, 76, 87, 0x0, STR_NULL}, // ORDER_WIDGET_SKIP |
c7c4f3bf5901
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
6923
diff
changeset
|
820 |
{ WWT_EMPTY, RESIZE_NONE, 14, 0, 319, 76, 87, 0x0, STR_NULL}, // ORDER_WIDGET_DELETE |
c7c4f3bf5901
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
6923
diff
changeset
|
821 |
{ WWT_EMPTY, RESIZE_NONE, 14, 0, 319, 76, 87, 0x0, STR_NULL}, // ORDER_WIDGET_NON_STOP |
c7c4f3bf5901
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
6923
diff
changeset
|
822 |
{ WWT_EMPTY, RESIZE_NONE, 14, 0, 319, 76, 87, 0x0, STR_NULL}, // ORDER_WIDGET_GOTO |
c7c4f3bf5901
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
6923
diff
changeset
|
823 |
{ WWT_EMPTY, RESIZE_NONE, 14, 0, 319, 76, 87, 0x0, STR_NULL}, // ORDER_WIDGET_FULL_LOAD |
c7c4f3bf5901
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
6923
diff
changeset
|
824 |
{ WWT_EMPTY, RESIZE_NONE, 14, 0, 319, 76, 87, 0x0, STR_NULL}, // ORDER_WIDGET_UNLOAD |
c7c4f3bf5901
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
6923
diff
changeset
|
825 |
{ WWT_EMPTY, RESIZE_NONE, 14, 0, 319, 76, 87, 0x0, STR_NULL}, // ORDER_WIDGET_REFIT |
c7c4f3bf5901
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
6923
diff
changeset
|
826 |
{ WWT_EMPTY, RESIZE_NONE, 14, 0, 319, 76, 87, 0x0, STR_NULL}, // ORDER_WIDGET_TRANSFER |
6807
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
827 |
|
6980
c7c4f3bf5901
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
6923
diff
changeset
|
828 |
{ WWT_EMPTY, RESIZE_NONE, 14, 0, 319, 76, 87, 0x0, STR_NULL}, // ORDER_WIDGET_SHARED_ORDER_LIST |
c7c4f3bf5901
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
6923
diff
changeset
|
829 |
|
c7c4f3bf5901
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
6923
diff
changeset
|
830 |
{ WWT_PANEL, RESIZE_RTB, 14, 0, 319, 76, 87, 0x0, STR_NULL}, // ORDER_WIDGET_RESIZE_BAR |
c7c4f3bf5901
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
6923
diff
changeset
|
831 |
|
c7c4f3bf5901
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
6923
diff
changeset
|
832 |
{ WWT_RESIZEBOX, RESIZE_LRTB, 14, 320, 331, 76, 87, 0x0, STR_RESIZE_BUTTON}, // ORDER_WIDGET_RESIZE |
6807
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
833 |
{ WIDGETS_END}, |
0 | 834 |
}; |
835 |
||
995
0a8d27dcc231
(svn r1493) -Codechange: Removed redundancy in the order GUI. Currently we had most
celestar
parents:
919
diff
changeset
|
836 |
static const WindowDesc _other_orders_desc = { |
7341
02515d0d4ced
(svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium
parents:
7312
diff
changeset
|
837 |
WDP_AUTO, WDP_AUTO, 332, 88, 332, 88, |
0 | 838 |
WC_VEHICLE_ORDERS,WC_VEHICLE_VIEW, |
1242
1ca216c50426
(svn r1746) - Feature: [GUI] [ 1107690 ] Resizable orders GUI (nzhook)
darkvater
parents:
1214
diff
changeset
|
839 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_RESIZABLE, |
995
0a8d27dcc231
(svn r1493) -Codechange: Removed redundancy in the order GUI. Currently we had most
celestar
parents:
919
diff
changeset
|
840 |
_other_orders_widgets, |
0 | 841 |
OrdersWndProc |
842 |
}; |
|
843 |
||
4171 | 844 |
void ShowOrdersWindow(const Vehicle *v) |
0 | 845 |
{ |
846 |
Window *w; |
|
847 |
VehicleID veh = v->index; |
|
848 |
||
849 |
DeleteWindowById(WC_VEHICLE_ORDERS, veh); |
|
850 |
DeleteWindowById(WC_VEHICLE_DETAILS, veh); |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
851 |
|
1081
0d79fc43fae2
(svn r1582) Fix: Only the train orders GUI has a non-stop button now.
dominik
parents:
1067
diff
changeset
|
852 |
if (v->owner != _local_player) { |
5071
e28106dfcb6f
(svn r7129) -Codechange: Get rid of a global variable that only sets a window's number.
Darkvater
parents:
5070
diff
changeset
|
853 |
w = AllocateWindowDescFront(&_other_orders_desc, veh); |
2549 | 854 |
} else { |
6259
471b91a4b1d8
(svn r9068) -Codechange: capitalize the VEH_Train etc. enums to match the coding style (and rest of the code).
rubidium
parents:
6091
diff
changeset
|
855 |
w = AllocateWindowDescFront((v->type == VEH_TRAIN) ? &_orders_train_desc : &_orders_desc, veh); |
2549 | 856 |
} |
0 | 857 |
|
1242
1ca216c50426
(svn r1746) - Feature: [GUI] [ 1107690 ] Resizable orders GUI (nzhook)
darkvater
parents:
1214
diff
changeset
|
858 |
if (w != NULL) { |
1ca216c50426
(svn r1746) - Feature: [GUI] [ 1107690 ] Resizable orders GUI (nzhook)
darkvater
parents:
1214
diff
changeset
|
859 |
w->caption_color = v->owner; |
1ca216c50426
(svn r1746) - Feature: [GUI] [ 1107690 ] Resizable orders GUI (nzhook)
darkvater
parents:
1214
diff
changeset
|
860 |
w->vscroll.cap = 6; |
1ca216c50426
(svn r1746) - Feature: [GUI] [ 1107690 ] Resizable orders GUI (nzhook)
darkvater
parents:
1214
diff
changeset
|
861 |
w->resize.step_height = 10; |
8082
63240e1bd6cc
(svn r11643) -Codechange: conform with the coding style for the WP macro uses.
rubidium
parents:
8064
diff
changeset
|
862 |
WP(w, order_d).sel = -1; |
1242
1ca216c50426
(svn r1746) - Feature: [GUI] [ 1107690 ] Resizable orders GUI (nzhook)
darkvater
parents:
1214
diff
changeset
|
863 |
} |
0 | 864 |
} |