From 1ba2ae69e61439add76e63cdf1be0fa079af1019 Mon Sep 17 00:00:00 2001 From: peter1138 Date: Mon, 18 Feb 2008 19:20:37 +0000 Subject: (svn r12180) -Fix: Test purchase list loading/loaded sprites instead of unconditionally returning a possibly non-existant sprite. --- src/newgrf_engine.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/newgrf_engine.cpp') 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; -- cgit v1.2.3-54-g00ecf