changeset 8599:8d23ba9f619f draft

(svn r12180) -Fix: Test purchase list loading/loaded sprites instead of unconditionally returning a possibly non-existant sprite.
author peter1138 <peter1138@openttd.org>
date Mon, 18 Feb 2008 19:20:37 +0000
parents ef2c93a9589d
children f318f3da511b
files src/newgrf_engine.cpp
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/newgrf_engine.cpp
+++ b/src/newgrf_engine.cpp
@@ -765,7 +765,11 @@
 	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;