summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2008-01-09 20:23:12 +0000
committerpeter1138 <peter1138@openttd.org>2008-01-09 20:23:12 +0000
commit82fe2885abb359c813908b0c844533bfec2c2b22 (patch)
treec671b18415d1ae7bdcd56b8ae5dbfe0fc5461c4c /src
parent6375ea065b32e6dc79cd05c5d137c4c8c17f32e8 (diff)
downloadopenttd-82fe2885abb359c813908b0c844533bfec2c2b22.tar.xz
(svn r11799) -Codechange: no need to special-case helicopter rotor 'overrides'
Diffstat (limited to 'src')
-rw-r--r--src/newgrf.cpp10
-rw-r--r--src/newgrf_engine.cpp29
-rw-r--r--src/newgrf_engine.h2
3 files changed, 2 insertions, 39 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index c47a74452..aec41b4f6 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -2842,14 +2842,7 @@ static void VehicleMapSpriteGroup(byte *buf, byte feature, uint8 idcount, uint8
}
if (wagover) {
- /* If the ID for this action 3 is the same as the vehicle ID,
- * this indicates we have a helicopter rotor override. */
- if (feature == GSF_AIRCRAFT && engine == last_engines[i]) {
- SetRotorOverrideSprites(engine, _cur_grffile->spritegroups[groupid]);
- } else {
- /* TODO: No multiple cargo types per vehicle yet. --pasky */
- SetWagonOverrideSprites(engine, CT_DEFAULT, _cur_grffile->spritegroups[groupid], last_engines, last_engines_count);
- }
+ SetWagonOverrideSprites(engine, CT_DEFAULT, _cur_grffile->spritegroups[groupid], last_engines, last_engines_count);
} else {
SetCustomEngineSprites(engine, CT_DEFAULT, _cur_grffile->spritegroups[groupid]);
SetEngineGRF(engine, _cur_grffile);
@@ -5085,7 +5078,6 @@ static void ResetNewGRFData()
/* Unload sprite group data */
UnloadWagonOverrides();
- UnloadRotorOverrideSprites();
UnloadCustomEngineSprites();
UnloadCustomEngineNames();
ResetEngineListOrder();
diff --git a/src/newgrf_engine.cpp b/src/newgrf_engine.cpp
index cb7b84c11..8dea0c7ea 100644
--- a/src/newgrf_engine.cpp
+++ b/src/newgrf_engine.cpp
@@ -125,33 +125,6 @@ void UnloadCustomEngineSprites()
memset(_engine_grf, 0, sizeof(_engine_grf));
}
-static const SpriteGroup *heli_rotor_custom_sprites[NUM_AIRCRAFT_ENGINES];
-
-/** Load a rotor override sprite group for an aircraft */
-void SetRotorOverrideSprites(EngineID engine, const SpriteGroup *group)
-{
- assert(engine >= AIRCRAFT_ENGINES_INDEX);
- assert(engine < AIRCRAFT_ENGINES_INDEX + NUM_AIRCRAFT_ENGINES);
-
- if (heli_rotor_custom_sprites[engine - AIRCRAFT_ENGINES_INDEX] != NULL) {
- grfmsg(6, "SetRotorOverrideSprites: engine %d already has group -- replacing.", engine);
- }
- heli_rotor_custom_sprites[engine - AIRCRAFT_ENGINES_INDEX] = group;
-}
-
-/** Unload all rotor override sprite groups */
-void UnloadRotorOverrideSprites()
-{
- EngineID engine;
-
- /* Starting at AIRCRAFT_ENGINES_INDEX may seem pointless, but it means
- * the context of EngineID is correct */
- for (engine = AIRCRAFT_ENGINES_INDEX; engine < AIRCRAFT_ENGINES_INDEX + NUM_AIRCRAFT_ENGINES; engine++) {
- heli_rotor_custom_sprites[engine - AIRCRAFT_ENGINES_INDEX] = NULL;
- }
-}
-
-
/**
* Tie a GRFFile entry to an engine, to allow us to retrieve GRF parameters
* etc during a game.
@@ -898,7 +871,7 @@ SpriteID GetRotorOverrideSprite(EngineID engine, const Vehicle *v, bool info_vie
object.info_view = info_view;
- group = heli_rotor_custom_sprites[engine - AIRCRAFT_ENGINES_INDEX];
+ group = GetWagonOverrideSpriteSet(engine, CT_DEFAULT, engine);
group = Resolve(group, &object);
if (group == NULL || group->type != SGT_RESULT) return 0;
diff --git a/src/newgrf_engine.h b/src/newgrf_engine.h
index 2aa7b0716..7502324b0 100644
--- a/src/newgrf_engine.h
+++ b/src/newgrf_engine.h
@@ -16,7 +16,6 @@ extern int _traininfo_vehicle_width;
void SetWagonOverrideSprites(EngineID engine, CargoID cargo, const struct SpriteGroup *group, EngineID *train_id, uint trains);
const SpriteGroup *GetWagonOverrideSpriteSet(EngineID engine, CargoID cargo, EngineID overriding_engine);
void SetCustomEngineSprites(EngineID engine, byte cargo, const struct SpriteGroup *group);
-void SetRotorOverrideSprites(EngineID engine, const struct SpriteGroup *group);
SpriteID GetCustomEngineSprite(EngineID engine, const Vehicle* v, Direction direction);
SpriteID GetRotorOverrideSprite(EngineID engine, const Vehicle* v, bool info_view);
#define GetCustomRotorSprite(v, i) GetRotorOverrideSprite(v->engine_type, v, i)
@@ -58,7 +57,6 @@ void SetCustomEngineName(EngineID engine, StringID name);
StringID GetCustomEngineName(EngineID engine);
void UnloadWagonOverrides();
-void UnloadRotorOverrideSprites();
void UnloadCustomEngineSprites();
void UnloadCustomEngineNames();