8 #include "command.h" |
8 #include "command.h" |
9 #include "engine.h" |
9 #include "engine.h" |
10 #include "viewport.h" |
10 #include "viewport.h" |
11 #include "player.h" |
11 #include "player.h" |
12 |
12 |
13 extern const byte _aircraft_cost_table[NUM_AIRCRAFT_ENGINES]; |
|
14 extern const byte _aircraft_speed[NUM_AIRCRAFT_ENGINES]; |
|
15 extern const uint16 _aircraft_num_pass[NUM_AIRCRAFT_ENGINES]; |
|
16 extern const byte _aircraft_num_mail[NUM_AIRCRAFT_ENGINES]; |
|
17 extern const byte _aircraft_running_cost[NUM_AIRCRAFT_ENGINES]; |
|
18 |
|
19 |
13 |
20 static void DrawAircraftImage(Vehicle *v, int x, int y, VehicleID selection) |
14 static void DrawAircraftImage(Vehicle *v, int x, int y, VehicleID selection) |
21 { |
15 { |
22 int image = GetAircraftImage(v, 6); |
16 int image = GetAircraftImage(v, 6); |
23 uint32 ormod = SPRITE_PALETTE(PLAYER_SPRITE_COLOR(v->owner)); |
17 uint32 ormod = SPRITE_PALETTE(PLAYER_SPRITE_COLOR(v->owner)); |
93 WP(w,buildtrain_d).sel_engine = selected_id; |
87 WP(w,buildtrain_d).sel_engine = selected_id; |
94 |
88 |
95 if (selected_id != -1) { |
89 if (selected_id != -1) { |
96 Engine *e; |
90 Engine *e; |
97 |
91 |
98 SET_DPARAM32(0, _aircraft_cost_table[selected_id - AIRCRAFT_ENGINES_INDEX] * (_price.aircraft_base>>3)>>5); |
92 SET_DPARAM32(0, aircraft_vehinfo(selected_id).base_cost * (_price.aircraft_base>>3)>>5); |
99 SET_DPARAM16(1, _aircraft_speed[selected_id - AIRCRAFT_ENGINES_INDEX] * 8); |
93 SET_DPARAM16(1, aircraft_vehinfo(selected_id).max_speed * 8); |
100 SET_DPARAM16(2, _aircraft_num_pass[selected_id - AIRCRAFT_ENGINES_INDEX]); |
94 SET_DPARAM16(2, aircraft_vehinfo(selected_id).passanger_capacity); |
101 SET_DPARAM16(3, _aircraft_num_mail[selected_id - AIRCRAFT_ENGINES_INDEX]); |
95 SET_DPARAM16(3, aircraft_vehinfo(selected_id).mail_capacity); |
102 SET_DPARAM32(4,_aircraft_running_cost[selected_id - AIRCRAFT_ENGINES_INDEX] * _price.aircraft_running >> 8); |
96 SET_DPARAM32(4, aircraft_vehinfo(selected_id).running_cost * _price.aircraft_running >> 8); |
103 |
97 |
104 e = &_engines[selected_id]; |
98 e = &_engines[selected_id]; |
105 SET_DPARAM16(6, e->lifelength); |
99 SET_DPARAM16(6, e->lifelength); |
106 SET_DPARAM8(7, e->reliability * 100 >> 16); |
100 SET_DPARAM8(7, e->reliability * 100 >> 16); |
107 ConvertDayToYMD(&ymd, e->intro_date); |
101 ConvertDayToYMD(&ymd, e->intro_date); |
216 SET_DPARAM16(0, v->string_id); |
210 SET_DPARAM16(0, v->string_id); |
217 SET_DPARAM16(1, v->unitnumber); |
211 SET_DPARAM16(1, v->unitnumber); |
218 DrawWindowWidgets(w); |
212 DrawWindowWidgets(w); |
219 |
213 |
220 DrawString(1, 15, STR_A040_SELECT_CARGO_TYPE_TO_CARRY, 0); |
214 DrawString(1, 15, STR_A040_SELECT_CARGO_TYPE_TO_CARRY, 0); |
|
215 |
|
216 /* TODO: Support for custom GRFSpecial-specified refitting! --pasky */ |
221 |
217 |
222 cargo = -1; |
218 cargo = -1; |
223 x = 6; |
219 x = 6; |
224 y = 25; |
220 y = 25; |
225 sel = WP(w,refit_d).sel; |
221 sel = WP(w,refit_d).sel; |
329 if (v->max_age - 366 < v->age) |
325 if (v->max_age - 366 < v->age) |
330 str++; |
326 str++; |
331 } |
327 } |
332 SET_DPARAM16(0, str); |
328 SET_DPARAM16(0, str); |
333 SET_DPARAM16(2, v->max_age / 366); |
329 SET_DPARAM16(2, v->max_age / 366); |
334 SET_DPARAM32(3, _price.aircraft_running * _aircraft_running_cost[v->engine_type - AIRCRAFT_ENGINES_INDEX] >> 8); |
330 SET_DPARAM32(3, _price.aircraft_running * aircraft_vehinfo(v->engine_type).running_cost >> 8); |
335 DrawString(2, 15, STR_A00D_AGE_RUNNING_COST_YR, 0); |
331 DrawString(2, 15, STR_A00D_AGE_RUNNING_COST_YR, 0); |
336 } |
332 } |
337 |
333 |
338 /* Draw max speed */ |
334 /* Draw max speed */ |
339 { |
335 { |