From bc984d9af52eaf55b7b76ad9e3cc5115935803b0 Mon Sep 17 00:00:00 2001 From: frosch Date: Fri, 22 Oct 2021 21:46:55 +0200 Subject: Codechange: remove redundant 'info_view' parameter, it can be derived from 'image_type'. --- src/aircraft_cmd.cpp | 2 +- src/aircraft_gui.cpp | 2 +- src/newgrf_engine.cpp | 3 ++- src/newgrf_engine.h | 6 +++--- src/vehicle_gui.cpp | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp index f4f933982..52c966e81 100644 --- a/src/aircraft_cmd.cpp +++ b/src/aircraft_cmd.cpp @@ -188,7 +188,7 @@ void GetRotorImage(const Aircraft *v, EngineImageType image_type, VehicleSpriteS const Aircraft *w = v->Next()->Next(); if (is_custom_sprite(v->spritenum)) { - GetCustomRotorSprite(v, false, image_type, result); + GetCustomRotorSprite(v, image_type, result); if (result->IsValid()) return; } diff --git a/src/aircraft_gui.cpp b/src/aircraft_gui.cpp index 311bc497b..422f42200 100644 --- a/src/aircraft_gui.cpp +++ b/src/aircraft_gui.cpp @@ -100,7 +100,7 @@ void DrawAircraftImage(const Vehicle *v, int left, int right, int y, VehicleID s if (helicopter) { const Aircraft *a = Aircraft::From(v); VehicleSpriteSeq rotor_seq; - GetCustomRotorSprite(a, true, image_type, &rotor_seq); + GetCustomRotorSprite(a, image_type, &rotor_seq); if (!rotor_seq.IsValid()) rotor_seq.Set(SPR_ROTOR_STOPPED); heli_offs = ScaleGUITrad(5); rotor_seq.Draw(x, y + y_offs - heli_offs, PAL_NONE, false); diff --git a/src/newgrf_engine.cpp b/src/newgrf_engine.cpp index ee4af5e6a..128f5639c 100644 --- a/src/newgrf_engine.cpp +++ b/src/newgrf_engine.cpp @@ -1103,7 +1103,7 @@ void GetCustomEngineSprite(EngineID engine, const Vehicle *v, Direction directio } -void GetRotorOverrideSprite(EngineID engine, const struct Aircraft *v, bool info_view, EngineImageType image_type, VehicleSpriteSeq *result) +void GetRotorOverrideSprite(EngineID engine, const struct Aircraft *v, EngineImageType image_type, VehicleSpriteSeq *result) { const Engine *e = Engine::Get(engine); @@ -1111,6 +1111,7 @@ void GetRotorOverrideSprite(EngineID engine, const struct Aircraft *v, bool info assert(e->type == VEH_AIRCRAFT); assert(!(e->u.air.subtype & AIR_CTOL)); + bool info_view = image_type != EIT_ON_MAP; VehicleResolverObject object(engine, v, VehicleResolverObject::WO_SELF, info_view, CBID_NO_CALLBACK); result->Clear(); uint rotor_pos = v == nullptr || info_view ? 0 : v->Next()->Next()->state; diff --git a/src/newgrf_engine.h b/src/newgrf_engine.h index f63134d9f..0cfbb0a76 100644 --- a/src/newgrf_engine.h +++ b/src/newgrf_engine.h @@ -84,9 +84,9 @@ void GetCustomEngineSprite(EngineID engine, const Vehicle *v, Direction directio #define GetCustomVehicleSprite(v, direction, image_type, result) GetCustomEngineSprite(v->engine_type, v, direction, image_type, result) #define GetCustomVehicleIcon(et, direction, image_type, result) GetCustomEngineSprite(et, nullptr, direction, image_type, result) -void GetRotorOverrideSprite(EngineID engine, const struct Aircraft *v, bool info_view, EngineImageType image_type, VehicleSpriteSeq *result); -#define GetCustomRotorSprite(v, i, image_type, result) GetRotorOverrideSprite(v->engine_type, v, i, image_type, result) -#define GetCustomRotorIcon(et, image_type, result) GetRotorOverrideSprite(et, nullptr, true, image_type, result) +void GetRotorOverrideSprite(EngineID engine, const struct Aircraft *v, EngineImageType image_type, VehicleSpriteSeq *result); +#define GetCustomRotorSprite(v, image_type, result) GetRotorOverrideSprite(v->engine_type, v, image_type, result) +#define GetCustomRotorIcon(et, image_type, result) GetRotorOverrideSprite(et, nullptr, image_type, result) /* Forward declaration of GRFFile, to avoid unnecessary inclusion of newgrf.h * elsewhere... */ diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index 10e925b8b..f2ab81157 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -3191,7 +3191,7 @@ void SetMouseCursorVehicle(const Vehicle *v, EngineImageType image_type) VehicleSpriteSeq seq; if (rotor_seq) { - GetCustomRotorSprite(Aircraft::From(v), true, image_type, &seq); + GetCustomRotorSprite(Aircraft::From(v), image_type, &seq); if (!seq.IsValid()) seq.Set(SPR_ROTOR_STOPPED); y_offset = - ScaleGUITrad(5); } else { -- cgit v1.2.3-70-g09d2