(svn r11799) -Codechange: no need to special-case helicopter rotor 'overrides'

This commit is contained in:
peter1138 2008-01-09 20:23:12 +00:00
parent 6375ea065b
commit 82fe2885ab
3 changed files with 2 additions and 39 deletions

View File

@ -2842,14 +2842,7 @@ static void VehicleMapSpriteGroup(byte *buf, byte feature, uint8 idcount, uint8
} }
if (wagover) { if (wagover) {
/* If the ID for this action 3 is the same as the vehicle ID, SetWagonOverrideSprites(engine, CT_DEFAULT, _cur_grffile->spritegroups[groupid], last_engines, last_engines_count);
* 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);
}
} else { } else {
SetCustomEngineSprites(engine, CT_DEFAULT, _cur_grffile->spritegroups[groupid]); SetCustomEngineSprites(engine, CT_DEFAULT, _cur_grffile->spritegroups[groupid]);
SetEngineGRF(engine, _cur_grffile); SetEngineGRF(engine, _cur_grffile);
@ -5085,7 +5078,6 @@ static void ResetNewGRFData()
/* Unload sprite group data */ /* Unload sprite group data */
UnloadWagonOverrides(); UnloadWagonOverrides();
UnloadRotorOverrideSprites();
UnloadCustomEngineSprites(); UnloadCustomEngineSprites();
UnloadCustomEngineNames(); UnloadCustomEngineNames();
ResetEngineListOrder(); ResetEngineListOrder();

View File

@ -125,33 +125,6 @@ void UnloadCustomEngineSprites()
memset(_engine_grf, 0, sizeof(_engine_grf)); 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 * Tie a GRFFile entry to an engine, to allow us to retrieve GRF parameters
* etc during a game. * etc during a game.
@ -898,7 +871,7 @@ SpriteID GetRotorOverrideSprite(EngineID engine, const Vehicle *v, bool info_vie
object.info_view = info_view; object.info_view = info_view;
group = heli_rotor_custom_sprites[engine - AIRCRAFT_ENGINES_INDEX]; group = GetWagonOverrideSpriteSet(engine, CT_DEFAULT, engine);
group = Resolve(group, &object); group = Resolve(group, &object);
if (group == NULL || group->type != SGT_RESULT) return 0; if (group == NULL || group->type != SGT_RESULT) return 0;

View File

@ -16,7 +16,6 @@ extern int _traininfo_vehicle_width;
void SetWagonOverrideSprites(EngineID engine, CargoID cargo, const struct SpriteGroup *group, EngineID *train_id, uint trains); 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); const SpriteGroup *GetWagonOverrideSpriteSet(EngineID engine, CargoID cargo, EngineID overriding_engine);
void SetCustomEngineSprites(EngineID engine, byte cargo, const struct SpriteGroup *group); 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 GetCustomEngineSprite(EngineID engine, const Vehicle* v, Direction direction);
SpriteID GetRotorOverrideSprite(EngineID engine, const Vehicle* v, bool info_view); SpriteID GetRotorOverrideSprite(EngineID engine, const Vehicle* v, bool info_view);
#define GetCustomRotorSprite(v, i) GetRotorOverrideSprite(v->engine_type, v, i) #define GetCustomRotorSprite(v, i) GetRotorOverrideSprite(v->engine_type, v, i)
@ -58,7 +57,6 @@ void SetCustomEngineName(EngineID engine, StringID name);
StringID GetCustomEngineName(EngineID engine); StringID GetCustomEngineName(EngineID engine);
void UnloadWagonOverrides(); void UnloadWagonOverrides();
void UnloadRotorOverrideSprites();
void UnloadCustomEngineSprites(); void UnloadCustomEngineSprites();
void UnloadCustomEngineNames(); void UnloadCustomEngineNames();