diff options
author | rubidium <rubidium@openttd.org> | 2009-11-16 22:25:01 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-11-16 22:25:01 +0000 |
commit | a808623b24b247d3a8b3b08875dd6cd2e22a85c6 (patch) | |
tree | 9f899d3a21ba89f4155651ef014a83b4e8392786 /src/roadveh_gui.cpp | |
parent | 6204c56d99d934c0fb04bf6194a7fa29e46953b8 (diff) | |
download | openttd-a808623b24b247d3a8b3b08875dd6cd2e22a85c6.tar.xz |
(svn r18133) -Codechange: pass the 'maximum' left/right positions to Draw*Image
Diffstat (limited to 'src/roadveh_gui.cpp')
-rw-r--r-- | src/roadveh_gui.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/roadveh_gui.cpp b/src/roadveh_gui.cpp index 00116e270..c0682cf06 100644 --- a/src/roadveh_gui.cpp +++ b/src/roadveh_gui.cpp @@ -123,27 +123,28 @@ void DrawRoadVehDetails(const Vehicle *v, int left, int right, int y) /** * 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 selection Selected vehicle to draw a border around - * @param max_width Number of pixels space for drawing + * @param v Front vehicle + * @param left The minimum horizontal position + * @param right The maximum horizontal position + * @param y Vertical position to draw at + * @param selection Selected vehicle to draw a frame around */ -void DrawRoadVehImage(const Vehicle *v, int x, int y, VehicleID selection, int max_width) +void DrawRoadVehImage(const Vehicle *v, int left, int right, int y, VehicleID selection) { const RoadVehicle *u = RoadVehicle::From(v); + int max_width = right - left + 1; int x_pos = 0; for (; u != NULL && x_pos < max_width; u = u->Next()) { Point offset; int width = u->GetDisplayImageWidth(&offset); SpriteID pal = (u->vehstatus & VS_CRASHED) ? PALETTE_CRASH : GetVehiclePalette(u); - DrawSprite(u->GetImage(DIR_W), pal, x + x_pos + offset.x, y + 6 + offset.y); + DrawSprite(u->GetImage(DIR_W), pal, left + x_pos + offset.x, y + 6 + offset.y); x_pos += width; } if (v->index == selection) { - DrawFrameRect(x - 1, y - 1, x - 1 + x_pos, y + 12, COLOUR_WHITE, FR_BORDERONLY); + DrawFrameRect(left - 1, y - 1, left - 1 + x_pos, y + 12, COLOUR_WHITE, FR_BORDERONLY); } } |