equal
deleted
inserted
replaced
49 void CcBuildAircraft(bool success, uint tile, uint32 p1, uint32 p2) |
49 void CcBuildAircraft(bool success, uint tile, uint32 p1, uint32 p2) |
50 { |
50 { |
51 Vehicle *v; |
51 Vehicle *v; |
52 |
52 |
53 if (success) { |
53 if (success) { |
54 v = &_vehicles[_new_aircraft_id]; |
54 v = GetVehicle(_new_aircraft_id); |
55 if (v->tile == _backup_orders_tile) { |
55 if (v->tile == _backup_orders_tile) { |
56 _backup_orders_tile = 0; |
56 _backup_orders_tile = 0; |
57 RestoreVehicleOrders(v, _backup_orders_data); |
57 RestoreVehicleOrders(v, _backup_orders_data); |
58 } |
58 } |
59 ShowAircraftViewWindow(v); |
59 ShowAircraftViewWindow(v); |
215 |
215 |
216 static void AircraftRefitWndProc(Window *w, WindowEvent *e) |
216 static void AircraftRefitWndProc(Window *w, WindowEvent *e) |
217 { |
217 { |
218 switch(e->event) { |
218 switch(e->event) { |
219 case WE_PAINT: { |
219 case WE_PAINT: { |
220 Vehicle *v = &_vehicles[w->window_number]; |
220 Vehicle *v = GetVehicle(w->window_number); |
221 const byte *b; |
221 const byte *b; |
222 int sel; |
222 int sel; |
223 int x,y; |
223 int x,y; |
224 byte color; |
224 byte color; |
225 int cargo; |
225 int cargo; |
294 SetWindowDirty(w); |
294 SetWindowDirty(w); |
295 } |
295 } |
296 } break; |
296 } break; |
297 case 4: /* refit button */ |
297 case 4: /* refit button */ |
298 if (WP(w,refit_d).cargo != 0xFF) { |
298 if (WP(w,refit_d).cargo != 0xFF) { |
299 Vehicle *v = &_vehicles[w->window_number]; |
299 Vehicle *v = GetVehicle(w->window_number); |
300 if (DoCommandP(v->tile, v->index, WP(w,refit_d).cargo, NULL, CMD_REFIT_AIRCRAFT | CMD_MSG(STR_A042_CAN_T_REFIT_AIRCRAFT))) |
300 if (DoCommandP(v->tile, v->index, WP(w,refit_d).cargo, NULL, CMD_REFIT_AIRCRAFT | CMD_MSG(STR_A042_CAN_T_REFIT_AIRCRAFT))) |
301 DeleteWindow(w); |
301 DeleteWindow(w); |
302 } |
302 } |
303 break; |
303 break; |
304 } |
304 } |
337 } |
337 } |
338 |
338 |
339 static void AircraftDetailsWndProc(Window *w, WindowEvent *e) |
339 static void AircraftDetailsWndProc(Window *w, WindowEvent *e) |
340 { |
340 { |
341 int mod; |
341 int mod; |
342 Vehicle *v = &_vehicles[w->window_number], *u; |
342 Vehicle *v = GetVehicle(w->window_number), *u; |
343 |
343 |
344 switch(e->event) { |
344 switch(e->event) { |
345 case WE_PAINT: |
345 case WE_PAINT: |
346 w->disabled_state = v->owner == _local_player ? 0 : (1 << 2); |
346 w->disabled_state = v->owner == _local_player ? 0 : (1 << 2); |
347 if (!_patches.servint_aircraft) // disable service-scroller when interval is set to disabled |
347 if (!_patches.servint_aircraft) // disable service-scroller when interval is set to disabled |
532 |
532 |
533 static void AircraftViewWndProc(Window *w, WindowEvent *e) |
533 static void AircraftViewWndProc(Window *w, WindowEvent *e) |
534 { |
534 { |
535 switch(e->event) { |
535 switch(e->event) { |
536 case WE_PAINT: { |
536 case WE_PAINT: { |
537 Vehicle *v = &_vehicles[w->window_number]; |
537 Vehicle *v = GetVehicle(w->window_number); |
538 uint32 disabled = 1<<8; |
538 uint32 disabled = 1<<8; |
539 StringID str; |
539 StringID str; |
540 |
540 |
541 { |
541 { |
542 uint tile = v->tile; |
542 uint tile = v->tile; |
593 DrawStringCentered(125, 105, str, 0); |
593 DrawStringCentered(125, 105, str, 0); |
594 DrawWindowViewport(w); |
594 DrawWindowViewport(w); |
595 } break; |
595 } break; |
596 |
596 |
597 case WE_CLICK: { |
597 case WE_CLICK: { |
598 Vehicle *v = &_vehicles[w->window_number]; |
598 Vehicle *v = GetVehicle(w->window_number); |
599 |
599 |
600 switch(e->click.widget) { |
600 switch(e->click.widget) { |
601 case 5: /* start stop */ |
601 case 5: /* start stop */ |
602 DoCommandP(v->tile, v->index, 0, NULL, CMD_START_STOP_AIRCRAFT | CMD_MSG(STR_A016_CAN_T_STOP_START_AIRCRAFT)); |
602 DoCommandP(v->tile, v->index, 0, NULL, CMD_START_STOP_AIRCRAFT | CMD_MSG(STR_A016_CAN_T_STOP_START_AIRCRAFT)); |
603 break; |
603 break; |
830 WP(w,traindepot_d).sel != INVALID_VEHICLE) { |
830 WP(w,traindepot_d).sel != INVALID_VEHICLE) { |
831 Vehicle *v; |
831 Vehicle *v; |
832 |
832 |
833 HandleButtonClick(w, 5); |
833 HandleButtonClick(w, 5); |
834 |
834 |
835 v = &_vehicles[WP(w,traindepot_d).sel]; |
835 v = GetVehicle(WP(w,traindepot_d).sel); |
836 WP(w,traindepot_d).sel = INVALID_VEHICLE; |
836 WP(w,traindepot_d).sel = INVALID_VEHICLE; |
837 |
837 |
838 _backup_orders_tile = v->tile; |
838 _backup_orders_tile = v->tile; |
839 BackupVehicleOrders(v, _backup_orders_data); |
839 BackupVehicleOrders(v, _backup_orders_data); |
840 |
840 |
977 SetDParam(1, p->name_2); |
977 SetDParam(1, p->name_2); |
978 SetDParam(2, w->vscroll.count); |
978 SetDParam(2, w->vscroll.count); |
979 w->widget[1].unkA = STR_A009_AIRCRAFT; |
979 w->widget[1].unkA = STR_A009_AIRCRAFT; |
980 } else { |
980 } else { |
981 /* Station Name -- (###) Aircraft */ |
981 /* Station Name -- (###) Aircraft */ |
982 SetDParam(0, DEREF_STATION(station)->index); |
982 SetDParam(0, GetStation(station)->index); |
983 SetDParam(1, w->vscroll.count); |
983 SetDParam(1, w->vscroll.count); |
984 w->widget[1].unkA = STR_SCHEDULED_AIRCRAFT; |
984 w->widget[1].unkA = STR_SCHEDULED_AIRCRAFT; |
985 } |
985 } |
986 DrawWindowWidgets(w); |
986 DrawWindowWidgets(w); |
987 } |
987 } |
991 DoDrawString( |
991 DoDrawString( |
992 vl->flags & VL_DESC ? "\xAA" : "\xA0", 69, 15, 0x10); |
992 vl->flags & VL_DESC ? "\xAA" : "\xA0", 69, 15, 0x10); |
993 |
993 |
994 max = min(w->vscroll.pos + w->vscroll.cap, vl->list_length); |
994 max = min(w->vscroll.pos + w->vscroll.cap, vl->list_length); |
995 for (i = w->vscroll.pos; i < max; ++i) { |
995 for (i = w->vscroll.pos; i < max; ++i) { |
996 Vehicle *v = DEREF_VEHICLE(vl->sort_list[i].index); |
996 Vehicle *v = GetVehicle(vl->sort_list[i].index); |
997 StringID str; |
997 StringID str; |
998 |
998 |
999 assert(v->type == VEH_Aircraft && v->subtype <= 2); |
999 assert(v->type == VEH_Aircraft && v->subtype <= 2); |
1000 |
1000 |
1001 DrawAircraftImage(v, x + 19, y + 6, INVALID_VEHICLE); |
1001 DrawAircraftImage(v, x + 19, y + 6, INVALID_VEHICLE); |
1045 { |
1045 { |
1046 Vehicle *v; |
1046 Vehicle *v; |
1047 |
1047 |
1048 if (id_v >= vl->list_length) return; // click out of list bound |
1048 if (id_v >= vl->list_length) return; // click out of list bound |
1049 |
1049 |
1050 v = DEREF_VEHICLE(vl->sort_list[id_v].index); |
1050 v = GetVehicle(vl->sort_list[id_v].index); |
1051 |
1051 |
1052 assert(v->type == VEH_Aircraft && v->subtype <= 2); |
1052 assert(v->type == VEH_Aircraft && v->subtype <= 2); |
1053 |
1053 |
1054 ShowAircraftViewWindow(v); |
1054 ShowAircraftViewWindow(v); |
1055 } |
1055 } |