--- a/src/vehicle_gui.cpp Sat Jun 02 19:59:29 2007 +0000
+++ b/src/vehicle_gui.cpp Sat Jul 14 19:42:58 2007 +0000
@@ -331,22 +331,21 @@
SetVScrollCount(w, WP(w, refit_d).list->num_lines);
- SetDParam(0, v->string_id);
- SetDParam(1, v->unitnumber);
+ SetDParam(0, v->index);
DrawWindowWidgets(w);
WP(w, refit_d).cargo = DrawVehicleRefitWindow(WP(w, refit_d).list, WP(w, refit_d).sel, w->vscroll.pos, w->vscroll.cap, w->resize.step_height);
if (WP(w, refit_d).cargo != NULL) {
- int32 cost;
+ CommandCost cost;
cost = DoCommand(v->tile, v->index, WP(w, refit_d).cargo->cargo | WP(w, refit_d).cargo->subtype << 8,
DC_QUERY_COST, GetCmdRefitVeh(GetVehicle(w->window_number)->type));
- if (!CmdFailed(cost)) {
+ if (CmdSucceeded(cost)) {
SetDParam(0, WP(w, refit_d).cargo->cargo);
SetDParam(1, _returned_refit_capacity);
- SetDParam(2, cost);
+ SetDParam(2, cost.GetCost());
DrawString(2, w->widget[5].top + 1, STR_9840_NEW_CAPACITY_COST_OF_REFIT, 0);
}
}
@@ -589,7 +588,7 @@
{
const Vehicle* va = *(const Vehicle**)a;
const Vehicle* vb = *(const Vehicle**)b;
- int r = va->profit_this_year - vb->profit_this_year;
+ int r = ClampToI32(va->profit_this_year - vb->profit_this_year);
VEHICLEUNITNUMBERSORTER(r, va, vb);
@@ -600,7 +599,7 @@
{
const Vehicle* va = *(const Vehicle**)a;
const Vehicle* vb = *(const Vehicle**)b;
- int r = va->profit_last_year - vb->profit_last_year;
+ int r = ClampToI32(va->profit_last_year - vb->profit_last_year);
VEHICLEUNITNUMBERSORTER(r, va, vb);
@@ -687,13 +686,12 @@
const Vehicle* va = *(const Vehicle**)a;
const Vehicle* vb = *(const Vehicle**)b;
const Vehicle *u;
- int valuea = 0, valueb = 0;
- int r;
+ Money valuea = 0, valueb = 0;
for (u = va; u != NULL; u = u->next) valuea += u->value;
for (u = vb; u != NULL; u = u->next) valueb += u->value;
- r = valuea - valueb;
+ int r = ClampToI32(valuea - valueb);
VEHICLEUNITNUMBERSORTER(r, va, vb);
@@ -959,9 +957,8 @@
break;
case VLW_STANDARD: /* Company Name */
- SetDParam(0, p->name_1);
- SetDParam(1, p->name_2);
- SetDParam(2, w->vscroll.count);
+ SetDParam(0, p->index);
+ SetDParam(1, w->vscroll.count);
break;
case VLW_STATION_LIST: /* Station Name */
@@ -1018,7 +1015,7 @@
(v->type == VEH_AIRCRAFT && v->string_id != STR_SV_AIRCRAFT_NAME)) {
/* The vehicle got a name so we will print it */
- SetDParam(0, v->string_id);
+ SetDParam(0, v->index);
DrawString(x + 19, y, STR_01AB, 0);
}
@@ -1114,7 +1111,7 @@
/* XXX - Substite string since the dropdown cannot handle dynamic strings */
action_str[2] = depot_name[vl->vehicle_type];
- ShowDropDownMenu(w, action_str, 0, VLW_WIDGET_MANAGE_VEHICLES_DROPDOWN, 0, 0);
+ ShowDropDownMenu(w, action_str, 0, VLW_WIDGET_MANAGE_VEHICLES_DROPDOWN, 0, (w->window_number & VLW_MASK) == VLW_STANDARD ? 0 : 1);
break;
}