summaryrefslogtreecommitdiff
path: root/src/aircraft_cmd.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/aircraft_cmd.cpp
parentd2393b4f6c89b75a90452fe68ab8a1cfbd8c353f (diff)
downloadopenttd-c175067ed9c17d43feaf356cd575dddddd699889.tar.xz
(svn r27667) -Codechange: Add VehicleSpriteSeq::GetBounds and Draw.
Diffstat (limited to 'src/aircraft_cmd.cpp')
-rw-r--r--src/aircraft_cmd.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp
index c7cb5bbb2..28680ad92 100644
--- a/src/aircraft_cmd.cpp
+++ b/src/aircraft_cmd.cpp
@@ -202,17 +202,19 @@ void DrawAircraftEngine(int left, int right, int preferred_x, int y, EngineID en
VehicleSpriteSeq seq;
GetAircraftIcon(engine, image_type, &seq);
- const Sprite *real_sprite = GetSprite(seq.sprite, ST_NORMAL);
+ Rect rect;
+ seq.GetBounds(&rect);
preferred_x = Clamp(preferred_x,
- left - UnScaleGUI(real_sprite->x_offs),
- right - UnScaleGUI(real_sprite->width) - UnScaleGUI(real_sprite->x_offs));
- DrawSprite(seq.sprite, pal, preferred_x, y);
+ left - UnScaleGUI(rect.left),
+ right - UnScaleGUI(rect.right));
+
+ seq.Draw(preferred_x, y, pal, pal == PALETTE_CRASH);
if (!(AircraftVehInfo(engine)->subtype & AIR_CTOL)) {
VehicleSpriteSeq rotor_seq;
GetCustomRotorIcon(engine, image_type, &rotor_seq);
if (!rotor_seq.IsValid()) rotor_seq.Set(SPR_ROTOR_STOPPED);
- DrawSprite(rotor_seq.sprite, PAL_NONE, preferred_x, y - ScaleGUITrad(5));
+ rotor_seq.Draw(preferred_x, y - ScaleGUITrad(5), PAL_NONE, false);
}
}
@@ -230,12 +232,13 @@ void GetAircraftSpriteSize(EngineID engine, uint &width, uint &height, int &xoff
VehicleSpriteSeq seq;
GetAircraftIcon(engine, image_type, &seq);
- const Sprite *spr = GetSprite(seq.sprite, ST_NORMAL);
+ Rect rect;
+ seq.GetBounds(&rect);
- width = UnScaleGUI(spr->width);
- height = UnScaleGUI(spr->height);
- xoffs = UnScaleGUI(spr->x_offs);
- yoffs = UnScaleGUI(spr->y_offs);
+ width = UnScaleGUI(rect.right - rect.left + 1);
+ height = UnScaleGUI(rect.bottom - rect.top + 1);
+ xoffs = UnScaleGUI(rect.left);
+ yoffs = UnScaleGUI(rect.top);
}
/**