author | celestar |
Wed, 12 Jan 2005 22:09:21 +0000 | |
changeset 995 | 96e9f70280d7 |
parent 919 | b0d6c7642f99 |
child 1000 | a418026097f6 |
permissions | -rw-r--r-- |
0 | 1 |
#include "stdafx.h" |
2 |
#include "ttd.h" |
|
507
8aa8100b0b22
(svn r815) Include strings.h only in the files which need it.
tron
parents:
395
diff
changeset
|
3 |
#include "table/strings.h" |
679
e959706a3e4d
(svn r1117) Move map arrays and some related macros into their own files map.c and map.h
tron
parents:
560
diff
changeset
|
4 |
#include "map.h" |
0 | 5 |
#include "window.h" |
6 |
#include "gui.h" |
|
7 |
#include "gfx.h" |
|
8 |
#include "vehicle.h" |
|
9 |
#include "station.h" |
|
10 |
#include "town.h" |
|
11 |
#include "command.h" |
|
12 |
#include "viewport.h" |
|
13 |
||
14 |
static int OrderGetSel(Window *w) |
|
15 |
{ |
|
919
b0d6c7642f99
(svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns and _industries
truelight
parents:
893
diff
changeset
|
16 |
Vehicle *v = GetVehicle(w->window_number); |
555
eec6c0294435
(svn r955) Replace uint16 for orders with struct Order
tron
parents:
536
diff
changeset
|
17 |
const Order *sched = v->schedule_ptr; |
0 | 18 |
int num = WP(w,order_d).sel; |
19 |
int count = 0; |
|
20 |
||
21 |
if (num == 0) |
|
22 |
return 0; |
|
23 |
||
555
eec6c0294435
(svn r955) Replace uint16 for orders with struct Order
tron
parents:
536
diff
changeset
|
24 |
while (sched->type != OT_NOTHING) { |
0 | 25 |
sched++; |
26 |
count++; |
|
27 |
if (--num == 0) |
|
28 |
break; |
|
29 |
} |
|
30 |
||
31 |
return count; |
|
32 |
} |
|
33 |
||
34 |
static void DrawOrdersWindow(Window *w) |
|
35 |
{ |
|
36 |
Vehicle *v; |
|
37 |
int num, sel; |
|
555
eec6c0294435
(svn r955) Replace uint16 for orders with struct Order
tron
parents:
536
diff
changeset
|
38 |
const Order *sched; |
eec6c0294435
(svn r955) Replace uint16 for orders with struct Order
tron
parents:
536
diff
changeset
|
39 |
Order ord; |
0 | 40 |
int y, i; |
41 |
StringID str; |
|
42 |
bool shared_schedule; |
|
43 |
||
919
b0d6c7642f99
(svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns and _industries
truelight
parents:
893
diff
changeset
|
44 |
v = GetVehicle(w->window_number); |
0 | 45 |
|
995
96e9f70280d7
(svn r1493) -Codechange: Removed redundancy in the order GUI. Currently we had most
celestar
parents:
919
diff
changeset
|
46 |
w->disabled_state = (v->owner == _local_player) ? 0 : ( |
96e9f70280d7
(svn r1493) -Codechange: Removed redundancy in the order GUI. Currently we had most
celestar
parents:
919
diff
changeset
|
47 |
1 << 4 | //skip |
96e9f70280d7
(svn r1493) -Codechange: Removed redundancy in the order GUI. Currently we had most
celestar
parents:
919
diff
changeset
|
48 |
1 << 5 | //delete |
96e9f70280d7
(svn r1493) -Codechange: Removed redundancy in the order GUI. Currently we had most
celestar
parents:
919
diff
changeset
|
49 |
1 << 6 | //non-stop |
96e9f70280d7
(svn r1493) -Codechange: Removed redundancy in the order GUI. Currently we had most
celestar
parents:
919
diff
changeset
|
50 |
1 << 7 | //go-to |
96e9f70280d7
(svn r1493) -Codechange: Removed redundancy in the order GUI. Currently we had most
celestar
parents:
919
diff
changeset
|
51 |
1 << 8 | //full load |
96e9f70280d7
(svn r1493) -Codechange: Removed redundancy in the order GUI. Currently we had most
celestar
parents:
919
diff
changeset
|
52 |
1 << 9 //unload |
96e9f70280d7
(svn r1493) -Codechange: Removed redundancy in the order GUI. Currently we had most
celestar
parents:
919
diff
changeset
|
53 |
); |
96e9f70280d7
(svn r1493) -Codechange: Removed redundancy in the order GUI. Currently we had most
celestar
parents:
919
diff
changeset
|
54 |
|
96e9f70280d7
(svn r1493) -Codechange: Removed redundancy in the order GUI. Currently we had most
celestar
parents:
919
diff
changeset
|
55 |
//disable non-stop for non-trains |
96e9f70280d7
(svn r1493) -Codechange: Removed redundancy in the order GUI. Currently we had most
celestar
parents:
919
diff
changeset
|
56 |
if (v->type != VEH_Train) { |
96e9f70280d7
(svn r1493) -Codechange: Removed redundancy in the order GUI. Currently we had most
celestar
parents:
919
diff
changeset
|
57 |
w->disabled_state |= 1 << 6; |
96e9f70280d7
(svn r1493) -Codechange: Removed redundancy in the order GUI. Currently we had most
celestar
parents:
919
diff
changeset
|
58 |
} |
0 | 59 |
|
60 |
shared_schedule = IsScheduleShared(v) != NULL; |
|
61 |
||
62 |
sched = v->schedule_ptr; |
|
63 |
num=0; |
|
555
eec6c0294435
(svn r955) Replace uint16 for orders with struct Order
tron
parents:
536
diff
changeset
|
64 |
while (sched->type != OT_NOTHING) { |
eec6c0294435
(svn r955) Replace uint16 for orders with struct Order
tron
parents:
536
diff
changeset
|
65 |
sched++; |
eec6c0294435
(svn r955) Replace uint16 for orders with struct Order
tron
parents:
536
diff
changeset
|
66 |
num++; |
eec6c0294435
(svn r955) Replace uint16 for orders with struct Order
tron
parents:
536
diff
changeset
|
67 |
} |
0 | 68 |
|
69 |
if ((uint)num + shared_schedule <= (uint)WP(w,order_d).sel) |
|
70 |
SETBIT(w->disabled_state, 5); /* delete */ |
|
71 |
||
72 |
if (num == 0) |
|
73 |
SETBIT(w->disabled_state, 4); /* skip */ |
|
74 |
||
75 |
SetVScrollCount(w, num+1); |
|
76 |
||
77 |
sel = OrderGetSel(w); |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
78 |
|
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
79 |
SetDParam(2,STR_8827_FULL_LOAD); |
555
eec6c0294435
(svn r955) Replace uint16 for orders with struct Order
tron
parents:
536
diff
changeset
|
80 |
switch (v->schedule_ptr[sel].type) { |
0 | 81 |
case OT_GOTO_STATION: |
82 |
break; |
|
83 |
case OT_GOTO_DEPOT: |
|
84 |
SETBIT(w->disabled_state, 9); /* unload */ |
|
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
85 |
SetDParam(2,STR_SERVICE); |
0 | 86 |
break; |
725 | 87 |
|
88 |
case OT_GOTO_WAYPOINT: |
|
89 |
SETBIT(w->disabled_state, 8); /* full load */ |
|
90 |
SETBIT(w->disabled_state, 9); /* unload */ |
|
91 |
break; |
|
92 |
||
0 | 93 |
default: |
94 |
SETBIT(w->disabled_state, 6); /* nonstop */ |
|
95 |
SETBIT(w->disabled_state, 8); /* full load */ |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
96 |
SETBIT(w->disabled_state, 9); /* unload */ |
0 | 97 |
} |
98 |
||
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
99 |
SetDParam(0, v->string_id); |
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
100 |
SetDParam(1, v->unitnumber); |
0 | 101 |
DrawWindowWidgets(w); |
102 |
||
103 |
y = 15; |
|
104 |
||
105 |
i = 0; |
|
106 |
for(;;) { |
|
107 |
str = ((byte)v->cur_order_index == i) ? STR_8805 : STR_8804; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
108 |
|
0 | 109 |
ord = v->schedule_ptr[i]; |
110 |
||
111 |
if ( (uint)(i - w->vscroll.pos) < 6) { |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
112 |
|
555
eec6c0294435
(svn r955) Replace uint16 for orders with struct Order
tron
parents:
536
diff
changeset
|
113 |
if (ord.type == OT_NOTHING) { |
0 | 114 |
str = shared_schedule ? STR_END_OF_SHARED_ORDERS : STR_882A_END_OF_ORDERS; |
115 |
} else { |
|
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
116 |
SetDParam(1, 6); |
0 | 117 |
|
555
eec6c0294435
(svn r955) Replace uint16 for orders with struct Order
tron
parents:
536
diff
changeset
|
118 |
if (ord.type == OT_GOTO_STATION) { |
eec6c0294435
(svn r955) Replace uint16 for orders with struct Order
tron
parents:
536
diff
changeset
|
119 |
SetDParam(1, STR_8806_GO_TO + (ord.flags >> 1)); |
eec6c0294435
(svn r955) Replace uint16 for orders with struct Order
tron
parents:
536
diff
changeset
|
120 |
SetDParam(2, ord.station); |
eec6c0294435
(svn r955) Replace uint16 for orders with struct Order
tron
parents:
536
diff
changeset
|
121 |
} else if (ord.type == OT_GOTO_DEPOT) { |
0 | 122 |
StringID s = STR_NULL; |
123 |
if (v->type == VEH_Aircraft) { |
|
124 |
s = STR_GO_TO_AIRPORT_HANGAR; |
|
555
eec6c0294435
(svn r955) Replace uint16 for orders with struct Order
tron
parents:
536
diff
changeset
|
125 |
SetDParam(2, ord.station); |
0 | 126 |
} else { |
555
eec6c0294435
(svn r955) Replace uint16 for orders with struct Order
tron
parents:
536
diff
changeset
|
127 |
SetDParam(2, _depots[ord.station].town_index); |
0 | 128 |
switch (v->type) { |
129 |
case VEH_Train: s = STR_880E_GO_TO_TRAIN_DEPOT; break; |
|
130 |
case VEH_Road: s = STR_9038_GO_TO_ROADVEH_DEPOT; break; |
|
131 |
case VEH_Ship: s = STR_GO_TO_SHIP_DEPOT; break; |
|
132 |
} |
|
133 |
} |
|
555
eec6c0294435
(svn r955) Replace uint16 for orders with struct Order
tron
parents:
536
diff
changeset
|
134 |
if (v->type == VEH_Train && ord.flags & OF_NON_STOP) s += 2; |
eec6c0294435
(svn r955) Replace uint16 for orders with struct Order
tron
parents:
536
diff
changeset
|
135 |
if (ord.flags & OF_FULL_LOAD) ++s; /* XXX service */ |
eec6c0294435
(svn r955) Replace uint16 for orders with struct Order
tron
parents:
536
diff
changeset
|
136 |
SetDParam(1, s); |
eec6c0294435
(svn r955) Replace uint16 for orders with struct Order
tron
parents:
536
diff
changeset
|
137 |
} else if (ord.type == OT_GOTO_WAYPOINT) { |
eec6c0294435
(svn r955) Replace uint16 for orders with struct Order
tron
parents:
536
diff
changeset
|
138 |
SetDParam(2, ord.station); |
725 | 139 |
SetDParam(1, (ord.flags & OF_NON_STOP) ? STR_GO_NON_STOP_TO_WAYPOINT : STR_GO_TO_WAYPOINT); |
0 | 140 |
} |
141 |
} |
|
142 |
{ |
|
143 |
byte color = (i == WP(w,order_d).sel) ? 0xC : 0x10; |
|
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
144 |
SetDParam(0, i+1); |
555
eec6c0294435
(svn r955) Replace uint16 for orders with struct Order
tron
parents:
536
diff
changeset
|
145 |
if (ord.type != OT_DUMMY) { |
127
815ec4d365e2
(svn r128) Invalid (void) orders in schedule are highlighted in red (Celestar)
dominik
parents:
44
diff
changeset
|
146 |
DrawString(2, y, str, color); |
815ec4d365e2
(svn r128) Invalid (void) orders in schedule are highlighted in red (Celestar)
dominik
parents:
44
diff
changeset
|
147 |
} else { |
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
148 |
SetDParam(1, STR_INVALID_ORDER); |
555
eec6c0294435
(svn r955) Replace uint16 for orders with struct Order
tron
parents:
536
diff
changeset
|
149 |
SetDParam(2, ord.station); |
127
815ec4d365e2
(svn r128) Invalid (void) orders in schedule are highlighted in red (Celestar)
dominik
parents:
44
diff
changeset
|
150 |
DrawString(2, y, str, color); |
815ec4d365e2
(svn r128) Invalid (void) orders in schedule are highlighted in red (Celestar)
dominik
parents:
44
diff
changeset
|
151 |
} |
0 | 152 |
} |
153 |
y += 10; |
|
154 |
} |
|
155 |
||
156 |
i++; |
|
157 |
||
555
eec6c0294435
(svn r955) Replace uint16 for orders with struct Order
tron
parents:
536
diff
changeset
|
158 |
if (ord.type == OT_NOTHING) |
0 | 159 |
break; |
160 |
} |
|
161 |
} |
|
162 |
||
163 |
||
164 |
// lookup a vehicle on a tile |
|
165 |
typedef struct { |
|
166 |
TileIndex tile; |
|
167 |
byte owner; |
|
168 |
byte type; |
|
169 |
} FindVehS; |
|
170 |
||
171 |
static void *FindVehicleCallb(Vehicle *v, FindVehS *f) |
|
172 |
{ |
|
173 |
if (v->tile != f->tile || v->owner != f->owner || v->vehstatus & VS_HIDDEN ) return NULL; |
|
174 |
return v; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
175 |
} |
0 | 176 |
|
177 |
Vehicle *GetVehicleOnTile(TileIndex tile, byte owner) |
|
178 |
{ |
|
781
9717ff353c17
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
725
diff
changeset
|
179 |
FindVehS fs; |
9717ff353c17
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
725
diff
changeset
|
180 |
fs.tile = tile; |
9717ff353c17
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
725
diff
changeset
|
181 |
fs.owner = owner; |
9717ff353c17
(svn r1248) -Add: initial OS/2 support (read docs/ReadMe_OS2.txt) (orudge)
truelight
parents:
725
diff
changeset
|
182 |
fs.type = 0; |
0 | 183 |
return VehicleFromPos(tile, &fs, (VehicleFromPosProc*)FindVehicleCallb); |
184 |
} |
|
185 |
||
558
9b115b39c515
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
186 |
static Order GetOrderCmdFromTile(Vehicle *v, uint tile) |
0 | 187 |
{ |
558
9b115b39c515
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
188 |
Order order; |
0 | 189 |
Station *st; |
190 |
int st_index; |
|
191 |
||
192 |
// check depot first |
|
193 |
if (_patches.gotodepot) { |
|
194 |
switch(GET_TILETYPE(tile)) { |
|
195 |
case MP_RAILWAY: |
|
196 |
if (v->type == VEH_Train && _map_owner[tile] == _local_player) { |
|
560
bd8a572dc8b9
(svn r962) Fixed a problem with the new order system due to missing '{}' (another place)
Celestar
parents:
559
diff
changeset
|
197 |
if ((_map5[tile]&0xFC)==0xC0) { |
558
9b115b39c515
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
198 |
order.type = OT_GOTO_DEPOT; |
9b115b39c515
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
199 |
order.flags = OF_UNLOAD; |
9b115b39c515
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
200 |
order.station = GetDepotByTile(tile); |
9b115b39c515
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
201 |
return order; |
560
bd8a572dc8b9
(svn r962) Fixed a problem with the new order system due to missing '{}' (another place)
Celestar
parents:
559
diff
changeset
|
202 |
} |
0 | 203 |
} |
204 |
break; |
|
205 |
||
206 |
case MP_STREET: |
|
560
bd8a572dc8b9
(svn r962) Fixed a problem with the new order system due to missing '{}' (another place)
Celestar
parents:
559
diff
changeset
|
207 |
if ((_map5[tile] & 0xF0) == 0x20 && v->type == VEH_Road && _map_owner[tile] == _local_player) { |
558
9b115b39c515
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
208 |
order.type = OT_GOTO_DEPOT; |
9b115b39c515
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
209 |
order.flags = OF_UNLOAD; |
9b115b39c515
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
210 |
order.station = GetDepotByTile(tile); |
9b115b39c515
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
211 |
return order; |
560
bd8a572dc8b9
(svn r962) Fixed a problem with the new order system due to missing '{}' (another place)
Celestar
parents:
559
diff
changeset
|
212 |
} |
0 | 213 |
break; |
214 |
||
215 |
case MP_STATION: |
|
216 |
if (v->type != VEH_Aircraft) break; |
|
559
2003549c0ddb
(svn r961) Fixed a problem with the new order system due to missing '{}'
Celestar
parents:
558
diff
changeset
|
217 |
if ( IsAircraftHangarTile(tile) && _map_owner[tile] == _local_player) { |
558
9b115b39c515
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
218 |
order.type = OT_GOTO_DEPOT; |
9b115b39c515
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
219 |
order.flags = OF_UNLOAD | OF_NON_STOP; |
9b115b39c515
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
220 |
order.station = _map2[tile]; |
9b115b39c515
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
221 |
return order; |
560
bd8a572dc8b9
(svn r962) Fixed a problem with the new order system due to missing '{}' (another place)
Celestar
parents:
559
diff
changeset
|
222 |
} |
0 | 223 |
break; |
224 |
||
225 |
case MP_WATER: |
|
226 |
if (v->type != VEH_Ship) break; |
|
227 |
if ( IsShipDepotTile(tile) && _map_owner[tile] == _local_player) { |
|
228 |
switch (_map5[tile]) { |
|
229 |
case 0x81: tile--; break; |
|
230 |
case 0x83: tile-= TILE_XY(0,1); break; |
|
231 |
} |
|
558
9b115b39c515
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
232 |
order.type = OT_GOTO_DEPOT; |
9b115b39c515
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
233 |
order.flags = OF_UNLOAD; |
9b115b39c515
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
234 |
order.station = GetDepotByTile(tile); |
9b115b39c515
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
235 |
return order; |
0 | 236 |
} |
237 |
} |
|
238 |
} |
|
239 |
||
395
4c990f33dab7
(svn r587) -newgrf: Rename all /Checkpoint/i tokens to 'Waypoint's. The name actually makes some sense and is also compatible with TTDPatch (pasky).
darkvater
parents:
319
diff
changeset
|
240 |
// check waypoint |
319
1891d07574d6
(svn r329) Fix: [ 1035066 ] 'Allow goto depot' turned off, no checkpoints in orders
dominik
parents:
193
diff
changeset
|
241 |
if (IS_TILETYPE(tile, MP_RAILWAY) |
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
781
diff
changeset
|
242 |
&& v->type == VEH_Train |
319
1891d07574d6
(svn r329) Fix: [ 1035066 ] 'Allow goto depot' turned off, no checkpoints in orders
dominik
parents:
193
diff
changeset
|
243 |
&& _map_owner[tile] == _local_player |
558
9b115b39c515
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
244 |
&& (_map5[tile]&0xFE)==0xC4) { |
9b115b39c515
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
245 |
order.type = OT_GOTO_WAYPOINT; |
9b115b39c515
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
246 |
order.flags = 0; |
9b115b39c515
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
247 |
order.station = GetWaypointByTile(tile); |
9b115b39c515
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
248 |
return order; |
9b115b39c515
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
249 |
} |
319
1891d07574d6
(svn r329) Fix: [ 1035066 ] 'Allow goto depot' turned off, no checkpoints in orders
dominik
parents:
193
diff
changeset
|
250 |
|
0 | 251 |
if (IS_TILETYPE(tile, MP_STATION)) { |
919
b0d6c7642f99
(svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns and _industries
truelight
parents:
893
diff
changeset
|
252 |
st = GetStation(st_index = _map2[tile]); |
0 | 253 |
|
254 |
if (st->owner == _current_player || st->owner == OWNER_NONE) { |
|
255 |
byte facil; |
|
256 |
(facil=FACIL_DOCK, v->type == VEH_Ship) || |
|
257 |
(facil=FACIL_TRAIN, v->type == VEH_Train) || |
|
258 |
(facil=FACIL_AIRPORT, v->type == VEH_Aircraft) || |
|
259 |
(facil=FACIL_BUS_STOP, v->type == VEH_Road && v->cargo_type == CT_PASSENGERS) || |
|
260 |
(facil=FACIL_TRUCK_STOP, 1); |
|
558
9b115b39c515
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
261 |
if (st->facilities & facil) { |
9b115b39c515
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
262 |
order.type = OT_GOTO_STATION; |
9b115b39c515
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
263 |
order.flags = 0; |
9b115b39c515
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
264 |
order.station = st_index; |
9b115b39c515
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
265 |
return order; |
9b115b39c515
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
266 |
} |
0 | 267 |
} |
268 |
} |
|
269 |
||
270 |
// not found |
|
558
9b115b39c515
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
271 |
order.type = OT_NOTHING; |
9b115b39c515
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
272 |
order.flags = 0; |
9b115b39c515
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
273 |
return order; |
0 | 274 |
} |
275 |
||
276 |
static bool HandleOrderVehClick(Vehicle *v, Vehicle *u, Window *w) |
|
277 |
{ |
|
278 |
if (u->type != v->type) |
|
279 |
return false; |
|
280 |
||
281 |
if (u->type == VEH_Train && u->subtype != 0) { |
|
282 |
u = GetFirstVehicleInChain(u); |
|
283 |
if (u->subtype != 0) |
|
284 |
return false; |
|
285 |
} |
|
286 |
||
287 |
// v is vehicle getting orders. Only copy/clone orders if vehicle doesn't have any orders yet |
|
288 |
// obviously if you press CTRL on a non-empty orders vehicle you know what you are doing |
|
289 |
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
|
290 |
|
0 | 291 |
if (DoCommandP(v->tile, v->index | (u->index << 16), _ctrl_pressed ? 0 : 1, NULL, |
292 |
_ctrl_pressed ? CMD_CLONE_ORDER | CMD_MSG(STR_CANT_SHARE_ORDER_LIST) : CMD_CLONE_ORDER | CMD_MSG(STR_CANT_COPY_ORDER_LIST))) { |
|
293 |
WP(w,order_d).sel = -1; |
|
294 |
ResetObjectToPlace(); |
|
295 |
} |
|
296 |
||
297 |
return true; |
|
298 |
} |
|
299 |
||
300 |
static void OrdersPlaceObj(Vehicle *v, uint tile, Window *w) |
|
301 |
{ |
|
558
9b115b39c515
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
302 |
Order cmd; |
0 | 303 |
Vehicle *u; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
304 |
|
0 | 305 |
// check if we're clicking on a vehicle first.. clone orders in that case. |
306 |
u = CheckMouseOverVehicle(); |
|
307 |
if (u && HandleOrderVehClick(v, u, w)) |
|
308 |
return; |
|
309 |
||
310 |
cmd = GetOrderCmdFromTile(v, tile); |
|
558
9b115b39c515
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
311 |
if (cmd.type == OT_NOTHING) return; |
0 | 312 |
|
558
9b115b39c515
(svn r960) -Fix: forgotten conversion of orders for the AI (Tron)
darkvater
parents:
555
diff
changeset
|
313 |
if (DoCommandP(v->tile, v->index + (OrderGetSel(w) << 16), PackOrder(&cmd), NULL, CMD_INSERT_ORDER | CMD_MSG(STR_8833_CAN_T_INSERT_NEW_ORDER))) { |
0 | 314 |
if (WP(w,order_d).sel != -1) |
315 |
WP(w,order_d).sel++; |
|
316 |
ResetObjectToPlace(); |
|
317 |
} |
|
318 |
} |
|
319 |
||
320 |
||
321 |
static void OrdersWndProc(Window *w, WindowEvent *e) |
|
322 |
{ |
|
323 |
switch(e->event) { |
|
324 |
case WE_PAINT: |
|
325 |
DrawOrdersWindow(w); |
|
326 |
break; |
|
327 |
||
328 |
case WE_CLICK: { |
|
919
b0d6c7642f99
(svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns and _industries
truelight
parents:
893
diff
changeset
|
329 |
Vehicle *v = GetVehicle(w->window_number); |
0 | 330 |
int mode; |
331 |
switch(e->click.widget) { |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
332 |
case 2: {/* orders list */ |
0 | 333 |
int sel; |
334 |
sel = (e->click.pt.y - 15) / 10; |
|
335 |
||
336 |
if ( (uint) sel >= 6) |
|
337 |
return; |
|
338 |
||
339 |
sel += w->vscroll.pos; |
|
340 |
||
44
1923acc255d1
(svn r45) -Feature [992998] Scrollto Station in Orders. CTRL click on orders of a vehicle and main-window scrolls to that station. (chrishuebsch)
darkvater
parents:
25
diff
changeset
|
341 |
if (_ctrl_pressed && sel < v->num_orders) { // watch out for schedule_ptr overflow |
555
eec6c0294435
(svn r955) Replace uint16 for orders with struct Order
tron
parents:
536
diff
changeset
|
342 |
Order ord = v->schedule_ptr[sel]; |
44
1923acc255d1
(svn r45) -Feature [992998] Scrollto Station in Orders. CTRL click on orders of a vehicle and main-window scrolls to that station. (chrishuebsch)
darkvater
parents:
25
diff
changeset
|
343 |
int xy = 0; |
555
eec6c0294435
(svn r955) Replace uint16 for orders with struct Order
tron
parents:
536
diff
changeset
|
344 |
switch (ord.type) { |
44
1923acc255d1
(svn r45) -Feature [992998] Scrollto Station in Orders. CTRL click on orders of a vehicle and main-window scrolls to that station. (chrishuebsch)
darkvater
parents:
25
diff
changeset
|
345 |
case OT_GOTO_STATION: /* station order */ |
919
b0d6c7642f99
(svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns and _industries
truelight
parents:
893
diff
changeset
|
346 |
xy = GetStation(ord.station)->xy ; |
44
1923acc255d1
(svn r45) -Feature [992998] Scrollto Station in Orders. CTRL click on orders of a vehicle and main-window scrolls to that station. (chrishuebsch)
darkvater
parents:
25
diff
changeset
|
347 |
break; |
1923acc255d1
(svn r45) -Feature [992998] Scrollto Station in Orders. CTRL click on orders of a vehicle and main-window scrolls to that station. (chrishuebsch)
darkvater
parents:
25
diff
changeset
|
348 |
case OT_GOTO_DEPOT: /* goto depot order */ |
555
eec6c0294435
(svn r955) Replace uint16 for orders with struct Order
tron
parents:
536
diff
changeset
|
349 |
xy = _depots[ord.station].xy; |
44
1923acc255d1
(svn r45) -Feature [992998] Scrollto Station in Orders. CTRL click on orders of a vehicle and main-window scrolls to that station. (chrishuebsch)
darkvater
parents:
25
diff
changeset
|
350 |
break; |
395
4c990f33dab7
(svn r587) -newgrf: Rename all /Checkpoint/i tokens to 'Waypoint's. The name actually makes some sense and is also compatible with TTDPatch (pasky).
darkvater
parents:
319
diff
changeset
|
351 |
case OT_GOTO_WAYPOINT: /* goto waypoint order */ |
555
eec6c0294435
(svn r955) Replace uint16 for orders with struct Order
tron
parents:
536
diff
changeset
|
352 |
xy = _waypoints[ord.station].xy; |
44
1923acc255d1
(svn r45) -Feature [992998] Scrollto Station in Orders. CTRL click on orders of a vehicle and main-window scrolls to that station. (chrishuebsch)
darkvater
parents:
25
diff
changeset
|
353 |
} |
1923acc255d1
(svn r45) -Feature [992998] Scrollto Station in Orders. CTRL click on orders of a vehicle and main-window scrolls to that station. (chrishuebsch)
darkvater
parents:
25
diff
changeset
|
354 |
|
1923acc255d1
(svn r45) -Feature [992998] Scrollto Station in Orders. CTRL click on orders of a vehicle and main-window scrolls to that station. (chrishuebsch)
darkvater
parents:
25
diff
changeset
|
355 |
if (xy) |
1923acc255d1
(svn r45) -Feature [992998] Scrollto Station in Orders. CTRL click on orders of a vehicle and main-window scrolls to that station. (chrishuebsch)
darkvater
parents:
25
diff
changeset
|
356 |
ScrollMainWindowToTile(xy); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
357 |
|
44
1923acc255d1
(svn r45) -Feature [992998] Scrollto Station in Orders. CTRL click on orders of a vehicle and main-window scrolls to that station. (chrishuebsch)
darkvater
parents:
25
diff
changeset
|
358 |
return; |
1923acc255d1
(svn r45) -Feature [992998] Scrollto Station in Orders. CTRL click on orders of a vehicle and main-window scrolls to that station. (chrishuebsch)
darkvater
parents:
25
diff
changeset
|
359 |
} |
1923acc255d1
(svn r45) -Feature [992998] Scrollto Station in Orders. CTRL click on orders of a vehicle and main-window scrolls to that station. (chrishuebsch)
darkvater
parents:
25
diff
changeset
|
360 |
|
0 | 361 |
if (sel == WP(w,order_d).sel) sel = -1; |
362 |
WP(w,order_d).sel = sel; |
|
363 |
SetWindowDirty(w); |
|
364 |
} break; |
|
365 |
||
366 |
case 4: /* skip button */ |
|
367 |
DoCommandP(v->tile,v->index, 0, NULL, CMD_SKIP_ORDER); |
|
368 |
break; |
|
369 |
||
370 |
case 5: /* delete button */ |
|
371 |
DoCommandP(v->tile,v->index, OrderGetSel(w), NULL, CMD_DELETE_ORDER | CMD_MSG(STR_8834_CAN_T_DELETE_THIS_ORDER)); |
|
372 |
break; |
|
373 |
||
374 |
case 7: /* goto button */ |
|
375 |
InvalidateWidget(w, 7); |
|
376 |
w->click_state ^= 1<<7; |
|
377 |
if (HASBIT(w->click_state, 7)) { |
|
378 |
_place_clicked_vehicle = NULL; |
|
379 |
SetObjectToPlaceWnd(ANIMCURSOR_PICKSTATION, 1, w); |
|
380 |
} else { |
|
381 |
ResetObjectToPlace(); |
|
382 |
} |
|
383 |
break; |
|
384 |
||
385 |
case 8: /* full load button */ |
|
386 |
mode = 0; |
|
387 |
DoCommandP(v->tile, v->index, OrderGetSel(w) | (mode << 8), NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER)); |
|
388 |
break; |
|
389 |
||
390 |
case 9: /* unload button */ |
|
391 |
mode = 1; |
|
392 |
DoCommandP(v->tile, v->index, OrderGetSel(w) | (mode << 8), NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER)); |
|
393 |
break; |
|
394 |
||
395 |
case 6: /* non stop button */ |
|
396 |
mode = 2; |
|
397 |
DoCommandP(v->tile, v->index, OrderGetSel(w) | (mode << 8), NULL, CMD_MODIFY_ORDER | CMD_MSG(STR_8835_CAN_T_MODIFY_THIS_ORDER)); |
|
398 |
break; |
|
399 |
} |
|
400 |
} break; |
|
401 |
||
402 |
||
403 |
case WE_RCLICK: { |
|
919
b0d6c7642f99
(svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns and _industries
truelight
parents:
893
diff
changeset
|
404 |
Vehicle *v = GetVehicle(w->window_number); |
0 | 405 |
if (e->click.widget != 8) break; |
555
eec6c0294435
(svn r955) Replace uint16 for orders with struct Order
tron
parents:
536
diff
changeset
|
406 |
if (v->schedule_ptr[OrderGetSel(w)].type == OT_GOTO_DEPOT) |
0 | 407 |
GuiShowTooltips(STR_SERVICE_HINT); |
408 |
else |
|
409 |
GuiShowTooltips(STR_8857_MAKE_THE_HIGHLIGHTED_ORDER); |
|
410 |
} break; |
|
411 |
||
412 |
case WE_4: { |
|
413 |
if (FindWindowById(WC_VEHICLE_VIEW, w->window_number) == NULL) |
|
414 |
DeleteWindow(w); |
|
415 |
} break; |
|
416 |
||
417 |
case WE_PLACE_OBJ: { |
|
919
b0d6c7642f99
(svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns and _industries
truelight
parents:
893
diff
changeset
|
418 |
OrdersPlaceObj(GetVehicle(w->window_number), e->place.tile, w); |
0 | 419 |
} break; |
420 |
||
421 |
case WE_ABORT_PLACE_OBJ: { |
|
422 |
w->click_state &= ~(1<<7); |
|
423 |
InvalidateWidget(w, 7); |
|
424 |
} break; |
|
425 |
||
426 |
// check if a vehicle in a depot was clicked.. |
|
427 |
case WE_MOUSELOOP: { |
|
428 |
Vehicle *v = _place_clicked_vehicle; |
|
25 | 429 |
/* |
430 |
* Check if we clicked on a vehicle |
|
431 |
* and if the GOTO button of this window is pressed |
|
432 |
* This is because of all open order windows WE_MOUSELOOP is called |
|
433 |
* and if you have 3 windows open, and this check is not done |
|
434 |
* the order is copied to the last open window instead of the |
|
435 |
* one where GOTO is enalbed |
|
436 |
*/ |
|
437 |
if (v && HASBIT(w->click_state, 7)) { |
|
0 | 438 |
_place_clicked_vehicle = NULL; |
919
b0d6c7642f99
(svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns and _industries
truelight
parents:
893
diff
changeset
|
439 |
HandleOrderVehClick(GetVehicle(w->window_number), v, w); |
0 | 440 |
} |
441 |
} break; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
442 |
|
0 | 443 |
} |
444 |
} |
|
445 |
||
995
96e9f70280d7
(svn r1493) -Codechange: Removed redundancy in the order GUI. Currently we had most
celestar
parents:
919
diff
changeset
|
446 |
static const Widget _orders_widgets[] = { |
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
781
diff
changeset
|
447 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
781
diff
changeset
|
448 |
{ WWT_CAPTION, RESIZE_NONE, 14, 11, 319, 0, 13, STR_8829_ORDERS, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
893
d9e69e5060ba
(svn r1379) -Fix: various GUI glitches. Added default sizes to various widgets. Sticky/Resize- and Scrollbar must be 11 pixels wide, Horizontal scrollbar 11 pixels high, caption must be 13 pixels. I hope I didn't forget any widgets, the game will assert for that so report them to me!
darkvater
parents:
867
diff
changeset
|
449 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 307, 14, 75, 0x0, STR_8852_ORDERS_LIST_CLICK_ON_ORDER}, |
d9e69e5060ba
(svn r1379) -Fix: various GUI glitches. Added default sizes to various widgets. Sticky/Resize- and Scrollbar must be 11 pixels wide, Horizontal scrollbar 11 pixels high, caption must be 13 pixels. I hope I didn't forget any widgets, the game will assert for that so report them to me!
darkvater
parents:
867
diff
changeset
|
450 |
{ WWT_SCROLLBAR, RESIZE_NONE, 14, 308, 319, 14, 75, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, |
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
781
diff
changeset
|
451 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 0, 52, 76, 87, STR_8823_SKIP, STR_8853_SKIP_THE_CURRENT_ORDER}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
781
diff
changeset
|
452 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 53, 105, 76, 87, STR_8824_DELETE, STR_8854_DELETE_THE_HIGHLIGHTED}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
781
diff
changeset
|
453 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 106, 158, 76, 87, STR_8825_NON_STOP, STR_8855_MAKE_THE_HIGHLIGHTED_ORDER}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
781
diff
changeset
|
454 |
{WWT_NODISTXTBTN, RESIZE_NONE, 14, 159, 211, 76, 87, STR_8826_GO_TO, STR_8856_INSERT_A_NEW_ORDER_BEFORE}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
781
diff
changeset
|
455 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 212, 264, 76, 87, STR_FULLLOAD_OR_SERVICE, STR_NULL}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
781
diff
changeset
|
456 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 265, 319, 76, 87, STR_8828_UNLOAD, STR_8858_MAKE_THE_HIGHLIGHTED_ORDER}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
127
diff
changeset
|
457 |
{ WIDGETS_END}, |
0 | 458 |
}; |
459 |
||
995
96e9f70280d7
(svn r1493) -Codechange: Removed redundancy in the order GUI. Currently we had most
celestar
parents:
919
diff
changeset
|
460 |
static const WindowDesc _orders_desc = { |
0 | 461 |
-1,-1, 320, 88, |
462 |
WC_VEHICLE_ORDERS,WC_VEHICLE_VIEW, |
|
463 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_RESTORE_DPARAM, |
|
995
96e9f70280d7
(svn r1493) -Codechange: Removed redundancy in the order GUI. Currently we had most
celestar
parents:
919
diff
changeset
|
464 |
_orders_widgets, |
0 | 465 |
OrdersWndProc |
466 |
}; |
|
467 |
||
995
96e9f70280d7
(svn r1493) -Codechange: Removed redundancy in the order GUI. Currently we had most
celestar
parents:
919
diff
changeset
|
468 |
static const Widget _other_orders_widgets[] = { |
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
781
diff
changeset
|
469 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
781
diff
changeset
|
470 |
{ WWT_CAPTION, RESIZE_NONE, 14, 11, 319, 0, 13, STR_A00B_ORDERS, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
893
d9e69e5060ba
(svn r1379) -Fix: various GUI glitches. Added default sizes to various widgets. Sticky/Resize- and Scrollbar must be 11 pixels wide, Horizontal scrollbar 11 pixels high, caption must be 13 pixels. I hope I didn't forget any widgets, the game will assert for that so report them to me!
darkvater
parents:
867
diff
changeset
|
471 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 307, 14, 75, 0x0, STR_8852_ORDERS_LIST_CLICK_ON_ORDER}, |
d9e69e5060ba
(svn r1379) -Fix: various GUI glitches. Added default sizes to various widgets. Sticky/Resize- and Scrollbar must be 11 pixels wide, Horizontal scrollbar 11 pixels high, caption must be 13 pixels. I hope I didn't forget any widgets, the game will assert for that so report them to me!
darkvater
parents:
867
diff
changeset
|
472 |
{ WWT_SCROLLBAR, RESIZE_NONE, 14, 308, 319, 14, 75, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
127
diff
changeset
|
473 |
{ WIDGETS_END}, |
0 | 474 |
}; |
475 |
||
995
96e9f70280d7
(svn r1493) -Codechange: Removed redundancy in the order GUI. Currently we had most
celestar
parents:
919
diff
changeset
|
476 |
static const WindowDesc _other_orders_desc = { |
0 | 477 |
-1,-1, 320, 76, |
478 |
WC_VEHICLE_ORDERS,WC_VEHICLE_VIEW, |
|
479 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, |
|
995
96e9f70280d7
(svn r1493) -Codechange: Removed redundancy in the order GUI. Currently we had most
celestar
parents:
919
diff
changeset
|
480 |
_other_orders_widgets, |
0 | 481 |
OrdersWndProc |
482 |
}; |
|
483 |
||
484 |
void ShowOrdersWindow(Vehicle *v) |
|
485 |
{ |
|
486 |
Window *w; |
|
487 |
VehicleID veh = v->index; |
|
488 |
||
489 |
DeleteWindowById(WC_VEHICLE_ORDERS, veh); |
|
490 |
DeleteWindowById(WC_VEHICLE_DETAILS, veh); |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
491 |
|
0 | 492 |
_alloc_wnd_parent_num = veh; |
995
96e9f70280d7
(svn r1493) -Codechange: Removed redundancy in the order GUI. Currently we had most
celestar
parents:
919
diff
changeset
|
493 |
|
96e9f70280d7
(svn r1493) -Codechange: Removed redundancy in the order GUI. Currently we had most
celestar
parents:
919
diff
changeset
|
494 |
w = AllocateWindowDesc( (v->owner == _local_player) ? &_orders_desc : &_other_orders_desc); |
0 | 495 |
|
496 |
w->window_number = veh; |
|
497 |
w->caption_color = v->owner; |
|
498 |
w->vscroll.cap = 6; |
|
499 |
WP(w,order_d).sel = -1; |
|
500 |
} |