OpenTTD Landscape Internals - #2
Description: Structure of OpenTTD (OTTD) landscape arrays #2

### Landscape

Six attributes hold the information about a tile. This can be seen in the Landscape 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.

- O - bit is free
- X - bit is used
- - bit of attribute is abused for different purposes, i.e. other bits define the actual meaning.
- ~ - bit is accessed, but does not really have a meaning (e.g. owner of clear land is always OWNER_NONE)

- 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 - 8 bits in size, is used for general storage
- m4 - 8 bits in size, is used for general storage
- m5 - 8 bits in size, is used for general storage
- m6 - 8 bits in size, special meaning : lower 2 bits only valid in tropic climate, upper 2 bits for bridges
- m7 - 8 bits in size, is used for general storage

class | type_height (8) | m1 (8) | m2 (16) | m3 (8) | m4 (8) | m5 (8) | m6 (8) | m7 (8)
--- | --- | --- | --- | --- | --- | --- | --- | ---
bits | 7654 3210 | 7654 3210 | FEDC BA98 7654 3210 | 7654 3210 | 7654 3210 | 7654 3210 | 7654 3210 | 7654 3210
0 | ground | XXXX XXXX | OOO~ ~~~~ | OOOO OOOO OOOO OOOO | XXXX OOOO | XXXX XXOO | XXXX XXXX | XXOX XXXX | OOOO OOOO
farmland | -inherit- | -inherit- | XXXX XXXX XXXX XXXX | XXXX XXXX | -inherit- | -inherit- | XXOX XXXX | OOOO OOOO
1 | rail | XXXX XXXX | OOOX XXXX | OOOO XXXX OOOO OOOO | OOOO XXXX | OOOO XXXX | XXXX XXXX | XXOO OOXX | OOOO OOOO
rail with signals | -inherit- | -inherit- | OOOO XXXX XXXX XXXX | XXXX XXXX | XXXX XXXX | -inherit- | XXOO OOXX | OOOO OOOO
depot | -inherit- | -inherit- | XXXX XXXX XXXX XXXX | OOOO XXXX | OOOO XXXX | XXOX OOXX | XXOO OOXX | OOOO OOOO
2 | road | XXXX XXXX | OOOX XXXX | XXXX XXXX XXXX XXXX | XXXX XXXX | OOOO OOOO | XXXX XXXX | XXXX XOXX | XXXO XXXX
level crossing | -inherit- | -inherit- | -inherit- | XXXX XXXX | -inherit- | XXXX OOOX | XXXX XOXX | XXXX XXXX
road depot | -inherit- | -inherit- | -inherit- | OOOO OOOO | OOOO OOOO | XXOO OOXX | XXOO OOXX | XXXO OOOO
3 | house | XXXX XXXX | XXXX XXXX | XXXX XXXX XXXX XXXX | XXO~ ~~XX | XXXX XXXX | XXXX XXXX | XXXX XXXX | XXXX XXXX
4 | trees | XXXX XXXX | OOO~ ~~~~ | OOOO OOOX XXXX XXXX | ~~XX XXXX | OOOO OOOO | XXOO OXXX | OOOO OOXX | OOOO OOOO
5 | rail station | XXXX XXXX | OXXX XXXX | XXXX XXXX XXXX XXXX | XXXX XXXX | XXXX XXXX | XXXX XXXX | OOXX XXXX | XXXX XXXX
rail waypoint | -inherit- | -inherit- | -inherit- | -inherit- | -inherit- | -inherit- | -inherit- | -inherit-
road stop | -inherit- | -inherit- | -inherit- | XXXX OOOO | OOOO OOOO | ~~~~ ~XXX | OOXX XOXX | XXOX XXXX
dock | -inherit- | -inherit- | -inherit- | OOOO OOOO | OOOO OOOO | ~~~~ ~XXX | OOXX XOXX | OOOO OOOO
airport | -inherit- | -inherit- | -inherit- | XXXX OOOO | OOOO OOOO | XXXX XXXX | OOXX XOXX | XXXX XXXX
buoy | -inherit- | -inherit- | -inherit- | OOOO OOOO | OOOO OOOO | ~~~~ ~~~~ | OOXX XOXX | OOOO OOOO
oilrig | -inherit- | -inherit- | -inherit- | OOOO OOOO | OOOO OOOO | ~~~~ ~~~~ | OOXX XOXX | OOOO OOOO
6 | sea, shore | XXXX XXXX | OXXX XXXX | OOOO OOOO OOOO OOOO | OOOO OOOO | OOOO OOOO | X~~X XXXX | XXOO OOXX | OOOO OOOO
canal, river | -inherit- | -inherit- | OOOO OOOO OOOO OOOO | OOOO OOOO | XXXX XXXX | -inherit- | XXOO OOXX | OOOO OOOO
shipdepot | -inherit- | -inherit- | XXXX XXXX XXXX XXXX | OOOO OOOO | OOOO OOOO | -inherit- | XXOO OOXX | OOOO OOOO
8 | industry | XXXX XXXX | XXXO XXXX | XXXX XXXX XXXX XXXX | XXXX XXXX | XXXX XXXX | XXXX XXXX | OOXX XXXX | XXXX XXXX
9 | tunnel entrance | XXXX XXXX | OOOX XXXX | OOOO OOOO OOOO OOOO | XXXX XXXX | OOOO OOOO | XOOX XXXX | XXOO OOXX | XXXX XXXX
bridge ramp | -inherit- | -inherit- | -inherit- | -inherit- | -inherit- | -inherit- | XXXX XXXX | -inherit-
A | objects | XXXX XXXX | OXXX XXXX | XXXX XXXX XXXX XXXX | XXXX XXXX | OOOO OOOO | XXXX XXXX | XXOO OOXX | XXXX XXXX