59 |
59 |
60 static uint32 IndustryTileGetVariable(const ResolverObject *object, byte variable, byte parameter, bool *available) |
60 static uint32 IndustryTileGetVariable(const ResolverObject *object, byte variable, byte parameter, bool *available) |
61 { |
61 { |
62 const Industry *inds = object->u.industry.ind; |
62 const Industry *inds = object->u.industry.ind; |
63 TileIndex tile = object->u.industry.tile; |
63 TileIndex tile = object->u.industry.tile; |
64 IndustryGfx gfx = object->u.industry.gfx; |
|
65 |
64 |
66 if (object->scope == VSG_SCOPE_PARENT) { |
65 if (object->scope == VSG_SCOPE_PARENT) { |
67 return IndustryGetVariable(object, variable, parameter, available); |
66 return IndustryGetVariable(object, variable, parameter, available); |
68 } |
67 } |
69 |
68 |
70 switch (variable) { |
69 switch (variable) { |
71 case 0x40 : return GetIndustryConstructionStage(tile); /* Construction state of the tile: a value between 0 and 3 */ |
70 /* Construction state of the tile: a value between 0 and 3 */ |
|
71 case 0x40 : return (IsTileType(tile, MP_INDUSTRY)) ? GetIndustryConstructionStage(tile) : 0; |
72 |
72 |
73 case 0x41 : return GetTerrainType(tile); |
73 case 0x41 : return GetTerrainType(tile); |
74 |
74 |
75 case 0x42 : return GetTownRadiusGroup(ClosestTownFromTile(tile, (uint)-1), tile); /* Current town zone of the tile in the nearest town */ |
75 /* Current town zone of the tile in the nearest town */ |
|
76 case 0x42 : return GetTownRadiusGroup(ClosestTownFromTile(tile, (uint)-1), tile); |
76 |
77 |
77 case 0x43 : return GetRelativePosition(tile, inds->xy); /* Relative position */ |
78 /* Relative position */ |
|
79 case 0x43 : return GetRelativePosition(tile, inds->xy); |
78 |
80 |
79 case 0x44 : break; /* Animation frame. Like house variable 46 but can contain anything 0..FF. */ |
81 /* Animation frame. Like house variable 46 but can contain anything 0..FF. */ |
|
82 case 0x44 : return (IsTileType(tile, MP_INDUSTRY)) ? GetIndustryAnimationState(tile) : 0; |
80 |
83 |
81 case 0x60 : return GetNearbyIndustryTileInformation(parameter, tile, inds->index); /* Land info of nearby tiles */ |
84 /* Land info of nearby tiles */ |
|
85 case 0x60 : return GetNearbyIndustryTileInformation(parameter, tile, inds->index); |
82 |
86 |
83 case 0x61 : {/* Animation stage of nearby tiles */ |
87 case 0x61 : {/* Animation stage of nearby tiles */ |
84 tile = GetNearbyTile(parameter, tile); |
88 tile = GetNearbyTile(parameter, tile); |
85 return 0; // TODO define the animation scheme for newgrf. Based on same as old one? |
89 if (IsTileType(tile, MP_INDUSTRY) && GetIndustryByTile(tile) == inds) { |
|
90 return GetIndustryAnimationState(tile); |
|
91 } |
|
92 return 0xFFFFFFFF; |
86 } |
93 } |
87 |
94 |
88 /* Get industry tile ID at offset */ |
95 /* Get industry tile ID at offset */ |
89 case 0x62 : return GetIndustryIDAtOffset(GetNearbyTile(parameter, tile), tile, inds); |
96 case 0x62 : return GetIndustryIDAtOffset(GetNearbyTile(parameter, tile), tile, inds); |
90 } |
97 } |