Landscape grid

From OpenTTD

Jump to: navigation, search

( Copied from 'docs/landscape.html' )

[edit] Landscape

Five attributes hold the information about a tile. This can be seen in the Landscape Document document. This page tries to give an overview of used and free bits of the array so you can quickly see what is used and what is not.


  • 0 - bit is free
  • 1 - bit is used
  • 1 - bit of attribute is abused for different purposes
  • NOTE: counting the bits starts with bit0 in the most left position (eg. a bit screwed LE format; BIT by BIT)


  • type_height - 8 bits in size, stores tile height (lower 4 bits) and tile class (upper 4 bits)
  • m1 - 8 bits in size, used to identify the owner of that tile (eg piece of rail, bridge, etc.)
  • m2 - 16 bits in size, used to identify the index of the given tile (object) in the (object-)array
  • m3/m4 - 16 bits in size, which is split up into m3 and m4 is used for general storage
  • m5 - 8 bits in size, is used for general storage
  • m6 - 8 bits in size, only two are used, to distinghish desert from rain forest (special meaning : lower 2 bits only valid in tropic climate, upper 2 bits for bridges)


class m1[L1] (8) m2[L2] (16) m3/m4[L3] (16) type_height[L4] (8) m5[L5] (8) extra (8)
bits 0123 4567 0123 4567 0123 4567 0123 4567 0123 4567 0123 4567 0123 4567 0123 4567
(0) ground 1111 1111 0000 0000 0000 0000 1111 0000 0011 1111 1111 1111 1111 1011 0000 0011
(1) rail 1111 1111 1111 1111 0000 0000 1111 1111 1111 1111 1111 1111 1111 1111 0000 0011
* depot/checkpoint -inherit- 0000 0000 0000 0000 1111 1000 1111 1111 -inherite- 1110 0011 0000 0011
(2) Road 1111 1111 1111 1111 1111 1111 0000 0000 1111 1111 1111 1111 1111 1111 0000 0011
Personal tools