diff options
author | rubidium <rubidium@openttd.org> | 2010-11-19 19:25:35 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2010-11-19 19:25:35 +0000 |
commit | 8ba6d25db6bb99454d91aa12f5cc559f5516397c (patch) | |
tree | e415f8dc8f94b39e4944907ea56ccf9a3fcba315 | |
parent | 0c6810eebe9a5f86e8c4e370a046003cee62d9fa (diff) | |
download | openttd-8ba6d25db6bb99454d91aa12f5cc559f5516397c.tar.xz |
(svn r21259) -Change: [NewGRF] Split var43 into var43 (animation stage) and var47 (object colour)
-rw-r--r-- | src/newgrf_object.cpp | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/newgrf_object.cpp b/src/newgrf_object.cpp index e04c0dee6..3215d1888 100644 --- a/src/newgrf_object.cpp +++ b/src/newgrf_object.cpp @@ -147,16 +147,6 @@ static uint32 GetNearbyObjectTileInformation(byte parameter, TileIndex tile, Obj } /** - * Get the object's animation counter data. - * @param tile The tile to query. - * @return The object's data. - */ -static uint32 GetObjectAnimationCounter(TileIndex tile) -{ - return Object::GetByTile(tile)->colour << 8 | GetAnimationFrame(tile); -} - -/** * Get the closest object of a given type. * @param tile The tile to start searching from. * @param type The type of the object to search for. @@ -252,6 +242,7 @@ static uint32 ObjectGetVariable(const ResolverObject *object, byte variable, byt * Disallow the rest: * 0x40: Relative position is passed as parameter during construction. * 0x43: Animation counter is only for actual tiles. + * 0x47: Object colour is only valid when its built. * 0x63: Animation counter of nearby tile, see above. */ default: @@ -280,7 +271,7 @@ static uint32 ObjectGetVariable(const ResolverObject *object, byte variable, byt case 0x42: return o->build_date; /* Animation counter */ - case 0x43: return GetObjectAnimationCounter(tile); + case 0x43: return GetAnimationFrame(tile); /* Object founder information */ case 0x44: return GetTileOwner(tile); @@ -291,6 +282,9 @@ static uint32 ObjectGetVariable(const ResolverObject *object, byte variable, byt /* Get square of Euclidian distance of closes town */ case 0x46: return GetTownRadiusGroup(t, tile) << 16 | min(DistanceSquare(tile, t->xy), 0xFFFF); + /* Object colour */ + case 0x47: return o->colour; + /* Get object ID at offset param */ case 0x60: return GetObjectIDAtOffset(GetNearbyTile(parameter, tile), object->grffile->grfid); @@ -305,7 +299,7 @@ static uint32 ObjectGetVariable(const ResolverObject *object, byte variable, byt /* Animation counter of nearby tile */ case 0x63: tile = GetNearbyTile(parameter, tile); - return (IsTileType(tile, MP_OBJECT) && Object::GetByTile(tile) == o) ? GetObjectAnimationCounter(tile) : 0; + return (IsTileType(tile, MP_OBJECT) && Object::GetByTile(tile) == o) ? GetAnimationFrame(tile) : 0; /* Count of object, distance of closest instance */ case 0x64: return GetCountAndDistanceOfClosestInstance(parameter, object->grffile->grfid, tile, o); |