(svn r18133) -Codechange: pass the 'maximum' left/right positions to Draw*Image
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user