summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--aircraft_gui.c79
-rw-r--r--roadveh_gui.c81
-rw-r--r--ship_gui.c80
-rw-r--r--train_gui.c78
-rw-r--r--vehicle_gui.c118
-rw-r--r--vehicle_gui.h2
6 files changed, 122 insertions, 316 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);
diff --git a/roadveh_gui.c b/roadveh_gui.c
index ac93a4d9a..61bab84e4 100644
--- a/roadveh_gui.c
+++ b/roadveh_gui.c
@@ -79,85 +79,6 @@ void DrawRoadVehImage(const Vehicle *v, int x, int y, VehicleID selection)
}
}
-static void RoadVehRefitWndProc(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);
-
- 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_ROAD_VEH);
- if (!CmdFailed(cost)) {
- SetDParam(0, _cargoc.names_long[WP(w,refit_d).cargo]);
- SetDParam(1, _returned_refit_capacity);
- SetDParam(2, cost);
- DrawString(1, 137, STR_9840_NEW_CAPACITY_COST_OF_REFIT, 0);
- }
- }
-
- break;
- }
-
- case WE_CLICK:
- switch (e->we.click.widget) {
- case 2: { /* List box */
- 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_ROAD_VEH | CMD_MSG(STR_REFIT_ROAD_VEHICLE_CAN_T)))
- DeleteWindow(w);
- }
- break;
- }
- break;
- }
-}
-
-static const Widget _road_veh_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_983B_REFIT, STR_018C_WINDOW_TITLE_DRAG_THIS },
-{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 239, 14, 135, 0x0, STR_983D_SELECT_TYPE_OF_CARGO_FOR },
-{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 239, 136, 157, 0x0, STR_NULL },
-{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 0, 239, 158, 169, STR_REFIT_ROAD_VEHICLE, STR_REFIT_ROAD_VEHICLE_TO_CARRY_HIGHLIGHTED },
-{ WWT_LABEL, RESIZE_NONE, 0, 0, 239, 13, 26, STR_983F_SELECT_CARGO_TYPE_TO_CARRY, STR_NULL},
-{ WIDGETS_END },
-};
-
-static const WindowDesc _road_veh_refit_desc = {
- -1, -1, 240, 170,
- WC_VEHICLE_REFIT, WC_VEHICLE_VIEW,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
- _road_veh_refit_widgets,
- RoadVehRefitWndProc,
-};
-
-static void ShowRoadVehRefitWindow(const Vehicle *v)
-{
- Window *w;
-
- DeleteWindowById(WC_VEHICLE_REFIT, v->index);
-
- _alloc_wnd_parent_num = v->index;
- w = AllocateWindowDesc(&_road_veh_refit_desc);
- w->window_number = v->index;
- w->caption_color = v->owner;
- WP(w,refit_d).sel = -1;
-}
-
static void RoadVehDetailsWndProc(Window *w, WindowEvent *e)
{
switch (e->event) {
@@ -398,7 +319,7 @@ static void RoadVehViewWndProc(Window *w, WindowEvent *e)
DoCommandP(v->tile, v->index, _ctrl_pressed ? 1 : 0, CcCloneRoadVeh, CMD_CLONE_VEHICLE | CMD_MSG(STR_9009_CAN_T_BUILD_ROAD_VEHICLE));
break;
case 12: /* Refit vehicle */
- ShowRoadVehRefitWindow(v);
+ ShowVehicleRefitWindow(v);
break;
}
} break;
diff --git a/ship_gui.c b/ship_gui.c
index c39d53d2b..8d80d9a48 100644
--- a/ship_gui.c
+++ b/ship_gui.c
@@ -78,84 +78,6 @@ void DrawShipImage(const Vehicle *v, int x, int y, VehicleID selection)
}
}
-static void ShipRefitWndProc(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_SHIP);
- if (!CmdFailed(cost)) {
- SetDParam(2, cost);
- SetDParam(0, _cargoc.names_long[WP(w,refit_d).cargo]);
- SetDParam(1, _returned_refit_capacity);
- DrawString(1, 137, STR_9840_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_SHIP | CMD_MSG(STR_9841_CAN_T_REFIT_SHIP)))
- DeleteWindow(w);
- }
- break;
- }
- break;
- }
-}
-
-
-static const Widget _ship_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_983B_REFIT, STR_018C_WINDOW_TITLE_DRAG_THIS},
-{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 239, 14, 135, 0x0, STR_983D_SELECT_TYPE_OF_CARGO_FOR},
-{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 239, 136, 157, 0x0, STR_NULL},
-{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 0, 239, 158, 169, STR_983C_REFIT_SHIP, STR_983E_REFIT_SHIP_TO_CARRY_HIGHLIGHTED},
-{ WWT_LABEL, RESIZE_NONE, 0, 0, 239, 13, 26, STR_983F_SELECT_CARGO_TYPE_TO_CARRY, STR_NULL},
-{ WIDGETS_END},
-};
-
-static const WindowDesc _ship_refit_desc = {
- -1,-1, 240, 170,
- WC_VEHICLE_REFIT,WC_VEHICLE_VIEW,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
- _ship_refit_widgets,
- ShipRefitWndProc,
-};
-
-static void ShowShipRefitWindow(const Vehicle *v)
-{
- Window *w;
-
- DeleteWindowById(WC_VEHICLE_REFIT, v->index);
-
- _alloc_wnd_parent_num = v->index;
- w = AllocateWindowDesc(&_ship_refit_desc);
- w->window_number = v->index;
- w->caption_color = v->owner;
- WP(w,refit_d).sel = -1;
-}
-
static void ShipDetailsWndProc(Window *w, WindowEvent *e)
{
switch (e->event) {
@@ -527,7 +449,7 @@ static void ShipViewWndProc(Window *w, WindowEvent *e)
DoCommandP(v->tile, v->index, _ctrl_pressed ? DEPOT_SERVICE : 0, NULL, CMD_SEND_SHIP_TO_DEPOT | CMD_MSG(STR_9819_CAN_T_SEND_SHIP_TO_DEPOT));
break;
case 8: /* refit */
- ShowShipRefitWindow(v);
+ ShowVehicleRefitWindow(v);
break;
case 9: /* show orders */
ShowOrdersWindow(v);
diff --git a/train_gui.c b/train_gui.c
index 8866bf2be..aba29e187 100644
--- a/train_gui.c
+++ b/train_gui.c
@@ -396,82 +396,6 @@ void DrawTrainImage(const Vehicle *v, int x, int y, int count, int skip, Vehicle
_cur_dpi = old_dpi;
}
-static void RailVehicleRefitWndProc(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_RAIL_VEHICLE);
- if (!CmdFailed(cost)) {
- SetDParam(2, cost);
- SetDParam(0, _cargoc.names_long[WP(w,refit_d).cargo]);
- SetDParam(1, _returned_refit_capacity);
- DrawString(1, 137, STR_9840_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_RAIL_VEHICLE | CMD_MSG(STR_RAIL_CAN_T_REFIT_VEHICLE)))
- DeleteWindow(w);
- }
- break;
- }
- break;
- }
-}
-
-
-static const Widget _rail_vehicle_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_983B_REFIT, STR_018C_WINDOW_TITLE_DRAG_THIS},
-{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 239, 14, 135, 0x0, STR_RAIL_SELECT_TYPE_OF_CARGO_FOR},
-{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 239, 136, 157, 0x0, STR_NULL},
-{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 0, 239, 158, 169, STR_RAIL_REFIT_VEHICLE, STR_RAIL_REFIT_TO_CARRY_HIGHLIGHTED},
-{ WWT_LABEL, RESIZE_NONE, 0, 0, 239, 13, 26, STR_983F_SELECT_CARGO_TYPE_TO_CARRY, STR_NULL},
-{ WIDGETS_END},
-};
-
-static const WindowDesc _rail_vehicle_refit_desc = {
- -1,-1, 240, 170,
- WC_VEHICLE_REFIT,WC_VEHICLE_VIEW,
- WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
- _rail_vehicle_refit_widgets,
- RailVehicleRefitWndProc,
-};
-
-static void ShowRailVehicleRefitWindow(Vehicle *v)
-{
- Window *w;
- DeleteWindowById(WC_VEHICLE_REFIT, v->index);
- _alloc_wnd_parent_num = v->index;
- w = AllocateWindowDesc(&_rail_vehicle_refit_desc);
- w->window_number = v->index;
- w->caption_color = v->owner;
- WP(w,refit_d).sel = -1;
-}
-
static const Widget _train_view_widgets[] = {
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW },
{ WWT_CAPTION, RESIZE_RIGHT, 14, 11, 237, 0, 13, STR_882E, STR_018C_WINDOW_TITLE_DRAG_THIS },
@@ -617,7 +541,7 @@ static void TrainViewWndProc(Window *w, WindowEvent *e)
ShowTrainDetailsWindow(v);
break;
case 12:
- ShowRailVehicleRefitWindow(v);
+ ShowVehicleRefitWindow(v);
break;
case 13:
DoCommandP(v->tile, v->index, _ctrl_pressed ? 1 : 0, NULL, CMD_CLONE_VEHICLE | CMD_MSG(STR_882B_CAN_T_BUILD_RAILROAD_VEHICLE));
diff --git a/vehicle_gui.c b/vehicle_gui.c
index ee039ad4e..41e183957 100644
--- a/vehicle_gui.c
+++ b/vehicle_gui.c
@@ -207,7 +207,7 @@ void DrawVehicleProfitButton(const Vehicle *v, int x, int y)
* @param sel selected refit cargo-type in the window
* @return the cargo type that is hightlighted, CT_INVALID if none
*/
-CargoID DrawVehicleRefitWindow(const Vehicle *v, int sel)
+static CargoID DrawVehicleRefitWindow(const Vehicle *v, int sel)
{
uint32 cmask = 0;
CargoID cid, cargo = CT_INVALID;
@@ -242,6 +242,122 @@ CargoID DrawVehicleRefitWindow(const Vehicle *v, int sel)
return cargo;
}
+static void VehicleRefitWndProc(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);
+
+
+ WP(w,refit_d).cargo = DrawVehicleRefitWindow(v, WP(w, refit_d).sel);
+
+ if (WP(w,refit_d).cargo != CT_INVALID) {
+ int32 cost = 0;
+ switch (GetVehicle(w->window_number)->type) {
+ case VEH_Train: cost = CMD_REFIT_RAIL_VEHICLE; break;
+ case VEH_Road: cost = CMD_REFIT_ROAD_VEH; break;
+ case VEH_Ship: cost = CMD_REFIT_SHIP; break;
+ case VEH_Aircraft: cost = CMD_REFIT_AIRCRAFT; break;
+ }
+
+ cost = DoCommand(v->tile, v->index, WP(w,refit_d).cargo, DC_QUERY_COST, cost);
+ if (!CmdFailed(cost)) {
+ SetDParam(0, _cargoc.names_long[WP(w,refit_d).cargo]);
+ SetDParam(1, _returned_refit_capacity);
+ SetDParam(2, cost);
+ DrawString(1, 137, STR_9840_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);
+ int command = 0;
+
+ switch (v->type) {
+ case VEH_Train: command = CMD_REFIT_RAIL_VEHICLE | CMD_MSG(STR_RAIL_CAN_T_REFIT_VEHICLE); break;
+ case VEH_Road: command = CMD_REFIT_ROAD_VEH | CMD_MSG(STR_REFIT_ROAD_VEHICLE_CAN_T); break;
+ case VEH_Ship: command = CMD_REFIT_SHIP | CMD_MSG(STR_9841_CAN_T_REFIT_SHIP); break;
+ case VEH_Aircraft: command = CMD_REFIT_AIRCRAFT | CMD_MSG(STR_A042_CAN_T_REFIT_AIRCRAFT); break;
+ }
+ if (DoCommandP(v->tile, v->index, WP(w,refit_d).cargo, NULL, command))
+ DeleteWindow(w);
+ }
+ break;
+ }
+ break;
+ }
+}
+
+
+static const Widget _vehicle_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_983B_REFIT, STR_018C_WINDOW_TITLE_DRAG_THIS},
+ { WWT_IMGBTN, RESIZE_NONE, 14, 0, 239, 14, 135, 0x0, STR_983D_SELECT_TYPE_OF_CARGO_FOR},
+ { WWT_IMGBTN, RESIZE_NONE, 14, 0, 239, 136, 157, 0x0, STR_NULL},
+ { WWT_PUSHTXTBTN, RESIZE_NONE, 14, 0, 239, 158, 169, 0x0, STR_NULL},
+ { WWT_LABEL, RESIZE_NONE, 0, 0, 239, 13, 26, STR_983F_SELECT_CARGO_TYPE_TO_CARRY, STR_NULL},
+ { WIDGETS_END},
+};
+
+static const WindowDesc _vehicle_refit_desc = {
+ -1,-1, 240, 170,
+ WC_VEHICLE_REFIT,WC_VEHICLE_VIEW,
+ WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
+ _vehicle_refit_widgets,
+ VehicleRefitWndProc,
+};
+
+/** Show the refit window for a vehicle
+* @param *v The vehicle to show the refit window for
+*/
+void ShowVehicleRefitWindow(const Vehicle *v)
+{
+ Window *w;
+
+ DeleteWindowById(WC_VEHICLE_REFIT, v->index);
+
+ _alloc_wnd_parent_num = v->index;
+ w = AllocateWindowDesc(&_vehicle_refit_desc);
+ w->window_number = v->index;
+ w->caption_color = v->owner;
+ WP(w,refit_d).sel = -1;
+
+ switch (v->type) {
+ case VEH_Train:
+ w->widget[4].data = STR_RAIL_REFIT_VEHICLE;
+ w->widget[4].tooltips = STR_RAIL_REFIT_TO_CARRY_HIGHLIGHTED;
+ break;
+ case VEH_Road:
+ w->widget[4].data = STR_REFIT_ROAD_VEHICLE;
+ w->widget[4].tooltips = STR_REFIT_ROAD_VEHICLE_TO_CARRY_HIGHLIGHTED;
+ break;
+ case VEH_Ship:
+ w->widget[4].data = STR_983C_REFIT_SHIP;
+ w->widget[4].tooltips = STR_983E_REFIT_SHIP_TO_CARRY_HIGHLIGHTED;
+ break;
+ case VEH_Aircraft:
+ w->widget[4].data = STR_A03D_REFIT_AIRCRAFT;
+ w->widget[4].tooltips = STR_A03F_REFIT_AIRCRAFT_TO_CARRY;
+ break;
+ default: NOT_REACHED();
+ }
+}
+
/* Display additional text from NewGRF in the purchase information window */
int ShowAdditionalText(int x, int y, int w, EngineID engine)
{
diff --git a/vehicle_gui.h b/vehicle_gui.h
index 108f8f88e..4a30a9518 100644
--- a/vehicle_gui.h
+++ b/vehicle_gui.h
@@ -6,7 +6,7 @@
#include "window.h"
void DrawVehicleProfitButton(const Vehicle *v, int x, int y);
-CargoID DrawVehicleRefitWindow(const Vehicle *v, int sel);
+void ShowVehicleRefitWindow(const Vehicle *v);
void InitializeVehiclesGuiList(void);
/* sorter stuff */