summaryrefslogtreecommitdiff
path: root/src/vehicle_gui.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2016-10-16 14:57:56 +0000
committerfrosch <frosch@openttd.org>2016-10-16 14:57:56 +0000
commitd2393b4f6c89b75a90452fe68ab8a1cfbd8c353f (patch)
treec7934b2d2a19fa55c53ac063b91cc519fb4b753a /src/vehicle_gui.cpp
parentf5409c713b002012c6a2218de1720a91282eab67 (diff)
downloadopenttd-d2393b4f6c89b75a90452fe68ab8a1cfbd8c353f.tar.xz
(svn r27666) -Codechange: Pass vehicle sprites around using a struct VehicleSpriteSeq.
Diffstat (limited to 'src/vehicle_gui.cpp')
-rw-r--r--src/vehicle_gui.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index 87c119074..3d93e4d30 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -2842,8 +2842,9 @@ int GetSingleVehicleWidth(const Vehicle *v, EngineImageType image_type)
default:
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);
return UnScaleGUI(real_sprite->width);
}
}
@@ -2882,8 +2883,10 @@ void SetMouseCursorVehicle(const Vehicle *v, EngineImageType image_type)
if (total_width >= 2 * (int)VEHICLEINFO_FULL_VEHICLE_WIDTH) break;
PaletteID pal = (v->vehstatus & VS_CRASHED) ? PALETTE_CRASH : GetVehiclePalette(v);
+ VehicleSpriteSeq seq;
+ v->GetImage(rtl ? DIR_E : DIR_W, image_type, &seq);
- _cursor.sprite_seq[_cursor.sprite_count].sprite = v->GetImage(rtl ? DIR_E : DIR_W, image_type);
+ _cursor.sprite_seq[_cursor.sprite_count].sprite = seq.sprite;
_cursor.sprite_seq[_cursor.sprite_count].pal = pal;
_cursor.sprite_pos[_cursor.sprite_count].x = rtl ? -total_width : total_width;
_cursor.sprite_pos[_cursor.sprite_count].y = 0;