author | darkvater |
Mon, 06 Sep 2004 18:15:13 +0000 | |
changeset 164 | 0cbdf3c9bde1 |
parent 156 | 8fef5e5752d6 |
child 168 | 79f9ed5b23e6 |
permissions | -rw-r--r-- |
0 | 1 |
#include "stdafx.h" |
2 |
#include "ttd.h" |
|
3 |
||
4 |
#include "window.h" |
|
5 |
#include "gui.h" |
|
6 |
#include "gfx.h" |
|
7 |
#include "vehicle.h" |
|
8 |
#include "viewport.h" |
|
9 |
#include "station.h" |
|
10 |
#include "command.h" |
|
11 |
#include "player.h" |
|
12 |
#include "engine.h" |
|
13 |
||
14 |
||
15 |
static void DrawShipImage(Vehicle *v, int x, int y, VehicleID selection); |
|
16 |
||
17 |
||
18 |
const byte _ship_refit_types[4][16] = { |
|
19 |
{CT_MAIL, CT_COAL, CT_LIVESTOCK, CT_GOODS, CT_GRAIN, CT_WOOD, CT_IRON_ORE, CT_STEEL, CT_VALUABLES, 255}, |
|
20 |
{CT_MAIL, CT_COAL, CT_LIVESTOCK, CT_GOODS, CT_GRAIN, CT_WOOD, CT_PAPER, CT_FOOD, CT_VALUABLES, 255}, |
|
21 |
{CT_MAIL, CT_FRUIT, CT_GOODS, CT_COPPER_ORE, CT_GRAIN, CT_WOOD, CT_WATER, CT_VALUABLES, 255}, |
|
22 |
{CT_MAIL, CT_SUGAR, CT_TOYS, CT_CANDY, CT_COLA, CT_COTTON_CANDY, CT_BUBBLES, CT_TOFFEE, CT_BATTERIES, CT_PLASTIC, CT_FIZZY_DRINKS, 255}, |
|
23 |
}; |
|
24 |
||
25 |
static void ShipRefitWndProc(Window *w, WindowEvent *e) |
|
26 |
{ |
|
27 |
switch(e->event) { |
|
28 |
case WE_PAINT: { |
|
29 |
Vehicle *v = &_vehicles[w->window_number]; |
|
30 |
const byte *b; |
|
31 |
int sel; |
|
32 |
int x,y; |
|
33 |
byte color; |
|
34 |
int cargo; |
|
35 |
||
36 |
SET_DPARAM16(0, v->string_id); |
|
37 |
SET_DPARAM16(1, v->unitnumber); |
|
38 |
DrawWindowWidgets(w); |
|
39 |
||
40 |
DrawString(1, 15, STR_983F_SELECT_CARGO_TYPE_TO_CARRY, 0); |
|
41 |
||
42 |
cargo = -1; |
|
43 |
x = 6; |
|
44 |
y = 25; |
|
45 |
sel = WP(w,refit_d).sel; |
|
46 |
||
47 |
#define show_cargo(ctype) { \ |
|
48 |
color = 16; \ |
|
49 |
if (sel == 0) { \ |
|
50 |
cargo = ctype; \ |
|
51 |
color = 12; \ |
|
52 |
} \ |
|
53 |
sel--; \ |
|
54 |
DrawString(x, y, _cargoc.names_s[ctype], color); \ |
|
55 |
y += 10; \ |
|
56 |
} |
|
57 |
||
58 |
if (_engine_refit_masks[v->engine_type]) { |
|
59 |
uint32 mask = _engine_refit_masks[v->engine_type]; |
|
60 |
int cid = 0; |
|
61 |
||
62 |
for (; mask; mask >>= 1, cid++) { |
|
63 |
if (!(mask & 1)) // not this cid |
|
64 |
continue; |
|
65 |
if (!(_local_cargo_id_landscape[cid] & (1 << _opt.landscape))) // not in this landscape |
|
66 |
continue; |
|
67 |
||
68 |
show_cargo(_local_cargo_id_ctype[cid]); |
|
69 |
} |
|
70 |
||
71 |
} else { // generic refit list |
|
72 |
b = _ship_refit_types[_opt.landscape]; |
|
73 |
do { |
|
74 |
show_cargo(*b); |
|
75 |
} while (*++b != 255); |
|
76 |
} |
|
77 |
||
78 |
#undef show_cargo |
|
79 |
||
80 |
WP(w,refit_d).cargo = cargo; |
|
81 |
||
82 |
if (cargo != -1) { |
|
83 |
int32 cost = DoCommandByTile(v->tile, v->index, cargo, 0, CMD_REFIT_SHIP); |
|
84 |
if (cost != CMD_ERROR) { |
|
85 |
SET_DPARAM32(2, cost); |
|
86 |
SET_DPARAM16(0, _cargoc.names_long_p[cargo]); |
|
87 |
SET_DPARAM16(1, v->cargo_cap); |
|
88 |
DrawString(1, 137, STR_9840_NEW_CAPACITY_COST_OF_REFIT, 0); |
|
89 |
} |
|
90 |
} |
|
91 |
||
92 |
break; |
|
93 |
} |
|
94 |
||
95 |
case WE_CLICK: |
|
96 |
switch(e->click.widget) { |
|
97 |
case 2: { /* listbox */ |
|
98 |
int y = e->click.pt.y - 25; |
|
99 |
if (y >= 0) { |
|
100 |
WP(w,refit_d).sel = y / 10; |
|
101 |
SetWindowDirty(w); |
|
102 |
} |
|
103 |
} break; |
|
104 |
case 4: /* refit button */ |
|
105 |
if (WP(w,refit_d).cargo != 0xFF) { |
|
106 |
Vehicle *v = &_vehicles[w->window_number]; |
|
107 |
if (DoCommandP(v->tile, v->index, WP(w,refit_d).cargo, NULL, CMD_REFIT_SHIP | CMD_MSG(STR_9841_CAN_T_REFIT_SHIP))) |
|
108 |
DeleteWindow(w); |
|
109 |
} |
|
110 |
break; |
|
111 |
} |
|
112 |
break; |
|
113 |
} |
|
114 |
} |
|
115 |
||
116 |
||
117 |
static const Widget _ship_refit_widgets[] = { |
|
118 |
{ WWT_TEXTBTN, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
|
119 |
{ WWT_CAPTION, 14, 11, 239, 0, 13, STR_983B_REFIT, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
|
120 |
{ WWT_IMGBTN, 14, 0, 239, 14, 135, 0x0, STR_983D_SELECT_TYPE_OF_CARGO_FOR}, |
|
121 |
{ WWT_IMGBTN, 14, 0, 239, 136, 157, 0x0}, |
|
122 |
{ WWT_PUSHTXTBTN, 14, 0, 239, 158, 169, STR_983C_REFIT_SHIP, STR_983E_REFIT_SHIP_TO_CARRY_HIGHLIGHTED}, |
|
123 |
{ WWT_LAST}, |
|
124 |
}; |
|
125 |
||
126 |
static const WindowDesc _ship_refit_desc = { |
|
127 |
-1,-1, 240, 170, |
|
128 |
WC_VEHICLE_REFIT,WC_VEHICLE_VIEW, |
|
129 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, |
|
130 |
_ship_refit_widgets, |
|
131 |
ShipRefitWndProc, |
|
132 |
}; |
|
133 |
||
134 |
static void ShowShipRefitWindow(Vehicle *v) |
|
135 |
{ |
|
136 |
Window *w; |
|
137 |
||
138 |
DeleteWindowById(WC_VEHICLE_REFIT, v->index); |
|
139 |
||
140 |
_alloc_wnd_parent_num = v->index; |
|
141 |
w = AllocateWindowDesc(&_ship_refit_desc); |
|
142 |
w->window_number = v->index; |
|
143 |
w->caption_color = v->owner; |
|
144 |
WP(w,refit_d).sel = -1; |
|
145 |
} |
|
146 |
||
147 |
static void ShipDetailsWndProc(Window *w, WindowEvent *e) |
|
148 |
{ |
|
149 |
Vehicle *v = &_vehicles[w->window_number]; |
|
150 |
StringID str; |
|
151 |
int mod; |
|
152 |
||
153 |
switch(e->event) { |
|
154 |
case WE_PAINT: |
|
155 |
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
|
156 |
if (!_patches.servint_ships) // 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
|
157 |
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
|
158 |
|
0 | 159 |
SET_DPARAM16(0, v->string_id); |
160 |
SET_DPARAM16(1, v->unitnumber); |
|
161 |
DrawWindowWidgets(w); |
|
162 |
||
163 |
/* Draw running cost */ |
|
164 |
{ |
|
165 |
int year = v->age / 366; |
|
166 |
StringID str; |
|
167 |
||
168 |
SET_DPARAM16(1, year); |
|
169 |
||
170 |
str = STR_0199_YEAR; |
|
171 |
if (year != 1) { |
|
172 |
str++; |
|
173 |
if (v->max_age - 366 < v->age) |
|
174 |
str++; |
|
175 |
} |
|
176 |
SET_DPARAM16(0, str); |
|
177 |
SET_DPARAM16(2, v->max_age / 366); |
|
178 |
SET_DPARAM32(3, ship_vehicle_info(v->engine_type).running_cost * _price.ship_running >> 8); |
|
179 |
DrawString(2, 15, STR_9812_AGE_RUNNING_COST_YR, 0); |
|
180 |
} |
|
181 |
||
182 |
/* Draw max speed */ |
|
183 |
{ |
|
184 |
SET_DPARAM16(0, v->max_speed * 10 >> 5); |
|
185 |
DrawString(2, 25, STR_9813_MAX_SPEED, 0); |
|
186 |
} |
|
187 |
||
188 |
/* Draw profit */ |
|
189 |
{ |
|
190 |
SET_DPARAM32(0, v->profit_this_year); |
|
191 |
SET_DPARAM32(1, v->profit_last_year); |
|
192 |
DrawString(2, 35, STR_9814_PROFIT_THIS_YEAR_LAST_YEAR, 0); |
|
193 |
} |
|
194 |
||
195 |
/* Draw breakdown & reliability */ |
|
196 |
{ |
|
197 |
SET_DPARAM8(0, v->reliability * 100 >> 16); |
|
198 |
SET_DPARAM16(1, v->breakdowns_since_last_service); |
|
199 |
DrawString(2, 45, STR_9815_RELIABILITY_BREAKDOWNS, 0); |
|
200 |
} |
|
201 |
||
202 |
/* Draw service interval text */ |
|
203 |
{ |
|
204 |
SET_DPARAM16(0, v->service_interval); |
|
205 |
SET_DPARAM16(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
|
206 |
DrawString(13, 90, _patches.servint_ispercent?STR_SERVICING_INTERVAL_PERCENT:STR_883C_SERVICING_INTERVAL_DAYS, 0); |
0 | 207 |
} |
208 |
||
209 |
DrawShipImage(v, 3, 57, INVALID_VEHICLE); |
|
210 |
||
211 |
SET_DPARAM16(1, 1920 + v->build_year); |
|
212 |
SET_DPARAM16(0, GetCustomEngineName(v->engine_type)); |
|
213 |
SET_DPARAM32(2, v->value); |
|
214 |
DrawString(74, 57, STR_9816_BUILT_VALUE, 0); |
|
215 |
||
216 |
SET_DPARAM16(0, _cargoc.names_long_p[v->cargo_type]); |
|
217 |
SET_DPARAM16(1, v->cargo_cap); |
|
218 |
DrawString(74, 67, STR_9817_CAPACITY, 0); |
|
219 |
||
220 |
str = STR_8812_EMPTY; |
|
221 |
if (v->cargo_count != 0) { |
|
222 |
SET_DPARAM8(0, v->cargo_type); |
|
223 |
SET_DPARAM16(1, v->cargo_count); |
|
224 |
SET_DPARAM16(2, v->cargo_source); |
|
225 |
str = STR_8813_FROM; |
|
226 |
} |
|
227 |
DrawString(74, 78, str, 0); |
|
228 |
break; |
|
229 |
||
230 |
case WE_CLICK: |
|
231 |
switch(e->click.widget) { |
|
232 |
case 2: /* rename */ |
|
233 |
SET_DPARAM16(0, v->unitnumber); |
|
234 |
ShowQueryString(v->string_id, STR_9831_NAME_SHIP, 31, 150, w->window_class, w->window_number); |
|
235 |
break; |
|
236 |
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
|
237 |
mod = _ctrl_pressed? 5 : 10; |
0 | 238 |
goto change_int; |
239 |
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
|
240 |
mod = _ctrl_pressed?- 5 : -10; |
0 | 241 |
change_int: |
242 |
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
|
243 |
|
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
|
244 |
/* %-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
|
245 |
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
|
246 |
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
|
247 |
if (mod == v->service_interval) |
0 | 248 |
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
|
249 |
|
0 | 250 |
DoCommandP(v->tile, v->index, mod, NULL, CMD_CHANGE_SHIP_SERVICE_INT | CMD_MSG(STR_018A_CAN_T_CHANGE_SERVICING)); |
251 |
break; |
|
252 |
} |
|
253 |
break; |
|
254 |
||
255 |
case WE_4: |
|
256 |
if (FindWindowById(WC_VEHICLE_VIEW, w->window_number) == NULL) |
|
257 |
DeleteWindow(w); |
|
258 |
break; |
|
259 |
||
260 |
case WE_ON_EDIT_TEXT: { |
|
261 |
byte *b = e->edittext.str; |
|
262 |
if (*b == 0) |
|
263 |
return; |
|
264 |
memcpy(_decode_parameters, b, 32); |
|
265 |
DoCommandP(0, w->window_number, 0, NULL, CMD_NAME_VEHICLE | CMD_MSG(STR_9832_CAN_T_NAME_SHIP)); |
|
266 |
} break; |
|
267 |
||
268 |
} |
|
269 |
} |
|
270 |
||
271 |
||
272 |
static const Widget _ship_details_widgets[] = { |
|
273 |
{ WWT_TEXTBTN, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
|
274 |
{ WWT_CAPTION, 14, 11, 364, 0, 13, STR_9811_DETAILS,STR_018C_WINDOW_TITLE_DRAG_THIS}, |
|
275 |
{ WWT_PUSHTXTBTN, 14, 365, 404, 0, 13, STR_01AA_NAME, STR_982F_NAME_SHIP}, |
|
276 |
{ WWT_IMGBTN, 14, 0, 404, 14, 55, 0x0}, |
|
277 |
{ WWT_IMGBTN, 14, 0, 404, 56, 88, 0x0}, |
|
278 |
{ WWT_PUSHTXTBTN, 14, 0, 10, 89, 94, STR_0188,STR_884D_INCREASE_SERVICING_INTERVAL}, |
|
279 |
{ WWT_PUSHTXTBTN, 14, 0, 10, 95, 100, STR_0189,STR_884E_DECREASE_SERVICING_INTERVAL}, |
|
280 |
{ WWT_IMGBTN, 14, 11, 404, 89, 100, 0x0}, |
|
281 |
{ WWT_LAST}, |
|
282 |
}; |
|
283 |
||
284 |
static const WindowDesc _ship_details_desc = { |
|
285 |
-1,-1, 405, 101, |
|
286 |
WC_VEHICLE_DETAILS,WC_VEHICLE_VIEW, |
|
287 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, |
|
288 |
_ship_details_widgets, |
|
289 |
ShipDetailsWndProc |
|
290 |
}; |
|
291 |
||
292 |
static void ShowShipDetailsWindow(Vehicle *v) |
|
293 |
{ |
|
294 |
Window *w; |
|
295 |
VehicleID veh = v->index; |
|
296 |
DeleteWindowById(WC_VEHICLE_ORDERS, veh); |
|
297 |
DeleteWindowById(WC_VEHICLE_DETAILS, veh); |
|
298 |
_alloc_wnd_parent_num = veh; |
|
299 |
w = AllocateWindowDesc(&_ship_details_desc); |
|
300 |
w->window_number = veh; |
|
301 |
w->caption_color = v->owner; |
|
302 |
} |
|
303 |
||
304 |
static void CcBuildShip(bool success, uint tile, uint32 p1, uint32 p2) |
|
305 |
{ |
|
306 |
Vehicle *v; |
|
307 |
if (!success) return; |
|
308 |
||
309 |
v = &_vehicles[_new_ship_id]; |
|
310 |
if (v->tile == _backup_orders_tile) { |
|
311 |
_backup_orders_tile = 0; |
|
312 |
RestoreVehicleOrders(v, _backup_orders_data); |
|
313 |
} |
|
314 |
ShowShipViewWindow(v); |
|
315 |
} |
|
316 |
||
317 |
static void NewShipWndProc(Window *w, WindowEvent *e) |
|
318 |
{ |
|
319 |
YearMonthDay ymd; |
|
320 |
switch(e->event) { |
|
321 |
case WE_PAINT: |
|
322 |
if (w->window_number == 0) |
|
323 |
w->disabled_state = 1 << 5; |
|
324 |
||
325 |
// Setup scroll count |
|
326 |
{ |
|
327 |
int count = 0; |
|
328 |
int num = NUM_SHIP_ENGINES; |
|
329 |
Engine *e = &_engines[SHIP_ENGINES_INDEX]; |
|
330 |
do { |
|
331 |
if (HASBIT(e->player_avail, _local_player)) |
|
332 |
count++; |
|
333 |
} while (++e,--num); |
|
334 |
SetVScrollCount(w, count); |
|
335 |
} |
|
336 |
||
337 |
DrawWindowWidgets(w); |
|
338 |
||
339 |
{ |
|
340 |
int num = NUM_SHIP_ENGINES; |
|
341 |
Engine *e = &_engines[SHIP_ENGINES_INDEX]; |
|
342 |
int x = 2; |
|
343 |
int y = 15; |
|
344 |
int sel = WP(w,buildtrain_d).sel_index; |
|
345 |
int pos = w->vscroll.pos; |
|
346 |
int engine_id = SHIP_ENGINES_INDEX; |
|
347 |
int selected_id = -1; |
|
348 |
||
349 |
do { |
|
350 |
if (HASBIT(e->player_avail, _local_player)) { |
|
351 |
if (sel==0) selected_id = engine_id; |
|
352 |
if (IS_INT_INSIDE(--pos, -4, 0)) { |
|
353 |
DrawString(x+75, y+7, GetCustomEngineName(engine_id), sel==0 ? 0xC : 0x10); |
|
354 |
DrawShipEngine(x+35, y+10, engine_id, SPRITE_PALETTE(PLAYER_SPRITE_COLOR(_local_player))); |
|
355 |
y += 24; |
|
356 |
} |
|
357 |
sel--; |
|
358 |
} |
|
359 |
} while (++engine_id, ++e,--num); |
|
360 |
||
361 |
WP(w,buildtrain_d).sel_engine = selected_id; |
|
362 |
||
363 |
if (selected_id != -1) { |
|
364 |
Engine *e; |
|
365 |
||
366 |
SET_DPARAM32(0, ship_vehicle_info(selected_id).base_cost * (_price.ship_base>>3)>>5); |
|
367 |
SET_DPARAM16(1, ship_vehicle_info(selected_id).max_speed * 10 >> 5); |
|
368 |
SET_DPARAM16(2, _cargoc.names_long_p[ship_vehicle_info(selected_id).cargo_type]); |
|
369 |
SET_DPARAM16(3, ship_vehicle_info(selected_id).capacity); |
|
370 |
SET_DPARAM16(4, ship_vehicle_info(selected_id).refittable ? STR_9842_REFITTABLE : STR_EMPTY); |
|
371 |
SET_DPARAM32(5, ship_vehicle_info(selected_id).running_cost * _price.ship_running >> 8); |
|
372 |
||
373 |
e = &_engines[selected_id]; |
|
374 |
SET_DPARAM16(7, e->lifelength); |
|
375 |
SET_DPARAM8(8, e->reliability * 100 >> 16); |
|
376 |
ConvertDayToYMD(&ymd, e->intro_date); |
|
377 |
SET_DPARAM16(6, ymd.year + 1920); |
|
378 |
||
379 |
DrawString(2, 111, STR_980A_COST_SPEED_CAPACITY_RUNNING, 0); |
|
380 |
} |
|
381 |
} |
|
382 |
break; |
|
383 |
||
384 |
case WE_CLICK: |
|
385 |
switch(e->click.widget) { |
|
386 |
case 2: { /* listbox */ |
|
387 |
uint i = (e->click.pt.y - 14) / 24; |
|
388 |
if (i < 4) { |
|
389 |
WP(w,buildtrain_d).sel_index = i + w->vscroll.pos; |
|
390 |
SetWindowDirty(w); |
|
391 |
} |
|
392 |
} break; |
|
393 |
case 5: { /* build */ |
|
394 |
int sel_eng = WP(w,buildtrain_d).sel_engine; |
|
395 |
if (sel_eng != -1) |
|
396 |
DoCommandP(w->window_number, sel_eng, 0, CcBuildShip, CMD_BUILD_SHIP | CMD_MSG(STR_980D_CAN_T_BUILD_SHIP)); |
|
397 |
} break; |
|
398 |
||
399 |
case 6: /* rename */ |
|
400 |
WP(w,buildtrain_d).rename_engine = WP(w,buildtrain_d).sel_engine; |
|
401 |
ShowQueryString( |
|
402 |
GetCustomEngineName(WP(w,buildtrain_d).sel_engine), |
|
403 |
STR_9838_RENAME_SHIP_TYPE, |
|
404 |
31, |
|
405 |
160, |
|
406 |
w->window_class, |
|
407 |
w->window_number); |
|
408 |
break; |
|
409 |
||
410 |
} |
|
411 |
break; |
|
412 |
||
413 |
case WE_4: |
|
414 |
if (w->window_number != 0 && !FindWindowById(WC_VEHICLE_DEPOT, w->window_number)) { |
|
415 |
DeleteWindow(w); |
|
416 |
} |
|
417 |
break; |
|
418 |
||
419 |
case WE_ON_EDIT_TEXT: { |
|
420 |
byte *b = e->edittext.str; |
|
421 |
if (*b == 0) |
|
422 |
return; |
|
423 |
memcpy(_decode_parameters, b, 32); |
|
424 |
DoCommandP(0, WP(w,buildtrain_d).rename_engine, 0, NULL, CMD_RENAME_ENGINE | CMD_MSG(STR_9839_CAN_T_RENAME_SHIP_TYPE)); |
|
425 |
} break; |
|
426 |
||
427 |
} |
|
428 |
} |
|
429 |
||
430 |
static const Widget _new_ship_widgets[] = { |
|
431 |
{ WWT_TEXTBTN, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
|
432 |
{ WWT_CAPTION, 14, 11, 254, 0, 13, STR_9808_NEW_SHIPS, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
|
433 |
{ WWT_MATRIX, 14, 0, 243, 14, 109, 0x401, STR_9825_SHIP_SELECTION_LIST_CLICK}, |
|
434 |
{ WWT_SCROLLBAR, 14, 244, 254, 14, 109, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, |
|
435 |
{ WWT_IMGBTN, 14, 0, 254, 110, 161, 0x0}, |
|
436 |
{ WWT_PUSHTXTBTN, 14, 0, 126, 162, 173, STR_9809_BUILD_SHIP, STR_9826_BUILD_THE_HIGHLIGHTED_SHIP}, |
|
437 |
{ WWT_PUSHTXTBTN, 14, 127, 254, 162, 173, STR_9836_RENAME, STR_9837_RENAME_SHIP_TYPE}, |
|
438 |
{ WWT_LAST}, |
|
439 |
}; |
|
440 |
||
441 |
static const WindowDesc _new_ship_desc = { |
|
442 |
-1, -1, 255, 174, |
|
443 |
WC_BUILD_VEHICLE,0, |
|
444 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, |
|
445 |
_new_ship_widgets, |
|
446 |
NewShipWndProc |
|
447 |
}; |
|
448 |
||
449 |
||
450 |
static void ShowBuildShipWindow(TileIndex tile) |
|
451 |
{ |
|
452 |
Window *w; |
|
453 |
||
454 |
DeleteWindowById(WC_BUILD_VEHICLE, tile); |
|
455 |
||
456 |
w = AllocateWindowDesc(&_new_ship_desc); |
|
457 |
w->window_number = tile; |
|
458 |
w->vscroll.cap = 4; |
|
459 |
||
460 |
if (tile != 0) { |
|
461 |
w->caption_color = _map_owner[tile]; |
|
462 |
} else { |
|
463 |
w->caption_color = _local_player; |
|
464 |
} |
|
465 |
||
466 |
} |
|
467 |
||
468 |
||
469 |
static void ShipViewWndProc(Window *w, WindowEvent *e) { |
|
470 |
switch(e->event) { |
|
471 |
case WE_PAINT: { |
|
472 |
Vehicle *v = &_vehicles[w->window_number]; |
|
473 |
uint32 disabled = 1<<7; |
|
474 |
StringID str; |
|
475 |
||
476 |
// Possible to refit? |
|
477 |
if (ship_vehicle_info(v->engine_type).refittable && |
|
478 |
v->vehstatus&VS_STOPPED && |
|
479 |
v->u.ship.state == 0x80 && |
|
480 |
IsShipDepotTile(v->tile)) |
|
481 |
disabled = 0; |
|
482 |
||
483 |
if (v->owner != _local_player) |
|
484 |
disabled |= 1<<7 | 1<<6; |
|
485 |
w->disabled_state = disabled; |
|
486 |
||
487 |
/* draw widgets & caption */ |
|
488 |
SET_DPARAM16(0, v->string_id); |
|
489 |
SET_DPARAM16(1, v->unitnumber); |
|
490 |
DrawWindowWidgets(w); |
|
491 |
||
492 |
/* draw the flag */ |
|
493 |
DrawSprite((v->vehstatus & VS_STOPPED) ? 0xC12 : 0xC13, 2, 105); |
|
494 |
||
495 |
if (v->breakdown_ctr == 1) { |
|
496 |
str = STR_885C_BROKEN_DOWN; |
|
497 |
} else if (v->vehstatus & VS_STOPPED) { |
|
498 |
str = STR_8861_STOPPED; |
|
499 |
} else { |
|
500 |
switch(v->next_order & OT_MASK) { |
|
501 |
case OT_GOTO_STATION: { |
|
502 |
SET_DPARAM16(0, v->next_order_param); |
|
503 |
SET_DPARAM16(1, v->cur_speed * 10 >> 5); |
|
504 |
str = STR_HEADING_FOR_STATION + _patches.vehicle_speed; |
|
505 |
} break; |
|
506 |
||
507 |
case OT_GOTO_DEPOT: { |
|
508 |
Depot *dep = &_depots[v->next_order_param]; |
|
509 |
SET_DPARAM16(0, dep->town_index); |
|
510 |
SET_DPARAM16(1, v->cur_speed * 10 >> 5); |
|
511 |
str = STR_HEADING_FOR_SHIP_DEPOT + _patches.vehicle_speed; |
|
512 |
} break; |
|
513 |
||
514 |
case OT_LOADING: |
|
515 |
case OT_LEAVESTATION: |
|
516 |
str = STR_882F_LOADING_UNLOADING; |
|
517 |
break; |
|
518 |
||
519 |
default: |
|
520 |
if (v->num_orders == 0) { |
|
521 |
str = STR_NO_ORDERS + _patches.vehicle_speed; |
|
522 |
SET_DPARAM16(0, v->cur_speed * 10 >> 5); |
|
523 |
} else |
|
524 |
str = STR_EMPTY; |
|
525 |
break; |
|
526 |
} |
|
527 |
} |
|
528 |
||
529 |
DrawStringCentered(125, 105, str, 0); |
|
530 |
DrawWindowViewport(w); |
|
531 |
} break; |
|
532 |
||
533 |
case WE_CLICK: { |
|
534 |
Vehicle *v = &_vehicles[w->window_number]; |
|
535 |
||
536 |
switch(e->click.widget) { |
|
537 |
case 4: /* start stop */ |
|
538 |
DoCommandP(v->tile, v->index, 0, NULL, CMD_START_STOP_SHIP | CMD_MSG(STR_9818_CAN_T_STOP_START_SHIP)); |
|
539 |
break; |
|
540 |
case 5: /* center main view */ |
|
541 |
ScrollMainWindowTo(v->x_pos, v->y_pos); |
|
542 |
break; |
|
543 |
case 6: /* goto hangar */ |
|
544 |
DoCommandP(v->tile, v->index, 0, NULL, CMD_SEND_SHIP_TO_DEPOT | CMD_MSG(STR_9819_CAN_T_SEND_SHIP_TO_DEPOT)); |
|
545 |
break; |
|
546 |
case 7: /* refit */ |
|
547 |
ShowShipRefitWindow(v); |
|
548 |
break; |
|
549 |
case 8: /* show orders */ |
|
550 |
ShowOrdersWindow(v); |
|
551 |
break; |
|
552 |
case 9: /* show details */ |
|
553 |
ShowShipDetailsWindow(v); |
|
554 |
break; |
|
555 |
} |
|
556 |
} break; |
|
557 |
||
558 |
case WE_DESTROY: |
|
559 |
DeleteWindowById(WC_VEHICLE_ORDERS, w->window_number); |
|
560 |
DeleteWindowById(WC_VEHICLE_REFIT, w->window_number); |
|
561 |
DeleteWindowById(WC_VEHICLE_DETAILS, w->window_number); |
|
562 |
break; |
|
563 |
} |
|
564 |
} |
|
565 |
||
566 |
static const Widget _ship_view_widgets[] = { |
|
567 |
{ WWT_TEXTBTN, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
|
568 |
{ WWT_CAPTION, 14, 11, 249, 0, 13, STR_980F, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
|
569 |
{ WWT_IMGBTN, 14, 0, 231, 14, 103, 0x0}, |
|
570 |
{ WWT_6, 14, 2, 229, 16, 101, 0}, |
|
571 |
{ WWT_PUSHIMGBTN, 14, 0, 249, 104, 115, 0x0, STR_9827_CURRENT_SHIP_ACTION_CLICK}, |
|
572 |
{ WWT_PUSHIMGBTN, 14, 232, 249, 14, 31, 0x2AB, STR_9829_CENTER_MAIN_VIEW_ON_SHIP}, |
|
573 |
{ WWT_PUSHIMGBTN, 14, 232, 249, 32, 49, 0x2B0, STR_982A_SEND_SHIP_TO_DEPOT}, |
|
574 |
{ WWT_PUSHIMGBTN, 14, 232, 249, 50, 67, 0x2B4, STR_983A_REFIT_CARGO_SHIP_TO_CARRY}, |
|
575 |
{ WWT_PUSHIMGBTN, 14, 232, 249, 68, 85, 0x2B2, STR_9828_SHOW_SHIP_S_ORDERS}, |
|
576 |
{ WWT_PUSHIMGBTN, 14, 232, 249, 86, 103, 0x2B3, STR_982B_SHOW_SHIP_DETAILS}, |
|
577 |
{ WWT_LAST}, |
|
578 |
}; |
|
579 |
||
580 |
static const WindowDesc _ship_view_desc = { |
|
581 |
-1,-1, 250, 116, |
|
582 |
WC_VEHICLE_VIEW,0, |
|
583 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, |
|
584 |
_ship_view_widgets, |
|
585 |
ShipViewWndProc |
|
586 |
}; |
|
587 |
||
588 |
void ShowShipViewWindow(Vehicle *v) |
|
589 |
{ |
|
590 |
Window *w; |
|
591 |
||
592 |
w = AllocateWindowDescFront(&_ship_view_desc, v->index); |
|
593 |
if (w) { |
|
594 |
w->caption_color = v->owner; |
|
595 |
AssignWindowViewport(w, 3, 17, 0xE2, 0x54, w->window_number | (1 << 31), 0); |
|
596 |
} |
|
597 |
} |
|
598 |
||
599 |
||
600 |
static void DrawShipImage(Vehicle *v, int x, int y, VehicleID selection) |
|
601 |
{ |
|
602 |
int image = GetShipImage(v, 6); |
|
603 |
uint32 ormod = SPRITE_PALETTE(PLAYER_SPRITE_COLOR(v->owner)); |
|
604 |
DrawSprite(image | ormod, x+32, y+10); |
|
605 |
||
606 |
if (v->index == selection) { |
|
607 |
DrawFrameRect(x-5, y-1, x+67, y+21, 15, 0x10); |
|
608 |
} |
|
609 |
} |
|
610 |
||
611 |
static void DrawShipDepotWindow(Window *w) |
|
612 |
{ |
|
613 |
uint tile; |
|
614 |
Vehicle *v; |
|
615 |
int num,x,y; |
|
616 |
Depot *d; |
|
617 |
||
618 |
tile = w->window_number; |
|
619 |
||
620 |
/* setup disabled buttons */ |
|
621 |
w->disabled_state = (_map_owner[tile]==_local_player) ? 0 : ((1<<3)|(1<<5)); |
|
622 |
||
623 |
/* determine amount of items for scroller */ |
|
624 |
num = 0; |
|
625 |
FOR_ALL_VEHICLES(v) { |
|
626 |
if (v->type == VEH_Ship && v->u.ship.state == 0x80 && |
|
627 |
v->tile == (TileIndex)tile) |
|
628 |
num++; |
|
629 |
} |
|
630 |
SetVScrollCount(w, (num+2) / 3); |
|
631 |
||
632 |
/* locate the depot struct */ |
|
633 |
for(d=_depots; d->xy != (TileIndex)tile; d++) {} |
|
634 |
||
635 |
SET_DPARAM16(0, d->town_index); |
|
636 |
DrawWindowWidgets(w); |
|
637 |
||
638 |
x = 2; |
|
639 |
y = 15; |
|
640 |
num = w->vscroll.pos * 3; |
|
641 |
||
642 |
FOR_ALL_VEHICLES(v) { |
|
643 |
if (v->type == VEH_Ship && |
|
644 |
v->u.ship.state == 0x80 && |
|
645 |
v->tile == (TileIndex)tile && |
|
646 |
--num < 0 && num >= -6) { |
|
647 |
||
648 |
DrawShipImage(v, x+19, y, WP(w,traindepot_d).sel); |
|
649 |
||
650 |
SET_DPARAM16(0, v->unitnumber); |
|
651 |
DrawString(x, y, (uint16)(v->max_age-366) >= v->age ? STR_00E2 : STR_00E3, 0); |
|
652 |
||
653 |
DrawSprite( (v->vehstatus & VS_STOPPED) ? 0xC12 : 0xC13, x, y + 9); |
|
654 |
||
655 |
if ((x+=90) == 2+90*3) { |
|
656 |
x = 2; |
|
657 |
y += 24; |
|
658 |
} |
|
659 |
} |
|
660 |
} |
|
661 |
} |
|
662 |
||
663 |
static int GetVehicleFromShipDepotWndPt(Window *w, int x, int y, Vehicle **veh) |
|
664 |
{ |
|
665 |
uint xt,yt,xm,ym; |
|
666 |
TileIndex tile; |
|
667 |
Vehicle *v; |
|
668 |
int pos; |
|
669 |
||
670 |
xt = x / 90; |
|
671 |
xm = x % 90; |
|
672 |
if (xt >= 5) |
|
673 |
return 1; |
|
674 |
||
675 |
yt = (y - 14) / 24; |
|
676 |
ym = (y - 14) % 24; |
|
677 |
if (yt >= 2) |
|
678 |
return 1; |
|
679 |
||
680 |
pos = (yt + w->vscroll.pos) * 3 + xt; |
|
681 |
||
682 |
tile = w->window_number; |
|
683 |
FOR_ALL_VEHICLES(v) { |
|
684 |
if (v->type == VEH_Ship && |
|
685 |
v->vehstatus&VS_HIDDEN && |
|
686 |
v->tile == (TileIndex)tile && |
|
687 |
--pos < 0) { |
|
688 |
*veh = v; |
|
689 |
if (xm >= 19) |
|
690 |
return 0; |
|
691 |
if (ym <= 10) |
|
692 |
return -1; /* show window */ |
|
693 |
return -2; /* start stop */ |
|
694 |
} |
|
695 |
} |
|
696 |
||
697 |
return 1; /* outside */ |
|
698 |
||
699 |
} |
|
700 |
||
701 |
static void ShipDepotClick(Window *w, int x, int y) |
|
702 |
{ |
|
703 |
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
|
704 |
int mode = GetVehicleFromShipDepotWndPt(w, x, y, &v); |
0 | 705 |
|
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
|
706 |
// 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
|
707 |
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
|
708 |
|
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
|
709 |
switch (mode) { |
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
|
710 |
case 1: // invalid |
0 | 711 |
return; |
712 |
||
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
|
713 |
case 0: // start dragging of vehicle |
0 | 714 |
if (v != NULL) { |
715 |
WP(w,traindepot_d).sel = v->index; |
|
716 |
SetWindowDirty(w); |
|
717 |
SetObjectToPlaceWnd( SPRITE_PALETTE(PLAYER_SPRITE_COLOR(v->owner)) + |
|
718 |
GetShipImage(v, 6), 4, w); |
|
719 |
} |
|
720 |
break; |
|
721 |
||
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
|
722 |
case -1: // show info window |
0 | 723 |
ShowShipViewWindow(v); |
724 |
break; |
|
725 |
||
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
|
726 |
case -2: // click start/stop flag |
0 | 727 |
DoCommandP(v->tile, v->index, 0, NULL, CMD_START_STOP_SHIP | CMD_MSG(STR_9818_CAN_T_STOP_START_SHIP)); |
728 |
break; |
|
729 |
||
730 |
default: |
|
731 |
NOT_REACHED(); |
|
732 |
} |
|
733 |
} |
|
734 |
||
735 |
static void ShipDepotWndProc(Window *w, WindowEvent *e) { |
|
736 |
switch(e->event) { |
|
737 |
case WE_PAINT: |
|
738 |
DrawShipDepotWindow(w); |
|
739 |
break; |
|
740 |
||
741 |
case WE_CLICK: |
|
742 |
switch(e->click.widget) { |
|
743 |
case 2: |
|
744 |
ShipDepotClick(w, e->click.pt.x, e->click.pt.y); |
|
745 |
break; |
|
746 |
||
747 |
case 5: |
|
748 |
ShowBuildShipWindow(w->window_number); |
|
749 |
break; |
|
750 |
||
751 |
case 6: /* scroll to tile */ |
|
752 |
ScrollMainWindowToTile(w->window_number); |
|
753 |
break; |
|
754 |
} |
|
755 |
break; |
|
756 |
||
757 |
case WE_DESTROY: |
|
758 |
DeleteWindowById(WC_BUILD_VEHICLE, w->window_number); |
|
759 |
break; |
|
760 |
||
761 |
case WE_DRAGDROP: { |
|
762 |
switch(e->click.widget) { |
|
763 |
case 2: { |
|
764 |
Vehicle *v; |
|
765 |
VehicleID sel = WP(w,traindepot_d).sel; |
|
766 |
||
767 |
WP(w,traindepot_d).sel = INVALID_VEHICLE; |
|
768 |
SetWindowDirty(w); |
|
769 |
||
770 |
if (GetVehicleFromShipDepotWndPt(w, e->dragdrop.pt.x, e->dragdrop.pt.y, &v) == 0 && |
|
771 |
v != NULL && |
|
772 |
sel == v->index) { |
|
773 |
ShowShipViewWindow(v); |
|
774 |
} |
|
775 |
} break; |
|
776 |
||
777 |
case 3: |
|
778 |
if (!HASBIT(w->disabled_state, 3) && |
|
779 |
WP(w,traindepot_d).sel != INVALID_VEHICLE) { |
|
780 |
Vehicle *v; |
|
781 |
||
782 |
HandleButtonClick(w, 3); |
|
783 |
||
784 |
v = &_vehicles[WP(w,traindepot_d).sel]; |
|
785 |
WP(w,traindepot_d).sel = INVALID_VEHICLE; |
|
786 |
||
787 |
_backup_orders_tile = v->tile; |
|
788 |
BackupVehicleOrders(v, _backup_orders_data); |
|
789 |
||
790 |
if (!DoCommandP(v->tile, v->index, 0, NULL, CMD_SELL_SHIP | CMD_MSG(STR_980C_CAN_T_SELL_SHIP))) |
|
791 |
_backup_orders_tile = 0; |
|
792 |
} |
|
793 |
break; |
|
794 |
default: |
|
795 |
WP(w,traindepot_d).sel = INVALID_VEHICLE; |
|
796 |
SetWindowDirty(w); |
|
797 |
} |
|
798 |
break; |
|
799 |
} |
|
800 |
break; |
|
801 |
} |
|
802 |
} |
|
803 |
||
804 |
static const Widget _ship_depot_widgets[] = { |
|
805 |
{ WWT_TEXTBTN, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
|
806 |
{ WWT_CAPTION, 14, 11, 304, 0, 13, STR_9803_SHIP_DEPOT, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
|
807 |
{ WWT_MATRIX, 14, 0, 269, 14, 61, 0x203, STR_981F_SHIPS_CLICK_ON_SHIP_FOR}, |
|
808 |
{ WWT_IMGBTN, 14, 270, 293, 14, 61, 0x2A9, STR_9821_DRAG_SHIP_TO_HERE_TO_SELL}, |
|
809 |
{ WWT_SCROLLBAR, 14, 294, 304, 14, 61, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, |
|
810 |
{ WWT_PUSHTXTBTN, 14, 0, 151, 62, 73, STR_9804_NEW_SHIPS, STR_9820_BUILD_NEW_SHIP}, |
|
811 |
{ WWT_PUSHTXTBTN, 14, 152, 304, 62, 73, STR_00E4_LOCATION, STR_9822_CENTER_MAIN_VIEW_ON_SHIP}, |
|
812 |
{ WWT_LAST}, |
|
813 |
}; |
|
814 |
||
815 |
static const WindowDesc _ship_depot_desc = { |
|
816 |
-1, -1, 305, 74, |
|
817 |
WC_VEHICLE_DEPOT,0, |
|
818 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, |
|
819 |
_ship_depot_widgets, |
|
820 |
ShipDepotWndProc |
|
821 |
}; |
|
822 |
||
823 |
void ShowShipDepotWindow(uint tile) |
|
824 |
{ |
|
825 |
Window *w; |
|
826 |
||
827 |
w = AllocateWindowDescFront(&_ship_depot_desc,tile); |
|
828 |
if (w) { |
|
829 |
w->caption_color = _map_owner[w->window_number]; |
|
830 |
w->vscroll.cap = 2; |
|
831 |
WP(w,traindepot_d).sel = INVALID_VEHICLE; |
|
832 |
_backup_orders_tile = 0; |
|
833 |
} |
|
834 |
} |
|
835 |
||
836 |
||
837 |
static void DrawSmallShipSchedule(Vehicle *v, int x, int y) { |
|
838 |
uint16 *sched; |
|
839 |
int sel; |
|
840 |
uint ord; |
|
841 |
Station *st; |
|
842 |
int i = 0; |
|
843 |
||
844 |
sched = v->schedule_ptr; |
|
845 |
sel = v->cur_order_index; |
|
846 |
||
847 |
while ((ord=*sched++) != 0) { |
|
848 |
if (sel == 0) { |
|
849 |
_stringwidth_base = 0xE0; |
|
850 |
DoDrawString( "\xAF", x-6, y, 16); |
|
851 |
_stringwidth_base = 0; |
|
852 |
} |
|
853 |
sel--; |
|
854 |
||
855 |
if ((ord & OT_MASK) == OT_GOTO_STATION) { |
|
856 |
st = DEREF_STATION(ord >> 8); |
|
857 |
||
858 |
if (!(st->had_vehicle_of_type & HVOT_BUOY)) { |
|
859 |
SET_DPARAM16(0, ord >> 8); |
|
860 |
DrawString(x, y, STR_A036, 0); |
|
861 |
||
862 |
y += 6; |
|
863 |
if (++i == 4) |
|
864 |
break; |
|
865 |
} |
|
866 |
} |
|
867 |
} |
|
868 |
} |
|
869 |
||
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
|
870 |
// used to get a sorted list of the vehicles |
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
|
871 |
static SortStruct _ship_sort[NUM_NORMAL_VEHICLES]; |
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
|
872 |
static uint16 _num_ship_sort[MAX_PLAYERS]; |
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
|
873 |
|
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
|
874 |
static void MakeSortedShiptList(byte owner) |
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
|
875 |
{ |
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
|
876 |
SortStruct *firstelement; |
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
|
877 |
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
|
878 |
uint32 n = 0; |
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
|
879 |
uint16 *i; |
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
|
880 |
|
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
|
881 |
if (_vehicle_sort_dirty[VEHSHIP]) { // only resort the whole array if vehicles have been added/removed |
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
|
882 |
// reset to 0 just to be sure |
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
|
883 |
for (i = _num_ship_sort; i != endof(_num_ship_sort); i++) {*i = 0;} |
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
|
884 |
|
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
|
885 |
FOR_ALL_VEHICLES(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
|
886 |
if(v->type == VEH_Ship) { |
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
|
887 |
_ship_sort[n].index = v->index; |
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
|
888 |
_ship_sort[n++].owner = v->owner; |
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
|
889 |
_num_ship_sort[v->owner]++; // add number of trains of player |
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
|
890 |
} |
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
|
891 |
} |
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
|
892 |
|
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
|
893 |
// create cumulative ship-ownage |
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
|
894 |
// ships are stored as a cummulative index, eg 25, 41, 43. This means |
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
|
895 |
// Player0: 25; Player1: (41-25) 16; Player2: (43-41) 2 |
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
|
896 |
for (i = &_num_ship_sort[1]; i != endof(_num_ship_sort); i++) {*i += *(i-1);} |
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
|
897 |
|
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
|
898 |
|
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
|
899 |
// sort by owner, then only subsort the requested owner-vehicles |
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
|
900 |
qsort(_ship_sort, n, sizeof(_ship_sort[0]), GeneralOwnerSorter); |
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
|
901 |
|
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
|
902 |
_last_vehicle_idx = 0; // used for "cache" in namesorting |
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
|
903 |
_vehicle_sort_dirty[VEHSHIP] = false; |
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
|
904 |
} |
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 |
|
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
|
906 |
if (owner == 0) { // first element starts at 0th element and has n elements as described above |
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
|
907 |
firstelement = &_ship_sort[0]; |
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
|
908 |
n = _num_ship_sort[0]; |
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
|
909 |
} else { // nth element starts at the end of the previous one, and has n elements as described above |
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
|
910 |
firstelement = &_ship_sort[_num_ship_sort[owner-1]]; |
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
|
911 |
n = _num_ship_sort[owner] - _num_ship_sort[owner-1]; |
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
|
912 |
} |
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
|
913 |
|
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
|
914 |
_internal_sort_type = _ship_sort_type[owner]; |
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
|
915 |
_internal_sort_order = _ship_sort_order[owner]; |
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
|
916 |
_internal_name_sorter_id = STR_SV_SHIP_NAME; |
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
|
917 |
// only name sorting needs a different procedure, all others are handled by the general sorter |
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 |
qsort(firstelement, n, sizeof(_ship_sort[0]), (_internal_sort_type == SORT_BY_NAME) ? VehicleNameSorter : GeneralVehicleSorter); |
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
|
919 |
|
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
|
920 |
DEBUG(misc, 1) ("Resorting Ships list player %d...", owner+1); |
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
|
921 |
} |
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
|
922 |
|
0 | 923 |
static void PlayerShipsWndProc(Window *w, WindowEvent *e) |
924 |
{ |
|
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: { |
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
|
927 |
uint32 i; |
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
|
928 |
const byte window_number = (byte)w->window_number; |
0 | 929 |
|
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
|
930 |
if (_ship_sort_type[window_number] == SORT_BY_UNSORTED) // disable 'Sort By' tooltip on Unsorted sorting criteria |
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
|
931 |
w->disabled_state |= (1 << 3); |
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
|
932 |
|
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
|
933 |
if (_ship_sort_dirty[window_number] || _vehicle_sort_dirty[VEHSHIP]) { |
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
|
934 |
_ship_sort_dirty[window_number] = false; |
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
|
935 |
MakeSortedShiptList(window_number); |
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
|
936 |
/* reset sorting timeout */ |
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
|
937 |
w->custom[0] = DAY_TICKS; |
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
|
938 |
w->custom[1] = PERIODIC_RESORT_DAYS; |
0 | 939 |
} |
940 |
||
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
|
941 |
// ships are stored as a cummulative index, eg 25, 41, 43. This means |
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
|
942 |
// Player0: 25; Player1: (41-25) 16; Player2: (43-41) 2 ships |
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
|
943 |
i = (window_number == 0) ? 0 : _num_ship_sort[window_number-1]; |
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
|
944 |
SetVScrollCount(w, _num_ship_sort[window_number] - i); |
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
|
945 |
|
0 | 946 |
/* draw the widgets */ |
947 |
{ |
|
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
|
948 |
Player *p = DEREF_PLAYER(window_number); |
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
|
949 |
/* Company Name -- (###) Ships */ |
0 | 950 |
SET_DPARAM16(0, p->name_1); |
951 |
SET_DPARAM32(1, p->name_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
|
952 |
SET_DPARAM16(2, w->vscroll.count); |
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
|
953 |
SET_DPARAM16(3, _vehicle_sort_listing[_ship_sort_type[window_number]]); |
0 | 954 |
DrawWindowWidgets(w); |
955 |
} |
|
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
|
956 |
/* draw arrow pointing up/down for ascending/descending soring */ |
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
|
957 |
DoDrawString(_ship_sort_order[window_number] & 1 ? "\xAA" : "\xA0", 85, 15, 0x10); |
0 | 958 |
|
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
|
959 |
/* draw the ship vehicles */ |
0 | 960 |
{ |
961 |
Vehicle *v; |
|
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
|
962 |
int n = 0; |
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
|
963 |
const int x = 2; // offset from left side of widget |
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
|
964 |
int y = PLY_WND_PRC__OFFSET_TOP_WIDGET; // offset from top of widget |
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
|
965 |
i += w->vscroll.pos; // offset from sorted ship list of current player |
0 | 966 |
|
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
|
967 |
while (i < _num_ship_sort[window_number]) { |
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
|
968 |
StringID str; |
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
|
969 |
v = DEREF_VEHICLE(_ship_sort[i].index); |
0 | 970 |
|
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
|
971 |
DrawShipImage(v, x + 19, y + 6, INVALID_VEHICLE); |
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
|
972 |
DrawVehicleProfitButton(v, x, y+13); |
0 | 973 |
|
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
|
974 |
SET_DPARAM16(0, v->unitnumber); |
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
|
975 |
if (IsShipDepotTile(v->tile)) { |
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 |
str = STR_021F; |
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
|
977 |
} else { |
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
|
978 |
str = v->age > v->max_age - 366 ? STR_00E3 : STR_00E2; |
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
|
979 |
} |
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
|
980 |
DrawString(x, y+2, str, 0); |
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
|
981 |
|
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
|
982 |
SET_DPARAM32(0, v->profit_this_year); |
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 |
SET_DPARAM32(1, v->profit_last_year); |
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
|
984 |
DrawString(x + 12, y + 28, STR_0198_PROFIT_THIS_YEAR_LAST_YEAR, 0); |
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
|
985 |
|
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
|
986 |
if (v->string_id != STR_SV_SHIP_NAME) { |
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
|
987 |
SET_DPARAM16(0, v->string_id); |
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
|
988 |
DrawString(x+12, y, STR_01AB, 0); |
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
|
989 |
} |
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
|
990 |
|
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
|
991 |
DrawSmallShipSchedule(v, x+138, y); |
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
|
992 |
|
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
|
993 |
|
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
|
994 |
y += PLY_WND_PRC__SIZE_OF_ROW_BIG; |
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
|
995 |
i++; // next ship |
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
|
996 |
if (++n == w->vscroll.cap) { break;} // max number of ships in the window |
0 | 997 |
} |
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 |
} break; |
0 | 1000 |
|
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
|
1001 |
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
|
1002 |
switch(e->click.widget) { |
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
|
1003 |
case 3: /* Flip sorting method ascending/descending */ |
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 |
_ship_sort_order[(byte)w->window_number] ^= 1; |
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 |
_ship_sort_dirty[(byte)w->window_number] = true; |
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
|
1006 |
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
|
1007 |
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
|
1008 |
case 4: case 5:/* Select sorting criteria dropdown menu */ |
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 |
ShowDropDownMenu(w, _vehicle_sort_listing, _ship_sort_type[(byte)w->window_number], 5, 0); // do it for widget 5 |
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
|
1010 |
return; |
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
|
1011 |
case 6: { /* Matrix to show vehicles */ |
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
|
1012 |
int id_v = (e->click.pt.y - PLY_WND_PRC__OFFSET_TOP_WIDGET) / PLY_WND_PRC__SIZE_OF_ROW_BIG; |
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
|
1013 |
|
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
|
1014 |
if ((uint)id_v >= w->vscroll.cap) { return;} // click out of bounds |
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 |
byte owner = (byte)w->window_number; |
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 |
uint16 adder = (owner == 0) ? 0 : _num_ship_sort[owner - 1]; // first element in list |
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
|
1021 |
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
|
1022 |
|
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
|
1023 |
if (id_v + adder >= _num_ship_sort[owner]) { return;} // click out of vehicle bound |
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 |
|
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
|
1025 |
v = DEREF_VEHICLE(_ship_sort[adder+id_v].index); // add the offset id_x to that |
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 |
assert(v->type == VEH_Ship && v->owner == owner && v->owner == _ship_sort[adder+id_v].owner); |
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
|
1028 |
|
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 |
ShowShipViewWindow(v); |
0 | 1030 |
} |
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
|
1031 |
} 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
|
1032 |
|
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
|
1033 |
case 8: { /* Build new Vehicle */ |
0 | 1034 |
uint tile; |
1035 |
||
1036 |
tile = _last_built_ship_depot_tile; |
|
1037 |
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
|
1038 |
if (_map_owner[tile] == _local_player && IsShipDepotTile(tile)) { |
0 | 1039 |
ShowShipDepotWindow(tile); |
1040 |
ShowBuildShipWindow(tile); |
|
1041 |
return; |
|
1042 |
} |
|
1043 |
||
1044 |
tile = TILE_MASK(tile + 1); |
|
1045 |
} while(tile != _last_built_ship_depot_tile); |
|
1046 |
||
1047 |
ShowBuildShipWindow(0); |
|
1048 |
} break; |
|
1049 |
} |
|
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
|
1050 |
} 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
|
1051 |
|
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
|
1052 |
case WE_DROPDOWN_SELECT: /* we have selected a dropdown item in the list */ |
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
|
1053 |
if (_ship_sort_type[(byte)w->window_number] != e->dropdown.index) // if value hasn't changed, dont resort list |
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
|
1054 |
_ship_sort_dirty[(byte)w->window_number] = true; |
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 |
|
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
|
1056 |
_ship_sort_type[(byte)w->window_number] = e->dropdown.index; |
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
|
1057 |
|
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
|
1058 |
if (_ship_sort_type[(byte)w->window_number] != SORT_BY_UNSORTED) // enable 'Sort By' if a sorter criteria is chosen |
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
|
1059 |
w->disabled_state &= ~(1 << 3); |
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 |
|
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 |
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
|
1062 |
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
|
1063 |
case WE_CREATE: /* set up resort timer */ |
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
|
1064 |
w->custom[0] = DAY_TICKS; |
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
|
1065 |
w->custom[1] = PERIODIC_RESORT_DAYS; |
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
|
1066 |
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
|
1067 |
case WE_TICK: /* resort the list every 20 seconds orso (10 days) */ |
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 |
if (--w->custom[0] == 0) { |
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
|
1069 |
w->custom[0] = DAY_TICKS; |
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 |
if (--w->custom[1] == 0) { |
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
|
1071 |
w->custom[1] = PERIODIC_RESORT_DAYS; |
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
|
1072 |
_ship_sort_dirty[(byte)w->window_number] = true; |
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
|
1073 |
DEBUG(misc, 1) ("Periodic resort Ships list player %d...", w->window_number+1); |
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
|
1074 |
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
|
1075 |
} |
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
|
1076 |
} |
0 | 1077 |
break; |
1078 |
} |
|
1079 |
} |
|
1080 |
static const Widget _player_ships_widgets[] = { |
|
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
|
1081 |
{ WWT_CLOSEBOX, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
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
|
1082 |
{ WWT_CAPTION, 14, 11, 259, 0, 13, STR_9805_SHIPS, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
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 |
{ WWT_PANEL, 14, 0, 15, 14, 25, 0x0, 0}, |
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
|
1084 |
{ WWT_PUSHTXTBTN, 14, 16, 96, 14, 25, SRT_SORT_BY, STR_SORT_TIP}, |
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
|
1085 |
{ WWT_TEXTBTN, 14, 97, 248, 14, 25, STR_02E7, 0}, |
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
|
1086 |
{ WWT_CLOSEBOX, 14, 249, 259, 14, 25, STR_0225, STR_SORT_TIP}, |
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
|
1087 |
{ WWT_MATRIX, 14, 0, 248, 26, 169, 0x401, STR_9823_SHIPS_CLICK_ON_SHIP_FOR}, |
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
|
1088 |
{ WWT_SCROLLBAR, 14, 249, 259, 26, 169, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, |
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
|
1089 |
{ WWT_PUSHTXTBTN, 14, 0, 129, 170, 181, STR_9804_NEW_SHIPS, STR_9824_BUILD_NEW_SHIPS_REQUIRES}, |
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
|
1090 |
{ WWT_PANEL, 14, 130, 259, 170, 181, 0x0, 0}, |
0 | 1091 |
{ WWT_LAST}, |
1092 |
}; |
|
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
|
1093 |
|
0 | 1094 |
static const WindowDesc _player_ships_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
|
1095 |
-1, -1, 260, 182, |
0 | 1096 |
WC_SHIPS_LIST,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
|
1097 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_RESTORE_DPARAM, |
0 | 1098 |
_player_ships_widgets, |
1099 |
PlayerShipsWndProc |
|
1100 |
}; |
|
1101 |
||
1102 |
static const Widget _other_player_ships_widgets[] = { |
|
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
|
1103 |
{ WWT_CLOSEBOX, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
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
|
1104 |
{ WWT_CAPTION, 14, 11, 259, 0, 13, STR_9805_SHIPS, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
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
|
1105 |
{ WWT_PANEL, 14, 0, 15, 14, 25, 0x0, 0}, |
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
|
1106 |
{ WWT_PUSHTXTBTN, 14, 16, 96, 14, 25, SRT_SORT_BY, STR_SORT_TIP}, |
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
|
1107 |
{ WWT_TEXTBTN, 14, 97, 248, 14, 25, STR_02E7, 0}, |
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
|
1108 |
{ WWT_CLOSEBOX, 14, 249, 259, 14, 25, STR_0225, STR_SORT_TIP}, |
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
|
1109 |
{ WWT_MATRIX, 14, 0, 248, 26, 169, 0x401, STR_9823_SHIPS_CLICK_ON_SHIP_FOR}, |
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 |
{ WWT_SCROLLBAR, 14, 249, 259, 26, 169, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, |
0 | 1111 |
{ WWT_LAST}, |
1112 |
}; |
|
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
|
1113 |
|
0 | 1114 |
static const WindowDesc _other_player_ships_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
|
1115 |
-1, -1, 260, 170, |
0 | 1116 |
WC_SHIPS_LIST,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
|
1117 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_RESTORE_DPARAM, |
0 | 1118 |
_other_player_ships_widgets, |
1119 |
PlayerShipsWndProc |
|
1120 |
}; |
|
1121 |
||
1122 |
||
1123 |
void ShowPlayerShips(int player) |
|
1124 |
{ |
|
1125 |
Window *w; |
|
1126 |
||
1127 |
if ( player == _local_player) { |
|
1128 |
w = AllocateWindowDescFront(&_player_ships_desc, player); |
|
1129 |
} else { |
|
1130 |
w = AllocateWindowDescFront(&_other_player_ships_desc, player); |
|
1131 |
} |
|
1132 |
if (w) { |
|
1133 |
w->caption_color = w->window_number; |
|
1134 |
w->vscroll.cap = 4; |
|
1135 |
} |
|
1136 |
} |