Changeset - r8599:42c534166459
[Not reviewed]
master
0 1 0
peter1138 - 16 years ago 2008-02-18 19:20:37
peter1138@openttd.org
(svn r12180) -Fix: Test purchase list loading/loaded sprites instead of unconditionally returning a possibly non-existant sprite.
1 file changed with 5 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/newgrf_engine.cpp
Show inline comments
 
@@ -762,13 +762,17 @@ static uint32 VehicleGetVariable(const R
 
static const SpriteGroup *VehicleResolveReal(const ResolverObject *object, const SpriteGroup *group)
 
{
 
	const Vehicle *v = object->u.vehicle.self;
 
	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;
 

	
 
	totalsets = in_motion ? group->g.real.num_loaded : group->g.real.num_loading;
 

	
 
	if (v->cargo.Count() >= v->cargo_cap || totalsets == 1) {
0 comments (0 inline, 0 general)