diff options
Diffstat (limited to 'aircraft_gui.c')
-rw-r--r-- | aircraft_gui.c | 79 |
1 files changed, 1 insertions, 78 deletions
diff --git a/aircraft_gui.c b/aircraft_gui.c index 8e1fd60e5..cc1894f27 100644 --- a/aircraft_gui.c +++ b/aircraft_gui.c @@ -263,83 +263,6 @@ void ShowBuildAircraftWindow(TileIndex tile) } } -static void AircraftRefitWndProc(Window *w, WindowEvent *e) -{ - switch (e->event) { - case WE_PAINT: { - const Vehicle *v = GetVehicle(w->window_number); - - SetDParam(0, v->string_id); - SetDParam(1, v->unitnumber); - DrawWindowWidgets(w); - - - /* TODO: Support for custom GRFSpecial-specified refitting! --pasky */ - WP(w,refit_d).cargo = DrawVehicleRefitWindow(v, WP(w, refit_d).sel); - - if (WP(w,refit_d).cargo != CT_INVALID) { - int32 cost = DoCommand(v->tile, v->index, WP(w,refit_d).cargo, DC_QUERY_COST, CMD_REFIT_AIRCRAFT); - if (!CmdFailed(cost)) { - SetDParam(2, cost); - SetDParam(0, _cargoc.names_long[WP(w,refit_d).cargo]); - SetDParam(1, _returned_refit_capacity); - DrawString(1, 147, STR_A041_NEW_CAPACITY_COST_OF_REFIT, 0); - } - } - } break; - - case WE_CLICK: - switch (e->we.click.widget) { - case 2: { /* listbox */ - int y = e->we.click.pt.y - 25; - if (y >= 0) { - WP(w,refit_d).sel = y / 10; - SetWindowDirty(w); - } - } break; - case 4: /* refit button */ - if (WP(w,refit_d).cargo != CT_INVALID) { - const Vehicle *v = GetVehicle(w->window_number); - if (DoCommandP(v->tile, v->index, WP(w,refit_d).cargo, NULL, CMD_REFIT_AIRCRAFT | CMD_MSG(STR_A042_CAN_T_REFIT_AIRCRAFT))) - DeleteWindow(w); - } - break; - } - break; - } -} - -static const Widget _aircraft_refit_widgets[] = { -{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW }, -{ WWT_CAPTION, RESIZE_NONE, 14, 11, 239, 0, 13, STR_A03C_REFIT, STR_018C_WINDOW_TITLE_DRAG_THIS }, -{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 239, 14, 145, 0x0, STR_A03E_SELECT_TYPE_OF_CARGO_FOR }, -{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 239, 146, 167, 0x0, STR_NULL }, -{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 0, 239, 168, 179, STR_A03D_REFIT_AIRCRAFT, STR_A03F_REFIT_AIRCRAFT_TO_CARRY }, -{ WWT_LABEL, RESIZE_NONE, 0, 0, 239, 13, 26, STR_A040_SELECT_CARGO_TYPE_TO_CARRY, STR_NULL}, -{ WIDGETS_END}, -}; - -static const WindowDesc _aircraft_refit_desc = { - -1,-1, 240, 180, - WC_VEHICLE_REFIT,WC_VEHICLE_VIEW, - WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, - _aircraft_refit_widgets, - AircraftRefitWndProc -}; - -static void ShowAircraftRefitWindow(const Vehicle *v) -{ - Window *w; - - DeleteWindowById(WC_VEHICLE_REFIT, v->index); - - _alloc_wnd_parent_num = v->index; - w = AllocateWindowDesc(&_aircraft_refit_desc); - w->window_number = v->index; - w->caption_color = v->owner; - WP(w,refit_d).sel = -1; -} - static void AircraftDetailsWndProc(Window *w, WindowEvent *e) { switch (e->event) { @@ -599,7 +522,7 @@ static void AircraftViewWndProc(Window *w, WindowEvent *e) DoCommandP(v->tile, v->index, _ctrl_pressed ? DEPOT_SERVICE : 0, NULL, CMD_SEND_AIRCRAFT_TO_HANGAR | CMD_MSG(STR_A012_CAN_T_SEND_AIRCRAFT_TO)); break; case 8: /* refit */ - ShowAircraftRefitWindow(v); + ShowVehicleRefitWindow(v); break; case 9: /* show orders */ ShowOrdersWindow(v); |