author | darkvater |
Wed, 22 Dec 2004 00:45:05 +0000 | |
changeset 757 | a3510cb57cfc |
parent 755 | 823358e83abf |
child 767 | 13c481dee3fc |
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:
382
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:
588
diff
changeset
|
4 |
#include "map.h" |
0 | 5 |
#include "window.h" |
6 |
#include "gui.h" |
|
7 |
#include "vehicle.h" |
|
8 |
#include "gfx.h" |
|
9 |
#include "station.h" |
|
10 |
#include "command.h" |
|
11 |
#include "engine.h" |
|
12 |
#include "viewport.h" |
|
13 |
#include "player.h" |
|
14 |
||
15 |
||
16 |
static void DrawAircraftImage(Vehicle *v, int x, int y, VehicleID selection) |
|
17 |
{ |
|
18 |
int image = GetAircraftImage(v, 6); |
|
19 |
uint32 ormod = SPRITE_PALETTE(PLAYER_SPRITE_COLOR(v->owner)); |
|
20 |
if (v->vehstatus & VS_CRASHED) ormod = 0x3248000; |
|
21 |
DrawSprite(image | ormod, x+25, y+10); |
|
22 |
if (v->subtype == 0) |
|
23 |
DrawSprite(0xF3D, x+25, y+5); |
|
24 |
if (v->index == selection) { |
|
25 |
DrawFrameRect(x-1, y-1, x+58, y+21, 0xF, 0x10); |
|
26 |
} |
|
27 |
} |
|
28 |
||
543
e3b43338096b
(svn r942) -Merged branch/network back into the trunk
truelight
parents:
538
diff
changeset
|
29 |
void CcBuildAircraft(bool success, uint tile, uint32 p1, uint32 p2) |
0 | 30 |
{ |
31 |
Vehicle *v; |
|
32 |
||
33 |
if (success) { |
|
34 |
v = &_vehicles[_new_aircraft_id]; |
|
35 |
if (v->tile == _backup_orders_tile) { |
|
36 |
_backup_orders_tile = 0; |
|
37 |
RestoreVehicleOrders(v, _backup_orders_data); |
|
38 |
} |
|
39 |
ShowAircraftViewWindow(v); |
|
40 |
} |
|
41 |
} |
|
42 |
||
43 |
||
44 |
static void NewAircraftWndProc(Window *w, WindowEvent *e) |
|
45 |
{ |
|
46 |
YearMonthDay ymd; |
|
47 |
||
48 |
switch(e->event) { |
|
49 |
||
50 |
case WE_PAINT: { |
|
51 |
if (w->window_number == 0) |
|
52 |
SETBIT(w->disabled_state, 5); |
|
53 |
||
54 |
{ |
|
55 |
int count = 0; |
|
56 |
int num = NUM_AIRCRAFT_ENGINES; |
|
57 |
Engine *e = &_engines[AIRCRAFT_ENGINES_INDEX]; |
|
58 |
do { |
|
59 |
if (HASBIT(e->player_avail, _local_player)) |
|
60 |
count++; |
|
61 |
} while (++e,--num); |
|
62 |
SetVScrollCount(w, count); |
|
63 |
} |
|
64 |
||
65 |
DrawWindowWidgets(w); |
|
66 |
||
67 |
{ |
|
68 |
int num = NUM_AIRCRAFT_ENGINES; |
|
69 |
Engine *e = &_engines[AIRCRAFT_ENGINES_INDEX]; |
|
70 |
int x = 2; |
|
71 |
int y = 15; |
|
72 |
int sel = WP(w,buildtrain_d).sel_index; |
|
73 |
int pos = w->vscroll.pos; |
|
74 |
int engine_id = AIRCRAFT_ENGINES_INDEX; |
|
75 |
int selected_id = -1; |
|
76 |
||
77 |
do { |
|
78 |
if (HASBIT(e->player_avail, _local_player)) { |
|
79 |
if (sel==0) selected_id = engine_id; |
|
80 |
if (IS_INT_INSIDE(--pos, -4, 0)) { |
|
81 |
DrawString(x+62, y+7, GetCustomEngineName(engine_id), sel==0 ? 0xC : 0x10); |
|
82 |
DrawAircraftEngine(x+29, y+10, engine_id, SPRITE_PALETTE(PLAYER_SPRITE_COLOR(_local_player))); |
|
83 |
y += 24; |
|
84 |
} |
|
85 |
sel--; |
|
86 |
} |
|
87 |
} while (++engine_id, ++e,--num); |
|
88 |
||
89 |
WP(w,buildtrain_d).sel_engine = selected_id; |
|
90 |
||
91 |
if (selected_id != -1) { |
|
538
5dd99f3b7eca
(svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents:
534
diff
changeset
|
92 |
const AircraftVehicleInfo *avi = AircraftVehInfo(selected_id); |
0 | 93 |
Engine *e; |
94 |
||
538
5dd99f3b7eca
(svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents:
534
diff
changeset
|
95 |
SetDParam(0, avi->base_cost * (_price.aircraft_base>>3)>>5); |
5dd99f3b7eca
(svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents:
534
diff
changeset
|
96 |
SetDParam(1, avi->max_speed * 8); |
5dd99f3b7eca
(svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents:
534
diff
changeset
|
97 |
SetDParam(2, avi->passanger_capacity); |
5dd99f3b7eca
(svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents:
534
diff
changeset
|
98 |
SetDParam(3, avi->mail_capacity); |
5dd99f3b7eca
(svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents:
534
diff
changeset
|
99 |
SetDParam(4, avi->running_cost * _price.aircraft_running >> 8); |
0 | 100 |
|
101 |
e = &_engines[selected_id]; |
|
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
102 |
SetDParam(6, e->lifelength); |
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
103 |
SetDParam(7, e->reliability * 100 >> 16); |
0 | 104 |
ConvertDayToYMD(&ymd, e->intro_date); |
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
105 |
SetDParam(5, ymd.year + 1920); |
0 | 106 |
|
107 |
DrawString(2, 111, STR_A007_COST_SPEED_CAPACITY_PASSENGERS, 0); |
|
108 |
} |
|
109 |
} |
|
110 |
} break; |
|
111 |
||
112 |
case WE_CLICK: |
|
113 |
switch(e->click.widget) { |
|
114 |
case 2: { /* listbox */ |
|
115 |
uint i = (e->click.pt.y - 14) / 24; |
|
116 |
if (i < 4) { |
|
117 |
WP(w,buildtrain_d).sel_index = i + w->vscroll.pos; |
|
118 |
SetWindowDirty(w); |
|
119 |
} |
|
120 |
} break; |
|
121 |
||
122 |
case 5: { /* build */ |
|
123 |
int sel_eng = WP(w,buildtrain_d).sel_engine; |
|
124 |
if (sel_eng != -1) |
|
125 |
DoCommandP(w->window_number, sel_eng, 0, CcBuildAircraft, CMD_BUILD_AIRCRAFT | CMD_MSG(STR_A008_CAN_T_BUILD_AIRCRAFT)); |
|
126 |
} break; |
|
127 |
||
128 |
case 6: /* rename */ |
|
129 |
WP(w,buildtrain_d).rename_engine = WP(w,buildtrain_d).sel_engine; |
|
130 |
ShowQueryString( |
|
131 |
GetCustomEngineName(WP(w,buildtrain_d).sel_engine), |
|
132 |
STR_A039_RENAME_AIRCRAFT_TYPE, |
|
133 |
31, |
|
134 |
160, |
|
135 |
w->window_class, |
|
136 |
w->window_number); |
|
137 |
break; |
|
138 |
} |
|
139 |
break; |
|
140 |
||
141 |
case WE_4: |
|
142 |
if (w->window_number != 0 && !FindWindowById(WC_VEHICLE_DEPOT, w->window_number)) { |
|
143 |
DeleteWindow(w); |
|
144 |
} |
|
145 |
break; |
|
146 |
||
147 |
case WE_ON_EDIT_TEXT: { |
|
148 |
byte *b = e->edittext.str; |
|
149 |
if (*b == 0) |
|
150 |
return; |
|
151 |
memcpy(_decode_parameters, b, 32); |
|
152 |
DoCommandP(0, WP(w,buildtrain_d).rename_engine, 0, NULL, CMD_RENAME_ENGINE | CMD_MSG(STR_A03A_CAN_T_RENAME_AIRCRAFT_TYPE)); |
|
153 |
} break; |
|
154 |
} |
|
155 |
} |
|
156 |
||
157 |
static const Widget _new_aircraft_widgets[] = { |
|
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
174
diff
changeset
|
158 |
{ WWT_TEXTBTN, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
174
diff
changeset
|
159 |
{ WWT_CAPTION, 14, 11, 239, 0, 13, STR_A005_NEW_AIRCRAFT, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
174
diff
changeset
|
160 |
{ WWT_MATRIX, 14, 0, 228, 14, 109, 0x401, STR_A025_AIRCRAFT_SELECTION_LIST}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
174
diff
changeset
|
161 |
{ WWT_SCROLLBAR, 14, 229, 239, 14, 109, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
174
diff
changeset
|
162 |
{ WWT_IMGBTN, 14, 0, 239, 110, 161, 0x0, STR_NULL}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
174
diff
changeset
|
163 |
{ WWT_PUSHTXTBTN, 14, 0, 119, 162, 173, STR_A006_BUILD_AIRCRAFT, STR_A026_BUILD_THE_HIGHLIGHTED_AIRCRAFT}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
174
diff
changeset
|
164 |
{ WWT_PUSHTXTBTN, 14, 120, 239, 162, 173, STR_A037_RENAME, STR_A038_RENAME_AIRCRAFT_TYPE}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
174
diff
changeset
|
165 |
{ WIDGETS_END}, |
0 | 166 |
}; |
167 |
||
168 |
static const WindowDesc _new_aircraft_desc = { |
|
169 |
-1, -1, 240, 174, |
|
170 |
WC_BUILD_VEHICLE,0, |
|
171 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, |
|
172 |
_new_aircraft_widgets, |
|
173 |
NewAircraftWndProc |
|
174 |
}; |
|
175 |
||
176 |
static void ShowBuildAircraftWindow(uint tile) |
|
177 |
{ |
|
178 |
Window *w; |
|
179 |
||
180 |
DeleteWindowById(WC_BUILD_VEHICLE, tile); |
|
181 |
||
182 |
w = AllocateWindowDesc(&_new_aircraft_desc); |
|
183 |
w->window_number = tile; |
|
184 |
w->vscroll.cap = 4; |
|
185 |
||
186 |
if (tile != 0) { |
|
187 |
w->caption_color = _map_owner[tile]; |
|
188 |
} else { |
|
189 |
w->caption_color = _local_player; |
|
190 |
} |
|
191 |
} |
|
192 |
||
193 |
const byte _aircraft_refit_normal[] = { 0,1,4,5,6,7,8,9,10,0xFF }; |
|
194 |
const byte _aircraft_refit_arctic[] = { 0,1,4,5,6,7,9,11,10,0xFF }; |
|
195 |
const byte _aircraft_refit_desert[] = { 0,4,5,8,6,7,9,10,0xFF }; |
|
196 |
const byte _aircraft_refit_candy[] = { 0,1,3,5,7,8,9,6,4,10,11,0xFF }; |
|
197 |
||
198 |
const byte * const _aircraft_refit_types[4] = { |
|
199 |
_aircraft_refit_normal, _aircraft_refit_arctic, _aircraft_refit_desert, _aircraft_refit_candy |
|
200 |
}; |
|
201 |
||
202 |
static void AircraftRefitWndProc(Window *w, WindowEvent *e) |
|
203 |
{ |
|
204 |
switch(e->event) { |
|
205 |
case WE_PAINT: { |
|
206 |
Vehicle *v = &_vehicles[w->window_number]; |
|
207 |
const byte *b; |
|
208 |
int sel; |
|
209 |
int x,y; |
|
210 |
byte color; |
|
211 |
int cargo; |
|
212 |
||
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
213 |
SetDParam(0, v->string_id); |
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
214 |
SetDParam(1, v->unitnumber); |
0 | 215 |
DrawWindowWidgets(w); |
216 |
||
217 |
DrawString(1, 15, STR_A040_SELECT_CARGO_TYPE_TO_CARRY, 0); |
|
218 |
||
381
94c4794d6bd4
(svn r570) -newgrf: Support for custom aircrafts via GRF files. Planeset seems to work :). Also use aircraft_vehinfo() instead of the old tables (pasky).
darkvater
parents:
243
diff
changeset
|
219 |
/* TODO: Support for custom GRFSpecial-specified refitting! --pasky */ |
94c4794d6bd4
(svn r570) -newgrf: Support for custom aircrafts via GRF files. Planeset seems to work :). Also use aircraft_vehinfo() instead of the old tables (pasky).
darkvater
parents:
243
diff
changeset
|
220 |
|
0 | 221 |
cargo = -1; |
222 |
x = 6; |
|
223 |
y = 25; |
|
224 |
sel = WP(w,refit_d).sel; |
|
382
c0b43541ed8e
(svn r572) -newgrf: Support for custom (newGRF-yielded) refit masks for trains and aircrafts (pasky).
darkvater
parents:
381
diff
changeset
|
225 |
|
c0b43541ed8e
(svn r572) -newgrf: Support for custom (newGRF-yielded) refit masks for trains and aircrafts (pasky).
darkvater
parents:
381
diff
changeset
|
226 |
#define show_cargo(ctype) { \ |
c0b43541ed8e
(svn r572) -newgrf: Support for custom (newGRF-yielded) refit masks for trains and aircrafts (pasky).
darkvater
parents:
381
diff
changeset
|
227 |
color = 16; \ |
c0b43541ed8e
(svn r572) -newgrf: Support for custom (newGRF-yielded) refit masks for trains and aircrafts (pasky).
darkvater
parents:
381
diff
changeset
|
228 |
if (sel == 0) { \ |
c0b43541ed8e
(svn r572) -newgrf: Support for custom (newGRF-yielded) refit masks for trains and aircrafts (pasky).
darkvater
parents:
381
diff
changeset
|
229 |
cargo = ctype; \ |
c0b43541ed8e
(svn r572) -newgrf: Support for custom (newGRF-yielded) refit masks for trains and aircrafts (pasky).
darkvater
parents:
381
diff
changeset
|
230 |
color = 12; \ |
c0b43541ed8e
(svn r572) -newgrf: Support for custom (newGRF-yielded) refit masks for trains and aircrafts (pasky).
darkvater
parents:
381
diff
changeset
|
231 |
} \ |
c0b43541ed8e
(svn r572) -newgrf: Support for custom (newGRF-yielded) refit masks for trains and aircrafts (pasky).
darkvater
parents:
381
diff
changeset
|
232 |
sel--; \ |
c0b43541ed8e
(svn r572) -newgrf: Support for custom (newGRF-yielded) refit masks for trains and aircrafts (pasky).
darkvater
parents:
381
diff
changeset
|
233 |
DrawString(x, y, _cargoc.names_s[ctype], color); \ |
c0b43541ed8e
(svn r572) -newgrf: Support for custom (newGRF-yielded) refit masks for trains and aircrafts (pasky).
darkvater
parents:
381
diff
changeset
|
234 |
y += 10; \ |
c0b43541ed8e
(svn r572) -newgrf: Support for custom (newGRF-yielded) refit masks for trains and aircrafts (pasky).
darkvater
parents:
381
diff
changeset
|
235 |
} |
c0b43541ed8e
(svn r572) -newgrf: Support for custom (newGRF-yielded) refit masks for trains and aircrafts (pasky).
darkvater
parents:
381
diff
changeset
|
236 |
|
c0b43541ed8e
(svn r572) -newgrf: Support for custom (newGRF-yielded) refit masks for trains and aircrafts (pasky).
darkvater
parents:
381
diff
changeset
|
237 |
if (_engine_refit_masks[v->engine_type]) { |
c0b43541ed8e
(svn r572) -newgrf: Support for custom (newGRF-yielded) refit masks for trains and aircrafts (pasky).
darkvater
parents:
381
diff
changeset
|
238 |
uint32 mask = _engine_refit_masks[v->engine_type]; |
c0b43541ed8e
(svn r572) -newgrf: Support for custom (newGRF-yielded) refit masks for trains and aircrafts (pasky).
darkvater
parents:
381
diff
changeset
|
239 |
int cid = 0; |
c0b43541ed8e
(svn r572) -newgrf: Support for custom (newGRF-yielded) refit masks for trains and aircrafts (pasky).
darkvater
parents:
381
diff
changeset
|
240 |
|
c0b43541ed8e
(svn r572) -newgrf: Support for custom (newGRF-yielded) refit masks for trains and aircrafts (pasky).
darkvater
parents:
381
diff
changeset
|
241 |
for (; mask; mask >>= 1, cid++) { |
c0b43541ed8e
(svn r572) -newgrf: Support for custom (newGRF-yielded) refit masks for trains and aircrafts (pasky).
darkvater
parents:
381
diff
changeset
|
242 |
if (!(mask & 1)) // not this cid |
c0b43541ed8e
(svn r572) -newgrf: Support for custom (newGRF-yielded) refit masks for trains and aircrafts (pasky).
darkvater
parents:
381
diff
changeset
|
243 |
continue; |
c0b43541ed8e
(svn r572) -newgrf: Support for custom (newGRF-yielded) refit masks for trains and aircrafts (pasky).
darkvater
parents:
381
diff
changeset
|
244 |
if (!(_local_cargo_id_landscape[cid] & (1 << _opt.landscape))) // not in this landscape |
c0b43541ed8e
(svn r572) -newgrf: Support for custom (newGRF-yielded) refit masks for trains and aircrafts (pasky).
darkvater
parents:
381
diff
changeset
|
245 |
continue; |
c0b43541ed8e
(svn r572) -newgrf: Support for custom (newGRF-yielded) refit masks for trains and aircrafts (pasky).
darkvater
parents:
381
diff
changeset
|
246 |
|
c0b43541ed8e
(svn r572) -newgrf: Support for custom (newGRF-yielded) refit masks for trains and aircrafts (pasky).
darkvater
parents:
381
diff
changeset
|
247 |
show_cargo(_local_cargo_id_ctype[cid]); |
0 | 248 |
} |
382
c0b43541ed8e
(svn r572) -newgrf: Support for custom (newGRF-yielded) refit masks for trains and aircrafts (pasky).
darkvater
parents:
381
diff
changeset
|
249 |
|
c0b43541ed8e
(svn r572) -newgrf: Support for custom (newGRF-yielded) refit masks for trains and aircrafts (pasky).
darkvater
parents:
381
diff
changeset
|
250 |
} else { // generic refit list |
c0b43541ed8e
(svn r572) -newgrf: Support for custom (newGRF-yielded) refit masks for trains and aircrafts (pasky).
darkvater
parents:
381
diff
changeset
|
251 |
b = _aircraft_refit_types[_opt.landscape]; |
c0b43541ed8e
(svn r572) -newgrf: Support for custom (newGRF-yielded) refit masks for trains and aircrafts (pasky).
darkvater
parents:
381
diff
changeset
|
252 |
do { |
c0b43541ed8e
(svn r572) -newgrf: Support for custom (newGRF-yielded) refit masks for trains and aircrafts (pasky).
darkvater
parents:
381
diff
changeset
|
253 |
show_cargo(*b); |
c0b43541ed8e
(svn r572) -newgrf: Support for custom (newGRF-yielded) refit masks for trains and aircrafts (pasky).
darkvater
parents:
381
diff
changeset
|
254 |
} while (*++b != 0xFF); |
c0b43541ed8e
(svn r572) -newgrf: Support for custom (newGRF-yielded) refit masks for trains and aircrafts (pasky).
darkvater
parents:
381
diff
changeset
|
255 |
} |
c0b43541ed8e
(svn r572) -newgrf: Support for custom (newGRF-yielded) refit masks for trains and aircrafts (pasky).
darkvater
parents:
381
diff
changeset
|
256 |
|
c0b43541ed8e
(svn r572) -newgrf: Support for custom (newGRF-yielded) refit masks for trains and aircrafts (pasky).
darkvater
parents:
381
diff
changeset
|
257 |
#undef show_cargo |
0 | 258 |
|
259 |
WP(w,refit_d).cargo = cargo; |
|
260 |
||
261 |
if (cargo != -1) { |
|
262 |
int32 cost = DoCommandByTile(v->tile, v->index, cargo, DC_QUERY_COST, CMD_REFIT_AIRCRAFT); |
|
263 |
if (cost != CMD_ERROR) { |
|
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
264 |
SetDParam(2, cost); |
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
265 |
SetDParam(0, _cargoc.names_long_p[cargo]); |
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
266 |
SetDParam(1, _aircraft_refit_capacity); |
0 | 267 |
DrawString(1, 137, STR_A041_NEW_CAPACITY_COST_OF_REFIT, 0); |
268 |
} |
|
269 |
} |
|
270 |
||
271 |
break; |
|
272 |
} |
|
273 |
||
274 |
case WE_CLICK: |
|
275 |
switch(e->click.widget) { |
|
276 |
case 2: { /* listbox */ |
|
277 |
int y = e->click.pt.y - 25; |
|
278 |
if (y >= 0) { |
|
279 |
WP(w,refit_d).sel = y / 10; |
|
280 |
SetWindowDirty(w); |
|
281 |
} |
|
282 |
} break; |
|
283 |
case 4: /* refit button */ |
|
284 |
if (WP(w,refit_d).cargo != 0xFF) { |
|
285 |
Vehicle *v = &_vehicles[w->window_number]; |
|
286 |
if (DoCommandP(v->tile, v->index, WP(w,refit_d).cargo, NULL, CMD_REFIT_AIRCRAFT | CMD_MSG(STR_A042_CAN_T_REFIT_AIRCRAFT))) |
|
287 |
DeleteWindow(w); |
|
288 |
} |
|
289 |
break; |
|
290 |
} |
|
291 |
break; |
|
292 |
} |
|
293 |
} |
|
294 |
||
295 |
static const Widget _aircraft_refit_widgets[] = { |
|
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
174
diff
changeset
|
296 |
{ WWT_TEXTBTN, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
174
diff
changeset
|
297 |
{ WWT_CAPTION, 14, 11, 239, 0, 13, STR_A03C_REFIT, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
174
diff
changeset
|
298 |
{ WWT_IMGBTN, 14, 0, 239, 14, 135, 0x0, STR_A03E_SELECT_TYPE_OF_CARGO_FOR}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
174
diff
changeset
|
299 |
{ WWT_IMGBTN, 14, 0, 239, 136, 157, 0x0, STR_NULL}, |
0 | 300 |
{ WWT_PUSHTXTBTN, 14, 0, 239, 158, 169, STR_A03D_REFIT_AIRCRAFT, STR_A03F_REFIT_AIRCRAFT_TO_CARRY}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
174
diff
changeset
|
301 |
{ WIDGETS_END}, |
0 | 302 |
}; |
303 |
||
304 |
static const WindowDesc _aircraft_refit_desc = { |
|
305 |
-1,-1, 240, 170, |
|
306 |
WC_VEHICLE_REFIT,WC_VEHICLE_VIEW, |
|
307 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, |
|
308 |
_aircraft_refit_widgets, |
|
309 |
AircraftRefitWndProc |
|
310 |
}; |
|
311 |
||
312 |
static void ShowAircraftRefitWindow(Vehicle *v) |
|
313 |
{ |
|
314 |
Window *w; |
|
315 |
||
316 |
DeleteWindowById(WC_VEHICLE_REFIT, v->index); |
|
317 |
||
318 |
_alloc_wnd_parent_num = v->index; |
|
319 |
w = AllocateWindowDesc(&_aircraft_refit_desc); |
|
320 |
w->window_number = v->index; |
|
321 |
w->caption_color = v->owner; |
|
322 |
WP(w,refit_d).sel = -1; |
|
323 |
} |
|
324 |
||
325 |
static void AircraftDetailsWndProc(Window *w, WindowEvent *e) |
|
326 |
{ |
|
327 |
int mod; |
|
328 |
Vehicle *v = &_vehicles[w->window_number], *u; |
|
329 |
||
330 |
switch(e->event) { |
|
331 |
case WE_PAINT: |
|
332 |
w->disabled_state = v->owner == _local_player ? 0 : (1 << 2); |
|
156
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
10
diff
changeset
|
333 |
if (!_patches.servint_aircraft) // disable service-scroller when interval is set to disabled |
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
10
diff
changeset
|
334 |
w->disabled_state |= (1 << 5) | (1 << 6); |
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
10
diff
changeset
|
335 |
|
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
336 |
SetDParam(0, v->string_id); |
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
337 |
SetDParam(1, v->unitnumber); |
0 | 338 |
DrawWindowWidgets(w); |
339 |
||
340 |
/* Draw running cost */ |
|
341 |
{ |
|
342 |
int year = v->age / 366; |
|
343 |
StringID str; |
|
344 |
||
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
345 |
SetDParam(1, year); |
0 | 346 |
|
347 |
str = STR_0199_YEAR; |
|
348 |
if (year != 1) { |
|
349 |
str++; |
|
350 |
if (v->max_age - 366 < v->age) |
|
351 |
str++; |
|
352 |
} |
|
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
353 |
SetDParam(0, str); |
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
354 |
SetDParam(2, v->max_age / 366); |
538
5dd99f3b7eca
(svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents:
534
diff
changeset
|
355 |
SetDParam(3, _price.aircraft_running * AircraftVehInfo(v->engine_type)->running_cost >> 8); |
0 | 356 |
DrawString(2, 15, STR_A00D_AGE_RUNNING_COST_YR, 0); |
357 |
} |
|
358 |
||
359 |
/* Draw max speed */ |
|
360 |
{ |
|
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
361 |
SetDParam(0, v->max_speed * 8); |
0 | 362 |
DrawString(2, 25, STR_A00E_MAX_SPEED, 0); |
363 |
} |
|
364 |
||
365 |
/* Draw profit */ |
|
366 |
{ |
|
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
367 |
SetDParam(0, v->profit_this_year); |
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
368 |
SetDParam(1, v->profit_last_year); |
0 | 369 |
DrawString(2, 35, STR_A00F_PROFIT_THIS_YEAR_LAST_YEAR, 0); |
370 |
} |
|
371 |
||
372 |
/* Draw breakdown & reliability */ |
|
373 |
{ |
|
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
374 |
SetDParam(0, v->reliability * 100 >> 16); |
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
375 |
SetDParam(1, v->breakdowns_since_last_service); |
0 | 376 |
DrawString(2, 45, STR_A010_RELIABILITY_BREAKDOWNS, 0); |
377 |
} |
|
378 |
||
379 |
/* Draw service interval text */ |
|
380 |
{ |
|
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
381 |
SetDParam(0, v->service_interval); |
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
382 |
SetDParam(1, v->date_of_last_service); |
156
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
10
diff
changeset
|
383 |
DrawString(13, 103, _patches.servint_ispercent?STR_SERVICING_INTERVAL_PERCENT:STR_883C_SERVICING_INTERVAL_DAYS, 0); |
0 | 384 |
} |
385 |
||
386 |
DrawAircraftImage(v, 3, 57, INVALID_VEHICLE); |
|
387 |
||
388 |
{ |
|
389 |
int y = 57; |
|
390 |
||
391 |
do { |
|
392 |
if (v->subtype <= 2) { |
|
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
393 |
SetDParam(0, GetCustomEngineName(v->engine_type)); |
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
394 |
SetDParam(1, 1920 + v->build_year); |
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
395 |
SetDParam(2, v->value); |
0 | 396 |
DrawString(60, y, STR_A011_BUILT_VALUE, 0); |
397 |
y += 10; |
|
398 |
||
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
399 |
SetDParam(0, _cargoc.names_long_p[v->cargo_type]); |
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
400 |
SetDParam(1, v->cargo_cap); |
0 | 401 |
u = v->next; |
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
402 |
SetDParam(2, _cargoc.names_long_p[u->cargo_type]); |
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
403 |
SetDParam(3, u->cargo_cap); |
0 | 404 |
DrawString(60, y, STR_A019_CAPACITY + (u->cargo_cap == 0), 0); |
405 |
y += 14; |
|
406 |
} |
|
407 |
||
408 |
if (v->cargo_count != 0) { |
|
409 |
||
410 |
/* Cargo names (fix pluralness) */ |
|
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
411 |
SetDParam(0, v->cargo_type); |
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
412 |
SetDParam(1, v->cargo_count); |
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
413 |
SetDParam(2, v->cargo_source); |
0 | 414 |
DrawString(60, y, STR_8813_FROM, 0); |
415 |
||
416 |
y += 10; |
|
417 |
} |
|
418 |
} while ( (v=v->next) != NULL); |
|
419 |
} |
|
420 |
break; |
|
421 |
||
422 |
case WE_CLICK: |
|
423 |
switch(e->click.widget) { |
|
424 |
case 2: /* rename */ |
|
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
425 |
SetDParam(0, v->unitnumber); |
0 | 426 |
ShowQueryString(v->string_id, STR_A030_NAME_AIRCRAFT, 31, 150, w->window_class, w->window_number); |
427 |
break; |
|
428 |
||
429 |
case 5: /* increase int */ |
|
156
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
10
diff
changeset
|
430 |
mod = _ctrl_pressed? 5 : 10; |
0 | 431 |
goto change_int; |
432 |
case 6: /* decrease int */ |
|
156
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
10
diff
changeset
|
433 |
mod = _ctrl_pressed?- 5 : -10; |
0 | 434 |
change_int: |
435 |
mod += v->service_interval; |
|
156
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
10
diff
changeset
|
436 |
|
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
10
diff
changeset
|
437 |
/* %-based service interval max 5%-90% |
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
10
diff
changeset
|
438 |
day-based service interval max 30-800 days */ |
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
10
diff
changeset
|
439 |
mod = _patches.servint_ispercent ? clamp(mod, MIN_SERVINT_PERCENT, MAX_SERVINT_PERCENT) : clamp(mod, MIN_SERVINT_DAYS, MAX_SERVINT_DAYS+1); |
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
10
diff
changeset
|
440 |
if (mod == v->service_interval) |
0 | 441 |
return; |
156
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
10
diff
changeset
|
442 |
|
0 | 443 |
DoCommandP(v->tile, v->index, mod, NULL, |
444 |
CMD_CHANGE_AIRCRAFT_SERVICE_INT | CMD_MSG(STR_018A_CAN_T_CHANGE_SERVICING)); |
|
445 |
break; |
|
446 |
} |
|
447 |
break; |
|
448 |
||
449 |
case WE_4: |
|
450 |
if (FindWindowById(WC_VEHICLE_VIEW, w->window_number) == NULL) |
|
451 |
DeleteWindow(w); |
|
452 |
break; |
|
453 |
||
454 |
case WE_ON_EDIT_TEXT: { |
|
455 |
byte *b = e->edittext.str; |
|
456 |
if (*b == 0) |
|
457 |
return; |
|
458 |
memcpy(_decode_parameters, b, 32); |
|
459 |
DoCommandP(0, w->window_number, 0, NULL, CMD_NAME_VEHICLE | CMD_MSG(STR_A031_CAN_T_NAME_AIRCRAFT)); |
|
460 |
} break; |
|
461 |
||
462 |
} |
|
463 |
} |
|
464 |
||
465 |
||
466 |
static const Widget _aircraft_details_widgets[] = { |
|
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
174
diff
changeset
|
467 |
{ WWT_TEXTBTN, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
174
diff
changeset
|
468 |
{ WWT_CAPTION, 14, 11, 349, 0, 13, STR_A00C_DETAILS, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
174
diff
changeset
|
469 |
{ WWT_PUSHTXTBTN, 14, 350, 389, 0, 13, STR_01AA_NAME, STR_A032_NAME_AIRCRAFT}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
174
diff
changeset
|
470 |
{ WWT_IMGBTN, 14, 0, 389, 14, 55, 0x0, STR_NULL}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
174
diff
changeset
|
471 |
{ WWT_IMGBTN, 14, 0, 389, 56, 101, 0x0, STR_NULL}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
174
diff
changeset
|
472 |
{ WWT_PUSHTXTBTN, 14, 0, 10, 102, 107, STR_0188, STR_884D_INCREASE_SERVICING_INTERVAL}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
174
diff
changeset
|
473 |
{ WWT_PUSHTXTBTN, 14, 0, 10, 108, 113, STR_0189, STR_884E_DECREASE_SERVICING_INTERVAL}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
174
diff
changeset
|
474 |
{ WWT_IMGBTN, 14, 11, 389, 102, 113, 0x0, STR_NULL}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
174
diff
changeset
|
475 |
{ WIDGETS_END}, |
0 | 476 |
}; |
477 |
||
478 |
static const WindowDesc _aircraft_details_desc = { |
|
479 |
-1,-1, 390, 114, |
|
480 |
WC_VEHICLE_DETAILS,WC_VEHICLE_VIEW, |
|
481 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, |
|
482 |
_aircraft_details_widgets, |
|
483 |
AircraftDetailsWndProc |
|
484 |
}; |
|
485 |
||
486 |
||
487 |
static void ShowAircraftDetailsWindow(Vehicle *v) |
|
488 |
{ |
|
489 |
Window *w; |
|
490 |
VehicleID veh = v->index; |
|
491 |
||
492 |
DeleteWindowById(WC_VEHICLE_ORDERS, veh); |
|
493 |
DeleteWindowById(WC_VEHICLE_DETAILS, veh); |
|
494 |
||
495 |
_alloc_wnd_parent_num = veh; |
|
496 |
w = AllocateWindowDesc(&_aircraft_details_desc); |
|
497 |
w->window_number = veh; |
|
498 |
w->caption_color = v->owner; |
|
499 |
// w->vscroll.cap = 6; |
|
500 |
// w->traindetails_d.tab = 0; |
|
501 |
} |
|
502 |
||
503 |
||
504 |
static const Widget _aircraft_view_widgets[] = { |
|
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
174
diff
changeset
|
505 |
{ WWT_TEXTBTN, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
755
823358e83abf
(svn r1211) -Feature: Introduce sticky windows to all vehicle windows...Just make sure you do not sticky more than 23 at a time. Also a lot of places in the code invalidated the 'status bar' of the vehicle, referring to it as widget 4. This is now widget 5 and has been #definitized
darkvater
parents:
727
diff
changeset
|
506 |
{ WWT_CAPTION, 14, 11, 237, 0, 13, STR_A00A, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
823358e83abf
(svn r1211) -Feature: Introduce sticky windows to all vehicle windows...Just make sure you do not sticky more than 23 at a time. Also a lot of places in the code invalidated the 'status bar' of the vehicle, referring to it as widget 4. This is now widget 5 and has been #definitized
darkvater
parents:
727
diff
changeset
|
507 |
{ WWT_STICKYBOX, 14, 238, 249, 0, 13, 0x0, STR_STICKY_BUTTON}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
174
diff
changeset
|
508 |
{ WWT_IMGBTN, 14, 0, 231, 14, 103, 0x0, STR_NULL}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
174
diff
changeset
|
509 |
{ WWT_6, 14, 2, 229, 16, 101, 0x0, STR_NULL}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
174
diff
changeset
|
510 |
{ WWT_PUSHIMGBTN, 14, 0, 249, 104, 115, 0x0, STR_A027_CURRENT_AIRCRAFT_ACTION}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
174
diff
changeset
|
511 |
{ WWT_PUSHIMGBTN, 14, 232, 249, 14, 31, 0x2AB, STR_A029_CENTER_MAIN_VIEW_ON_AIRCRAFT}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
174
diff
changeset
|
512 |
{ WWT_PUSHIMGBTN, 14, 232, 249, 32, 49, 0x2AF, STR_A02A_SEND_AIRCRAFT_TO_HANGAR}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
174
diff
changeset
|
513 |
{ WWT_PUSHIMGBTN, 14, 232, 249, 50, 67, 0x2B4, STR_A03B_REFIT_AIRCRAFT_TO_CARRY}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
174
diff
changeset
|
514 |
{ WWT_PUSHIMGBTN, 14, 232, 249, 68, 85, 0x2B2, STR_A028_SHOW_AIRCRAFT_S_ORDERS}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
174
diff
changeset
|
515 |
{ WWT_PUSHIMGBTN, 14, 232, 249, 86, 103, 0x2B3, STR_A02B_SHOW_AIRCRAFT_DETAILS}, |
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
174
diff
changeset
|
516 |
{ WIDGETS_END}, |
0 | 517 |
}; |
518 |
||
519 |
static void AircraftViewWndProc(Window *w, WindowEvent *e) |
|
520 |
{ |
|
521 |
switch(e->event) { |
|
522 |
case WE_PAINT: { |
|
523 |
Vehicle *v = &_vehicles[w->window_number]; |
|
755
823358e83abf
(svn r1211) -Feature: Introduce sticky windows to all vehicle windows...Just make sure you do not sticky more than 23 at a time. Also a lot of places in the code invalidated the 'status bar' of the vehicle, referring to it as widget 4. This is now widget 5 and has been #definitized
darkvater
parents:
727
diff
changeset
|
524 |
uint32 disabled = 1<<8; |
0 | 525 |
StringID str; |
526 |
||
527 |
{ |
|
528 |
uint tile = v->tile; |
|
529 |
if (IS_TILETYPE(tile, MP_STATION) && |
|
530 |
(_map5[tile] == 32 || _map5[tile] == 65) && |
|
531 |
v->vehstatus&VS_STOPPED) |
|
532 |
disabled = 0; |
|
533 |
} |
|
534 |
||
535 |
if (v->owner != _local_player) |
|
755
823358e83abf
(svn r1211) -Feature: Introduce sticky windows to all vehicle windows...Just make sure you do not sticky more than 23 at a time. Also a lot of places in the code invalidated the 'status bar' of the vehicle, referring to it as widget 4. This is now widget 5 and has been #definitized
darkvater
parents:
727
diff
changeset
|
536 |
disabled |= 1<<8 | 1<<7; |
0 | 537 |
w->disabled_state = disabled; |
538 |
||
539 |
/* draw widgets & caption */ |
|
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
540 |
SetDParam(0, v->string_id); |
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
541 |
SetDParam(1, v->unitnumber); |
0 | 542 |
DrawWindowWidgets(w); |
543 |
||
544 |
/* draw the flag */ |
|
545 |
DrawSprite((v->vehstatus & VS_STOPPED) ? 0xC12 : 0xC13, 2, 105); |
|
546 |
||
547 |
if (v->vehstatus & VS_CRASHED) { |
|
548 |
str = STR_8863_CRASHED; |
|
549 |
} else if (v->vehstatus & VS_STOPPED) { |
|
550 |
str = STR_8861_STOPPED; |
|
551 |
} else { |
|
555
eec6c0294435
(svn r955) Replace uint16 for orders with struct Order
tron
parents:
543
diff
changeset
|
552 |
switch (v->current_order.type) { |
0 | 553 |
case OT_GOTO_STATION: { |
555
eec6c0294435
(svn r955) Replace uint16 for orders with struct Order
tron
parents:
543
diff
changeset
|
554 |
SetDParam(0, v->current_order.station); |
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
555 |
SetDParam(1, v->cur_speed * 8); |
0 | 556 |
str = STR_HEADING_FOR_STATION + _patches.vehicle_speed; |
557 |
} break; |
|
558 |
||
559 |
case OT_GOTO_DEPOT: { |
|
555
eec6c0294435
(svn r955) Replace uint16 for orders with struct Order
tron
parents:
543
diff
changeset
|
560 |
SetDParam(0, v->current_order.station); |
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
561 |
SetDParam(1, v->cur_speed * 8); |
0 | 562 |
str = STR_HEADING_FOR_HANGAR + _patches.vehicle_speed; |
563 |
} break; |
|
564 |
||
565 |
case OT_LOADING: |
|
566 |
str = STR_882F_LOADING_UNLOADING; |
|
567 |
break; |
|
568 |
||
569 |
default: |
|
570 |
if (v->num_orders == 0) { |
|
571 |
str = STR_NO_ORDERS + _patches.vehicle_speed; |
|
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
572 |
SetDParam(0, v->cur_speed * 8); |
0 | 573 |
} else |
574 |
str = STR_EMPTY; |
|
575 |
break; |
|
576 |
} |
|
577 |
} |
|
578 |
||
579 |
DrawStringCentered(125, 105, str, 0); |
|
580 |
DrawWindowViewport(w); |
|
581 |
} break; |
|
582 |
||
583 |
case WE_CLICK: { |
|
584 |
Vehicle *v = &_vehicles[w->window_number]; |
|
585 |
||
586 |
switch(e->click.widget) { |
|
755
823358e83abf
(svn r1211) -Feature: Introduce sticky windows to all vehicle windows...Just make sure you do not sticky more than 23 at a time. Also a lot of places in the code invalidated the 'status bar' of the vehicle, referring to it as widget 4. This is now widget 5 and has been #definitized
darkvater
parents:
727
diff
changeset
|
587 |
case 5: /* start stop */ |
0 | 588 |
DoCommandP(v->tile, v->index, 0, NULL, CMD_START_STOP_AIRCRAFT | CMD_MSG(STR_A016_CAN_T_STOP_START_AIRCRAFT)); |
589 |
break; |
|
755
823358e83abf
(svn r1211) -Feature: Introduce sticky windows to all vehicle windows...Just make sure you do not sticky more than 23 at a time. Also a lot of places in the code invalidated the 'status bar' of the vehicle, referring to it as widget 4. This is now widget 5 and has been #definitized
darkvater
parents:
727
diff
changeset
|
590 |
case 6: /* center main view */ |
0 | 591 |
ScrollMainWindowTo(v->x_pos, v->y_pos); |
592 |
break; |
|
755
823358e83abf
(svn r1211) -Feature: Introduce sticky windows to all vehicle windows...Just make sure you do not sticky more than 23 at a time. Also a lot of places in the code invalidated the 'status bar' of the vehicle, referring to it as widget 4. This is now widget 5 and has been #definitized
darkvater
parents:
727
diff
changeset
|
593 |
case 7: /* goto hangar */ |
0 | 594 |
DoCommandP(v->tile, v->index, 0, NULL, CMD_SEND_AIRCRAFT_TO_HANGAR | CMD_MSG(STR_A012_CAN_T_SEND_AIRCRAFT_TO)); |
595 |
break; |
|
755
823358e83abf
(svn r1211) -Feature: Introduce sticky windows to all vehicle windows...Just make sure you do not sticky more than 23 at a time. Also a lot of places in the code invalidated the 'status bar' of the vehicle, referring to it as widget 4. This is now widget 5 and has been #definitized
darkvater
parents:
727
diff
changeset
|
596 |
case 8: /* refit */ |
0 | 597 |
ShowAircraftRefitWindow(v); |
598 |
break; |
|
755
823358e83abf
(svn r1211) -Feature: Introduce sticky windows to all vehicle windows...Just make sure you do not sticky more than 23 at a time. Also a lot of places in the code invalidated the 'status bar' of the vehicle, referring to it as widget 4. This is now widget 5 and has been #definitized
darkvater
parents:
727
diff
changeset
|
599 |
case 9: /* show orders */ |
0 | 600 |
ShowOrdersWindow(v); |
601 |
break; |
|
755
823358e83abf
(svn r1211) -Feature: Introduce sticky windows to all vehicle windows...Just make sure you do not sticky more than 23 at a time. Also a lot of places in the code invalidated the 'status bar' of the vehicle, referring to it as widget 4. This is now widget 5 and has been #definitized
darkvater
parents:
727
diff
changeset
|
602 |
case 10: /* show details */ |
0 | 603 |
ShowAircraftDetailsWindow(v); |
604 |
break; |
|
605 |
} |
|
606 |
} break; |
|
607 |
||
608 |
case WE_DESTROY: |
|
609 |
DeleteWindowById(WC_VEHICLE_ORDERS, w->window_number); |
|
610 |
DeleteWindowById(WC_VEHICLE_REFIT, w->window_number); |
|
611 |
DeleteWindowById(WC_VEHICLE_DETAILS, w->window_number); |
|
612 |
break; |
|
613 |
} |
|
614 |
} |
|
615 |
||
616 |
||
617 |
static const WindowDesc _aircraft_view_desc = { |
|
618 |
-1,-1, 250, 116, |
|
619 |
WC_VEHICLE_VIEW ,0, |
|
755
823358e83abf
(svn r1211) -Feature: Introduce sticky windows to all vehicle windows...Just make sure you do not sticky more than 23 at a time. Also a lot of places in the code invalidated the 'status bar' of the vehicle, referring to it as widget 4. This is now widget 5 and has been #definitized
darkvater
parents:
727
diff
changeset
|
620 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON, |
0 | 621 |
_aircraft_view_widgets, |
622 |
AircraftViewWndProc |
|
623 |
}; |
|
624 |
||
625 |
||
626 |
void ShowAircraftViewWindow(Vehicle *v) |
|
627 |
{ |
|
628 |
Window *w; |
|
629 |
||
630 |
w = AllocateWindowDescFront(&_aircraft_view_desc, v->index); |
|
631 |
if (w) { |
|
632 |
w->caption_color = v->owner; |
|
633 |
AssignWindowViewport(w, 3, 17, 0xE2, 0x54, w->window_number | (1 << 31), 0); |
|
634 |
} |
|
635 |
} |
|
636 |
||
637 |
static void DrawAircraftDepotWindow(Window *w) |
|
638 |
{ |
|
639 |
uint tile; |
|
640 |
Vehicle *v; |
|
641 |
int num,x,y; |
|
642 |
||
643 |
tile = w->window_number; |
|
644 |
||
645 |
/* setup disabled buttons */ |
|
757 | 646 |
w->disabled_state = (_map_owner[tile]==_local_player) ? 0 : ((1<<4)|(1<<6)); |
0 | 647 |
|
648 |
/* determine amount of items for scroller */ |
|
649 |
num = 0; |
|
650 |
FOR_ALL_VEHICLES(v) { |
|
651 |
if (v->type == VEH_Aircraft && v->subtype <= 2 && v->vehstatus&VS_HIDDEN && |
|
652 |
v->tile == (TileIndex)tile) |
|
653 |
num++; |
|
654 |
} |
|
655 |
SetVScrollCount(w, (num + 3) >> 2); |
|
656 |
||
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
657 |
SetDParam(0, _map2[tile]); |
0 | 658 |
DrawWindowWidgets(w); |
659 |
||
660 |
x = 2; |
|
661 |
y = 15; |
|
662 |
num = w->vscroll.pos * 4; |
|
663 |
||
664 |
FOR_ALL_VEHICLES(v) { |
|
665 |
if (v->type == VEH_Aircraft && |
|
666 |
v->subtype <= 2 && |
|
667 |
v->vehstatus&VS_HIDDEN && |
|
668 |
v->tile == (TileIndex)tile && |
|
669 |
--num < 0 && num >= -8) { |
|
670 |
||
671 |
DrawAircraftImage(v, x+12, y, WP(w,traindepot_d).sel); |
|
672 |
||
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
673 |
SetDParam(0, v->unitnumber); |
0 | 674 |
DrawString(x, y+2, (uint16)(v->max_age-366) >= v->age ? STR_00E2 : STR_00E3, 0); |
675 |
||
676 |
DrawSprite( (v->vehstatus & VS_STOPPED) ? 0xC12 : 0xC13, x, y+12); |
|
677 |
||
678 |
if ((x+=74) == 2+74*4) { |
|
679 |
x -= 74*4; |
|
680 |
y += 24; |
|
681 |
} |
|
682 |
} |
|
683 |
} |
|
684 |
} |
|
685 |
||
686 |
static int GetVehicleFromAircraftDepotWndPt(Window *w, int x, int y, Vehicle **veh) { |
|
687 |
uint xt,yt,xm,ym; |
|
688 |
Vehicle *v; |
|
689 |
uint tile; |
|
690 |
int pos; |
|
691 |
||
692 |
xt = x / 74; |
|
693 |
xm = x % 74; |
|
694 |
if (xt >= 4) |
|
695 |
return 1; |
|
696 |
||
697 |
yt = (y - 14) / 24; |
|
698 |
ym = (y - 14) % 24; |
|
699 |
if (yt >= 2) |
|
700 |
return 1; |
|
701 |
||
702 |
pos = (yt + w->vscroll.pos) * 4 + xt; |
|
703 |
||
704 |
tile = w->window_number; |
|
705 |
FOR_ALL_VEHICLES(v) { |
|
706 |
if (v->type == VEH_Aircraft && |
|
707 |
v->subtype <= 2 && |
|
708 |
v->vehstatus&VS_HIDDEN && |
|
709 |
v->tile == (TileIndex)tile && |
|
710 |
--pos < 0) { |
|
711 |
*veh = v; |
|
712 |
if (xm >= 12) |
|
713 |
return 0; |
|
714 |
||
715 |
if (ym <= 12) |
|
716 |
return -1; /* show window */ |
|
717 |
||
718 |
return -2; /* start stop */ |
|
719 |
} |
|
720 |
} |
|
721 |
return 1; /* outside */ |
|
722 |
} |
|
723 |
||
724 |
static void AircraftDepotClickAircraft(Window *w, int x, int y) |
|
725 |
{ |
|
726 |
Vehicle *v; |
|
10
c35ab8426202
(svn r11) Feature: Copy/share orders now works from ship depot window for ships and hangar window for aircraft
dominik
parents:
0
diff
changeset
|
727 |
int mode = GetVehicleFromAircraftDepotWndPt(w, x, y, &v); |
0 | 728 |
|
10
c35ab8426202
(svn r11) Feature: Copy/share orders now works from ship depot window for ships and hangar window for aircraft
dominik
parents:
0
diff
changeset
|
729 |
// share / copy orders |
c35ab8426202
(svn r11) Feature: Copy/share orders now works from ship depot window for ships and hangar window for aircraft
dominik
parents:
0
diff
changeset
|
730 |
if (_thd.place_mode && mode <= 0) { _place_clicked_vehicle = v; return; } |
c35ab8426202
(svn r11) Feature: Copy/share orders now works from ship depot window for ships and hangar window for aircraft
dominik
parents:
0
diff
changeset
|
731 |
|
c35ab8426202
(svn r11) Feature: Copy/share orders now works from ship depot window for ships and hangar window for aircraft
dominik
parents:
0
diff
changeset
|
732 |
switch(mode) { |
0 | 733 |
case 1: |
734 |
return; |
|
735 |
||
10
c35ab8426202
(svn r11) Feature: Copy/share orders now works from ship depot window for ships and hangar window for aircraft
dominik
parents:
0
diff
changeset
|
736 |
case 0: // start dragging of vehicle |
0 | 737 |
if (v != NULL) { |
738 |
WP(w,traindepot_d).sel = v->index; |
|
739 |
SetWindowDirty(w); |
|
740 |
SetObjectToPlaceWnd( SPRITE_PALETTE(PLAYER_SPRITE_COLOR(v->owner)) + GetAircraftImage(v, 6), 4, w); |
|
741 |
} |
|
742 |
break; |
|
743 |
||
10
c35ab8426202
(svn r11) Feature: Copy/share orders now works from ship depot window for ships and hangar window for aircraft
dominik
parents:
0
diff
changeset
|
744 |
case -1: // show info window |
0 | 745 |
ShowAircraftViewWindow(v); |
746 |
break; |
|
747 |
||
10
c35ab8426202
(svn r11) Feature: Copy/share orders now works from ship depot window for ships and hangar window for aircraft
dominik
parents:
0
diff
changeset
|
748 |
case -2: // click start/stop flag |
0 | 749 |
DoCommandP(v->tile, v->index, 0, NULL, CMD_START_STOP_AIRCRAFT | CMD_MSG(STR_A016_CAN_T_STOP_START_AIRCRAFT)); |
750 |
break; |
|
751 |
||
752 |
default: |
|
753 |
NOT_REACHED(); |
|
754 |
} |
|
755 |
} |
|
756 |
||
757 |
static const Widget _aircraft_depot_widgets[] = { |
|
758 |
{ WWT_TEXTBTN, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
|
757 | 759 |
{ WWT_CAPTION, 14, 11, 318, 0, 13, STR_A002_AIRCRAFT_HANGAR, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
760 |
{ WWT_STICKYBOX, 14, 319, 330, 0, 13, 0x0, STR_STICKY_BUTTON}, |
|
0 | 761 |
{ WWT_MATRIX, 14, 0, 295, 14, 61, 0x204, STR_A021_AIRCRAFT_CLICK_ON_AIRCRAFT}, |
762 |
{ WWT_IMGBTN, 14, 296, 319, 14, 61, 0x2A9, STR_A023_DRAG_AIRCRAFT_TO_HERE_TO}, |
|
763 |
{ WWT_SCROLLBAR, 14, 320, 330, 14, 61, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, |
|
764 |
{ WWT_PUSHTXTBTN, 14, 0, 164, 62, 73, STR_A003_NEW_AIRCRAFT, STR_A022_BUILD_NEW_AIRCRAFT}, |
|
765 |
{ WWT_PUSHTXTBTN, 14, 165, 330, 62, 73, STR_00E4_LOCATION, STR_A024_CENTER_MAIN_VIEW_ON_HANGAR}, |
|
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
174
diff
changeset
|
766 |
{ WIDGETS_END}, |
0 | 767 |
}; |
768 |
||
769 |
||
770 |
static void AircraftDepotWndProc(Window *w, WindowEvent *e) |
|
771 |
{ |
|
772 |
switch(e->event) { |
|
773 |
case WE_PAINT: |
|
774 |
DrawAircraftDepotWindow(w); |
|
775 |
break; |
|
776 |
||
777 |
case WE_CLICK: |
|
778 |
switch(e->click.widget) { |
|
757 | 779 |
case 3: /* click aircraft */ |
0 | 780 |
AircraftDepotClickAircraft(w, e->click.pt.x, e->click.pt.y); |
781 |
break; |
|
757 | 782 |
case 6: /* show build aircraft window */ |
0 | 783 |
ShowBuildAircraftWindow(w->window_number); |
784 |
break; |
|
757 | 785 |
case 7: /* scroll to tile */ |
0 | 786 |
ScrollMainWindowToTile(w->window_number); |
787 |
break; |
|
788 |
} |
|
789 |
break; |
|
790 |
||
791 |
case WE_DESTROY: |
|
792 |
DeleteWindowById(WC_BUILD_VEHICLE, w->window_number); |
|
793 |
break; |
|
794 |
||
795 |
case WE_DRAGDROP: { |
|
796 |
switch(e->click.widget) { |
|
757 | 797 |
case 3: { |
0 | 798 |
Vehicle *v; |
799 |
VehicleID sel = WP(w,traindepot_d).sel; |
|
800 |
||
801 |
WP(w,traindepot_d).sel = INVALID_VEHICLE; |
|
802 |
SetWindowDirty(w); |
|
803 |
||
804 |
if (GetVehicleFromAircraftDepotWndPt(w, e->dragdrop.pt.x, e->dragdrop.pt.y, &v) == 0 && |
|
805 |
v != NULL && |
|
806 |
sel == v->index) { |
|
807 |
ShowAircraftViewWindow(v); |
|
808 |
} |
|
809 |
} break; |
|
810 |
||
757 | 811 |
case 4: |
812 |
if (!HASBIT(w->disabled_state, 4) && |
|
0 | 813 |
WP(w,traindepot_d).sel != INVALID_VEHICLE) { |
814 |
Vehicle *v; |
|
815 |
||
757 | 816 |
HandleButtonClick(w, 4); |
0 | 817 |
|
818 |
v = &_vehicles[WP(w,traindepot_d).sel]; |
|
819 |
WP(w,traindepot_d).sel = INVALID_VEHICLE; |
|
820 |
||
821 |
_backup_orders_tile = v->tile; |
|
822 |
BackupVehicleOrders(v, _backup_orders_data); |
|
823 |
||
824 |
if (!DoCommandP(v->tile, v->index, 0, NULL, CMD_SELL_AIRCRAFT | CMD_MSG(STR_A01C_CAN_T_SELL_AIRCRAFT))) |
|
825 |
_backup_orders_tile = 0; |
|
826 |
} |
|
827 |
break; |
|
828 |
default: |
|
829 |
WP(w,traindepot_d).sel = INVALID_VEHICLE; |
|
830 |
SetWindowDirty(w); |
|
831 |
} |
|
832 |
break; |
|
833 |
} |
|
834 |
break; |
|
835 |
} |
|
836 |
} |
|
837 |
||
838 |
||
839 |
||
840 |
static const WindowDesc _aircraft_depot_desc = { |
|
841 |
-1, -1, 331, 74, |
|
842 |
WC_VEHICLE_DEPOT,0, |
|
757 | 843 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON, |
0 | 844 |
_aircraft_depot_widgets, |
845 |
AircraftDepotWndProc |
|
846 |
}; |
|
847 |
||
848 |
||
849 |
void ShowAircraftDepotWindow(uint tile) |
|
850 |
{ |
|
851 |
Window *w; |
|
852 |
||
853 |
w = AllocateWindowDescFront(&_aircraft_depot_desc, tile); |
|
854 |
if (w) { |
|
855 |
w->caption_color = _map_owner[tile]; |
|
856 |
w->vscroll.cap = 2; |
|
857 |
WP(w,traindepot_d).sel = INVALID_VEHICLE; |
|
858 |
_backup_orders_tile = 0; |
|
859 |
} |
|
860 |
} |
|
861 |
||
862 |
static void DrawSmallSchedule(Vehicle *v, int x, int y) { |
|
555
eec6c0294435
(svn r955) Replace uint16 for orders with struct Order
tron
parents:
543
diff
changeset
|
863 |
const Order *sched; |
0 | 864 |
int sel; |
555
eec6c0294435
(svn r955) Replace uint16 for orders with struct Order
tron
parents:
543
diff
changeset
|
865 |
Order ord; |
0 | 866 |
int i = 0; |
867 |
||
868 |
sched = v->schedule_ptr; |
|
869 |
sel = v->cur_order_index; |
|
870 |
||
555
eec6c0294435
(svn r955) Replace uint16 for orders with struct Order
tron
parents:
543
diff
changeset
|
871 |
while ((ord = *sched++).type != OT_NOTHING) { |
0 | 872 |
if (sel == 0) { |
873 |
_stringwidth_base = 0xE0; |
|
874 |
DoDrawString( "\xAF", x-6, y, 16); |
|
875 |
_stringwidth_base = 0; |
|
876 |
} |
|
877 |
sel--; |
|
878 |
||
555
eec6c0294435
(svn r955) Replace uint16 for orders with struct Order
tron
parents:
543
diff
changeset
|
879 |
if (ord.type == OT_GOTO_STATION) { |
eec6c0294435
(svn r955) Replace uint16 for orders with struct Order
tron
parents:
543
diff
changeset
|
880 |
SetDParam(0, ord.station); |
0 | 881 |
DrawString(x, y, STR_A036, 0); |
882 |
||
883 |
y += 6; |
|
884 |
if (++i == 4) |
|
885 |
break; |
|
886 |
} |
|
887 |
} |
|
888 |
} |
|
889 |
||
243
9a40daa560ae
(svn r244) -Fix: Stations were not sorted for non-player-0 players
darkvater
parents:
193
diff
changeset
|
890 |
|
588 | 891 |
static Widget _player_aircraft_widgets[] = { |
892 |
{ WWT_CLOSEBOX, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
|
757 | 893 |
{ WWT_CAPTION, 14, 11, 247, 0, 13, STR_A009_AIRCRAFT, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
894 |
{ WWT_STICKYBOX, 14, 248, 259, 0, 13, 0x0, STR_STICKY_BUTTON}, |
|
727 | 895 |
{ WWT_PUSHTXTBTN, 14, 0, 80, 14, 25, SRT_SORT_BY, STR_SORT_ORDER_TIP}, |
896 |
{ WWT_PANEL, 14, 81, 237, 14, 25, 0x0, STR_SORT_CRITERIA_TIP}, |
|
897 |
{ WWT_CLOSEBOX, 14, 238, 248, 14, 25, STR_0225, STR_SORT_CRITERIA_TIP}, |
|
588 | 898 |
{ WWT_PANEL, 14, 249, 259, 14, 25, 0x0, STR_NULL}, |
899 |
{ WWT_MATRIX, 14, 0, 248, 26, 169, 0x401, STR_A01F_AIRCRAFT_CLICK_ON_AIRCRAFT}, |
|
900 |
{ WWT_SCROLLBAR, 14, 249, 259, 26, 169, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, |
|
901 |
{ WWT_PUSHTXTBTN, 14, 0, 129, 170, 181, STR_A003_NEW_AIRCRAFT, STR_A020_BUILD_NEW_AIRCRAFT_REQUIRES}, |
|
902 |
{ WWT_PANEL, 14, 130, 259, 170, 181, 0x0, STR_NULL}, |
|
903 |
{ WIDGETS_END}, |
|
904 |
}; |
|
164
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
156
diff
changeset
|
905 |
|
588 | 906 |
static Widget _other_player_aircraft_widgets[] = { |
907 |
{ WWT_CLOSEBOX, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
|
757 | 908 |
{ WWT_CAPTION, 14, 11, 247, 0, 13, STR_A009_AIRCRAFT, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
909 |
{ WWT_STICKYBOX, 14, 248, 259, 0, 13, 0x0, STR_STICKY_BUTTON}, |
|
727 | 910 |
{ WWT_PUSHTXTBTN, 14, 0, 80, 14, 25, SRT_SORT_BY, STR_SORT_ORDER_TIP}, |
911 |
{ WWT_PANEL, 14, 81, 237, 14, 25, 0x0, STR_SORT_CRITERIA_TIP}, |
|
912 |
{ WWT_CLOSEBOX, 14, 238, 248, 14, 25, STR_0225, STR_SORT_CRITERIA_TIP}, |
|
588 | 913 |
{ WWT_PANEL, 14, 249, 259, 14, 25, 0x0, STR_NULL}, |
914 |
{ WWT_MATRIX, 14, 0, 248, 26, 169, 0x401, STR_A01F_AIRCRAFT_CLICK_ON_AIRCRAFT}, |
|
915 |
{ WWT_SCROLLBAR, 14, 249, 259, 26, 169, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, |
|
916 |
{ WIDGETS_END}, |
|
917 |
}; |
|
164
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
156
diff
changeset
|
918 |
|
0 | 919 |
static void PlayerAircraftWndProc(Window *w, WindowEvent *e) |
920 |
{ |
|
588 | 921 |
int station = (int)w->window_number >> 16; |
922 |
int owner = w->window_number & 0xff; |
|
923 |
vehiclelist_d *vl = &WP(w, vehiclelist_d); |
|
924 |
||
0 | 925 |
switch(e->event) { |
164
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
156
diff
changeset
|
926 |
case WE_PAINT: { |
588 | 927 |
int x = 2; |
928 |
int y = PLY_WND_PRC__OFFSET_TOP_WIDGET; |
|
929 |
int max; |
|
930 |
int i; |
|
243
9a40daa560ae
(svn r244) -Fix: Stations were not sorted for non-player-0 players
darkvater
parents:
193
diff
changeset
|
931 |
|
588 | 932 |
BuildVehicleList(vl, VEH_Aircraft, owner, station); |
933 |
SortVehicleList(vl); |
|
0 | 934 |
|
588 | 935 |
SetVScrollCount(w, vl->list_length); |
936 |
||
937 |
// disable 'Sort By' tooltip on Unsorted sorting criteria |
|
938 |
if (vl->sort_type == SORT_BY_UNSORTED) |
|
757 | 939 |
w->disabled_state |= (1 << 3); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
940 |
|
0 | 941 |
/* draw the widgets */ |
942 |
{ |
|
588 | 943 |
const Player *p = DEREF_PLAYER(owner); |
944 |
/* XXX hack */ |
|
945 |
if (station == -1) { |
|
946 |
/* Company Name -- (###) Aircraft */ |
|
947 |
SetDParam(0, p->name_1); |
|
948 |
SetDParam(1, p->name_2); |
|
949 |
SetDParam(2, w->vscroll.count); |
|
950 |
_player_aircraft_widgets[1].unkA = STR_A009_AIRCRAFT; |
|
951 |
_other_player_aircraft_widgets[1].unkA = STR_A009_AIRCRAFT; |
|
952 |
} else { |
|
953 |
/* Station Name -- (###) Aircraft */ |
|
954 |
SetDParam(0, DEREF_STATION(station)->index); |
|
955 |
SetDParam(1, w->vscroll.count); |
|
956 |
_player_aircraft_widgets[1].unkA = STR_SCHEDULED_AIRCRAFT; |
|
957 |
_other_player_aircraft_widgets[1].unkA = STR_SCHEDULED_AIRCRAFT; |
|
958 |
} |
|
0 | 959 |
DrawWindowWidgets(w); |
960 |
} |
|
168
79f9ed5b23e6
(svn r169) -Fix: move around sort-widgets a bit so it looks more natural
darkvater
parents:
164
diff
changeset
|
961 |
/* draw sorting criteria string */ |
588 | 962 |
DrawString(85, 15, _vehicle_sort_listing[vl->sort_type], 0x10); |
963 |
/* draw arrow pointing up/down for ascending/descending sorting */ |
|
964 |
DoDrawString( |
|
965 |
vl->flags & VL_DESC ? "\xAA" : "\xA0", 69, 15, 0x10); |
|
0 | 966 |
|
588 | 967 |
max = min(w->vscroll.pos + w->vscroll.cap, vl->list_length); |
968 |
for (i = w->vscroll.pos; i < max; ++i) { |
|
969 |
Vehicle *v = DEREF_VEHICLE(vl->sort_list[i].index); |
|
970 |
StringID str; |
|
0 | 971 |
|
588 | 972 |
assert(v->type == VEH_Aircraft && v->subtype <= 2); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
973 |
|
588 | 974 |
DrawAircraftImage(v, x + 19, y + 6, INVALID_VEHICLE); |
975 |
DrawVehicleProfitButton(v, x, y + 13); |
|
164
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
156
diff
changeset
|
976 |
|
588 | 977 |
SetDParam(0, v->unitnumber); |
978 |
if (IsAircraftHangarTile(v->tile)) |
|
979 |
str = STR_021F; |
|
980 |
else |
|
981 |
str = v->age > v->max_age - 366 ? STR_00E3 : STR_00E2; |
|
982 |
DrawString(x, y + 2, str, 0); |
|
164
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
156
diff
changeset
|
983 |
|
588 | 984 |
SetDParam(0, v->profit_this_year); |
985 |
SetDParam(1, v->profit_last_year); |
|
986 |
DrawString(x + 19, y + 28, STR_0198_PROFIT_THIS_YEAR_LAST_YEAR, 0); |
|
987 |
||
988 |
if (v->string_id != STR_SV_AIRCRAFT_NAME) { |
|
989 |
SetDParam(0, v->string_id); |
|
990 |
DrawString(x + 19, y, STR_01AB, 0); |
|
0 | 991 |
} |
588 | 992 |
|
993 |
DrawSmallSchedule(v, x + 136, y); |
|
994 |
||
995 |
y += PLY_WND_PRC__SIZE_OF_ROW_BIG; |
|
0 | 996 |
} |
164
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
156
diff
changeset
|
997 |
} break; |
0 | 998 |
|
164
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
156
diff
changeset
|
999 |
case WE_CLICK: { |
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
156
diff
changeset
|
1000 |
switch(e->click.widget) { |
757 | 1001 |
case 3: /* Flip sorting method ascending/descending */ |
588 | 1002 |
vl->flags ^= VL_DESC; |
1003 |
vl->flags |= VL_RESORT; |
|
164
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
156
diff
changeset
|
1004 |
SetWindowDirty(w); |
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
156
diff
changeset
|
1005 |
break; |
588 | 1006 |
|
757 | 1007 |
case 4: case 5:/* Select sorting criteria dropdown menu */ |
1008 |
ShowDropDownMenu(w, _vehicle_sort_listing, vl->sort_type, 5, 0); |
|
164
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
156
diff
changeset
|
1009 |
return; |
588 | 1010 |
|
757 | 1011 |
case 7: { /* Matrix to show vehicles */ |
174
bd79fb899824
(svn r175) -Fix: [1023771] inconsistent/missing stations in station list. Forgot to change owner-sort after changing function.
darkvater
parents:
168
diff
changeset
|
1012 |
uint32 id_v = (e->click.pt.y - PLY_WND_PRC__OFFSET_TOP_WIDGET) / PLY_WND_PRC__SIZE_OF_ROW_BIG; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
1013 |
|
174
bd79fb899824
(svn r175) -Fix: [1023771] inconsistent/missing stations in station list. Forgot to change owner-sort after changing function.
darkvater
parents:
168
diff
changeset
|
1014 |
if (id_v >= w->vscroll.cap) { return;} // click out of bounds |
164
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
156
diff
changeset
|
1015 |
|
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
156
diff
changeset
|
1016 |
id_v += w->vscroll.pos; |
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
156
diff
changeset
|
1017 |
|
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
156
diff
changeset
|
1018 |
{ |
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
156
diff
changeset
|
1019 |
Vehicle *v; |
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
156
diff
changeset
|
1020 |
|
588 | 1021 |
if (id_v >= vl->list_length) return; // click out of list bound |
164
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
156
diff
changeset
|
1022 |
|
588 | 1023 |
v = DEREF_VEHICLE(vl->sort_list[id_v].index); |
164
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
156
diff
changeset
|
1024 |
|
588 | 1025 |
assert(v->type == VEH_Aircraft && v->subtype <= 2); |
164
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
156
diff
changeset
|
1026 |
|
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
156
diff
changeset
|
1027 |
ShowAircraftViewWindow(v); |
0 | 1028 |
} |
164
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
156
diff
changeset
|
1029 |
} break; |
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
156
diff
changeset
|
1030 |
|
757 | 1031 |
case 9: { /* Build new Vehicle */ |
0 | 1032 |
uint tile; |
1033 |
||
1034 |
tile = _last_built_aircraft_depot_tile; |
|
1035 |
do { |
|
164
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
156
diff
changeset
|
1036 |
if (_map_owner[tile] == _local_player && IsAircraftHangarTile(tile)) { |
0 | 1037 |
ShowAircraftDepotWindow(tile); |
1038 |
ShowBuildAircraftWindow(tile); |
|
1039 |
return; |
|
1040 |
} |
|
1041 |
||
1042 |
tile = TILE_MASK(tile + 1); |
|
1043 |
} while(tile != _last_built_aircraft_depot_tile); |
|
164
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
156
diff
changeset
|
1044 |
|
0 | 1045 |
ShowBuildAircraftWindow(0); |
1046 |
} break; |
|
1047 |
} |
|
164
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
156
diff
changeset
|
1048 |
} break; |
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
156
diff
changeset
|
1049 |
|
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
156
diff
changeset
|
1050 |
case WE_DROPDOWN_SELECT: /* we have selected a dropdown item in the list */ |
588 | 1051 |
if (vl->sort_type != e->dropdown.index) { |
1052 |
// value has changed -> resort |
|
1053 |
vl->flags |= VL_RESORT; |
|
1054 |
vl->sort_type = e->dropdown.index; |
|
164
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
156
diff
changeset
|
1055 |
|
588 | 1056 |
// enable 'Sort By' if a sorter criteria is chosen |
1057 |
if (vl->sort_type != SORT_BY_UNSORTED) |
|
757 | 1058 |
w->disabled_state &= ~(1 << 3); |
588 | 1059 |
} |
164
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
156
diff
changeset
|
1060 |
SetWindowDirty(w); |
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
156
diff
changeset
|
1061 |
break; |
588 | 1062 |
|
164
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
156
diff
changeset
|
1063 |
case WE_CREATE: /* set up resort timer */ |
588 | 1064 |
vl->sort_list = NULL; |
1065 |
vl->flags = VL_REBUILD; |
|
1066 |
vl->sort_type = SORT_BY_UNSORTED; |
|
1067 |
vl->resort_timer = DAY_TICKS * PERIODIC_RESORT_DAYS; |
|
164
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
156
diff
changeset
|
1068 |
break; |
588 | 1069 |
|
164
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
156
diff
changeset
|
1070 |
case WE_TICK: /* resort the list every 20 seconds orso (10 days) */ |
588 | 1071 |
if (--vl->resort_timer == 0) { |
1072 |
DEBUG(misc, 1) ("Periodic resort aircraft list player %d station %d", |
|
1073 |
owner, station); |
|
1074 |
vl->resort_timer = DAY_TICKS * PERIODIC_RESORT_DAYS; |
|
1075 |
vl->flags |= VL_RESORT; |
|
1076 |
SetWindowDirty(w); |
|
164
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
156
diff
changeset
|
1077 |
} |
0 | 1078 |
break; |
1079 |
} |
|
1080 |
} |
|
1081 |
||
1082 |
static const WindowDesc _player_aircraft_desc = { |
|
164
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
156
diff
changeset
|
1083 |
-1, -1, 260, 182, |
0 | 1084 |
WC_AIRCRAFT_LIST,0, |
757 | 1085 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON, |
0 | 1086 |
_player_aircraft_widgets, |
1087 |
PlayerAircraftWndProc |
|
1088 |
}; |
|
1089 |
||
1090 |
static const WindowDesc _other_player_aircraft_desc = { |
|
164
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
156
diff
changeset
|
1091 |
-1, -1, 260, 170, |
0 | 1092 |
WC_AIRCRAFT_LIST,0, |
757 | 1093 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON, |
0 | 1094 |
_other_player_aircraft_widgets, |
1095 |
PlayerAircraftWndProc |
|
1096 |
}; |
|
1097 |
||
588 | 1098 |
void ShowPlayerAircraft(int player, int station) |
0 | 1099 |
{ |
1100 |
Window *w; |
|
1101 |
||
164
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
156
diff
changeset
|
1102 |
if (player == _local_player) { |
588 | 1103 |
w = AllocateWindowDescFront(&_player_aircraft_desc, (station << 16) | player); |
0 | 1104 |
} else { |
588 | 1105 |
w = AllocateWindowDescFront(&_other_player_aircraft_desc, (station << 16) | player); |
0 | 1106 |
} |
1107 |
||
1108 |
if (w) { |
|
1109 |
w->caption_color = w->window_number; |
|
164
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
156
diff
changeset
|
1110 |
w->vscroll.cap = 4; // maximum number of vehicles shown |
0 | 1111 |
} |
1112 |
} |