summaryrefslogtreecommitdiff
path: root/src/roadveh_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/roadveh_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/roadveh_gui.cpp')
-rw-r--r--src/roadveh_gui.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/roadveh_gui.cpp b/src/roadveh_gui.cpp
index 11e8f3eca..d09792e2f 100644
--- a/src/roadveh_gui.cpp
+++ b/src/roadveh_gui.cpp
@@ -120,12 +120,17 @@ static inline int RoadVehLengthToPixels(int length)
return (length * 28) / 8;
}
-void DrawRoadVehImage(const Vehicle *v, int x, int y, VehicleID selection, int count)
+/**
+ * Draws an image of a road 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 border around
+ * @param max_width Number of pixels space for drawing
+ */
+void DrawRoadVehImage(const Vehicle *v, int x, int y, VehicleID selection, int max_width)
{
- /* Road vehicle lengths are measured in eighths of the standard length, so
- * count is the number of standard vehicles that should be drawn. If it is
- * 0, we draw enough vehicles for 10 standard vehicle lengths. */
- int max_length = (count == 0) ? 80 : count * 8;
+ int max_length = max_width / 28;
/* Width of highlight box */
int highlight_w = 0;