File diff r21007:a373e4a7c6f0 → r21008:be2e3d3c935b
src/newgrf_object.cpp
Show inline comments
 
@@ -133,7 +133,7 @@ INSTANTIATE_NEWGRF_CLASS_METHODS(ObjectC
 
 * @param tile %Tile of the object.
 
 * @param view View of the object.
 
 */
 
ObjectScopeResolver::ObjectScopeResolver(ResolverObject *ro, Object *obj, TileIndex tile, uint8 view)
 
ObjectScopeResolver::ObjectScopeResolver(ResolverObject &ro, Object *obj, TileIndex tile, uint8 view)
 
		: ScopeResolver(ro)
 
{
 
	this->obj = obj;
 
@@ -326,7 +326,7 @@ static uint32 GetCountAndDistanceOfClose
 
		case 0x48: return this->obj->view;
 

	
 
		/* Get object ID at offset param */
 
		case 0x60: return GetObjectIDAtOffset(GetNearbyTile(parameter, this->tile), this->ro->grffile->grfid);
 
		case 0x60: return GetObjectIDAtOffset(GetNearbyTile(parameter, this->tile), this->ro.grffile->grfid);
 

	
 
		/* Get random tile bits at offset param */
 
		case 0x61: {
 
@@ -335,7 +335,7 @@ static uint32 GetCountAndDistanceOfClose
 
		}
 

	
 
		/* Land info of nearby tiles */
 
		case 0x62: return GetNearbyObjectTileInformation(parameter, this->tile, this->obj == NULL ? INVALID_OBJECT : this->obj->index, this->ro->grffile->grf_version >= 8);
 
		case 0x62: return GetNearbyObjectTileInformation(parameter, this->tile, this->obj == NULL ? INVALID_OBJECT : this->obj->index, this->ro.grffile->grf_version >= 8);
 

	
 
		/* Animation counter of nearby tile */
 
		case 0x63: {
 
@@ -344,7 +344,7 @@ static uint32 GetCountAndDistanceOfClose
 
		}
 

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

	
 
unhandled:
 
@@ -383,7 +383,7 @@ static const SpriteGroup *GetObjectSprit
 
 */
 
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)
 
	: ResolverObject(spec->grf_prop.grffile, callback, param1, param2), object_scope(*this, obj, tile, view)
 
{
 
	this->town_scope = NULL;
 
}
 
@@ -408,7 +408,7 @@ TownScopeResolver *ObjectResolverObject:
 
			t = ClosestTownFromTile(this->object_scope.tile, UINT_MAX);
 
		}
 
		if (t == NULL) return NULL;
 
		this->town_scope = new TownScopeResolver(this, t, this->object_scope.obj == NULL);
 
		this->town_scope = new TownScopeResolver(*this, t, this->object_scope.obj == NULL);
 
	}
 
	return this->town_scope;
 
}
 
@@ -427,7 +427,7 @@ TownScopeResolver *ObjectResolverObject:
 
uint16 GetObjectCallback(CallbackID callback, uint32 param1, uint32 param2, const ObjectSpec *spec, Object *o, TileIndex tile, uint8 view)
 
{
 
	ObjectResolverObject object(spec, o, tile, view, callback, param1, param2);
 
	const SpriteGroup *group = SpriteGroup::Resolve(GetObjectSpriteGroup(spec, o), &object);
 
	const SpriteGroup *group = SpriteGroup::Resolve(GetObjectSpriteGroup(spec, o), object);
 
	if (group == NULL) return CALLBACK_FAILED;
 

	
 
	return group->GetCallbackResult();
 
@@ -470,7 +470,7 @@ void DrawNewObjectTile(TileInfo *ti, con
 
	Object *o = Object::GetByTile(ti->tile);
 
	ObjectResolverObject object(spec, o, ti->tile);
 

	
 
	const SpriteGroup *group = SpriteGroup::Resolve(GetObjectSpriteGroup(spec, o), &object);
 
	const SpriteGroup *group = SpriteGroup::Resolve(GetObjectSpriteGroup(spec, o), object);
 
	if (group == NULL || group->type != SGT_TILELAYOUT) return;
 

	
 
	DrawTileLayout(ti, (const TileLayoutSpriteGroup *)group, spec);
 
@@ -486,7 +486,7 @@ void DrawNewObjectTile(TileInfo *ti, con
 
void DrawNewObjectTileInGUI(int x, int y, const ObjectSpec *spec, uint8 view)
 
{
 
	ObjectResolverObject object(spec, NULL, INVALID_TILE, view);
 
	const SpriteGroup *group = SpriteGroup::Resolve(GetObjectSpriteGroup(spec, NULL), &object);
 
	const SpriteGroup *group = SpriteGroup::Resolve(GetObjectSpriteGroup(spec, NULL), object);
 
	if (group == NULL || group->type != SGT_TILELAYOUT) return;
 

	
 
	const DrawTileSprites *dts = ((const TileLayoutSpriteGroup *)group)->ProcessRegisters(NULL);