summaryrefslogtreecommitdiff
path: root/src/newgrf_industrytiles.cpp
diff options
context:
space:
mode:
authorbelugas <belugas@openttd.org>2007-06-13 18:35:06 +0000
committerbelugas <belugas@openttd.org>2007-06-13 18:35:06 +0000
commit920b4feb9dfce8104c15b41cd0a22073dc7c580c (patch)
tree4c6db00f96db73eaae1f0fbac7fe8df3eccda8c2 /src/newgrf_industrytiles.cpp
parent8ed345d5fbd14f75a22807eece0836fc38f6e820 (diff)
downloadopenttd-920b4feb9dfce8104c15b41cd0a22073dc7c580c.tar.xz
(svn r10146) -Codechange: Silence a compiler warning
-Codechange: Comment style beautifying -Codechange: define (tentatively) var 0x44 and 0x61 for industry tiles
Diffstat (limited to 'src/newgrf_industrytiles.cpp')
-rw-r--r--src/newgrf_industrytiles.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/newgrf_industrytiles.cpp b/src/newgrf_industrytiles.cpp
index f910dfb67..3ec3788bf 100644
--- a/src/newgrf_industrytiles.cpp
+++ b/src/newgrf_industrytiles.cpp
@@ -61,28 +61,35 @@ static uint32 IndustryTileGetVariable(const ResolverObject *object, byte variabl
{
const Industry *inds = object->u.industry.ind;
TileIndex tile = object->u.industry.tile;
- IndustryGfx gfx = object->u.industry.gfx;
if (object->scope == VSG_SCOPE_PARENT) {
return IndustryGetVariable(object, variable, parameter, available);
}
switch (variable) {
- case 0x40 : return GetIndustryConstructionStage(tile); /* Construction state of the tile: a value between 0 and 3 */
+ /* Construction state of the tile: a value between 0 and 3 */
+ case 0x40 : return (IsTileType(tile, MP_INDUSTRY)) ? GetIndustryConstructionStage(tile) : 0;
case 0x41 : return GetTerrainType(tile);
- case 0x42 : return GetTownRadiusGroup(ClosestTownFromTile(tile, (uint)-1), tile); /* Current town zone of the tile in the nearest town */
+ /* Current town zone of the tile in the nearest town */
+ case 0x42 : return GetTownRadiusGroup(ClosestTownFromTile(tile, (uint)-1), tile);
- case 0x43 : return GetRelativePosition(tile, inds->xy); /* Relative position */
+ /* Relative position */
+ case 0x43 : return GetRelativePosition(tile, inds->xy);
- case 0x44 : break; /* Animation frame. Like house variable 46 but can contain anything 0..FF. */
+ /* Animation frame. Like house variable 46 but can contain anything 0..FF. */
+ case 0x44 : return (IsTileType(tile, MP_INDUSTRY)) ? GetIndustryAnimationState(tile) : 0;
- case 0x60 : return GetNearbyIndustryTileInformation(parameter, tile, inds->index); /* Land info of nearby tiles */
+ /* Land info of nearby tiles */
+ case 0x60 : return GetNearbyIndustryTileInformation(parameter, tile, inds->index);
case 0x61 : {/* Animation stage of nearby tiles */
tile = GetNearbyTile(parameter, tile);
- return 0; // TODO define the animation scheme for newgrf. Based on same as old one?
+ if (IsTileType(tile, MP_INDUSTRY) && GetIndustryByTile(tile) == inds) {
+ return GetIndustryAnimationState(tile);
+ }
+ return 0xFFFFFFFF;
}
/* Get industry tile ID at offset */