summaryrefslogtreecommitdiff
path: root/src/ship_gui.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2016-10-16 14:58:38 +0000
committerfrosch <frosch@openttd.org>2016-10-16 14:58:38 +0000
commitc175067ed9c17d43feaf356cd575dddddd699889 (patch)
treef865fa356c59ab450aa1c93a22f024f15d675224 /src/ship_gui.cpp
parentd2393b4f6c89b75a90452fe68ab8a1cfbd8c353f (diff)
downloadopenttd-c175067ed9c17d43feaf356cd575dddddd699889.tar.xz
(svn r27667) -Codechange: Add VehicleSpriteSeq::GetBounds and Draw.
Diffstat (limited to 'src/ship_gui.cpp')
-rw-r--r--src/ship_gui.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/ship_gui.cpp b/src/ship_gui.cpp
index f827b0a31..c6bf342d9 100644
--- a/src/ship_gui.cpp
+++ b/src/ship_gui.cpp
@@ -38,19 +38,20 @@ void DrawShipImage(const Vehicle *v, int left, int right, int y, VehicleID selec
VehicleSpriteSeq seq;
v->GetImage(rtl ? DIR_E : DIR_W, image_type, &seq);
- const Sprite *real_sprite = GetSprite(seq.sprite, ST_NORMAL);
+ Rect rect;
+ seq.GetBounds(&rect);
- int width = UnScaleGUI(real_sprite->width);
- int x_offs = UnScaleGUI(real_sprite->x_offs);
+ int width = UnScaleGUI(rect.right - rect.left + 1);
+ int x_offs = UnScaleGUI(rect.left);
int x = rtl ? right - width - x_offs : left - x_offs;
y += ScaleGUITrad(10);
- DrawSprite(seq.sprite, GetVehiclePalette(v), x, y);
+ seq.Draw(x, y, GetVehiclePalette(v), false);
if (v->index == selection) {
x += x_offs;
- y += UnScaleGUI(real_sprite->y_offs);
- DrawFrameRect(x - 1, y - 1, x + width + 1, y + UnScaleGUI(real_sprite->height) + 1, COLOUR_WHITE, FR_BORDERONLY);
+ y += UnScaleGUI(rect.top);
+ DrawFrameRect(x - 1, y - 1, x + width + 1, y + UnScaleGUI(rect.bottom - rect.top + 1) + 1, COLOUR_WHITE, FR_BORDERONLY);
}
}