File diff r23022:731ae1300799 → r23023:7b8669afd1db
src/newgrf_object.cpp
Show inline comments
 
@@ -329,50 +329,50 @@ static uint32 GetCountAndDistanceOfClose
 

	
 
		/* Animation counter of nearby tile */
 
		case 0x63: {
 
			TileIndex tile = GetNearbyTile(parameter, this->tile);
 
			return (IsTileType(tile, MP_OBJECT) && Object::GetByTile(tile) == this->obj) ? GetAnimationFrame(tile) : 0;
 
		}
 

	
 
		/* Count of object, distance of closest instance */
 
		case 0x64: return GetCountAndDistanceOfClosestInstance(parameter, this->ro.grffile->grfid, this->tile, this->obj);
 
	}
 

	
 
unhandled:
 
	DEBUG(grf, 1, "Unhandled object variable 0x%X", variable);
 

	
 
	*available = false;
 
	return UINT_MAX;
 
}
 

	
 
/**
 
 * Constructor of the object resolver.
 
 * @param obj Object being resolved.
 
 * @param tile %Tile of the object.
 
 * @param view View of the object.
 
 * @param callback Callback ID.
 
 * @param callback_param1 First parameter (var 10) of the callback.
 
 * @param callback_param2 Second parameter (var 18) of the callback.
 
 * @param param1 First parameter (var 10) of the callback.
 
 * @param param2 Second parameter (var 18) of the callback.
 
 */
 
ObjectResolverObject::ObjectResolverObject(const ObjectSpec *spec, Object *obj, TileIndex tile, uint8 view,
 
		CallbackID callback, uint32 param1, uint32 param2)
 
	: ResolverObject(spec->grf_prop.grffile, callback, param1, param2), object_scope(*this, obj, tile, view)
 
{
 
	this->town_scope = NULL;
 
	this->root_spritegroup = (obj == NULL && spec->grf_prop.spritegroup[CT_PURCHASE_OBJECT] != NULL) ?
 
			spec->grf_prop.spritegroup[CT_PURCHASE_OBJECT] : spec->grf_prop.spritegroup[0];
 
}
 

	
 
ObjectResolverObject::~ObjectResolverObject()
 
{
 
	delete this->town_scope;
 
}
 

	
 
/**
 
 * Get the town resolver scope that belongs to this object resolver.
 
 * On the first call, the town scope is created (if possible).
 
 * @return Town scope, if available.
 
 */
 
TownScopeResolver *ObjectResolverObject::GetTown()
 
{
 
	if (this->town_scope == NULL) {
 
		Town *t;