summaryrefslogtreecommitdiff
path: root/vehicle_gui.c
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2006-10-23 18:45:43 +0000
committerpeter1138 <peter1138@openttd.org>2006-10-23 18:45:43 +0000
commit4c11b5aef574087fa43159e5e4ee0f0cdc1d6fd4 (patch)
treee73bc759e69d13e07ce73c600d8ac0c7f1536fe8 /vehicle_gui.c
parentf1b57ead1b26eb7e172e90c864b080d46a2e3412 (diff)
downloadopenttd-4c11b5aef574087fa43159e5e4ee0f0cdc1d6fd4.tar.xz
(svn r6910) - Codechange: Supply width of area when drawing purchase info instead of using hardcoded values. (mart3p)
Diffstat (limited to 'vehicle_gui.c')
-rw-r--r--vehicle_gui.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/vehicle_gui.c b/vehicle_gui.c
index f171e8435..6a4ea4c42 100644
--- a/vehicle_gui.c
+++ b/vehicle_gui.c
@@ -990,20 +990,20 @@ static void DrawEngineArrayInReplaceWindow(Window *w, int x, int y, int x2, int
}
}
-static void DrawVehiclePurchaseInfo(const int x, const int y, const EngineID engine_number)
+static void DrawVehiclePurchaseInfo(const int x, const int y, uint w, const EngineID engine_number)
{
switch (GetEngine(engine_number)->type) {
case VEH_Train:
if ((RailVehInfo(engine_number)->flags & RVI_WAGON) == 0) {
- DrawTrainEnginePurchaseInfo(x, y, engine_number);
+ DrawTrainEnginePurchaseInfo(x, y, w, engine_number);
} else {
- DrawTrainWagonPurchaseInfo(x, y, engine_number);
+ DrawTrainWagonPurchaseInfo(x, y, w, engine_number);
}
break;
- case VEH_Road: DrawRoadVehPurchaseInfo(x, y, engine_number); break;
- case VEH_Ship: DrawShipPurchaseInfo(x, y, engine_number); break;
- case VEH_Aircraft: DrawAircraftPurchaseInfo(x, y, engine_number); break;
+ case VEH_Road: DrawRoadVehPurchaseInfo(x, y, w, engine_number); break;
+ case VEH_Ship: DrawShipPurchaseInfo(x, y, w, engine_number); break;
+ case VEH_Aircraft: DrawAircraftPurchaseInfo(x, y, w, engine_number); break;
default: NOT_REACHED();
}
}
@@ -1080,7 +1080,7 @@ static void ReplaceVehicleWndProc(Window *w, WindowEvent *e)
SetDParam(0, STR_NOT_REPLACING_VEHICLE_SELECTED);
}
- DrawString(145, 87 + w->resize.step_height * w->vscroll.cap, STR_02BD, 0x10);
+ DrawString(145, w->widget[5].top + 1, STR_02BD, 0x10);
/* now we draw the two arrays according to what we just counted */
DrawEngineArrayInReplaceWindow(w, x, y, x2, y2, pos, pos2, sel[0], sel[1], selected_id[0], selected_id[1]);
@@ -1090,7 +1090,8 @@ static void ReplaceVehicleWndProc(Window *w, WindowEvent *e)
/* now we draw the info about the vehicles we selected */
for (i = 0 ; i < 2 ; i++) {
if (selected_id[i] != INVALID_ENGINE) {
- DrawVehiclePurchaseInfo((i == 1) ? 230 : 2 , 15 + (w->resize.step_height * w->vscroll.cap), selected_id[i]);
+ const Widget *wi = &w->widget[i == 0 ? 3 : 11];
+ DrawVehiclePurchaseInfo(wi->left + 2 , wi->top + 1, wi->right - wi->left - 2, selected_id[i]);
}
}
} break; // end of paint