From c28cffdf672fdf47bf89936c8e4ddc1b20f52d32 Mon Sep 17 00:00:00 2001 From: peter1138 Date: Sun, 20 May 2007 09:17:42 +0000 Subject: (svn r9888) -Codechange: [NewGRF] allow non-spec cargo action2s to work, and using the goods sprite if really nothing is returned. --- src/newgrf_cargo.cpp | 8 +++++--- src/station_gui.cpp | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/newgrf_cargo.cpp b/src/newgrf_cargo.cpp index 788e2fbe5..6724edb53 100644 --- a/src/newgrf_cargo.cpp +++ b/src/newgrf_cargo.cpp @@ -39,10 +39,12 @@ static uint32 CargoGetVariable(const ResolverObject *object, byte variable, byte static const SpriteGroup *CargoResolveReal(const ResolverObject *object, const SpriteGroup *group) { - /* Cargo action 2s should always have only 1 "loaded" state */ - if (group->g.real.num_loaded == 0) return NULL; + /* Cargo action 2s should always have only 1 "loaded" state, but some + * times things don't follow the spec... */ + if (group->g.real.num_loaded > 0) return group->g.real.loaded[0]; + if (group->g.real.num_loading > 0) return group->g.real.loading[0]; - return group->g.real.loaded[0]; + return NULL; } diff --git a/src/station_gui.cpp b/src/station_gui.cpp index e17f9ac56..045f927b9 100644 --- a/src/station_gui.cpp +++ b/src/station_gui.cpp @@ -686,7 +686,7 @@ static void DrawCargoIcons(CargoID i, uint waiting, int x, int y) sprite = cs->sprite; } - if (sprite == 0) return; + if (sprite == 0) sprite = SPR_CARGO_GOODS; do { DrawSprite(sprite, PAL_NONE, x, y); -- cgit v1.2.3-70-g09d2