summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2008-02-18 19:20:37 +0000
committerpeter1138 <peter1138@openttd.org>2008-02-18 19:20:37 +0000
commita4c14fb442e72994b03d9e5a0356088aae94cdeb (patch)
treea36354a4c3e84e687e606e5ec6da430e3a8f46d6 /src
parent509b3a324728b01d958cfed9df42985a308b8cf8 (diff)
downloadopenttd-a4c14fb442e72994b03d9e5a0356088aae94cdeb.tar.xz
(svn r12180) -Fix: Test purchase list loading/loaded sprites instead of unconditionally returning a possibly non-existant sprite.
Diffstat (limited to 'src')
-rw-r--r--src/newgrf_engine.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/newgrf_engine.cpp b/src/newgrf_engine.cpp
index 316e07b31..e35d25456 100644
--- a/src/newgrf_engine.cpp
+++ b/src/newgrf_engine.cpp
@@ -765,7 +765,11 @@ static const SpriteGroup *VehicleResolveReal(const ResolverObject *object, const
uint totalsets;
uint set;
- if (v == NULL) return group->g.real.loading[0];
+ if (v == NULL) {
+ if (group->g.real.num_loading > 0) return group->g.real.loading[0];
+ if (group->g.real.num_loaded > 0) return group->g.real.loaded[0];
+ return NULL;
+ }
bool in_motion = v->First()->current_order.type != OT_LOADING;