summaryrefslogtreecommitdiff
path: root/src/newgrf_object.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2013-11-24 14:41:19 +0000
committerfrosch <frosch@openttd.org>2013-11-24 14:41:19 +0000
commitdb894b0b3fa13413cdb76989cfcd2bb789243b77 (patch)
treefd61e4df264893e0c41b0d989f3294c3b4909b63 /src/newgrf_object.cpp
parent45a5aba8d55c68f54885c1de27684e8544e111d9 (diff)
downloadopenttd-db894b0b3fa13413cdb76989cfcd2bb789243b77.tar.xz
(svn r26085) -Codechange: Pass ResolverObjects as reference instead of pointer since they are never NULL.
Diffstat (limited to 'src/newgrf_object.cpp')
-rw-r--r--src/newgrf_object.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/newgrf_object.cpp b/src/newgrf_object.cpp
index 57468d7c7..da12a51ee 100644
--- a/src/newgrf_object.cpp
+++ b/src/newgrf_object.cpp
@@ -133,7 +133,7 @@ INSTANTIATE_NEWGRF_CLASS_METHODS(ObjectClass, ObjectSpec, ObjectClassID, OBJECT_
* @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 GetCountAndDistanceOfClosestInstance(byte local_id, uint32 grfid,
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 GetCountAndDistanceOfClosestInstance(byte local_id, uint32 grfid,
}
/* 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 GetCountAndDistanceOfClosestInstance(byte local_id, uint32 grfid,
}
/* 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 *GetObjectSpriteGroup(const ObjectSpec *spec, const Obj
*/
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::GetTown()
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::GetTown()
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, const ObjectSpec *spec)
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, const ObjectSpec *spec)
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);