author | rubidium |
Thu, 10 Apr 2008 22:07:24 +0000 | |
changeset 8887 | 27fe38a85cdc |
parent 8886 | ba4a5da628f9 |
child 8888 | 19fb42a62eb4 |
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" |
8877
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
29 |
#include "widgets/dropdown_func.h" |
0 | 30 |
|
8264
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/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
|
32 |
#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
|
33 |
|
5828
e7b332dac5e8
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5745
diff
changeset
|
34 |
enum OrderWindowWidgets { |
e7b332dac5e8
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5745
diff
changeset
|
35 |
ORDER_WIDGET_CLOSEBOX = 0, |
e7b332dac5e8
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5745
diff
changeset
|
36 |
ORDER_WIDGET_CAPTION, |
6980
c7c4f3bf5901
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
6923
diff
changeset
|
37 |
ORDER_WIDGET_TIMETABLE_VIEW, |
5828
e7b332dac5e8
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5745
diff
changeset
|
38 |
ORDER_WIDGET_ORDER_LIST, |
e7b332dac5e8
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5745
diff
changeset
|
39 |
ORDER_WIDGET_SCROLLBAR, |
e7b332dac5e8
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5745
diff
changeset
|
40 |
ORDER_WIDGET_SKIP, |
e7b332dac5e8
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5745
diff
changeset
|
41 |
ORDER_WIDGET_DELETE, |
e7b332dac5e8
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5745
diff
changeset
|
42 |
ORDER_WIDGET_NON_STOP, |
e7b332dac5e8
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5745
diff
changeset
|
43 |
ORDER_WIDGET_GOTO, |
e7b332dac5e8
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5745
diff
changeset
|
44 |
ORDER_WIDGET_FULL_LOAD, |
e7b332dac5e8
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5745
diff
changeset
|
45 |
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
|
46 |
ORDER_WIDGET_REFIT, |
8874
db064c1eb143
(svn r12641) -Codechange: do not use the same button for two completely distinct tasks, just make an extra button for it and hide them when not needed.
rubidium
parents:
8873
diff
changeset
|
47 |
ORDER_WIDGET_SERVICE, |
db064c1eb143
(svn r12641) -Codechange: do not use the same button for two completely distinct tasks, just make an extra button for it and hide them when not needed.
rubidium
parents:
8873
diff
changeset
|
48 |
ORDER_WIDGET_RESIZE_BAR, |
5828
e7b332dac5e8
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5745
diff
changeset
|
49 |
ORDER_WIDGET_SHARED_ORDER_LIST, |
e7b332dac5e8
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5745
diff
changeset
|
50 |
ORDER_WIDGET_RESIZE, |
e7b332dac5e8
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5745
diff
changeset
|
51 |
}; |
e7b332dac5e8
(svn r8394) -Cleanup: added an enum with widget names to the orders window
bjarni
parents:
5745
diff
changeset
|
52 |
|
6832
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
53 |
/** |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
54 |
* Return the memorised selected order. |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
55 |
* |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
56 |
* @param w current window |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
57 |
* @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
|
58 |
* else return the number of orders |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
59 |
*/ |
4171 | 60 |
static int OrderGetSel(const Window *w) |
0 | 61 |
{ |
4171 | 62 |
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
|
63 |
int num = WP(w, order_d).sel; |
0 | 64 |
|
2549 | 65 |
return (num >= 0 && num < v->num_orders) ? num : v->num_orders; |
0 | 66 |
} |
67 |
||
6832
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
68 |
/** |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
69 |
* Calculate the selected order. |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
70 |
* 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
|
71 |
* the position of the scrollbar. |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
72 |
* |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
73 |
* @param w current window |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
74 |
* @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
|
75 |
* @param v current vehicle |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
76 |
* @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
|
77 |
* an invalid one has been selected. |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
78 |
*/ |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
79 |
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
|
80 |
{ |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
81 |
/* |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
82 |
* Calculation description: |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
83 |
* 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
|
84 |
* 10 = order text hight |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
85 |
*/ |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
86 |
int sel = (y - 15) / 10; |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
87 |
|
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
88 |
if ((uint)sel >= w->vscroll.cap) return INVALID_ORDER; |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
89 |
|
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
90 |
sel += w->vscroll.pos; |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
91 |
|
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
92 |
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
|
93 |
} |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
94 |
|
8876
e5bf23efad87
(svn r12643) -Codechange: be more explicit about the orders a vehicle has (non stop and full load are ambiguous and depend on some patch settings).
rubidium
parents:
8874
diff
changeset
|
95 |
/** Order load types that could be given to station orders. */ |
e5bf23efad87
(svn r12643) -Codechange: be more explicit about the orders a vehicle has (non stop and full load are ambiguous and depend on some patch settings).
rubidium
parents:
8874
diff
changeset
|
96 |
static const StringID _station_load_types[][5] = { |
8845
f9ef3bb70e47
(svn r12595) -Codechange: hide Order's flags in the last few cases.
rubidium
parents:
8843
diff
changeset
|
97 |
{ |
8876
e5bf23efad87
(svn r12643) -Codechange: be more explicit about the orders a vehicle has (non stop and full load are ambiguous and depend on some patch settings).
rubidium
parents:
8874
diff
changeset
|
98 |
STR_EMPTY, |
8885
647cda0e9312
(svn r12652) -Codechange: rework the order GUI a little more to make it a little more clear that 'transfer' is just an unload type.
rubidium
parents:
8883
diff
changeset
|
99 |
INVALID_STRING_ID, |
8876
e5bf23efad87
(svn r12643) -Codechange: be more explicit about the orders a vehicle has (non stop and full load are ambiguous and depend on some patch settings).
rubidium
parents:
8874
diff
changeset
|
100 |
STR_ORDER_FULL_LOAD, |
e5bf23efad87
(svn r12643) -Codechange: be more explicit about the orders a vehicle has (non stop and full load are ambiguous and depend on some patch settings).
rubidium
parents:
8874
diff
changeset
|
101 |
STR_ORDER_FULL_LOAD_ANY, |
e5bf23efad87
(svn r12643) -Codechange: be more explicit about the orders a vehicle has (non stop and full load are ambiguous and depend on some patch settings).
rubidium
parents:
8874
diff
changeset
|
102 |
STR_ORDER_NO_LOAD, |
8845
f9ef3bb70e47
(svn r12595) -Codechange: hide Order's flags in the last few cases.
rubidium
parents:
8843
diff
changeset
|
103 |
}, { |
8885
647cda0e9312
(svn r12652) -Codechange: rework the order GUI a little more to make it a little more clear that 'transfer' is just an unload type.
rubidium
parents:
8883
diff
changeset
|
104 |
STR_ORDER_UNLOAD, |
647cda0e9312
(svn r12652) -Codechange: rework the order GUI a little more to make it a little more clear that 'transfer' is just an unload type.
rubidium
parents:
8883
diff
changeset
|
105 |
INVALID_STRING_ID, |
647cda0e9312
(svn r12652) -Codechange: rework the order GUI a little more to make it a little more clear that 'transfer' is just an unload type.
rubidium
parents:
8883
diff
changeset
|
106 |
STR_ORDER_UNLOAD_FULL_LOAD, |
647cda0e9312
(svn r12652) -Codechange: rework the order GUI a little more to make it a little more clear that 'transfer' is just an unload type.
rubidium
parents:
8883
diff
changeset
|
107 |
STR_ORDER_UNLOAD_FULL_LOAD_ANY, |
647cda0e9312
(svn r12652) -Codechange: rework the order GUI a little more to make it a little more clear that 'transfer' is just an unload type.
rubidium
parents:
8883
diff
changeset
|
108 |
STR_ORDER_UNLOAD_NO_LOAD, |
647cda0e9312
(svn r12652) -Codechange: rework the order GUI a little more to make it a little more clear that 'transfer' is just an unload type.
rubidium
parents:
8883
diff
changeset
|
109 |
}, { |
8876
e5bf23efad87
(svn r12643) -Codechange: be more explicit about the orders a vehicle has (non stop and full load are ambiguous and depend on some patch settings).
rubidium
parents:
8874
diff
changeset
|
110 |
STR_ORDER_TRANSFER, |
8885
647cda0e9312
(svn r12652) -Codechange: rework the order GUI a little more to make it a little more clear that 'transfer' is just an unload type.
rubidium
parents:
8883
diff
changeset
|
111 |
INVALID_STRING_ID, |
8876
e5bf23efad87
(svn r12643) -Codechange: be more explicit about the orders a vehicle has (non stop and full load are ambiguous and depend on some patch settings).
rubidium
parents:
8874
diff
changeset
|
112 |
STR_ORDER_TRANSFER_FULL_LOAD, |
e5bf23efad87
(svn r12643) -Codechange: be more explicit about the orders a vehicle has (non stop and full load are ambiguous and depend on some patch settings).
rubidium
parents:
8874
diff
changeset
|
113 |
STR_ORDER_TRANSFER_FULL_LOAD_ANY, |
8885
647cda0e9312
(svn r12652) -Codechange: rework the order GUI a little more to make it a little more clear that 'transfer' is just an unload type.
rubidium
parents:
8883
diff
changeset
|
114 |
STR_ORDER_TRANSFER_NO_LOAD, |
647cda0e9312
(svn r12652) -Codechange: rework the order GUI a little more to make it a little more clear that 'transfer' is just an unload type.
rubidium
parents:
8883
diff
changeset
|
115 |
}, { |
647cda0e9312
(svn r12652) -Codechange: rework the order GUI a little more to make it a little more clear that 'transfer' is just an unload type.
rubidium
parents:
8883
diff
changeset
|
116 |
/* Unload and transfer do not work together. */ |
647cda0e9312
(svn r12652) -Codechange: rework the order GUI a little more to make it a little more clear that 'transfer' is just an unload type.
rubidium
parents:
8883
diff
changeset
|
117 |
INVALID_STRING_ID, |
647cda0e9312
(svn r12652) -Codechange: rework the order GUI a little more to make it a little more clear that 'transfer' is just an unload type.
rubidium
parents:
8883
diff
changeset
|
118 |
INVALID_STRING_ID, |
647cda0e9312
(svn r12652) -Codechange: rework the order GUI a little more to make it a little more clear that 'transfer' is just an unload type.
rubidium
parents:
8883
diff
changeset
|
119 |
INVALID_STRING_ID, |
8876
e5bf23efad87
(svn r12643) -Codechange: be more explicit about the orders a vehicle has (non stop and full load are ambiguous and depend on some patch settings).
rubidium
parents:
8874
diff
changeset
|
120 |
INVALID_STRING_ID, |
8883
baee554a9449
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
8882
diff
changeset
|
121 |
}, { |
baee554a9449
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
8882
diff
changeset
|
122 |
STR_ORDER_NO_UNLOAD, |
baee554a9449
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
8882
diff
changeset
|
123 |
INVALID_STRING_ID, |
baee554a9449
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
8882
diff
changeset
|
124 |
STR_ORDER_NO_UNLOAD_FULL_LOAD, |
baee554a9449
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
8882
diff
changeset
|
125 |
STR_ORDER_NO_UNLOAD_FULL_LOAD_ANY, |
baee554a9449
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
8882
diff
changeset
|
126 |
INVALID_STRING_ID, |
8845
f9ef3bb70e47
(svn r12595) -Codechange: hide Order's flags in the last few cases.
rubidium
parents:
8843
diff
changeset
|
127 |
} |
1935
164d58b9137c
(svn r2441) -Feature: You can now give transfer order to set up feeder systems
celestar
parents:
1901
diff
changeset
|
128 |
}; |
164d58b9137c
(svn r2441) -Feature: You can now give transfer order to set up feeder systems
celestar
parents:
1901
diff
changeset
|
129 |
|
0 | 130 |
static void DrawOrdersWindow(Window *w) |
131 |
{ |
|
8871
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
132 |
const Vehicle *v = GetVehicle(w->window_number); |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
133 |
bool shared_orders = v->IsOrderListShared(); |
0 | 134 |
|
1024
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
135 |
SetVScrollCount(w, v->num_orders + 1); |
0 | 136 |
|
8871
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
137 |
int sel = OrderGetSel(w); |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
138 |
const Order *order = GetVehicleOrder(v, sel); |
725 | 139 |
|
4949
6bf60913767f
(svn r6938) -Codechange: Comments, typo, variable naming, whitespace, strecpy and simplification
Darkvater
parents:
4935
diff
changeset
|
140 |
if (v->owner == _local_player) { |
6bf60913767f
(svn r6938) -Codechange: Comments, typo, variable naming, whitespace, strecpy and simplification
Darkvater
parents:
4935
diff
changeset
|
141 |
/* skip */ |
7997
df87ccd00a96
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
7889
diff
changeset
|
142 |
w->SetWidgetDisabledState(ORDER_WIDGET_SKIP, v->num_orders <= 1); |
4709
a81ab800c25b
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4668
diff
changeset
|
143 |
|
4949
6bf60913767f
(svn r6938) -Codechange: Comments, typo, variable naming, whitespace, strecpy and simplification
Darkvater
parents:
4935
diff
changeset
|
144 |
/* delete */ |
7997
df87ccd00a96
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
7889
diff
changeset
|
145 |
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
|
146 |
(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
|
147 |
|
4949
6bf60913767f
(svn r6938) -Codechange: Comments, typo, variable naming, whitespace, strecpy and simplification
Darkvater
parents:
4935
diff
changeset
|
148 |
/* non-stop only for trains */ |
7997
df87ccd00a96
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
7889
diff
changeset
|
149 |
w->SetWidgetDisabledState(ORDER_WIDGET_NON_STOP, v->type != VEH_TRAIN || order == NULL); |
8886
ba4a5da628f9
(svn r12653) -Codechange: disable load/unload dropdowns when there is a 'via' non-stop order to emphasize that loading/unloading will not be done.
rubidium
parents:
8885
diff
changeset
|
150 |
w->SetWidgetDisabledState(ORDER_WIDGET_FULL_LOAD, order == NULL || (order->GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION) != 0); // full load |
ba4a5da628f9
(svn r12653) -Codechange: disable load/unload dropdowns when there is a 'via' non-stop order to emphasize that loading/unloading will not be done.
rubidium
parents:
8885
diff
changeset
|
151 |
w->SetWidgetDisabledState(ORDER_WIDGET_UNLOAD, order == NULL || (order->GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION) != 0); // unload |
4949
6bf60913767f
(svn r6938) -Codechange: Comments, typo, variable naming, whitespace, strecpy and simplification
Darkvater
parents:
4935
diff
changeset
|
152 |
/* 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
|
153 |
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
|
154 |
w->SetWidgetDisabledState(ORDER_WIDGET_REFIT, order == NULL); // Refit |
8874
db064c1eb143
(svn r12641) -Codechange: do not use the same button for two completely distinct tasks, just make an extra button for it and hide them when not needed.
rubidium
parents:
8873
diff
changeset
|
155 |
w->SetWidgetDisabledState(ORDER_WIDGET_SERVICE, order == NULL); // Refit |
7997
df87ccd00a96
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
7889
diff
changeset
|
156 |
w->HideWidget(ORDER_WIDGET_REFIT); // Refit |
8874
db064c1eb143
(svn r12641) -Codechange: do not use the same button for two completely distinct tasks, just make an extra button for it and hide them when not needed.
rubidium
parents:
8873
diff
changeset
|
157 |
w->HideWidget(ORDER_WIDGET_SERVICE); // Service |
4949
6bf60913767f
(svn r6938) -Codechange: Comments, typo, variable naming, whitespace, strecpy and simplification
Darkvater
parents:
4935
diff
changeset
|
158 |
} else { |
8874
db064c1eb143
(svn r12641) -Codechange: do not use the same button for two completely distinct tasks, just make an extra button for it and hide them when not needed.
rubidium
parents:
8873
diff
changeset
|
159 |
w->DisableWidget(ORDER_WIDGET_FULL_LOAD); |
4949
6bf60913767f
(svn r6938) -Codechange: Comments, typo, variable naming, whitespace, strecpy and simplification
Darkvater
parents:
4935
diff
changeset
|
160 |
} |
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
|
161 |
|
8874
db064c1eb143
(svn r12641) -Codechange: do not use the same button for two completely distinct tasks, just make an extra button for it and hide them when not needed.
rubidium
parents:
8873
diff
changeset
|
162 |
w->ShowWidget(ORDER_WIDGET_UNLOAD); |
8885
647cda0e9312
(svn r12652) -Codechange: rework the order GUI a little more to make it a little more clear that 'transfer' is just an unload type.
rubidium
parents:
8883
diff
changeset
|
163 |
w->ShowWidget(ORDER_WIDGET_FULL_LOAD); |
4709
a81ab800c25b
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4668
diff
changeset
|
164 |
|
1024
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
165 |
if (order != NULL) { |
8836
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8787
diff
changeset
|
166 |
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
|
167 |
case OT_GOTO_STATION: |
8840
332412c2e9c1
(svn r12588) -Codechange: do not access the destination of an order directly.
rubidium
parents:
8839
diff
changeset
|
168 |
if (!GetStation(order->GetDestination())->IsBuoy()) break; |
8057
9a378e86100b
(svn r11618) -Fix: buoys are just waypoints, so don't allow load/unload/transfert for them
glx
parents:
8028
diff
changeset
|
169 |
/* Fall-through */ |
9a378e86100b
(svn r11618) -Fix: buoys are just waypoints, so don't allow load/unload/transfert for them
glx
parents:
8028
diff
changeset
|
170 |
|
9a378e86100b
(svn r11618) -Fix: buoys are just waypoints, so don't allow load/unload/transfert for them
glx
parents:
8028
diff
changeset
|
171 |
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
|
172 |
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
|
173 |
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
|
174 |
break; |
2549 | 175 |
|
1024
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
176 |
case OT_GOTO_DEPOT: |
8874
db064c1eb143
(svn r12641) -Codechange: do not use the same button for two completely distinct tasks, just make an extra button for it and hide them when not needed.
rubidium
parents:
8873
diff
changeset
|
177 |
w->DisableWidget(ORDER_WIDGET_FULL_LOAD); |
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
|
178 |
|
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
|
179 |
/* Remove unload and replace it with refit */ |
7997
df87ccd00a96
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
7889
diff
changeset
|
180 |
w->HideWidget(ORDER_WIDGET_UNLOAD); |
df87ccd00a96
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
7889
diff
changeset
|
181 |
w->ShowWidget(ORDER_WIDGET_REFIT); |
8885
647cda0e9312
(svn r12652) -Codechange: rework the order GUI a little more to make it a little more clear that 'transfer' is just an unload type.
rubidium
parents:
8883
diff
changeset
|
182 |
w->HideWidget(ORDER_WIDGET_FULL_LOAD); |
8874
db064c1eb143
(svn r12641) -Codechange: do not use the same button for two completely distinct tasks, just make an extra button for it and hide them when not needed.
rubidium
parents:
8873
diff
changeset
|
183 |
w->ShowWidget(ORDER_WIDGET_SERVICE); |
1024
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
184 |
break; |
725 | 185 |
|
4709
a81ab800c25b
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4668
diff
changeset
|
186 |
default: // every other orders |
7997
df87ccd00a96
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
7889
diff
changeset
|
187 |
w->DisableWidget(ORDER_WIDGET_NON_STOP); |
df87ccd00a96
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
7889
diff
changeset
|
188 |
w->DisableWidget(ORDER_WIDGET_FULL_LOAD); |
df87ccd00a96
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
7889
diff
changeset
|
189 |
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
|
190 |
} |
0 | 191 |
} |
192 |
||
7049
0ebe47348074
(svn r10314) -Codechange: Refer to vehicle names by index
peter1138
parents:
6980
diff
changeset
|
193 |
SetDParam(0, v->index); |
0 | 194 |
DrawWindowWidgets(w); |
195 |
||
8871
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
196 |
int y = 15; |
0 | 197 |
|
8871
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
198 |
int i = w->vscroll.pos; |
1024
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
199 |
order = GetVehicleOrder(v, i); |
8871
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
200 |
StringID str; |
1024
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
201 |
while (order != NULL) { |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
202 |
str = (v->cur_order_index == i) ? STR_8805 : STR_8804; |
8882 | 203 |
SetDParam(5, STR_EMPTY); |
0 | 204 |
|
1242
1ca216c50426
(svn r1746) - Feature: [GUI] [ 1107690 ] Resizable orders GUI (nzhook)
darkvater
parents:
1214
diff
changeset
|
205 |
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
|
206 |
SetDParam(1, 6); |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
207 |
|
8836
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8787
diff
changeset
|
208 |
switch (order->GetType()) { |
7312
9e89be4bc9a2
(svn r10664) -Codechange: simplify a small piece of code (skidd13)
truelight
parents:
7266
diff
changeset
|
209 |
case OT_DUMMY: |
9e89be4bc9a2
(svn r10664) -Codechange: simplify a small piece of code (skidd13)
truelight
parents:
7266
diff
changeset
|
210 |
SetDParam(1, STR_INVALID_ORDER); |
8840
332412c2e9c1
(svn r12588) -Codechange: do not access the destination of an order directly.
rubidium
parents:
8839
diff
changeset
|
211 |
SetDParam(2, order->GetDestination()); |
7312
9e89be4bc9a2
(svn r10664) -Codechange: simplify a small piece of code (skidd13)
truelight
parents:
7266
diff
changeset
|
212 |
break; |
9e89be4bc9a2
(svn r10664) -Codechange: simplify a small piece of code (skidd13)
truelight
parents:
7266
diff
changeset
|
213 |
|
8876
e5bf23efad87
(svn r12643) -Codechange: be more explicit about the orders a vehicle has (non stop and full load are ambiguous and depend on some patch settings).
rubidium
parents:
8874
diff
changeset
|
214 |
case OT_GOTO_STATION: { |
e5bf23efad87
(svn r12643) -Codechange: be more explicit about the orders a vehicle has (non stop and full load are ambiguous and depend on some patch settings).
rubidium
parents:
8874
diff
changeset
|
215 |
OrderLoadFlags load = order->GetLoadType(); |
e5bf23efad87
(svn r12643) -Codechange: be more explicit about the orders a vehicle has (non stop and full load are ambiguous and depend on some patch settings).
rubidium
parents:
8874
diff
changeset
|
216 |
OrderUnloadFlags unload = order->GetUnloadType(); |
e5bf23efad87
(svn r12643) -Codechange: be more explicit about the orders a vehicle has (non stop and full load are ambiguous and depend on some patch settings).
rubidium
parents:
8874
diff
changeset
|
217 |
|
e5bf23efad87
(svn r12643) -Codechange: be more explicit about the orders a vehicle has (non stop and full load are ambiguous and depend on some patch settings).
rubidium
parents:
8874
diff
changeset
|
218 |
SetDParam(1, STR_GO_TO_STATION); |
e5bf23efad87
(svn r12643) -Codechange: be more explicit about the orders a vehicle has (non stop and full load are ambiguous and depend on some patch settings).
rubidium
parents:
8874
diff
changeset
|
219 |
SetDParam(2, STR_ORDER_GO_TO + (v->type == VEH_TRAIN ? order->GetNonStopType() : 0)); |
e5bf23efad87
(svn r12643) -Codechange: be more explicit about the orders a vehicle has (non stop and full load are ambiguous and depend on some patch settings).
rubidium
parents:
8874
diff
changeset
|
220 |
SetDParam(3, order->GetDestination()); |
8886
ba4a5da628f9
(svn r12653) -Codechange: disable load/unload dropdowns when there is a 'via' non-stop order to emphasize that loading/unloading will not be done.
rubidium
parents:
8885
diff
changeset
|
221 |
SetDParam(4, (order->GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION) ? STR_EMPTY : _station_load_types[unload][load]); |
8876
e5bf23efad87
(svn r12643) -Codechange: be more explicit about the orders a vehicle has (non stop and full load are ambiguous and depend on some patch settings).
rubidium
parents:
8874
diff
changeset
|
222 |
} break; |
1935
164d58b9137c
(svn r2441) -Feature: You can now give transfer order to set up feeder systems
celestar
parents:
1901
diff
changeset
|
223 |
|
2631
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2549
diff
changeset
|
224 |
case OT_GOTO_DEPOT: { |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2549
diff
changeset
|
225 |
StringID s = STR_NULL; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2549
diff
changeset
|
226 |
|
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
|
227 |
if (v->type == VEH_AIRCRAFT) { |
2631
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2549
diff
changeset
|
228 |
s = STR_GO_TO_AIRPORT_HANGAR; |
8840
332412c2e9c1
(svn r12588) -Codechange: do not access the destination of an order directly.
rubidium
parents:
8839
diff
changeset
|
229 |
SetDParam(2, order->GetDestination()); |
2631
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2549
diff
changeset
|
230 |
} else { |
8840
332412c2e9c1
(svn r12588) -Codechange: do not access the destination of an order directly.
rubidium
parents:
8839
diff
changeset
|
231 |
SetDParam(2, GetDepot(order->GetDestination())->town_index); |
2631
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2549
diff
changeset
|
232 |
|
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2549
diff
changeset
|
233 |
switch (v->type) { |
8848
635cb164edd4
(svn r12600) -Codechange: make GetNonStopType return a more augmented type; not is there a non-stop order but the kind of non-stop order, so one doesn't need to check _patches.new_nonstop type everywhere.
rubidium
parents:
8845
diff
changeset
|
234 |
case VEH_TRAIN: s = (order->GetNonStopType() & ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS) ? 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
|
235 |
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
|
236 |
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
|
237 |
default: break; |
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2549
diff
changeset
|
238 |
} |
0 | 239 |
} |
1935
164d58b9137c
(svn r2441) -Feature: You can now give transfer order to set up feeder systems
celestar
parents:
1901
diff
changeset
|
240 |
|
8871
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
241 |
if (order->GetDepotOrderType() & ODTFB_SERVICE) s++; // service at |
2631
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2549
diff
changeset
|
242 |
|
1935
164d58b9137c
(svn r2441) -Feature: You can now give transfer order to set up feeder systems
celestar
parents:
1901
diff
changeset
|
243 |
SetDParam(1, s); |
8838
068d63397dc3
(svn r12586) -Codechange: do not access an order's refit variables directly.
rubidium
parents:
8836
diff
changeset
|
244 |
if (order->IsRefit()) { |
8882 | 245 |
SetDParam(5, STR_REFIT_ORDER); |
246 |
SetDParam(6, GetCargo(order->GetRefitCargo())->name); |
|
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
|
247 |
} |
2631
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2549
diff
changeset
|
248 |
break; |
0 | 249 |
} |
1024
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
250 |
|
2631
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2549
diff
changeset
|
251 |
case OT_GOTO_WAYPOINT: |
8848
635cb164edd4
(svn r12600) -Codechange: make GetNonStopType return a more augmented type; not is there a non-stop order but the kind of non-stop order, so one doesn't need to check _patches.new_nonstop type everywhere.
rubidium
parents:
8845
diff
changeset
|
252 |
SetDParam(1, (order->GetNonStopType() & ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS) ? STR_GO_NON_STOP_TO_WAYPOINT : STR_GO_TO_WAYPOINT); |
8840
332412c2e9c1
(svn r12588) -Codechange: do not access the destination of an order directly.
rubidium
parents:
8839
diff
changeset
|
253 |
SetDParam(2, order->GetDestination()); |
2631
2ed0eb408229
(svn r3173) Use the trinary operator and switch to improve readability
tron
parents:
2549
diff
changeset
|
254 |
break; |
4351
c9799dd53eec
(svn r6052) -Codechange: change OrderType (order->type) in a typedef
truelight
parents:
4344
diff
changeset
|
255 |
|
c9799dd53eec
(svn r6052) -Codechange: change OrderType (order->type) in a typedef
truelight
parents:
4344
diff
changeset
|
256 |
default: break; |
0 | 257 |
} |
1024
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
258 |
|
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
259 |
SetDParam(0, i + 1); |
8082
63240e1bd6cc
(svn r11643) -Codechange: conform with the coding style for the WP macro uses.
rubidium
parents:
8064
diff
changeset
|
260 |
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
|
261 |
|
0 | 262 |
y += 10; |
263 |
} |
|
264 |
||
265 |
i++; |
|
1024
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
266 |
order = order->next; |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
267 |
} |
0 | 268 |
|
1242
1ca216c50426
(svn r1746) - Feature: [GUI] [ 1107690 ] Resizable orders GUI (nzhook)
darkvater
parents:
1214
diff
changeset
|
269 |
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
|
270 |
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
|
271 |
DrawString(2, y, str, (i == WP(w, order_d).sel) ? TC_WHITE : TC_BLACK); |
0 | 272 |
} |
273 |
} |
|
274 |
||
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
|
275 |
static Order GetOrderCmdFromTile(const Vehicle *v, TileIndex tile) |
0 | 276 |
{ |
558
1ae2a752501e
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
277 |
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
|
278 |
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
|
279 |
order.index = 0; |
0 | 280 |
|
8871
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
281 |
/* check depot first */ |
0 | 282 |
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
|
283 |
switch (GetTileType(tile)) { |
8871
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
284 |
case MP_RAILWAY: |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
285 |
if (v->type == VEH_TRAIN && IsTileOwner(tile, _local_player)) { |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
286 |
if (IsRailDepot(tile)) { |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
287 |
order.MakeGoToDepot(GetDepotByTile(tile)->index, ODTFB_PART_OF_ORDERS); |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
288 |
return order; |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
289 |
} |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
290 |
} |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
291 |
break; |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
292 |
|
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
293 |
case MP_ROAD: |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
294 |
if (IsRoadDepot(tile) && v->type == VEH_ROAD && IsTileOwner(tile, _local_player)) { |
8853
3266f0374302
(svn r12615) -Codechange: rename some enums related to depot orders to make it more clear that they are no loading/unloading flags. Also add more type strictness.
rubidium
parents:
8848
diff
changeset
|
295 |
order.MakeGoToDepot(GetDepotByTile(tile)->index, ODTFB_PART_OF_ORDERS); |
558
1ae2a752501e
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
296 |
return order; |
560
60e198893a41
(svn r962) Fixed a problem with the new order system due to missing '{}' (another place)
Celestar
parents:
559
diff
changeset
|
297 |
} |
8871
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
298 |
break; |
0 | 299 |
|
8871
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
300 |
case MP_STATION: |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
301 |
if (v->type != VEH_AIRCRAFT) break; |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
302 |
if (IsHangar(tile) && IsTileOwner(tile, _local_player)) { |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
303 |
order.MakeGoToDepot(GetStationIndex(tile), ODTFB_PART_OF_ORDERS); |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
304 |
return order; |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
305 |
} |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
306 |
break; |
0 | 307 |
|
8871
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
308 |
case MP_WATER: |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
309 |
if (v->type != VEH_SHIP) break; |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
310 |
if (IsTileDepotType(tile, TRANSPORT_WATER) && |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
311 |
IsTileOwner(tile, _local_player)) { |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
312 |
TileIndex tile2 = GetOtherShipDepotTile(tile); |
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
|
313 |
|
8871
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
314 |
order.MakeGoToDepot(GetDepotByTile(tile < tile2 ? tile : tile2)->index, ODTFB_PART_OF_ORDERS); |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
315 |
return order; |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
316 |
} |
1214
8262981ac274
(svn r1718) Use the enum TileType as parameter/return type for [GS]etTileType() instead of plain int.
tron
parents:
1209
diff
changeset
|
317 |
|
8262981ac274
(svn r1718) Use the enum TileType as parameter/return type for [GS]etTileType() instead of plain int.
tron
parents:
1209
diff
changeset
|
318 |
default: |
8262981ac274
(svn r1718) Use the enum TileType as parameter/return type for [GS]etTileType() instead of plain int.
tron
parents:
1209
diff
changeset
|
319 |
break; |
0 | 320 |
} |
321 |
} |
|
322 |
||
8871
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
323 |
/* 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
|
324 |
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
|
325 |
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
|
326 |
IsTileOwner(tile, _local_player) && |
2668
c0f1828b89e4
(svn r3210) -Codechange: use IsRailWaypoint where possible (instead of magicnumbers)
truelight
parents:
2643
diff
changeset
|
327 |
IsRailWaypoint(tile)) { |
8836
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8787
diff
changeset
|
328 |
order.MakeGoToWaypoint(GetWaypointByTile(tile)->index); |
558
1ae2a752501e
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
329 |
return order; |
1ae2a752501e
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
330 |
} |
319
1769185de5f5
(svn r329) Fix: [ 1035066 ] 'Allow goto depot' turned off, no checkpoints in orders
dominik
parents:
193
diff
changeset
|
331 |
|
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
|
332 |
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
|
333 |
StationID st_index = GetStationIndex(tile); |
4171 | 334 |
const Station *st = GetStation(st_index); |
0 | 335 |
|
336 |
if (st->owner == _current_player || st->owner == OWNER_NONE) { |
|
337 |
byte facil; |
|
8871
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
338 |
(facil = FACIL_DOCK, v->type == VEH_SHIP) || |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
339 |
(facil = FACIL_TRAIN, v->type == VEH_TRAIN) || |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
340 |
(facil = FACIL_AIRPORT, v->type == VEH_AIRCRAFT) || |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
341 |
(facil = FACIL_BUS_STOP, v->type == VEH_ROAD && IsCargoInClass(v->cargo_type, CC_PASSENGERS)) || |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
342 |
(facil = FACIL_TRUCK_STOP, 1); |
558
1ae2a752501e
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
343 |
if (st->facilities & facil) { |
8836
f6f1ea3d7e93
(svn r12584) -Codechange: do not access the order type directly.
rubidium
parents:
8787
diff
changeset
|
344 |
order.MakeGoToStation(st_index); |
8881
ad608e8305ad
(svn r12648) -Feature: allow four different non-stop types in a single game instead of two. The "TTDP compatible order" setting now only sets the default behaviour of new trains.
rubidium
parents:
8877
diff
changeset
|
345 |
if (_patches.new_nonstop && v->type == VEH_TRAIN) order.SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS); |
558
1ae2a752501e
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
346 |
return order; |
1ae2a752501e
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
347 |
} |
0 | 348 |
} |
349 |
} |
|
350 |
||
8871
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
351 |
/* 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
|
352 |
order.Free(); |
558
1ae2a752501e
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
353 |
return order; |
0 | 354 |
} |
355 |
||
4171 | 356 |
static bool HandleOrderVehClick(const Vehicle *v, const Vehicle *u, Window *w) |
0 | 357 |
{ |
2549 | 358 |
if (u->type != v->type) return false; |
0 | 359 |
|
7548
3a679b6e8b30
(svn r11068) -Codechange: remove Vehicle::HasFront as all vehicles have the Vehicle::first pointer correctly set.
rubidium
parents:
7497
diff
changeset
|
360 |
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
|
361 |
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
|
362 |
if (!u->IsPrimaryVehicle()) return false; |
0 | 363 |
} |
364 |
||
8871
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
365 |
/* v is vehicle getting orders. Only copy/clone orders if vehicle doesn't have any orders yet |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
366 |
* obviously if you press CTRL on a non-empty orders vehicle you know what you are doing */ |
2549 | 367 |
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
|
368 |
|
8064
fef5cd447a5a
(svn r11625) -Codechange: add CO_* enum at some places, add includes of order.h too
smatz
parents:
8057
diff
changeset
|
369 |
if (DoCommandP(v->tile, v->index | (u->index << 16), _ctrl_pressed ? CO_SHARE : CO_COPY, NULL, |
0 | 370 |
_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
|
371 |
WP(w, order_d).sel = -1; |
0 | 372 |
ResetObjectToPlace(); |
373 |
} |
|
374 |
||
375 |
return true; |
|
376 |
} |
|
377 |
||
4171 | 378 |
static void OrdersPlaceObj(const Vehicle *v, TileIndex tile, Window *w) |
0 | 379 |
{ |
8871
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
380 |
/* check if we're clicking on a vehicle first.. clone orders in that case. */ |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
381 |
const Vehicle *u = CheckMouseOverVehicle(); |
2549 | 382 |
if (u != NULL && HandleOrderVehClick(v, u, w)) return; |
0 | 383 |
|
8871
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
384 |
const Order 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
|
385 |
if (!cmd.IsValid()) return; |
0 | 386 |
|
8839
6337281b393b
(svn r12587) -Codechange: unduplicate some code in the Unpack*Order functions and move the 'normal' case Pack/Unpack to Order.
rubidium
parents:
8838
diff
changeset
|
387 |
if (DoCommandP(v->tile, v->index + (OrderGetSel(w) << 16), cmd.Pack(), 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
|
388 |
if (WP(w, order_d).sel != -1) WP(w,order_d).sel++; |
0 | 389 |
ResetObjectToPlace(); |
390 |
} |
|
391 |
} |
|
392 |
||
6807
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
393 |
/** |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
394 |
* Handle the click on the goto button. |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
395 |
* |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
396 |
* @param w current window |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
397 |
* @param v current vehicle |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
398 |
*/ |
8877
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
399 |
static void OrderClick_Goto(Window *w, const Vehicle *v, int i) |
1000
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
400 |
{ |
8028
e578ea22f371
(svn r11588) -Codechange: use the new member introduced in r11551
glx
parents:
7997
diff
changeset
|
401 |
w->InvalidateWidget(ORDER_WIDGET_GOTO); |
7997
df87ccd00a96
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
7889
diff
changeset
|
402 |
w->ToggleWidgetLoweredState(ORDER_WIDGET_GOTO); |
df87ccd00a96
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
7889
diff
changeset
|
403 |
if (w->IsWidgetLowered(ORDER_WIDGET_GOTO)) { |
1000
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
404 |
_place_clicked_vehicle = NULL; |
7889
e74ce8853ba7
(svn r11440) -Codechange: replace magic numbers with enumified WindowHighlightMode constants. Patch by SmatZ.
rubidium
parents:
7824
diff
changeset
|
405 |
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
|
406 |
} else { |
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
407 |
ResetObjectToPlace(); |
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
408 |
} |
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
409 |
} |
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
410 |
|
6807
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
411 |
/** |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
412 |
* Handle the click on the full load button. |
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 |
* @param w current window |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
415 |
* @param v current vehicle |
8877
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
416 |
* @param load_type the way to load. |
6807
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
417 |
*/ |
8877
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
418 |
static void OrderClick_FullLoad(Window *w, const Vehicle *v, int load_type) |
1000
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
419 |
{ |
8869
8a3dac8dc505
(svn r12636) -Codechange: make CmdModifyOrder a little more flexible and remove 'hack' that used the full load flag to set the service if needed flag.
rubidium
parents:
8861
diff
changeset
|
420 |
VehicleOrderID sel_ord = OrderGetSel(w); |
8a3dac8dc505
(svn r12636) -Codechange: make CmdModifyOrder a little more flexible and remove 'hack' that used the full load flag to set the service if needed flag.
rubidium
parents:
8861
diff
changeset
|
421 |
const Order *order = GetVehicleOrder(v, sel_ord); |
8a3dac8dc505
(svn r12636) -Codechange: make CmdModifyOrder a little more flexible and remove 'hack' that used the full load flag to set the service if needed flag.
rubidium
parents:
8861
diff
changeset
|
422 |
|
8885
647cda0e9312
(svn r12652) -Codechange: rework the order GUI a little more to make it a little more clear that 'transfer' is just an unload type.
rubidium
parents:
8883
diff
changeset
|
423 |
if (order->GetLoadType() == load_type) return; |
8881
ad608e8305ad
(svn r12648) -Feature: allow four different non-stop types in a single game instead of two. The "TTDP compatible order" setting now only sets the default behaviour of new trains.
rubidium
parents:
8877
diff
changeset
|
424 |
|
ad608e8305ad
(svn r12648) -Feature: allow four different non-stop types in a single game instead of two. The "TTDP compatible order" setting now only sets the default behaviour of new trains.
rubidium
parents:
8877
diff
changeset
|
425 |
if (load_type < 0) { |
ad608e8305ad
(svn r12648) -Feature: allow four different non-stop types in a single game instead of two. The "TTDP compatible order" setting now only sets the default behaviour of new trains.
rubidium
parents:
8877
diff
changeset
|
426 |
switch (order->GetLoadType()) { |
ad608e8305ad
(svn r12648) -Feature: allow four different non-stop types in a single game instead of two. The "TTDP compatible order" setting now only sets the default behaviour of new trains.
rubidium
parents:
8877
diff
changeset
|
427 |
case OLF_LOAD_IF_POSSIBLE: load_type = OLFB_FULL_LOAD; break; |
ad608e8305ad
(svn r12648) -Feature: allow four different non-stop types in a single game instead of two. The "TTDP compatible order" setting now only sets the default behaviour of new trains.
rubidium
parents:
8877
diff
changeset
|
428 |
case OLFB_FULL_LOAD: load_type = OLF_FULL_LOAD_ANY; break; |
8883
baee554a9449
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
8882
diff
changeset
|
429 |
case OLF_FULL_LOAD_ANY: load_type = OLFB_NO_LOAD; break; |
baee554a9449
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
8882
diff
changeset
|
430 |
case OLFB_NO_LOAD: load_type = OLF_LOAD_IF_POSSIBLE; break; |
8881
ad608e8305ad
(svn r12648) -Feature: allow four different non-stop types in a single game instead of two. The "TTDP compatible order" setting now only sets the default behaviour of new trains.
rubidium
parents:
8877
diff
changeset
|
431 |
default: NOT_REACHED(); |
ad608e8305ad
(svn r12648) -Feature: allow four different non-stop types in a single game instead of two. The "TTDP compatible order" setting now only sets the default behaviour of new trains.
rubidium
parents:
8877
diff
changeset
|
432 |
} |
ad608e8305ad
(svn r12648) -Feature: allow four different non-stop types in a single game instead of two. The "TTDP compatible order" setting now only sets the default behaviour of new trains.
rubidium
parents:
8877
diff
changeset
|
433 |
} |
ad608e8305ad
(svn r12648) -Feature: allow four different non-stop types in a single game instead of two. The "TTDP compatible order" setting now only sets the default behaviour of new trains.
rubidium
parents:
8877
diff
changeset
|
434 |
DoCommandP(v->tile, v->index + (sel_ord << 16), MOF_LOAD | (load_type << 2), NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER)); |
8874
db064c1eb143
(svn r12641) -Codechange: do not use the same button for two completely distinct tasks, just make an extra button for it and hide them when not needed.
rubidium
parents:
8873
diff
changeset
|
435 |
} |
db064c1eb143
(svn r12641) -Codechange: do not use the same button for two completely distinct tasks, just make an extra button for it and hide them when not needed.
rubidium
parents:
8873
diff
changeset
|
436 |
|
db064c1eb143
(svn r12641) -Codechange: do not use the same button for two completely distinct tasks, just make an extra button for it and hide them when not needed.
rubidium
parents:
8873
diff
changeset
|
437 |
/** |
db064c1eb143
(svn r12641) -Codechange: do not use the same button for two completely distinct tasks, just make an extra button for it and hide them when not needed.
rubidium
parents:
8873
diff
changeset
|
438 |
* Handle the click on the service. |
db064c1eb143
(svn r12641) -Codechange: do not use the same button for two completely distinct tasks, just make an extra button for it and hide them when not needed.
rubidium
parents:
8873
diff
changeset
|
439 |
* |
db064c1eb143
(svn r12641) -Codechange: do not use the same button for two completely distinct tasks, just make an extra button for it and hide them when not needed.
rubidium
parents:
8873
diff
changeset
|
440 |
* @param w current window |
db064c1eb143
(svn r12641) -Codechange: do not use the same button for two completely distinct tasks, just make an extra button for it and hide them when not needed.
rubidium
parents:
8873
diff
changeset
|
441 |
* @param v current vehicle |
db064c1eb143
(svn r12641) -Codechange: do not use the same button for two completely distinct tasks, just make an extra button for it and hide them when not needed.
rubidium
parents:
8873
diff
changeset
|
442 |
*/ |
8877
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
443 |
static void OrderClick_Service(Window *w, const Vehicle *v, int i) |
8874
db064c1eb143
(svn r12641) -Codechange: do not use the same button for two completely distinct tasks, just make an extra button for it and hide them when not needed.
rubidium
parents:
8873
diff
changeset
|
444 |
{ |
db064c1eb143
(svn r12641) -Codechange: do not use the same button for two completely distinct tasks, just make an extra button for it and hide them when not needed.
rubidium
parents:
8873
diff
changeset
|
445 |
DoCommandP(v->tile, v->index + (OrderGetSel(w) << 16), MOF_DEPOT_ACTION, NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER)); |
1000
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
446 |
} |
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
447 |
|
6807
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
448 |
/** |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
449 |
* Handle the click on the unload button. |
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 |
*/ |
8883
baee554a9449
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
8882
diff
changeset
|
454 |
static void OrderClick_Unload(Window *w, const Vehicle *v, int unload_type) |
1000
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
455 |
{ |
8869
8a3dac8dc505
(svn r12636) -Codechange: make CmdModifyOrder a little more flexible and remove 'hack' that used the full load flag to set the service if needed flag.
rubidium
parents:
8861
diff
changeset
|
456 |
VehicleOrderID sel_ord = OrderGetSel(w); |
8a3dac8dc505
(svn r12636) -Codechange: make CmdModifyOrder a little more flexible and remove 'hack' that used the full load flag to set the service if needed flag.
rubidium
parents:
8861
diff
changeset
|
457 |
const Order *order = GetVehicleOrder(v, sel_ord); |
8a3dac8dc505
(svn r12636) -Codechange: make CmdModifyOrder a little more flexible and remove 'hack' that used the full load flag to set the service if needed flag.
rubidium
parents:
8861
diff
changeset
|
458 |
|
8885
647cda0e9312
(svn r12652) -Codechange: rework the order GUI a little more to make it a little more clear that 'transfer' is just an unload type.
rubidium
parents:
8883
diff
changeset
|
459 |
if (order->GetUnloadType() == unload_type) return; |
647cda0e9312
(svn r12652) -Codechange: rework the order GUI a little more to make it a little more clear that 'transfer' is just an unload type.
rubidium
parents:
8883
diff
changeset
|
460 |
|
8883
baee554a9449
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
8882
diff
changeset
|
461 |
if (unload_type < 0) { |
baee554a9449
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
8882
diff
changeset
|
462 |
switch (order->GetUnloadType()) { |
baee554a9449
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
8882
diff
changeset
|
463 |
case OUF_UNLOAD_IF_POSSIBLE: unload_type = OUFB_UNLOAD; break; |
8885
647cda0e9312
(svn r12652) -Codechange: rework the order GUI a little more to make it a little more clear that 'transfer' is just an unload type.
rubidium
parents:
8883
diff
changeset
|
464 |
case OUFB_UNLOAD: unload_type = OUFB_TRANSFER; break; |
647cda0e9312
(svn r12652) -Codechange: rework the order GUI a little more to make it a little more clear that 'transfer' is just an unload type.
rubidium
parents:
8883
diff
changeset
|
465 |
case OUFB_TRANSFER: unload_type = OUFB_NO_UNLOAD; break; |
8883
baee554a9449
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
8882
diff
changeset
|
466 |
case OUFB_NO_UNLOAD: unload_type = OUF_UNLOAD_IF_POSSIBLE; break; |
baee554a9449
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
8882
diff
changeset
|
467 |
default: NOT_REACHED(); |
baee554a9449
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
8882
diff
changeset
|
468 |
} |
baee554a9449
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
8882
diff
changeset
|
469 |
} |
baee554a9449
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
8882
diff
changeset
|
470 |
|
baee554a9449
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
8882
diff
changeset
|
471 |
DoCommandP(v->tile, v->index + (sel_ord << 16), MOF_UNLOAD | (unload_type << 2), 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
|
472 |
} |
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
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 nonstop button. |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
476 |
* |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
477 |
* @param w current window |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
478 |
* @param v current vehicle |
8877
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
479 |
* @param non_stop what non-stop type to use; -1 to use the 'next' one. |
6807
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
480 |
*/ |
8877
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
481 |
static void OrderClick_Nonstop(Window *w, const Vehicle *v, int non_stop) |
1024
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
482 |
{ |
8869
8a3dac8dc505
(svn r12636) -Codechange: make CmdModifyOrder a little more flexible and remove 'hack' that used the full load flag to set the service if needed flag.
rubidium
parents:
8861
diff
changeset
|
483 |
VehicleOrderID sel_ord = OrderGetSel(w); |
8a3dac8dc505
(svn r12636) -Codechange: make CmdModifyOrder a little more flexible and remove 'hack' that used the full load flag to set the service if needed flag.
rubidium
parents:
8861
diff
changeset
|
484 |
const Order *order = GetVehicleOrder(v, sel_ord); |
8a3dac8dc505
(svn r12636) -Codechange: make CmdModifyOrder a little more flexible and remove 'hack' that used the full load flag to set the service if needed flag.
rubidium
parents:
8861
diff
changeset
|
485 |
|
8877
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
486 |
if (order->GetNonStopType() == non_stop) return; |
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
487 |
|
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
488 |
/* Keypress if negative, so 'toggle' to the next */ |
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
489 |
if (non_stop < 0) { |
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
490 |
non_stop = (order->GetNonStopType() + 1) % ONSF_END; |
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
491 |
} |
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
492 |
|
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
493 |
DoCommandP(v->tile, v->index + (sel_ord << 16), MOF_NON_STOP | non_stop << 2, 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
|
494 |
} |
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
495 |
|
6807
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 |
* Handle the click on the transfer button. |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
498 |
* |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
499 |
* @param w current window |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
500 |
* @param v current vehicle |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
501 |
*/ |
8877
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
502 |
static void OrderClick_Transfer(Window *w, const Vehicle *v, int i) |
1935
164d58b9137c
(svn r2441) -Feature: You can now give transfer order to set up feeder systems
celestar
parents:
1901
diff
changeset
|
503 |
{ |
8869
8a3dac8dc505
(svn r12636) -Codechange: make CmdModifyOrder a little more flexible and remove 'hack' that used the full load flag to set the service if needed flag.
rubidium
parents:
8861
diff
changeset
|
504 |
VehicleOrderID sel_ord = OrderGetSel(w); |
8a3dac8dc505
(svn r12636) -Codechange: make CmdModifyOrder a little more flexible and remove 'hack' that used the full load flag to set the service if needed flag.
rubidium
parents:
8861
diff
changeset
|
505 |
const Order *order = GetVehicleOrder(v, sel_ord); |
8a3dac8dc505
(svn r12636) -Codechange: make CmdModifyOrder a little more flexible and remove 'hack' that used the full load flag to set the service if needed flag.
rubidium
parents:
8861
diff
changeset
|
506 |
|
8883
baee554a9449
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
8882
diff
changeset
|
507 |
DoCommandP(v->tile, v->index + (sel_ord << 16), MOF_UNLOAD | ((order->GetUnloadType() & ~OUFB_NO_UNLOAD) ^ OUFB_TRANSFER) << 2, 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
|
508 |
} |
164d58b9137c
(svn r2441) -Feature: You can now give transfer order to set up feeder systems
celestar
parents:
1901
diff
changeset
|
509 |
|
6807
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
510 |
/** |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
511 |
* Handle the click on the skip button. |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
512 |
* If ctrl is pressed skip to selected order. |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
513 |
* Else skip to current order + 1 |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
514 |
* |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
515 |
* @param w current window |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
516 |
* @param v current vehicle |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
517 |
*/ |
8877
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
518 |
static void OrderClick_Skip(Window *w, const Vehicle *v, int i) |
1000
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
519 |
{ |
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
|
520 |
/* 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
|
521 |
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
|
522 |
|
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
|
523 |
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
|
524 |
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
|
525 |
} |
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
526 |
|
6807
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
527 |
/** |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
528 |
* Handle the click on the unload button. |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
529 |
* |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
530 |
* @param w current window |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
531 |
* @param v current vehicle |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
532 |
*/ |
8877
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
533 |
static void OrderClick_Delete(Window *w, const Vehicle *v, int i) |
1000
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
534 |
{ |
1024
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1019
diff
changeset
|
535 |
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
|
536 |
} |
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
537 |
|
6807
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
538 |
/** |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
539 |
* Handle the click on the refit button. |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
540 |
* If ctrl is pressed cancel refitting. |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
541 |
* Else show the refit window. |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
542 |
* |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
543 |
* @param w current window |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
544 |
* @param v current vehicle |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
545 |
*/ |
8877
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
546 |
static void OrderClick_Refit(Window *w, const Vehicle *v, int i) |
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
|
547 |
{ |
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
|
548 |
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
|
549 |
/* Cancel refitting */ |
8082
63240e1bd6cc
(svn r11643) -Codechange: conform with the coding style for the WP macro uses.
rubidium
parents:
8064
diff
changeset
|
550 |
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
|
551 |
} else { |
8082
63240e1bd6cc
(svn r11643) -Codechange: conform with the coding style for the WP macro uses.
rubidium
parents:
8064
diff
changeset
|
552 |
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
|
553 |
} |
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
|
554 |
} |
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
|
555 |
|
8877
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
556 |
typedef void OnButtonVehClick(Window *w, const Vehicle *v, int i); |
1000
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
557 |
|
6807
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
558 |
/** |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
559 |
* Keycode function mapping. |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
560 |
* |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
561 |
* @see _order_keycodes[] |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
562 |
* @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
|
563 |
*/ |
4171 | 564 |
static OnButtonVehClick* const _order_button_proc[] = { |
1000
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
565 |
OrderClick_Skip, |
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
566 |
OrderClick_Delete, |
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
567 |
OrderClick_Nonstop, |
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
568 |
OrderClick_Goto, |
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
569 |
OrderClick_FullLoad, |
1935
164d58b9137c
(svn r2441) -Feature: You can now give transfer order to set up feeder systems
celestar
parents:
1901
diff
changeset
|
570 |
OrderClick_Unload, |
8874
db064c1eb143
(svn r12641) -Codechange: do not use the same button for two completely distinct tasks, just make an extra button for it and hide them when not needed.
rubidium
parents:
8873
diff
changeset
|
571 |
OrderClick_Transfer, |
db064c1eb143
(svn r12641) -Codechange: do not use the same button for two completely distinct tasks, just make an extra button for it and hide them when not needed.
rubidium
parents:
8873
diff
changeset
|
572 |
OrderClick_Service, |
1000
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
573 |
}; |
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
574 |
|
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
575 |
static const uint16 _order_keycodes[] = { |
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
576 |
'D', //skip order |
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
577 |
'F', //delete order |
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
578 |
'G', //non-stop |
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
579 |
'H', //goto order |
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
580 |
'J', //full load |
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
581 |
'K' //unload |
db05d7d665b4
(svn r1498) -Feature: Addded keyboard shortcuts for the order window
Celestar
parents:
995
diff
changeset
|
582 |
}; |
0 | 583 |
|
8877
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
584 |
static const StringID _order_non_stop_drowdown[] = { |
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
585 |
STR_ORDER_GO_TO, |
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
586 |
STR_ORDER_GO_NON_STOP_TO, |
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
587 |
STR_ORDER_GO_VIA, |
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
588 |
STR_ORDER_GO_NON_STOP_VIA, |
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
589 |
INVALID_STRING_ID |
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
590 |
}; |
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
591 |
|
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
592 |
static const StringID _order_full_load_drowdown[] = { |
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
593 |
STR_ORDER_DROP_LOAD_IF_POSSIBLE, |
8883
baee554a9449
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
8882
diff
changeset
|
594 |
STR_EMPTY, |
8877
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
595 |
STR_ORDER_DROP_FULL_LOAD_ALL, |
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
596 |
STR_ORDER_DROP_FULL_LOAD_ANY, |
8883
baee554a9449
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
8882
diff
changeset
|
597 |
STR_ORDER_DROP_NO_LOADING, |
baee554a9449
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
8882
diff
changeset
|
598 |
INVALID_STRING_ID |
baee554a9449
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
8882
diff
changeset
|
599 |
}; |
baee554a9449
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
8882
diff
changeset
|
600 |
|
baee554a9449
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
8882
diff
changeset
|
601 |
static const StringID _order_unload_drowdown[] = { |
baee554a9449
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
8882
diff
changeset
|
602 |
STR_ORDER_DROP_UNLOAD_IF_ACCEPTED, |
baee554a9449
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
8882
diff
changeset
|
603 |
STR_ORDER_DROP_UNLOAD, |
8885
647cda0e9312
(svn r12652) -Codechange: rework the order GUI a little more to make it a little more clear that 'transfer' is just an unload type.
rubidium
parents:
8883
diff
changeset
|
604 |
STR_ORDER_DROP_TRANSFER, |
8883
baee554a9449
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
8882
diff
changeset
|
605 |
STR_EMPTY, |
baee554a9449
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
8882
diff
changeset
|
606 |
STR_ORDER_DROP_NO_UNLOADING, |
8877
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
607 |
INVALID_STRING_ID |
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
608 |
}; |
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
609 |
|
0 | 610 |
static void OrdersWndProc(Window *w, WindowEvent *e) |
611 |
{ |
|
8871
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
612 |
const Vehicle *v = GetVehicle(w->window_number); |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
613 |
|
2549 | 614 |
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
|
615 |
case WE_CREATE: |
6980
c7c4f3bf5901
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
6923
diff
changeset
|
616 |
if (_patches.timetabling) { |
c7c4f3bf5901
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
6923
diff
changeset
|
617 |
w->widget[ORDER_WIDGET_CAPTION].right -= 61; |
c7c4f3bf5901
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
6923
diff
changeset
|
618 |
} else { |
7997
df87ccd00a96
(svn r11555) -Codechange: use the new members introduced in r11551.
rubidium
parents:
7889
diff
changeset
|
619 |
w->HideWidget(ORDER_WIDGET_TIMETABLE_VIEW); |
6980
c7c4f3bf5901
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
6923
diff
changeset
|
620 |
} |
c7c4f3bf5901
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
6923
diff
changeset
|
621 |
|
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
|
622 |
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
|
623 |
|
8871
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
624 |
case WE_PAINT: |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
625 |
DrawOrdersWindow(w); |
6980
c7c4f3bf5901
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
6923
diff
changeset
|
626 |
break; |
c7c4f3bf5901
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
6923
diff
changeset
|
627 |
|
8871
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
628 |
case WE_CLICK: |
8887
27fe38a85cdc
(svn r12654) -Codechange: remove some unneeded right click handling due to the splitting of the load/refit button.
rubidium
parents:
8886
diff
changeset
|
629 |
if (w->widget[e->we.click.widget].type != WWT_DROPDOWN) HideDropDownMenu(w); |
8871
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
630 |
switch (e->we.click.widget) { |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
631 |
case ORDER_WIDGET_ORDER_LIST: { |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
632 |
ResetObjectToPlace(); |
6832
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
633 |
|
8871
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
634 |
int sel = GetOrderFromOrderWndPt(w, e->we.click.pt.y, v); |
6832
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
635 |
|
8871
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
636 |
if (sel == INVALID_ORDER) { |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
637 |
/* This was a click on an empty part of the orders window, so |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
638 |
* deselect the currently selected order. */ |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
639 |
WP(w, order_d).sel = -1; |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
640 |
SetWindowDirty(w); |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
641 |
return; |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
642 |
} |
6832
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
643 |
|
8871
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
644 |
if (_ctrl_pressed && sel < v->num_orders) { |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
645 |
const Order *ord = GetVehicleOrder(v, sel); |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
646 |
TileIndex xy; |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
647 |
|
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
648 |
switch (ord->GetType()) { |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
649 |
case OT_GOTO_STATION: xy = GetStation(ord->GetDestination())->xy ; break; |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
650 |
case OT_GOTO_DEPOT: xy = (v->type == VEH_AIRCRAFT) ? GetStation(ord->GetDestination())->xy : GetDepot(ord->GetDestination())->xy; break; |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
651 |
case OT_GOTO_WAYPOINT: xy = GetWaypoint(ord->GetDestination())->xy; break; |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
652 |
default: xy = 0; break; |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
653 |
} |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
654 |
|
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
655 |
if (xy != 0) ScrollMainWindowToTile(xy); |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
656 |
return; |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
657 |
} else { |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
658 |
if (sel == WP(w, order_d).sel) { |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
659 |
/* Deselect clicked order */ |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
660 |
WP(w, order_d).sel = -1; |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
661 |
} else { |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
662 |
/* Select clicked order */ |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
663 |
WP(w, order_d).sel = sel; |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
664 |
|
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
665 |
if (v->owner == _local_player) { |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
666 |
/* Activate drag and drop */ |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
667 |
SetObjectToPlaceWnd(SPR_CURSOR_MOUSE, PAL_NONE, VHM_DRAG, w); |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
668 |
} |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
669 |
} |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
670 |
} |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
671 |
|
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
672 |
SetWindowDirty(w); |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
673 |
} break; |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
674 |
|
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
675 |
case ORDER_WIDGET_SKIP: |
8877
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
676 |
OrderClick_Skip(w, v, 0); |
8871
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
677 |
break; |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
678 |
|
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
679 |
case ORDER_WIDGET_DELETE: |
8877
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
680 |
OrderClick_Delete(w, v, 0); |
8871
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
681 |
break; |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
682 |
|
8882 | 683 |
case ORDER_WIDGET_NON_STOP: { |
684 |
const Order *o = GetVehicleOrder(v, OrderGetSel(w)); |
|
8885
647cda0e9312
(svn r12652) -Codechange: rework the order GUI a little more to make it a little more clear that 'transfer' is just an unload type.
rubidium
parents:
8883
diff
changeset
|
685 |
ShowDropDownMenu(w, _order_non_stop_drowdown, o->GetNonStopType(), ORDER_WIDGET_NON_STOP, 0, o->IsType(OT_GOTO_STATION) ? 0 : (o->IsType(OT_GOTO_WAYPOINT) ? 3 : 12)); |
8882 | 686 |
} break; |
8871
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
687 |
|
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
688 |
case ORDER_WIDGET_GOTO: |
8877
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
689 |
OrderClick_Goto(w, v, 0); |
8871
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
690 |
break; |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
691 |
|
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
692 |
case ORDER_WIDGET_FULL_LOAD: |
8885
647cda0e9312
(svn r12652) -Codechange: rework the order GUI a little more to make it a little more clear that 'transfer' is just an unload type.
rubidium
parents:
8883
diff
changeset
|
693 |
ShowDropDownMenu(w, _order_full_load_drowdown, GetVehicleOrder(v, OrderGetSel(w))->GetLoadType(), ORDER_WIDGET_FULL_LOAD, 0, 2); |
8871
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
694 |
break; |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
695 |
|
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
696 |
case ORDER_WIDGET_UNLOAD: |
8885
647cda0e9312
(svn r12652) -Codechange: rework the order GUI a little more to make it a little more clear that 'transfer' is just an unload type.
rubidium
parents:
8883
diff
changeset
|
697 |
ShowDropDownMenu(w, _order_unload_drowdown, GetVehicleOrder(v, OrderGetSel(w))->GetUnloadType(), ORDER_WIDGET_UNLOAD, 0, 8); |
8871
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
698 |
break; |
8874
db064c1eb143
(svn r12641) -Codechange: do not use the same button for two completely distinct tasks, just make an extra button for it and hide them when not needed.
rubidium
parents:
8873
diff
changeset
|
699 |
|
8871
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
700 |
case ORDER_WIDGET_REFIT: |
8877
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
701 |
OrderClick_Refit(w, v, 0); |
8871
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
702 |
break; |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
703 |
|
8874
db064c1eb143
(svn r12641) -Codechange: do not use the same button for two completely distinct tasks, just make an extra button for it and hide them when not needed.
rubidium
parents:
8873
diff
changeset
|
704 |
case ORDER_WIDGET_SERVICE: |
8877
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
705 |
OrderClick_Service(w, v, 0); |
8874
db064c1eb143
(svn r12641) -Codechange: do not use the same button for two completely distinct tasks, just make an extra button for it and hide them when not needed.
rubidium
parents:
8873
diff
changeset
|
706 |
break; |
db064c1eb143
(svn r12641) -Codechange: do not use the same button for two completely distinct tasks, just make an extra button for it and hide them when not needed.
rubidium
parents:
8873
diff
changeset
|
707 |
|
8871
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
708 |
case ORDER_WIDGET_TIMETABLE_VIEW: |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
709 |
ShowTimetableWindow(v); |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
710 |
break; |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
711 |
|
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
712 |
case ORDER_WIDGET_SHARED_ORDER_LIST: |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
713 |
ShowVehicleListWindow(v); |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
714 |
break; |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
715 |
} |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
716 |
break; |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
717 |
|
8877
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
718 |
case WE_DROPDOWN_SELECT: // we have selected a dropdown item in the list |
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
719 |
switch (e->we.dropdown.button) { |
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
720 |
case ORDER_WIDGET_NON_STOP: |
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
721 |
OrderClick_Nonstop(w, v, e->we.dropdown.index); |
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
722 |
break; |
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
723 |
|
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
724 |
case ORDER_WIDGET_FULL_LOAD: |
8883
baee554a9449
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
8882
diff
changeset
|
725 |
OrderClick_FullLoad(w, v, e->we.dropdown.index); |
baee554a9449
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
8882
diff
changeset
|
726 |
break; |
baee554a9449
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
8882
diff
changeset
|
727 |
|
baee554a9449
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
8882
diff
changeset
|
728 |
case ORDER_WIDGET_UNLOAD: |
baee554a9449
(svn r12650) -Feature: ability to force a vehicle to not load at a station.
rubidium
parents:
8882
diff
changeset
|
729 |
OrderClick_Unload(w, v, e->we.dropdown.index); |
8877
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
730 |
break; |
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
731 |
} |
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
732 |
break; |
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
733 |
|
8871
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
734 |
case WE_DRAGDROP: |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
735 |
switch (e->we.click.widget) { |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
736 |
case ORDER_WIDGET_ORDER_LIST: { |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
737 |
int from_order = OrderGetSel(w); |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
738 |
int to_order = GetOrderFromOrderWndPt(w, e->we.dragdrop.pt.y, v); |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
739 |
|
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
740 |
if (!(from_order == to_order || from_order == INVALID_ORDER || from_order > v->num_orders || to_order == INVALID_ORDER || to_order > v->num_orders) && |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
741 |
DoCommandP(v->tile, v->index, from_order | (to_order << 16), NULL, CMD_MOVE_ORDER | CMD_MSG(STR_CAN_T_MOVE_THIS_ORDER))) { |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
742 |
WP(w, order_d).sel = -1; |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
743 |
} |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
744 |
|
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
745 |
} break; |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
746 |
|
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
747 |
case ORDER_WIDGET_DELETE: |
8877
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
748 |
OrderClick_Delete(w, v, 0); |
8871
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
749 |
break; |
6832
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
750 |
} |
fec0caeac27d
(svn r10071) -Feature [FS#828]: moving of orders (skidd13).
rubidium
parents:
6807
diff
changeset
|
751 |
|
8871
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
752 |
ResetObjectToPlace(); |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
753 |
break; |
0 | 754 |
|
8871
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
755 |
case WE_KEYPRESS: |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
756 |
if (v->owner != _local_player) break; |
0 | 757 |
|
8871
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
758 |
for (uint i = 0; i < lengthof(_order_keycodes); i++) { |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
759 |
if (e->we.keypress.keycode == _order_keycodes[i]) { |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
760 |
e->we.keypress.cont = false; |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
761 |
/* see if the button is disabled */ |
8877
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
762 |
if (!w->IsWidgetDisabled(i + ORDER_WIDGET_SKIP)) _order_button_proc[i](w, v, -1); |
8871
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
763 |
break; |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
764 |
} |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
765 |
} |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
766 |
break; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
767 |
|
8871
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
768 |
case WE_PLACE_OBJ: |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
769 |
OrdersPlaceObj(GetVehicle(w->window_number), e->we.place.tile, w); |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
770 |
break; |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
771 |
|
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
772 |
case WE_ABORT_PLACE_OBJ: |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
773 |
w->RaiseWidget(ORDER_WIDGET_GOTO); |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
774 |
w->InvalidateWidget(ORDER_WIDGET_GOTO); |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
775 |
break; |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
776 |
|
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
777 |
/* check if a vehicle in a depot was clicked.. */ |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
778 |
case WE_MOUSELOOP: |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
779 |
v = _place_clicked_vehicle; |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
780 |
/* |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
781 |
* Check if we clicked on a vehicle |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
782 |
* and if the GOTO button of this window is pressed |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
783 |
* This is because of all open order windows WE_MOUSELOOP is called |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
784 |
* and if you have 3 windows open, and this check is not done |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
785 |
* the order is copied to the last open window instead of the |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
786 |
* one where GOTO is enabled |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
787 |
*/ |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
788 |
if (v != NULL && w->IsWidgetLowered(ORDER_WIDGET_GOTO)) { |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
789 |
_place_clicked_vehicle = NULL; |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
790 |
HandleOrderVehClick(GetVehicle(w->window_number), v, w); |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
791 |
} |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
792 |
break; |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
793 |
|
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
794 |
case WE_RESIZE: |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
795 |
/* Update the scroll + matrix */ |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
796 |
w->vscroll.cap = (w->widget[ORDER_WIDGET_ORDER_LIST].bottom - w->widget[ORDER_WIDGET_ORDER_LIST].top) / 10; |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
797 |
break; |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
798 |
|
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
799 |
case WE_TIMEOUT: // handle button unclick ourselves... |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
800 |
/* unclick all buttons except for the 'goto' button (ORDER_WIDGET_GOTO), which is 'persistent' */ |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
801 |
for (uint i = 0; i < w->widget_count; i++) { |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
802 |
if (w->IsWidgetLowered(i) && i != ORDER_WIDGET_GOTO) { |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
803 |
w->RaiseWidget(i); |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
804 |
w->InvalidateWidget(i); |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
805 |
} |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
806 |
} |
2fbfd7ec3a5d
(svn r12638) -Codechange: give order_gui.cpp a touch of coding style.
rubidium
parents:
8869
diff
changeset
|
807 |
break; |
0 | 808 |
} |
809 |
} |
|
810 |
||
6807
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
811 |
/** |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
812 |
* Widget definition for player train orders |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
813 |
*/ |
1081
0d79fc43fae2
(svn r1582) Fix: Only the train orders GUI has a non-stop button now.
dominik
parents:
1067
diff
changeset
|
814 |
static const Widget _orders_train_widgets[] = { |
6807
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
815 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // ORDER_WIDGET_CLOSEBOX |
8877
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
816 |
{ WWT_CAPTION, RESIZE_RIGHT, 14, 11, 385, 0, 13, STR_8829_ORDERS, STR_018C_WINDOW_TITLE_DRAG_THIS}, // ORDER_WIDGET_CAPTION |
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
817 |
{ WWT_PUSHTXTBTN, RESIZE_LR, 14, 325, 385, 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
|
818 |
|
8877
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
819 |
{ WWT_PANEL, RESIZE_RB, 14, 0, 373, 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
|
820 |
|
8877
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
821 |
{ WWT_SCROLLBAR, RESIZE_LRB, 14, 374, 385, 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
|
822 |
|
8877
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
823 |
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 0, 123, 88, 99, STR_8823_SKIP, STR_8853_SKIP_THE_CURRENT_ORDER}, // ORDER_WIDGET_SKIP |
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
824 |
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 124, 247, 88, 99, STR_8824_DELETE, STR_8854_DELETE_THE_HIGHLIGHTED}, // ORDER_WIDGET_DELETE |
8885
647cda0e9312
(svn r12652) -Codechange: rework the order GUI a little more to make it a little more clear that 'transfer' is just an unload type.
rubidium
parents:
8883
diff
changeset
|
825 |
{ WWT_DROPDOWN, RESIZE_TB, 14, 0, 123, 76, 87, STR_8825_NON_STOP, STR_8855_MAKE_THE_HIGHLIGHTED_ORDER}, // ORDER_WIDGET_NON_STOP |
8877
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
826 |
{ WWT_TEXTBTN, RESIZE_TB, 14, 248, 371, 88, 99, STR_8826_GO_TO, STR_8856_INSERT_A_NEW_ORDER_BEFORE}, // ORDER_WIDGET_GOTO |
8885
647cda0e9312
(svn r12652) -Codechange: rework the order GUI a little more to make it a little more clear that 'transfer' is just an unload type.
rubidium
parents:
8883
diff
changeset
|
827 |
{ WWT_DROPDOWN, RESIZE_TB, 14, 124, 247, 76, 87, STR_8827_FULL_LOAD, STR_8857_MAKE_THE_HIGHLIGHTED_ORDER}, // ORDER_WIDGET_FULL_LOAD |
647cda0e9312
(svn r12652) -Codechange: rework the order GUI a little more to make it a little more clear that 'transfer' is just an unload type.
rubidium
parents:
8883
diff
changeset
|
828 |
{ WWT_DROPDOWN, RESIZE_TB, 14, 248, 371, 76, 87, STR_8828_UNLOAD, STR_8858_MAKE_THE_HIGHLIGHTED_ORDER}, // ORDER_WIDGET_UNLOAD |
647cda0e9312
(svn r12652) -Codechange: rework the order GUI a little more to make it a little more clear that 'transfer' is just an unload type.
rubidium
parents:
8883
diff
changeset
|
829 |
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 124, 247, 76, 87, STR_REFIT, STR_REFIT_TIP}, // ORDER_WIDGET_REFIT |
8887
27fe38a85cdc
(svn r12654) -Codechange: remove some unneeded right click handling due to the splitting of the load/refit button.
rubidium
parents:
8886
diff
changeset
|
830 |
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 248, 371, 76, 87, STR_SERVICE, STR_SERVICE_HINT}, // ORDER_WIDGET_SERVICE |
8877
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
831 |
|
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
832 |
{ WWT_PANEL, RESIZE_RTB, 14, 372, 373, 76, 99, 0x0, STR_NULL}, // ORDER_WIDGET_RESIZE_BAR |
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
833 |
{ WWT_PUSHIMGBTN, RESIZE_LRTB, 14, 372, 385, 76, 87, SPR_SHARED_ORDERS_ICON, STR_VEH_WITH_SHARED_ORDERS_LIST_TIP}, // ORDER_WIDGET_SHARED_ORDER_LIST |
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
834 |
|
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
835 |
{ WWT_RESIZEBOX, RESIZE_LRTB, 14, 374, 385, 88, 99, 0x0, STR_RESIZE_BUTTON}, // ORDER_WIDGET_RESIZE |
6807
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
836 |
{ WIDGETS_END}, |
0 | 837 |
}; |
838 |
||
1081
0d79fc43fae2
(svn r1582) Fix: Only the train orders GUI has a non-stop button now.
dominik
parents:
1067
diff
changeset
|
839 |
static const WindowDesc _orders_train_desc = { |
8877
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
840 |
WDP_AUTO, WDP_AUTO, 386, 100, 386, 100, |
1081
0d79fc43fae2
(svn r1582) Fix: Only the train orders GUI has a non-stop button now.
dominik
parents:
1067
diff
changeset
|
841 |
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
|
842 |
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
|
843 |
_orders_train_widgets, |
0d79fc43fae2
(svn r1582) Fix: Only the train orders GUI has a non-stop button now.
dominik
parents:
1067
diff
changeset
|
844 |
OrdersWndProc |
0d79fc43fae2
(svn r1582) Fix: Only the train orders GUI has a non-stop button now.
dominik
parents:
1067
diff
changeset
|
845 |
}; |
0d79fc43fae2
(svn r1582) Fix: Only the train orders GUI has a non-stop button now.
dominik
parents:
1067
diff
changeset
|
846 |
|
6807
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
847 |
/** |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
848 |
* Widget definition for player orders (!train) |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
849 |
*/ |
1081
0d79fc43fae2
(svn r1582) Fix: Only the train orders GUI has a non-stop button now.
dominik
parents:
1067
diff
changeset
|
850 |
static const Widget _orders_widgets[] = { |
6807
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
851 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // ORDER_WIDGET_CLOSEBOX |
8877
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
852 |
{ WWT_CAPTION, RESIZE_RIGHT, 14, 11, 385, 0, 13, STR_8829_ORDERS, STR_018C_WINDOW_TITLE_DRAG_THIS}, // ORDER_WIDGET_CAPTION |
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
853 |
{ WWT_PUSHTXTBTN, RESIZE_LR, 14, 325, 385, 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
|
854 |
|
8877
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
855 |
{ WWT_PANEL, RESIZE_RB, 14, 0, 373, 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
|
856 |
|
8877
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
857 |
{ WWT_SCROLLBAR, RESIZE_LRB, 14, 374, 385, 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
|
858 |
|
8877
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
859 |
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 0, 123, 88, 99, STR_8823_SKIP, STR_8853_SKIP_THE_CURRENT_ORDER}, // ORDER_WIDGET_SKIP |
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
860 |
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 124, 247, 88, 99, STR_8824_DELETE, STR_8854_DELETE_THE_HIGHLIGHTED}, // ORDER_WIDGET_DELETE |
6807
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
861 |
{ WWT_EMPTY, RESIZE_TB, 14, 0, 0, 76, 87, 0x0, 0x0}, // ORDER_WIDGET_NON_STOP |
8877
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
862 |
{ WWT_TEXTBTN, RESIZE_TB, 14, 248, 371, 88, 99, STR_8826_GO_TO, STR_8856_INSERT_A_NEW_ORDER_BEFORE}, // ORDER_WIDGET_GOTO |
8885
647cda0e9312
(svn r12652) -Codechange: rework the order GUI a little more to make it a little more clear that 'transfer' is just an unload type.
rubidium
parents:
8883
diff
changeset
|
863 |
{ WWT_DROPDOWN, RESIZE_TB, 14, 0, 185, 76, 87, STR_8827_FULL_LOAD, STR_8857_MAKE_THE_HIGHLIGHTED_ORDER}, // ORDER_WIDGET_FULL_LOAD |
647cda0e9312
(svn r12652) -Codechange: rework the order GUI a little more to make it a little more clear that 'transfer' is just an unload type.
rubidium
parents:
8883
diff
changeset
|
864 |
{ WWT_DROPDOWN, RESIZE_TB, 14, 186, 372, 76, 87, STR_8828_UNLOAD, STR_8858_MAKE_THE_HIGHLIGHTED_ORDER}, // ORDER_WIDGET_UNLOAD |
647cda0e9312
(svn r12652) -Codechange: rework the order GUI a little more to make it a little more clear that 'transfer' is just an unload type.
rubidium
parents:
8883
diff
changeset
|
865 |
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 0, 185, 76, 87, STR_REFIT, STR_REFIT_TIP}, // ORDER_WIDGET_REFIT |
8887
27fe38a85cdc
(svn r12654) -Codechange: remove some unneeded right click handling due to the splitting of the load/refit button.
rubidium
parents:
8886
diff
changeset
|
866 |
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 186, 372, 76, 87, STR_SERVICE, STR_SERVICE_HINT}, // ORDER_WIDGET_SERVICE |
6807
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
867 |
|
8877
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
868 |
{ WWT_PANEL, RESIZE_RTB, 14, 372, 373, 76, 99, 0x0, STR_NULL}, // ORDER_WIDGET_RESIZE_BAR |
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
869 |
{ WWT_PUSHIMGBTN, RESIZE_LRTB, 14, 372, 385, 76, 87, SPR_SHARED_ORDERS_ICON, STR_VEH_WITH_SHARED_ORDERS_LIST_TIP}, // ORDER_WIDGET_SHARED_ORDER_LIST |
6807
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
870 |
|
8877
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
871 |
{ WWT_RESIZEBOX, RESIZE_LRTB, 14, 374, 385, 88, 99, 0x0, STR_RESIZE_BUTTON}, // ORDER_WIDGET_RESIZE |
6807
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
872 |
{ WIDGETS_END}, |
1081
0d79fc43fae2
(svn r1582) Fix: Only the train orders GUI has a non-stop button now.
dominik
parents:
1067
diff
changeset
|
873 |
}; |
0d79fc43fae2
(svn r1582) Fix: Only the train orders GUI has a non-stop button now.
dominik
parents:
1067
diff
changeset
|
874 |
|
995
0a8d27dcc231
(svn r1493) -Codechange: Removed redundancy in the order GUI. Currently we had most
celestar
parents:
919
diff
changeset
|
875 |
static const WindowDesc _orders_desc = { |
8877
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
876 |
WDP_AUTO, WDP_AUTO, 386, 100, 386, 100, |
0 | 877 |
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
|
878 |
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
|
879 |
_orders_widgets, |
0 | 880 |
OrdersWndProc |
881 |
}; |
|
882 |
||
6807
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
883 |
/** |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
884 |
* Widget definition for competitor orders |
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
885 |
*/ |
995
0a8d27dcc231
(svn r1493) -Codechange: Removed redundancy in the order GUI. Currently we had most
celestar
parents:
919
diff
changeset
|
886 |
static const Widget _other_orders_widgets[] = { |
6980
c7c4f3bf5901
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
6923
diff
changeset
|
887 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // ORDER_WIDGET_CLOSEBOX |
8877
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
888 |
{ WWT_CAPTION, RESIZE_RIGHT, 14, 11, 385, 0, 13, STR_8829_ORDERS, STR_018C_WINDOW_TITLE_DRAG_THIS}, // ORDER_WIDGET_CAPTION |
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
889 |
{ WWT_PUSHTXTBTN, RESIZE_LR, 14, 325, 385, 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
|
890 |
|
8877
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
891 |
{ WWT_PANEL, RESIZE_RB, 14, 0, 373, 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
|
892 |
|
8877
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
893 |
{ WWT_SCROLLBAR, RESIZE_LRB, 14, 374, 385, 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
|
894 |
|
8874
db064c1eb143
(svn r12641) -Codechange: do not use the same button for two completely distinct tasks, just make an extra button for it and hide them when not needed.
rubidium
parents:
8873
diff
changeset
|
895 |
{ WWT_EMPTY, RESIZE_NONE, 14, 0, 0, 76, 87, 0x0, STR_NULL}, // ORDER_WIDGET_SKIP |
db064c1eb143
(svn r12641) -Codechange: do not use the same button for two completely distinct tasks, just make an extra button for it and hide them when not needed.
rubidium
parents:
8873
diff
changeset
|
896 |
{ WWT_EMPTY, RESIZE_NONE, 14, 0, 0, 76, 87, 0x0, STR_NULL}, // ORDER_WIDGET_DELETE |
db064c1eb143
(svn r12641) -Codechange: do not use the same button for two completely distinct tasks, just make an extra button for it and hide them when not needed.
rubidium
parents:
8873
diff
changeset
|
897 |
{ WWT_EMPTY, RESIZE_NONE, 14, 0, 0, 76, 87, 0x0, STR_NULL}, // ORDER_WIDGET_NON_STOP |
db064c1eb143
(svn r12641) -Codechange: do not use the same button for two completely distinct tasks, just make an extra button for it and hide them when not needed.
rubidium
parents:
8873
diff
changeset
|
898 |
{ WWT_EMPTY, RESIZE_NONE, 14, 0, 0, 76, 87, 0x0, STR_NULL}, // ORDER_WIDGET_GOTO |
db064c1eb143
(svn r12641) -Codechange: do not use the same button for two completely distinct tasks, just make an extra button for it and hide them when not needed.
rubidium
parents:
8873
diff
changeset
|
899 |
{ WWT_EMPTY, RESIZE_NONE, 14, 0, 0, 76, 87, 0x0, STR_NULL}, // ORDER_WIDGET_FULL_LOAD |
db064c1eb143
(svn r12641) -Codechange: do not use the same button for two completely distinct tasks, just make an extra button for it and hide them when not needed.
rubidium
parents:
8873
diff
changeset
|
900 |
{ WWT_EMPTY, RESIZE_NONE, 14, 0, 0, 76, 87, 0x0, STR_NULL}, // ORDER_WIDGET_UNLOAD |
db064c1eb143
(svn r12641) -Codechange: do not use the same button for two completely distinct tasks, just make an extra button for it and hide them when not needed.
rubidium
parents:
8873
diff
changeset
|
901 |
{ WWT_EMPTY, RESIZE_NONE, 14, 0, 0, 76, 87, 0x0, STR_NULL}, // ORDER_WIDGET_REFIT |
db064c1eb143
(svn r12641) -Codechange: do not use the same button for two completely distinct tasks, just make an extra button for it and hide them when not needed.
rubidium
parents:
8873
diff
changeset
|
902 |
{ WWT_EMPTY, RESIZE_NONE, 14, 0, 0, 76, 87, 0x0, STR_NULL}, // ORDER_WIDGET_SERVICE |
6980
c7c4f3bf5901
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
6923
diff
changeset
|
903 |
|
8877
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
904 |
{ WWT_PANEL, RESIZE_RTB, 14, 0, 373, 76, 87, 0x0, STR_NULL}, // ORDER_WIDGET_RESIZE_BAR |
8874
db064c1eb143
(svn r12641) -Codechange: do not use the same button for two completely distinct tasks, just make an extra button for it and hide them when not needed.
rubidium
parents:
8873
diff
changeset
|
905 |
{ WWT_EMPTY, RESIZE_TB, 14, 0, 0, 76, 87, 0x0, STR_NULL}, // ORDER_WIDGET_SHARED_ORDER_LIST |
6980
c7c4f3bf5901
(svn r10236) -Feature: Introduce a form of timetabling for vehicles.
maedhros
parents:
6923
diff
changeset
|
906 |
|
8877
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
907 |
{ WWT_RESIZEBOX, RESIZE_LRTB, 14, 374, 385, 88, 99, 0x0, STR_RESIZE_BUTTON}, // ORDER_WIDGET_RESIZE |
6807
89fba17b6cd3
(svn r10046) -Documentation: add some documentation in order_gui (skidd13).
rubidium
parents:
6794
diff
changeset
|
908 |
{ WIDGETS_END}, |
0 | 909 |
}; |
910 |
||
995
0a8d27dcc231
(svn r1493) -Codechange: Removed redundancy in the order GUI. Currently we had most
celestar
parents:
919
diff
changeset
|
911 |
static const WindowDesc _other_orders_desc = { |
8877
f09f03b0dc64
(svn r12644) -Codechange: rework the order gui a little to prepare it for some future changes.
rubidium
parents:
8876
diff
changeset
|
912 |
WDP_AUTO, WDP_AUTO, 386, 88, 386, 88, |
0 | 913 |
WC_VEHICLE_ORDERS,WC_VEHICLE_VIEW, |
1242
1ca216c50426
(svn r1746) - Feature: [GUI] [ 1107690 ] Resizable orders GUI (nzhook)
darkvater
parents:
1214
diff
changeset
|
914 |
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
|
915 |
_other_orders_widgets, |
0 | 916 |
OrdersWndProc |
917 |
}; |
|
918 |
||
4171 | 919 |
void ShowOrdersWindow(const Vehicle *v) |
0 | 920 |
{ |
921 |
Window *w; |
|
922 |
VehicleID veh = v->index; |
|
923 |
||
924 |
DeleteWindowById(WC_VEHICLE_ORDERS, veh); |
|
925 |
DeleteWindowById(WC_VEHICLE_DETAILS, veh); |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
926 |
|
1081
0d79fc43fae2
(svn r1582) Fix: Only the train orders GUI has a non-stop button now.
dominik
parents:
1067
diff
changeset
|
927 |
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
|
928 |
w = AllocateWindowDescFront(&_other_orders_desc, veh); |
2549 | 929 |
} 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
|
930 |
w = AllocateWindowDescFront((v->type == VEH_TRAIN) ? &_orders_train_desc : &_orders_desc, veh); |
2549 | 931 |
} |
0 | 932 |
|
1242
1ca216c50426
(svn r1746) - Feature: [GUI] [ 1107690 ] Resizable orders GUI (nzhook)
darkvater
parents:
1214
diff
changeset
|
933 |
if (w != NULL) { |
1ca216c50426
(svn r1746) - Feature: [GUI] [ 1107690 ] Resizable orders GUI (nzhook)
darkvater
parents:
1214
diff
changeset
|
934 |
w->caption_color = v->owner; |
1ca216c50426
(svn r1746) - Feature: [GUI] [ 1107690 ] Resizable orders GUI (nzhook)
darkvater
parents:
1214
diff
changeset
|
935 |
w->vscroll.cap = 6; |
1ca216c50426
(svn r1746) - Feature: [GUI] [ 1107690 ] Resizable orders GUI (nzhook)
darkvater
parents:
1214
diff
changeset
|
936 |
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
|
937 |
WP(w, order_d).sel = -1; |
1242
1ca216c50426
(svn r1746) - Feature: [GUI] [ 1107690 ] Resizable orders GUI (nzhook)
darkvater
parents:
1214
diff
changeset
|
938 |
} |
0 | 939 |
} |