diff options
author | peter1138 <peter1138@openttd.org> | 2006-04-23 22:25:33 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2006-04-23 22:25:33 +0000 |
commit | 7555d8528b5e12cc9d73c810d89f9bbaf8d8fd87 (patch) | |
tree | 28cddf5dd52d151cd3f987efd80935ebf740f84c | |
parent | fd2a005139eb3a94db9e6dbe0effd5e26e853381 (diff) | |
download | openttd-7555d8528b5e12cc9d73c810d89f9bbaf8d8fd87.tar.xz |
(svn r4559) - NewGRF: keep a record of which grf an engine is defined in. Will be used in the future.
-rw-r--r-- | newgrf.c | 1 | ||||
-rw-r--r-- | newgrf_engine.c | 15 | ||||
-rw-r--r-- | newgrf_engine.h | 4 |
3 files changed, 20 insertions, 0 deletions
@@ -1662,6 +1662,7 @@ static void NewVehicle_SpriteGroupMapping(byte *buf, int len) SetWagonOverrideSprites(engine, _cur_grffile->spritegroups[groupid], last_engines, last_engines_count); } else { SetCustomEngineSprites(engine, ctype, _cur_grffile->spritegroups[groupid]); + SetEngineGRF(engine, _cur_grffile->grfid); last_engines[i] = engine; } } diff --git a/newgrf_engine.c b/newgrf_engine.c index e6f878a7c..965aa696a 100644 --- a/newgrf_engine.c +++ b/newgrf_engine.c @@ -99,6 +99,7 @@ void UnloadWagonOverrides(void) // may appear in future - however it's more convenient to store it like this in // memory. --pasky) static SpriteGroup *engine_custom_sprites[TOTAL_NUM_ENGINES][NUM_GLOBAL_CID]; +static uint32 _engine_grf[TOTAL_NUM_ENGINES]; void SetCustomEngineSprites(EngineID engine, byte cargo, SpriteGroup *group) { @@ -121,9 +122,23 @@ void UnloadCustomEngineSprites(void) for (cargo = 0; cargo < NUM_GLOBAL_CID; cargo++) { engine_custom_sprites[engine][cargo] = NULL; } + _engine_grf[engine] = 0; } } +void SetEngineGRF(EngineID engine, uint32 grfid) +{ + assert(engine < TOTAL_NUM_ENGINES); + _engine_grf[engine] = grfid; +} + +uint32 GetEngineGRFID(EngineID engine) +{ + assert(engine < TOTAL_NUM_ENGINES); + return _engine_grf[engine]; +} + + static int MapOldSubType(const Vehicle *v) { if (v->type != VEH_Train) return v->subtype; diff --git a/newgrf_engine.h b/newgrf_engine.h index eac7e2f6f..6f05d8133 100644 --- a/newgrf_engine.h +++ b/newgrf_engine.h @@ -18,6 +18,10 @@ void SetWagonOverrideSprites(EngineID engine, struct SpriteGroup *group, byte *t void SetCustomEngineSprites(EngineID engine, byte cargo, struct SpriteGroup *group); // loaded is in percents, overriding_engine 0xffff is none int GetCustomEngineSprite(EngineID engine, const Vehicle* v, Direction direction); + +void SetEngineGRF(EngineID engine, uint32 grfid); +uint32 GetEngineGRFID(EngineID engine); + uint16 GetVehicleCallback(byte callback, uint32 param1, uint32 param2, EngineID engine, const Vehicle *v); bool UsesWagonOverride(const Vehicle *v); #define GetCustomVehicleSprite(v, direction) GetCustomEngineSprite(v->engine_type, v, direction) |