diff options
author | peter1138 <peter1138@openttd.org> | 2006-04-21 17:02:51 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2006-04-21 17:02:51 +0000 |
commit | 31c3240227b3d0159c49ca0a88bf20b30414e525 (patch) | |
tree | dca92b494e19b5f9438ad8e7fe92f7b7354b9f08 /newgrf_engine.c | |
parent | 3c64af460614b4bf637918ec69310891f3387339 (diff) | |
download | openttd-31c3240227b3d0159c49ca0a88bf20b30414e525.tar.xz |
(svn r4500) - NewGRF: When running a callback with no vehicle, use the purchase list 'cargo' type first, and then fallback to the default if needed.
Diffstat (limited to 'newgrf_engine.c')
-rw-r--r-- | newgrf_engine.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/newgrf_engine.c b/newgrf_engine.c index f30c7ebba..679a88cbd 100644 --- a/newgrf_engine.c +++ b/newgrf_engine.c @@ -481,11 +481,10 @@ bool UsesWagonOverride(const Vehicle* v) uint16 GetVehicleCallback(byte callback, uint32 param1, uint32 param2, EngineID engine, const Vehicle *v) { const SpriteGroup *group; - CargoID cargo = GC_DEFAULT; + CargoID cargo; uint16 callback_info = callback | (param1 << 8); // XXX Temporary conversion between new and old format. - if (v != NULL) - cargo = _global_cargo_id[_opt.landscape][v->cargo_type]; + cargo = (v == NULL) ? GC_PURCHASE : _global_cargo_id[_opt.landscape][v->cargo_type]; group = engine_custom_sprites[engine][cargo]; @@ -497,7 +496,7 @@ uint16 GetVehicleCallback(byte callback, uint32 param1, uint32 param2, EngineID group = ResolveVehicleSpriteGroup(group, v, callback_info, (resolve_callback) ResolveVehicleSpriteGroup); - if (group == NULL && cargo != GC_DEFAULT) { + if ((group == NULL || group->type != SGT_CALLBACK) && cargo != GC_DEFAULT) { // This group is empty but perhaps there'll be a default one. group = ResolveVehicleSpriteGroup(engine_custom_sprites[engine][GC_DEFAULT], v, callback_info, (resolve_callback) ResolveVehicleSpriteGroup); |