OTTD's class-specific periodic tile processing routine is called once every +256 ticks for each tile.
Class |
Meaning & details of encoding |
0 |
Ground |
|
- m1 bits 4..0: owner of the tile (normally 10)
- m2: see fields
- m3 bits 7..5: type of hedge on NE border of the tile
- m3 bits 3..0: see fields
- m3 bit 4: set if the tile is covered with snow
- m4 bits 7..5: type of hedge on the SW border of the tile (1 through 6, or 0=none)
- m4 bits 4..2: same as 7..5, but for the SE border
- m5 bits 7..5: update counter, incremented on every periodic processing for tile types,
other than 03, 07, 0B, 10 and above.
on wraparound, the tile is updated (for fields, the type of fields in m3 is increased, for other types the tile type in m5 is increased).
For snow and desert, these bits are not used, tile is updated on every periodic processing.
- m5 bits 4..2: tile type:
0 |
bare land / grass |
1 |
rough land (density must be 3) |
2 |
rocks (density must be 3) |
3 |
fields (density must be 3)
- m2: index into the array of industries (farms), INVALID_INDUSTRY (0xFFFF) if farm has been removed
- m3 bits 3..0: field type (legal values: 0 through 9)
|
4 |
snow |
5 |
desert (density must be 1 or 3) |
- m5 bits 1..0: density:
0 |
bare land |
|
|
|
1/4 snow |
|
1 |
1/3 grass |
|
|
|
2/4 snow; |
1/2 desert |
2 |
2/3 grass |
|
|
|
3/4 snow |
|
3 |
full grass; |
rough land; |
rocks; |
fields; |
full snow; |
full desert |
- m6 bits 4..2: type of hedge on NW border of the tile
|
1 |
Railway tracks |
|
- m1 bit 7: Ship docking tile status (for half-tile with water)
- m1 bits 4..0: owner of the tile
- m2: see signals
- m3 bits 7..4: see signals
- m8 bits 5..0 = track type:
0 |
conventional railway |
1 |
electrified railway |
2 |
monorail |
3 |
maglev |
- m8 bits 11..6 = secondary track type (used for lower or right track when two parallel tracks on tile)
- m4 bits 7..4: see signals
- m4 bits 3..0: Ground type (values with fences are not valid for depots and checkpoints)
0 |
on bare land |
1 |
on grass, no fences |
2 |
fence on the NW side |
3 |
fence on the SE side |
4 |
fences on the NW and SE sides |
5 |
fence on the NE side |
6 |
fence on the SW side |
7 |
fences on the NE and SW sides |
8 |
fence on the E side (track in the W corner) |
9 |
fence on the W side (track in the E corner) |
A |
fence on the S side (track in the N corner) |
B |
fence on the N side (track in the S corner) |
C |
on snow or desert |
D |
on grass with fence and shore or water on the free halftile |
E |
higher part on foundation with snow, lower without snow |
- m5 bit 7 clear: railway track
- m5 bits 5..0: track layout: bit set = track present:
bit 0: |
in the X direction |
bit 1: |
in the Y direction |
bit 2: |
in the north corner (direction W-E) |
bit 3: |
in the south corner (direction W-E) |
bit 4: |
in the west corner (direction N-S) |
bit 5: |
in the east corner (direction N-S) |
- m5 bit 6 set = with signals:
There are at most 4 signals on a tile. The signals 0..3 belong to the directions:
|
Track 0 (X) |
Track 1 (Y) |
Track 2 (north) |
Track 3 (south) |
Track 4 (west) |
Track 5 (east) |
Signal 0 |
|
|
|
west |
|
south |
Signal 1 |
|
|
|
east |
|
north |
Signal 2 |
south-west |
north-west |
west |
|
south |
|
Signal 3 |
north-east |
south-east |
east |
|
north |
|
- m2 bit 7: Signal 0 and 1: set = semaphore signals, clear = light signals
- m2 bit 3: Signal 2 and 3: set = semaphore signals, clear = light signals
- m2 bits 6..4: type of signal 0 and 1 (same values as m2 bits 2..0)
- m2 bits 2..0: type of signal 2 and 3
000: |
normal signals |
001: |
pre-signals |
010: |
exit-signals |
011: |
combo-signals |
100: |
pbs signals |
101: |
no-entry signals |
110: |
programmable signals |
- m2 bit 12: this signal tile has 1 or more restricted signals (tracerestrict patch)
- m3 bits 7..4: bit set = signal 3..0 present
- m4 bits 7..4: bit clear = signal 3..0 shows red
- m6 bits 7..4: signal style for signal 0 and 1
- m6 bits 3..0: signal style for signal 2 and 3
- m7 bits 7: reserve through always set for signal 0 or 1
- m7 bits 6: reserve through always set for signal 2 or 3
- m7 bits 5..3: signal aspect for signal 0 or 1 (only valid if signal is present and not red, and multi-aspect signalling is in effect)
- m7 bits 2..0: signal aspect for signal 2 or 3 (only valid if signal is present and not red, and multi-aspect signalling is in effect)
- m2 bits 8..10: track reserved for pbs
0 |
not reserved |
1 |
X direction |
2 |
Y direction |
3 |
north corner (W-E) |
4 |
south corner (W-E) |
5 |
west corner (N-S) |
6 |
east corner (N-S) |
- m2 bit 11: opposite track is reserved, too
- m5 bit 7 set, bit 6 set: railway depot
- m2: Depot index
- m5 bits 1..0: exit towards
- m5 bit 4: pbs reservation state
|
2 |
Roads |
|
- m2: Index into the array of towns (owning town for town roads; closest town otherwise, INVALID_TOWN if there is no town or we are creating a town)
- m3 bits 7..4: owner of road type 1 (tram); OWNER_NONE (10) is stored as OWNER_TOWN (0F)
- m4 bits 5..0: Roadtype
- m7 bit 5 set = on snow or desert
- m8 bits 14..12: Road cached one way state
- m8 bits 11..6: Tramtype
- m5 bits 7 clear: road or level-crossing
- m6 bits 5..3:
0 |
on bare land |
1 |
on grass |
2 |
paved |
3 |
with streetlights |
5 |
tree-lined |
6 |
on grass with road works |
7 |
paved with road works |
- m5 bit 6 clear: road
- m1 bits 4..0: owner of the road type 0 (normal road)
- m7 bits 3..0: counter for the roadworks
- m5 bits 3..0: road layout road type 0 (normal road): bit set = road piece present:
bit 0: |
NW piece |
bit 1: |
SW piece |
bit 2: |
SE piece |
bit 3: |
NE piece |
- m3 bits 0..3: road layout road type 1 (tram)
- m5 bits 5..4: bits to disallow vehicles to go a specific direction
bit 0: |
set = disallow driving in south-west or south-east direction |
bit 1: |
set = disallow driving in north-west or north-east direction |
- m5 bit 6 set: level crossing
- m1 bits 4..0: owner of the railway track
- m5 bit 5: set if crossing lights are on
- m5 bit 4: pbs reservation state
- m5 bit 1: set if crossing is possibly occupied by a road vehicle
- m5 bit 0: direction
0 |
road in the X direction, rail in Y |
1 |
road in the Y direction, rail in X |
- m7 bits 4..0: owner of the road type 0 (normal road)
- m8 bits 5..0: railway track type
- m5 bit 7 set, bit 6 clear: road depot
- m1 bits 4..0: owner of the depot
- m2: Depot index
- m5 bits 1..0: exit towards:
- m7 bits 4..0: owner of the road type 0 (normal road)
|
3 |
Town building |
|
- m1 : Random bits (newhouses)
- m2 : index into the array of towns
- m3 bit 7 :
- set : House is complete
- m5 : Age of house in years, clamped at 255
- clear : House is in construction
- m5 bits 7..5 : free
- m5 bits 4..3 : construction stage
- m5 bits 2..0 : construction counter
- m3 bit 6 : bit 8 of house type (m4), allowing 512 different types.
- m3 bit 5 : free
- m3 bits 4..0 : triggers activated (newhouses)
- m4 : town building type (with m3[6] bit)
- m5 : see m3 bit 7
- m6 :
- If newhouses is activated
- bits 7..2 : Periodic processing time remaining
- Standard behaviour
- bits 7..2 : lift position (for houses type 04 and 05)
- m7 :
- If newhouses is activated
- Standard behaviour (only for houses type 04 and 05)
- bits 7..4 : free
- bits 3..1 : lift destination. Values can be 0..6, except 1.
So the building has 6 effective floors. This is due to the fact that the first floor is 2 'normal' floors high.
One 'normal' floor has a height of 6 lift positions.
- bit 0 : Lift has destination when set
Newhouses is the name englobing a newGRF feature developed by TTDPatch devs (mainly Csaboka).
It allows the replacement of the properties as well as the graphics of houses in the game.
To distinguish between the standard behaviour and the newGRF one, HouseID (m4 + m3[6]) is tested for anything above 110.
110 is the count of standard houses. So above 110 means there is a new definition of at least one house
|
4 |
Trees |
|
- m1 bits 6..5: water class (sea or land)
- m1 bits 4..0: owner (normally 10)
- m2 bits 8..6: ground
0 |
on grass |
1 |
on rough land (density must be 3) |
2 |
on snow or desert |
3 |
on shore (density must be 3) |
4 |
on snow with rough land underneath |
- m2 bits 5..4: ground density
- m3 bits 7..0: type of trees:
00..0B |
temperate climate trees |
0C..13 |
sub-arctic climate trees |
14..1A |
rainforest trees |
1B |
cactus plants |
1C..1F |
sub-tropical climate, non-rainforest, non-desert trees |
20..28 |
toyland trees |
Note: the actually displayed set of trees depends on both type and number of trees
- m5 bits 7..6: number of trees minus one
- m5 bits 2..0: growth status:
0..2 |
one of trees is growing |
3 |
all trees are fully grown |
4..6 |
one of trees is withering |
|
5 |
Station tiles |
|
- m1 bit 7: Ship docking tile status (for buoys)
- m1 bits 6..5: water class for buoys, water part of docks and for airport tiles
- m1 bits 4..0: owner of the station
- m2: index into the array of stations
- m3 bits 7..4: persistent random data for railway stations/waypoints and airports)
- m3 bits 7..4: owner of tram tracks (road stop)
- m3 bits 3..2: ground type (road waypoints)
0 |
on bare land |
1 |
on grass |
2 |
paved |
- m3 bits 1..0: bits to disallow vehicles to go a specific direction (drive-through road stop)
bit 0: |
set = disallow driving in south-west or south-east direction |
bit 1: |
set = disallow driving in north-west or north-east direction |
- m4: custom station id; 0 means standard graphics
- m4: Roadtype for road stops
- m5: graphics index (range from 0..255 for each station type):
00..07 |
railway station
00..01 |
open platform |
02..03 |
open platform with station building |
04....07 |
roofed platform |
bit 0: clear = in X direction, set = in Y direction |
|
00..01 |
waypoints
00 |
in X direction |
01 |
in Y direction |
|
00..FF |
all airports |
00..05 |
road stops
00 |
exit towards NE |
01 |
exit towards SE |
02 |
exit towards SW |
03 |
exit towards NW |
04 |
drive through X |
05 |
drive through Y |
|
00..05 |
ship dock
00 |
SW coast part |
01 |
NW coast part |
02 |
NE coast part |
03 |
SE coast part |
04 |
X direction water part |
05 |
Y direction water part |
|
- m6 bits 6..3: the station type (rail, airport, truck, bus, oilrig, dock, buoy, waypoint, road waypoint)
- m6 bit 2: pbs reservation state for railway stations/waypoints
- m7 bits 4..0: owner of road (road stops)
- m7: animation frame (railway stations/waypoints, airports)
- m8 bit 15: Snow or desert present (road waypoints)
- m8 bits 14..12: Road cached one way state
- m8 bits 11..6: Tramtype
- m8 bits 5..0: track type for railway stations/waypoints
- m8 bits 5..0: custom road stop id; 0 means standard graphics
|
6 |
Water |
|
- m1 bit 7: Ship docking tile status
- m1 bits 6..5 : Water class (sea, canal or river)
- m1 bits 4..0: owner (for sea, rivers, and coasts normally 11)
- m2: Depot index (for depots only)
- m3 bit 0: No flooding state, set if all neighbouring tiles are also water
- m4: Random data for canal or river tiles
- m5: tile type:
00 |
water, canal or river |
01 |
coast or riverbank |
10..1B |
canal locks
10 |
middle part, (SW-NE direction) |
11 |
middle part, (NW-SE direction) |
12 |
middle part, (NE-SW direction) |
13 |
middle part, (SE-NW direction) |
14 |
lower part, (SW-NE direction) |
15 |
lower part, (NW-SE direction) |
16 |
lower part, (NE-SW direction) |
17 |
lower part, (SE-NW direction) |
18 |
upper part, (SW-NE direction) |
19 |
upper part, (NW-SE direction) |
1A |
upper part, (NE-SW direction) |
1B |
upper part, (SE-NW direction) |
|
80..83 |
ship depots
80 |
ship depot, NE part (X direction) |
81 |
ship depot, SW part (X direction) |
82 |
ship depot, NW part (Y direction) |
83 |
ship depot, SE part (Y direction) |
|
|
7 |
Void |
|
Tiles of this class form an invisible, one tile wide border at the south (bottom) edges of the map,
so as to protect several algorithms from the consequences of a wraparound at the edges.
|
8 |
Industries |
|
- m1 bit 7: clear = under construction
- m1 bits 6..5 : Water class (sea, canal, river or land)
- m1 bits 3..2: construction counter, for buildings under construction incremented on every periodic tile processing
- m1 bits 1..0: stage of construction (3 = completed), incremented when the construction counter wraps around
the meaning is different for some animated tiles which are never under construction (types 01, 1E..20, 30, 58; see above)
- m2: index into the array of industries
- m3: random bits (NewGRF)
- m4: animation loop
- m5: type (plus m6 bit 2):
(note: this is not the same as the industry type, which is stored in the array of industries)
00..06 |
coal mine
00 |
wheel tower when not animated |
01 |
wheel tower when animated
animation state in m7 bits 5..0; m7 bit 6 set = sound already generated |
|
07..0A |
power station
08 |
chimney |
0A |
transformer; animation progress in m7(valid range 0..7) |
|
0B..0F |
sawmill |
10..11 |
forest
|
12..17 |
oil refinery |
18..1C |
oil rig |
1D..20 |
oil wells
1D |
not animated |
1E..20 |
various stages of animation; progress of animation in m7 |
|
21..26 |
farm |
27..2A |
factory (temperate climate) |
2B..2E |
printing works |
2F..33 |
copper ore mine
2F |
wheel tower when not animated |
30 |
wheel tower when animated; animation state in m7 bits 5..0; m7 bit 6 set = sound already generated |
31 |
chimney |
|
34..39 |
steel mill |
3A..3B |
bank (temperate climate) |
3C..3F |
food processing plant |
40..47 |
paper mill |
48..58 |
gold mine
4F |
wheel tower when not animated |
58 |
wheel tower when animated; animation state in m7 bits 5..0; m7 bit 6 set = sound already generated |
|
59..5A |
bank (sub-arctic or sub-tropical climate) |
5B..63 |
diamond mine |
64..73 |
iron ore mine |
74 |
fruit plantation |
75 |
rubber plantation |
76..77 |
water supply |
78 |
water tower |
79..7C |
factory (sub-tropical climate) |
7D..80 |
lumber mill |
81..82 |
candyfloss forest
82 |
candyfloss 'trees' cut down |
|
83..86 |
sweet factory |
87..88 |
battery farm
|
89 |
cola wells |
8A..8D |
toy shop |
8E..93 |
toy factory
8F |
Animated part; animation state in m7 (valid range 00..31)
Tile animation is started (m4 zeroed) on the periodic processing.
While the animation is in progress, m4 holds the number
of animation cycles that have already taken place.
when this number reaches 8 the animation is stopped. |
|
94..9B |
plastic fountains (various stages of cyclic animation) |
9C..9F |
fizzy drink factory |
A0..A3 |
bubble generator
A1 |
generators |
A2 |
bubble capture facility; animation state in m7 (valid range 00..27) |
|
A4..A6 |
toffee quarry
A5 |
animated part; animation state in m3 (valid range 00..45) |
|
A7..AE |
sugar mine
AE |
animated part; animation state in m3 (valid range 00..5F) |
|
AF..1FF |
NewGRF industries industry |
- m6 bits 5..3: random triggers (NewGRF)
- m6 bit 2: bit 8 of type (see m5)
- m7: animation frame
|
9 |
Tunnel / bridge |
|
- m1 bit 7: Ship docking tile status (for aqueducts)
- m1 bits 4..0: owner
- m2 bits 15..0: tunnel ID (tunnel entrance/exits only)
0000 - FFFE |
Tunnel ID value |
FFFF |
Sentinel value: tunnel ID is >= FFFF, it must be looked up in a separate off-map index for tunnels with high IDs |
- m2 bits 7..0: custom road bridge heads (flat bridge heads only)
Road/tram bits below are XORed with the axial bridge direction road bits.
A non-custom bridge head configuration will have a value of 0.
- m2 bits 7..4: Road bits
Valid only if m7 bit 6 is set
- m2 bits 3..0: Tram bits
Valid only if m7 bit 7 is set
bit 0: |
NW piece |
bit 1: |
SW piece |
bit 2: |
SE piece |
bit 3: |
NE piece |
- m2 bits 2..0: rail bridge heads track reserved for pbs
0 |
not reserved |
1 |
X direction |
2 |
Y direction |
3 |
north corner (W-E) |
4 |
south corner (W-E) |
5 |
west corner (N-S) |
6 |
east corner (N-S) |
- m2 bit 3: rail bridge heads opposite track is reserved, too
- m3 bits 7..4: owner of tram
- m4: Roadtype
- m4 bits 5..0: rail bridge heads track layout: bit set = track present:
bit 0: |
in the X direction |
bit 1: |
in the Y direction |
bit 2: |
in the north corner (direction W-E) |
bit 3: |
in the south corner (direction W-E) |
bit 4: |
in the west corner (direction N-S) |
bit 5: |
in the east corner (direction N-S) |
- m5 bit 7 clear: tunnel entrance/exit
- m5 bit 7 set: bridge ramp
- m6 bits 5..2: bridge type:
Type |
Max. speed (mph) |
Description |
0 |
20 |
wooden |
1 |
30 |
concrete |
2 |
40 |
girder, steel |
3 |
50 |
suspension, concrete |
4 |
60 |
suspension, steel |
5 |
70 |
suspension, steel |
6 |
100 |
cantilever, steel |
7 |
130 |
cantilever, steel |
8 |
150 |
cantilever, steel |
9 |
160 |
girder, steel |
A |
200 |
tubular, steel |
B |
320 |
tubular, steel |
C |
380 |
tubular, silicon |
- m5 bits 6..5: signal simulation (signals on bridge/tunnels patch)
0 |
no signal simulation |
1 |
signal simulation entrance (bit 5 set) |
2 |
signal simulation exit (bit 6 set) |
3 |
signal simulation bidirectional entrance and exit (bits 5 and 6 set) |
If signal simulation entrance or exit:
- m2 bit 15: for bridge entrances only: storage for visual red/green state of signals starting from 15 is allocated outside the map array
- m2 bits 14..4: for bridge entrances only: for signals 0..10 on bridge, signal is visually red if corresponding bit in 4..14 is set
- m3 bit 7: the signal style is non-zero (style stored outside the map array)
- m3 bit 6: the entrance and/or exit signals on this tile are restricted (tracerestrict patch)
- m3 bits 5..3: entrance signal aspect (only valid if signal is present and not red, and multi-aspect signalling is in effect)
- m3 bits 2..0: exit signal aspect (only valid if signal is present and not red, and multi-aspect signalling is in effect)
- m6 bit 7: set = exit signal shows green, clear = exit signal shows red
- m6 bit 6: set = PBS signals, clear = block signals
- m6 bit 1: set = semaphore signals, clear = light signals
- m6 bit 0: set = entrance signal shows green, clear = entrance signal shows red
- m8 bits 15..12: signal simulation spacing
- m5 bit 4: pbs reservation state for railway (tunnel only)
- m5 bits 3..2: transport type
- m5 bits 1..0: direction onto the bridge / out of the tunnel
- m7 bits 7..5: ground type, values greater than 1 are only valid for rail custom bridge heads
0 |
on grass, no fences |
1 |
on snow or desert |
2 |
on bare land |
3 |
facing NE, SE, SW: fence on the NW side, facing NW: fence on the SE side |
4 |
facing NE, SW: fence on the SE side, facing SE, NW: fence on the NE side |
5 |
facing NE, SE, NW: fence on the SW side, facing SW: fence on the NE side |
6 |
facing NE, SE: fence on the W side (track in the E corner), facing: SW, NW: fence on the E side (track in the W corner) |
7 |
facing NE, NW: fence on the S side (track in the N corner), facing: SE, SW: fence on the N side (track in the S corner) |
- m7 bits 4..0: owner of road
- m8 bits 14..12: Road cached one way state
- m8 bits 11..6: Tramtype
- m8 bits 11..6: secondary track type for railway (used for bridge-bypassing track when two parallel tracks on custom bridge head)
- m8 bits 5..0: track type for railway
|
A |
Objects |
|
- m1 bits 6..5 : Water class (sea, canal, river or land)
- m1 bits 4..0: owner of the object (for lighthouses and transmitters normally 10)
- m2: index into the array of objects, bits 0 to 15 (upper bits in m5)
- m3: random bits
- m5: index into the array of objects, bits 16 to 23 (lower bits in m2)
- m6 bits 1..0: foundation type:
0 |
none |
1 |
flat |
2 |
inclined X-axis |
3 |
inclined Y-axis |
- m7: animation counter
- m4 bits 7..5: update counter (for objects using land ground sprites), incremented on every periodic processing.
For snow and desert, these bits are not used, tile is updated on every periodic processing.
- m4 bit 4: object type has viewport map colour/type override.
- m4 bits 3..2: ground type (for objects using land ground sprites):
0 |
bare land / grass |
1 |
snow or desert |
2 |
shore/coast |
- m4 bits 1..0: density (for objects using land ground sprites):
0 |
bare land |
1/4 snow |
|
1 |
1/3 grass |
2/4 snow; |
1/2 desert |
2 |
2/3 grass |
3/4 snow |
|
3 |
full grass; |
full snow; |
full desert |
|
Classes B through F are reserved. The presence
of a tile in one of the reserved classes will crash OTTD. |