From d2393b4f6c89b75a90452fe68ab8a1cfbd8c353f Mon Sep 17 00:00:00 2001 From: frosch Date: Sun, 16 Oct 2016 14:57:56 +0000 Subject: (svn r27666) -Codechange: Pass vehicle sprites around using a struct VehicleSpriteSeq. --- src/aircraft_gui.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/aircraft_gui.cpp') diff --git a/src/aircraft_gui.cpp b/src/aircraft_gui.cpp index c3379d395..752e0da90 100644 --- a/src/aircraft_gui.cpp +++ b/src/aircraft_gui.cpp @@ -83,8 +83,10 @@ void DrawAircraftImage(const Vehicle *v, int left, int right, int y, VehicleID s { bool rtl = _current_text_dir == TD_RTL; - SpriteID sprite = v->GetImage(rtl ? DIR_E : DIR_W, image_type); - const Sprite *real_sprite = GetSprite(sprite, ST_NORMAL); + VehicleSpriteSeq seq; + v->GetImage(rtl ? DIR_E : DIR_W, image_type, &seq); + + const Sprite *real_sprite = GetSprite(seq.sprite, ST_NORMAL); int width = UnScaleGUI(real_sprite->width); int x_offs = UnScaleGUI(real_sprite->x_offs); @@ -95,13 +97,14 @@ void DrawAircraftImage(const Vehicle *v, int left, int right, int y, VehicleID s int heli_offs = 0; PaletteID pal = (v->vehstatus & VS_CRASHED) ? PALETTE_CRASH : GetVehiclePalette(v); - DrawSprite(sprite, pal, x, y + y_offs); + DrawSprite(seq.sprite, pal, x, y + y_offs); if (helicopter) { const Aircraft *a = Aircraft::From(v); - SpriteID rotor_sprite = GetCustomRotorSprite(a, true, image_type); - if (rotor_sprite == 0) rotor_sprite = SPR_ROTOR_STOPPED; + VehicleSpriteSeq rotor_seq; + GetCustomRotorSprite(a, true, image_type, &rotor_seq); + if (!rotor_seq.IsValid()) rotor_seq.Set(SPR_ROTOR_STOPPED); heli_offs = ScaleGUITrad(5); - DrawSprite(rotor_sprite, PAL_NONE, x, y + y_offs - heli_offs); + DrawSprite(rotor_seq.sprite, PAL_NONE, x, y + y_offs - heli_offs); } if (v->index == selection) { x += x_offs; -- cgit v1.2.3-54-g00ecf