VariationalAction2/Industry Tiles

From GRFSpecs
< VariationalAction2
Revision as of 07:04, 23 September 2005 by dmccoy (talk)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Variational Action 2 Variables for Industry Tiles

Variational Action 2 Variables for Industry Tiles

||Variable|Content

40|Construction state of the tile: a value between 0 and 3

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

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

43|Relative position

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

60|Land info of nearby tiles||

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.

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 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 rrzzbbss, where the meaning of the letters is:

  • rr is reserved for future use
  • zz is the height of the lowest corner of the tile. Always the 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.

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||