summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2021-10-22 21:46:55 +0200
committerfrosch <github@elsenhans.name>2021-10-23 14:45:08 +0200
commitbc984d9af52eaf55b7b76ad9e3cc5115935803b0 (patch)
tree85f5565f2bba561a0270483f8b89a779670d3f6e
parentbf0210229c9e9a9c36c515e5a19bd620bc22c924 (diff)
downloadopenttd-bc984d9af52eaf55b7b76ad9e3cc5115935803b0.tar.xz
Codechange: remove redundant 'info_view' parameter, it can be derived from 'image_type'.
-rw-r--r--src/aircraft_cmd.cpp2
-rw-r--r--src/aircraft_gui.cpp2
-rw-r--r--src/newgrf_engine.cpp3
-rw-r--r--src/newgrf_engine.h6
-rw-r--r--src/vehicle_gui.cpp2
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 {