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

### Landscape

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

- type - 8 bits in size, tile class (bits 4..7), bridge (bits 2..3) tropic zone (bits 0..1, only valid in tropic climate)
- height - 8 bits in size, stores tile height
- 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, is used for general storage
- m7 - 8 bits in size, is used for general storage
- m8 - 16 bits in size, is used for general storage

- O - bit is free
- X - bit is used, but could be freed if needed
- X - bit is used
- X - bit is used for an index on a pool
- X - bit is introduced by a patch
- X - bit of attribute is abused for different purposes, i.e. other bits define the actual meaning
- X - bit is accessed, but a rearrangement of the map array could free some of these bits (probably not done for bit alignment)

class | type (8) | height (8) | m1 (8) | m2 (16) | m3 (8) | m4 (8) | m5 (8) | m6 (8) | m7 (8) | m8 (16)
--- | --- | --- | --- | --- | --- | --- | --- | --- | --- | ---
bits | 7654 3210 | 7654 3210 | 7654 3210 | FEDC BA98 7654 3210 | 7654 3210 | 7654 3210 | 7654 3210 | 7654 3210 | 7654 3210 | FEDC BA98 7654 3210
0 | ground | XXXX XX XX | XXXX XXXX | OOO1 OOOO | OOOO OOOO OOOO OOOO | XXX XOOOO | XXX XXXOO | XXX XXX XX | OOOX XXOO | OOOO OOOO | OOOO OOOO OOOO OOOO
farmland | XXXX XXXX XXXX XXXX | XXX XXXXX
1 | rail | XOOX XXXX | OOOO XXXX OOOO OOOO | OOOO OOOO | OOOO XXXX | OO XXXXXX | OOOO OOOO | OOOO OOOO | OOOO OOOO OOXX XXXX
rail with signals | OOOO XXXX XXXX XXXX | XXXX OOOO | XXXX XXXX | O1 XXXXXX
depot | XXXX XXXX XXXX XXXX | OOOO OOOO | OOOO XXXX | 11OX OOXX
2 | road | OOOX XXXX | XXXX XXXX XXXX XXXX | XXXX XXXX | OOXX XXXX | OO XX XXXX | OO XXXOOO | OOX OXXXX | OOOO XXXX XXOO OOOO
level crossing | OOOX XXXX | XXXX OOOO | O1 X XOOOX | OO XXXOOO | OOX XXXXX | OOOO XXXX XX XXXXXX
road depot | OOOX XXXX | XXXX XXXX XXXX XXXX | XXXX OOOO | 1OOO OOXX | OOOO OOOO | OOX XXXXX | OOOO XXXX XXOO OOOO
3 | finished house | XXXX XXXX | XXXX XXXX XXXX XXXX | 1OXX XXXX | OOOO OOOO | XXXX XXXX | XXXX XXXX | XXXX XXXX | OOOO XXXX XXXX XXXX
house under construction | OXXX XXXX | OOOX XXXX
4 | trees | OXX1 OOOO | OOOO OOOXXX XX XXXX | XXXX XXXX | OOOO OOOO | XXOO OXXX | OOOO OOOO | OOOO OOOO | OOOO OOOO OOOO OOOO
5 | rail station | OXX XXXXX | XXXX XXXX XXXX XXXX | XXXX OXXX | XXXX XXXX | XXXX XXXX | OXXX XXXX | XXXX XXXX | OOOO OOOO OOXX XXXX
rail waypoint | OOOO OOOX
road stop | XXXX OOOO | OOXX XXXX | OOOO OXXX | OXXX XOXX | OOOX XXXX | OOOO XXXX XX XXXXXX
road waypoint | XXXX XXOO | XOOO XXXX XX XXXXXX
airport | XXXX OOOO | OOOO OOOO | XXXX XXXX | XXXX XXXX | OOOO OOOO OOOO OOOO
dock | OOOO OOOO | OOOO OOOO | OOOO OXXX | OOOO OOOO
buoy | OOOO OOOO | OOOO OOOO | OOOO OOOO | OOOO OOOO
oilrig | OOOO OOOO | OOOO OOOO | OOOO OOOO | OOOO OOOO
6 | sea | X XX XXXXX | OOOO OOOO OOOO OOOO | OOOO OOOX | OOOO OOOO | 0000 OOOO | OOOO OOOO | OOOO OOOO | OOOO OOOO OOOO OOOO
canal, river | XXXX XXXX | 0000 OOOO
shore | OOOO OOOO | 0001 OOOO
lock | OOOO OOOO | 0010 XXXX
shipdepot | XXXX XXXX XXXX XXXX | OOOO OOOO | 0011 OOXX
8 | finished industry | 1 XXO OOOO | XXXX XXXX XXXX XXXX | XXXX XXXX | XXXX XXXX | XXXX XXXX | OOXXX XXX | XXXX XXXX | OOOO OOOO OOOO OOOO
industry under construction | O XXO XXXX
9 | tunnel entrance | XOO XXXXX | OOOO OOOO OOOO OOOO | XXXX OOOO | OOXX XXXX | OOOX XX XX | OOOO OOOO | OOXX XXXX | OOOO XXXX XXXX XXXX
bridge ramp | 1OOX XX XX | OOXX XXOO
A | objects | OXX XXXXX | XXXX XXXX XXXX XXXX | XXXX XXXX | OOOO OOOO | XXXX XXXX | OOOO OOXX | XXXX XXXX | OOOO OOOO OOOO OOOO
bits | 7654 3210 | 7654 3210 | 7654 3210 | FEDC BA98 7654 3210 | 7654 3210 | 7654 3210 | 7654 3210 | 7654 3210 | 7654 3210 | FEDC BA98 7654 3210
class | type (8) | height (8) | m1 (8) | m2 (16) | m3 (8) | m4 (8) | m5 (8) | m6 (8) | m7 (8) | m8 (16)