summaryrefslogtreecommitdiff
path: root/src/vehicle_gui.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2009-07-12 16:00:11 +0000
committerfrosch <frosch@openttd.org>2009-07-12 16:00:11 +0000
commit78eccd05befe40a006974daf0b29dfb1b2382b65 (patch)
treedfc209ba6db7b370111bda05a1b8649de8667821 /src/vehicle_gui.cpp
parent9efd32d13ce11aedf020cd2ce9eddc2ccaa72d32 (diff)
downloadopenttd-78eccd05befe40a006974daf0b29dfb1b2382b65.tar.xz
(svn r16799) -Codechange: When drawing articulated road vehicles in the vehicle details window, draw as many parts as the window fits instead of always up to a vehicle length of 80/8.
Diffstat (limited to 'src/vehicle_gui.cpp')
-rw-r--r--src/vehicle_gui.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index 17b225b38..7f55f3b24 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -798,13 +798,22 @@ static void DrawSmallOrderList(const Vehicle *v, int left, int right, int y)
}
}
-static void DrawVehicleImage(const Vehicle *v, int x, int y, VehicleID selection, int count, int skip)
+/**
+ * Draws an image of a vehicle chain
+ * @param v Front vehicle
+ + @param x x Position to start at
+ * @param y y Position to draw at
+ * @param seletion Selected vehicle to draw a frame around
+ * @param max_width Number of pixels space for drawing
+ * @param skip Number of pixels to skip at the front (for scrolling)
+ */
+static void DrawVehicleImage(const Vehicle *v, int x, int y, VehicleID selection, int max_width, int skip)
{
switch (v->type) {
- case VEH_TRAIN: DrawTrainImage(v, x, y, selection, count, skip); break;
- case VEH_ROAD: DrawRoadVehImage(v, x, y, selection, count); break;
- case VEH_SHIP: DrawShipImage(v, x, y, selection); break;
- case VEH_AIRCRAFT: DrawAircraftImage(v, x, y, selection); break;
+ case VEH_TRAIN: DrawTrainImage(v, x, y, selection, max_width, skip); break;
+ case VEH_ROAD: DrawRoadVehImage(v, x, y, selection, max_width); break;
+ case VEH_SHIP: DrawShipImage(v, x, y, selection); break;
+ case VEH_AIRCRAFT: DrawAircraftImage(v, x, y, selection); break;
default: NOT_REACHED();
}
}
@@ -1517,7 +1526,7 @@ struct VehicleDetailsWindow : Window {
case VEH_ROAD:
case VEH_SHIP:
case VEH_AIRCRAFT:
- DrawVehicleImage(v, matrix->left + 3, matrix->top + 1, INVALID_VEHICLE, 0, 0);
+ DrawVehicleImage(v, matrix->left + 3, matrix->top + 1, INVALID_VEHICLE, matrix->right - matrix->left - 5, 0);
DrawVehicleDetails(v, matrix->left + 75, matrix->right - 2, matrix->top + 1, this->vscroll.pos, this->vscroll.cap, det_tab);
break;