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 7..6 : Possibility of a bridge above, in the direction specified
- m6 bits 4..2: type of hedge on NW border of the tile
- m6 bits 1..0 : Tropic zone definition
|
1 |
Railway tracks |
|
- m1 bits 4..0: owner of the tile
- m2: see signals
- m3 bits 7..4: see signals
- m3 bits 3..0 = track type:
0 |
conventional railway |
1 |
electrified railway |
2 |
monorail |
3 |
maglev |
- 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 |
- m3 bits 7..4: bit set = signal 3..0 present
- m4 bits 7..4: bit clear = signal 3..0 shows red
- 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
- m6 bits 7..6 : Possibility of a bridge above, in the direction specified
- m6 bits 1..0 : Tropic zone definition
|
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)
- m7 bit 5 set = on snow or desert
- m7 bits 7..6: present road types
bit 0 |
normal road |
bit 1 |
tram |
- 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 |
- m3 bits 7..4: owner of road type 1 (tram); OWNER_NONE (10) is stored as OWNER_TOWN (0F)
- 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
- m3 bits 3..0: railway track type
- m5 bit 0: direction
0 |
road in the X direction, rail in Y |
1 |
road in the Y direction, rail in X |
- m5 bit 5: set if crossing lights are on
- m7 bits 4..0: owner of the road type 0 (normal road)
- m5 bit 4: pbs reservation state
- 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:
- m6 bits 7..6 : Possibility of a bridge above, in the direction specified
- m6 bits 1..0 : Tropic zone definition
|
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)
- bits 1..0 : tropic zone specifier
- 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 developped 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 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 underneed |
- m2 bits 5..4: ground density
- m2 bits 3..0: update counter, incremented on every periodic processing.
on wraparound the growth status is updated (or, if it's 3, a random action is taken)
- 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 |
- m6 bits 1..0 : Tropic zone definition
|
5 |
Station tiles |
|
- 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..0: track type for railway stations/waypoints
- m4: custom station id; 0 means standard graphics
- 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 5..3: the station type (rail, airport, truck, bus, oilrig, dock, buoy, waypoint)
- m6 bit 2: pbs reservation state for railway stations/waypoints
- m6 bits 1..0 : Tropic zone definition
- m7 bits 4..0: owner of road (road stops)
- m7 bits 7..6: present road types (road stops)
- m7: animation frame (railway stations/waypoints, airports)
|
6 |
Water |
|
- 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)
- 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) |
|
- m6 bits 7..6 : Possibility of a bridge above, in the direction specified
- m6 bits 1..0 : Tropic zone definition
|
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 |
Industry tile |
|
- 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)
- m6 bits 1..0 : Tropic zone definition
- m7: animation frame
|
9 |
Tunnel / bridge |
|
- m1 bits 4..0: owner
- m3 bits 7..4: owner of tram
- m3 bits 3..0: track type for railway
- m5 bit 4: pbs reservation state for railway
- m5 bits 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 3..2: transport type
- m5 bits 1..0: direction onto the bridge / out of the tunnel
- m6 bits 7..6 : Possibility of a bridge above, in the direction specified
- m6 bits 1..0 : Tropic zone definition
- m7 bits 4..0: owner of road
- m7 bit 5 set = on snow or desert
- m7 bits 7..6: present road types for road
|
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
- m3: random bits
- m5: tile type:
00 |
transmitter |
01 |
lighthouse |
02 |
company statue
|
03 |
company-owned land |
04 |
company headquarters |
- m6 bits 7..6 : Possibility of a bridge above, in the direction specified
- m6 bits 1..0 : Tropic zone definition
- m7: animation counter
|
Classes B through F are reserved. The presence
of a tile in one of the reserved classes will crash OTTD. |