Difference between revisions of "VariationalAction2/Industry Tiles"

From GRFSpecs
Jump to navigationJump to search
(No difference)

Revision as of 00:06, 4 March 2010

Variational Action 2 Variables for Industry and Airport Tiles

Variational Action 2 Variables for Industry and Airport Tiles

VarAction2 for airport tiles is only available in OpenTTD r19204 or later

||Variable|Size|Content

40|B|Construction state of the tile: a value between 0 and 3 (only defined for industries)

41|B|Ground type, the same as variable 81 for canals

42|B|Current town zone of the tile in the nearest town

43|D|Relative position

44|B|Animation frame. Like house variable 46 but can contain anything 0..FF.

60|D|Land info of nearby tiles

61|D|Animation stage of nearby tiles

62|D|Get industry or airport tile ID at offset||

No 80+x variables are available (nor will they ever be). Try to access one will crash TTD.

Town zone (42)

Town zone where the building is situated (which is not necessarily the founder of the town). Zero if the tile isn't in a town. This is mostly useful for banks and other urban industries.

Relative position (43)

This is the position of the tile relative to the northernmost tile of the industry or airport.

Format: 00yxYYXX

||Variable|Content

x|the x offset from the northernmost tile

XX|same, but stored in a byte instead of a nibble

y|the y offset from the northernmost tile

YY|same, but stored in a byte instead of a nibble||

Because of the fact that y and x are nibbles, they may contain incorrect values if your industry exceeds 16 tiles in either direction. This variable can be used to spare industry or airport tile IDs: the same tile type can choose different representation depending on where exactly it is inside the industry.

Land info of nearby tiles (60)

The parameter of this variable is an offset from the position of the current tile. The low nibble contains the signed X offset (that is 0h=0, 1h=+1 ... 7h=+7, 8h=-8, 9h=-7 ... Fh=-1), the high nibble contains the Y offset. Therefore the parameter 00h accesses the current tile itself. The returned doubleword is in the format rczzbbss, where the meaning of the letters is:

  • r is reserved for future use
  • c contains the class of the tile. (only from alpha 72 and above)
  • zz is the height of the lowest corner of the tile. Always a multiple of 8
  • bb is a bit field, the meaning of the individual bits are: ||Bit|Value|Meaning

0|1|The tile is an industry tile, and belongs to the same industry as the current one

1|2|The tile has water on it. This flag is set for coasts as well. If you need a full water tile, check the slope data as well. If it's zero (flat tile), the tile is fully watered.

2..4| |(From alpha 70) 0 - normal tile; 1 - desert; 2 - rainforest; 4 - snowy tile

other bits| |reserved for future use||

  • ss contains the slope data of the tile. The meaning of the individual bits is: ||Bit|Value|Meaning

0|1|West corner is above the lowest

1|2|South corner is above the lowest

2|4|East corner is above the lowest

3|8|North corner is above the lowest

4|16|The tile is a steep slope (i.e. the corner opposite to the lowest one is two units higher)

other bits| |always zero||

It is sometimes more useful to know the height of the highest corner of the tile. This can be computed with "zz/8 +