diff --git a/docs/landscape.html b/docs/landscape.html
--- a/docs/landscape.html
+++ b/docs/landscape.html
@@ -11,7 +11,17 @@
-Five arrays are used to encode the information of the contents of each tile. These arrays are referred to as "map_owner", "map2", "map3_lo|_hi", "map_type_and_height" and "map5". The known encodings are listed in the table below. The most important value is the class of a tile, stored in the upper 4 bits of the type_and_height array. The lower 4 bits are used to encode the height and slope data. For a graphical represenation of the tile-layout have a look at Landscape grid page.
+Five attributes hold the information about a tile.
+These attributes are referred to as
+ "type_height",
+ "owner",
+ "m2",
+ "m3",
+ "m4" and
+ "m5".
+The most important value is the class of a tile, stored in the upper 4 bits of the type_height array.
+The lower 4 bits are used to encode the height and slope data.
+For a graphical represenation of the tile-layout have a look at Landscape grid page.
OTTD's class-specific periodic tile processing routine is called once every +256 ticks for each tile.
@@ -22,7 +32,7 @@ OTTD's class-specific periodic tile proc
0 |
-- map5 bits 4..0: tile type:
+
- m5 bits 4..0: tile type:
00 | bare land |
01 | 1/3 grass |
@@ -30,7 +40,7 @@ OTTD's class-specific periodic tile proc
03 | full grass |
07 | rough land |
0B | rocks |
-0F | fields; type of fields in map3_lo bits 3..0 (legal values: 0 through 9) |
+0F | fields; type of fields in m3 bits 3..0 (legal values: 0 through 9) |
10 | 1/4 snow |
11 | 2/4 snow |
12 | 3/4 snow |
@@ -39,20 +49,20 @@ OTTD's class-specific periodic tile proc
17 | full desert |
-- map5 bits 7..6: update counter, incremented on every periodic processing for tile types other than 03, 07, 0B and 10 and above, on wraparound the tile is updated (for fields, the type of fields in map3_lo is increased, for other types the tile type in map5 is increased)
+
- m5 bits 7..6: update counter, incremented on every periodic processing for tile types other than 03, 07, 0B and 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)
-- map_owner: owner of the tile (normally 10)
+
- owner: owner of the tile (normally 10)
-- map3_hi bits 7..5: type of hedge on the SW border of the tile (1 through 6, or 0=none); bits 4..2: same for the SE border
+
- m4 bits 7..5: type of hedge on the SW border of the tile (1 through 6, or 0=none); bits 4..2: same for the SE border
|
1 |
-map5 bit 7 clear: railway track
+m5 bit 7 clear: railway track
-- map5 bits 0..5: track layout: bit set = track present:
+
- m5 bits 0..5: track layout: bit set = track present:
bit 0: | in the X direction |
bit 1: | in the Y direction |
@@ -61,9 +71,9 @@ map5 bit 7 clear: railway track
bit 4: | in the west corner (direction N-S) |
bit 5: | in the east corner (direction N-S) |
-- map5 bit 6 set = with signals:
+
- m5 bit 6 set = with signals:
-- map3_lo bits 7..4: bit set = signal present:
+
- m3 bits 7..4: bit set = signal present:
- For track in the X direction:
@@ -90,8 +100,8 @@ map5 bit 7 clear: railway track
bit 7: | signal in the N direction on the track in the W corner |
-- map2 bits 7..4: bit clear = signal shows red; same bits as in map3_lo
-- OpenTTD bits in map3_hi:
+
- m2 bits 7..4: bit clear = signal shows red; same bits as in m3
+- OpenTTD bits in m4:
bits 2..0: | type of signal: |
000: | normal signals |
@@ -102,9 +112,9 @@ map5 bit 7 clear: railway track
bit 3: | set = semaphore signals, clear = light signals |
-- map_owner: owner of the track
+
- owner: owner of the track
-- map2 bits 0..3:
+
- m2 bits 0..3:
0 | on bare land |
1 | on grass, no fences |
@@ -120,70 +130,70 @@ map5 bit 7 clear: railway track
B | fence on the N side (track in the S corner) |
C | on snow or desert |
-- map3_hi bits 0..3 = track type: 0 - conventional railway, 1 - monorail, 2 - maglev
-
- map3_hi bits 4..7 = Pbs reserved status:
+
- m4 bits 0..3 = track type: 0 - conventional railway, 1 - monorail, 2 - maglev
+
- m4 bits 4..7 = Pbs reserved status:
bits 4..6 | 'Track'number of reserved track + 1, if this is zero it means nothing is reserved on this tile |
bit 7 | If this is set, then the opposite track ('Track'number^1) is also reserved |
-map5 bits 7 and 6 set: railway depot / checkpoints
+m5 bits 7 and 6 set: railway depot / checkpoints
-- map5 value C0..C3: railway depot
-
map5 bits 1..0 - direction: exit towards: 00 = NE, 01 = SE, 02 = SW, 03 = NW
-- map5 value C4..C5: checkpoint
+
- m5 value C0..C3: railway depot
+
m5 bits 1..0 - direction: exit towards: 00 = NE, 01 = SE, 02 = SW, 03 = NW
+- m5 value C4..C5: checkpoint
bit 0: clear = in X direction, set = in Y direction
- - map_owner: owner of the depot / checkpoint
-- map3_lo bits 0..3 = track type
-- map3_lo bit 4 = use custom sprite (valid only for the checkpoint)
-- map3_lo bit 6 = track on this tile is reserved by pbs
-- map3_hi = custom station id
+- owner: owner of the depot / checkpoint
+- m3 bits 0..3 = track type
+- m3 bit 4 = use custom sprite (valid only for the checkpoint)
+- m3 bit 6 = track on this tile is reserved by pbs
+- m4 = custom station id
|
2 |
-map5 bits 7..4 clear: road
+m5 bits 7..4 clear: road
-- map5 bits 3..0: road layout: bit set = road piece present:
+
- m5 bits 3..0: road layout: bit set = road piece present:
bit 0: | NW piece |
bit 1: | SW piece |
bit 2: | SE piece |
bit 3: | NE piece |
-- map_owner: owner of the road
-- map2: Index into the array of towns, 0 for non-town roads
-- map3_hi bits 0..3: counter for the roadworks
-- map3_hi bits 4..6: 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
-- map3_hi bit 7 set = on snow or desert
+- owner: owner of the road
+- m2: Index into the array of towns, 0 for non-town roads
+- m4 bits 0..3: counter for the roadworks
+- m4 bits 4..6: 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
+- m4 bit 7 set = on snow or desert
-map5 bit 4 set, bits 7..5 clear: level crossing
+m5 bit 4 set, bits 7..5 clear: level crossing
-- map5 bit 3: clear - road in the X direction, set - road in the Y direction (railway track always perpendicular)
-- map5 bit 2: set if crossing lights are on
-- map5 bit 0: set if rail track is reserved by pbs
-- map_owner: owner of the railway track
-- map2: Index into the array of towns, 0 for non-town roads
-- map3_lo bits 0..7: owner of the road
-- map3_hi bits 3..0: track type
-- map3_hi bits 4..6: 0 - on bare land, 1 - on grass, 2 or higher - paved
-- map3_hi bit 7 set = on snow or desert
+- m5 bit 3: clear - road in the X direction, set - road in the Y direction (railway track always perpendicular)
+- m5 bit 2: set if crossing lights are on
+- m5 bit 0: set if rail track is reserved by pbs
+- owner: owner of the railway track
+- m2: Index into the array of towns, 0 for non-town roads
+- m3 bits 0..7: owner of the road
+- m4 bits 3..0: track type
+- m4 bits 4..6: 0 - on bare land, 1 - on grass, 2 or higher - paved
+- m4 bit 7 set = on snow or desert
-map5 bit 5 set: road depot
+m5 bit 5 set: road depot
-- map5 bits 3..0 - direction: exit towards: 0 = NE, 1 = SE, 2 = SW, 3 = NW
-- map_owner: owner of the depot
-- map3_hi bit 7 set = on snow or desert (not displayed, but set internally)
+- m5 bits 3..0 - direction: exit towards: 0 = NE, 1 = SE, 2 = SW, 3 = NW
+- owner: owner of the depot
+- m4 bit 7 set = on snow or desert (not displayed, but set internally)
|
3 |
Town building
|
@@ -287,9 +297,9 @@ Town building
4 |
Trees
-- map5 bits 7..6: number of trees minus one
-- map5 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
-- map3_lo bits 7..0: type 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
+- m3 bits 7..0: type of trees:
00..0B | temperate climate trees |
0C..13 | sub-arctic climate trees |
@@ -300,24 +310,24 @@ Trees
(note: the actually displayed set of trees depends on both type and number of trees)
-- map3_hi bits 7..5: type of hedge on the SW border of the tile (1 through 6, or 0=none)
-- map3_hi bits 4..2: type of hedge on the SE border of the tile (1 through 6, or 0=none)
-- map2 bits 5..4:
+
- m4 bits 7..5: type of hedge on the SW border of the tile (1 through 6, or 0=none)
+- m4 bits 4..2: type of hedge on the SE border of the tile (1 through 6, or 0=none)
+- m2 bits 5..4:
0 | on grass |
1 | on rough land |
-2 | on snow or desert; map2 bits 7..6 - amount of snow or desert (for desert always set to 3 in TTD)
+ | 2 | on snow or desert; m2 bits 7..6 - amount of snow or desert (for desert always set to 3 in TTD)
|
-- map2 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)
-- map_owner: owner (normally 10)
+- 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)
+- owner: owner (normally 10)
|
5 |
Station tile
-- map5: tile type:
+
- m5: tile type:
00..07 | railway station
00..01 - open platform, 02..03 - open platform with station building, 04....07 - roofed platform
@@ -375,18 +385,18 @@ exit towards: 47 - NE, 48
|
|
-- map_owner: owner of the station
-- map2: index into the array of stations
-- map3_lo bits 0..3: track type for railway stations, must be 0 for all the other stations
-- map3_lo bit 4 = use custom sprite (valid only railway stations FOR NOW)
-- map3lo bit 6 set = track is reserved by pbs (railway stations only)
-- map3_hi = custom station id
+- owner: owner of the station
+- m2: index into the array of stations
+- m3 bits 0..3: track type for railway stations, must be 0 for all the other stations
+- m3 bit 4 = use custom sprite (valid only railway stations FOR NOW)
+- m3 bit 6 set = track is reserved by pbs (railway stations only)
+- m4 = custom station id
|
6 |
-- map5: tile type:
+
- m5: tile type:
00 | water |
01 | coast or riverbank |
@@ -417,7 +427,7 @@ exit towards: 47 - NE, 48
|
-map_owner: owner (for water and coasts normally 11)
+owner: owner (for water and coasts normally 11)
@@ -431,19 +441,19 @@ Tiles of this class form an invisible, o
8 |
Industry tile
-- map5: type:
+
- m5: type:
(note: this is not the same as the industry type stored in the array of industries)
00..06 | coal mine
00 | wheel tower when not animated |
-01 | wheel tower when animated; animation state in map_owner bits 5..0; map_owner bit 6 set = sound already generated |
+01 | wheel tower when animated; animation state in owner bits 5..0; owner bit 6 set = sound already generated |
|
07..0A | power station
08 | chimney |
-0A | transformer; animation progress in map_owner bits 5..2 (valid range 0..7) |
+0A | transformer; animation progress in owner bits 5..2 (valid range 0..7) |
|
0B..0F | sawmill |
@@ -457,7 +467,7 @@ Industry tile
1D..20 | oil wells
1D | not animated |
-1E..20 | various stages of animation; progress of animation in map_owner bits 1..0 |
+1E..20 | various stages of animation; progress of animation in owner bits 1..0 |
|
21..26 | farm |
@@ -466,7 +476,7 @@ Industry tile
2F..33 | copper ore mine
2F | wheel tower when not animated |
-30 | wheel tower when animated; animation state in map_owner bits 5..0; map_owner bit 6 set = sound already generated |
+30 | wheel tower when animated; animation state in owner bits 5..0; owner bit 6 set = sound already generated |
31 | chimney |
|
@@ -477,7 +487,7 @@ Industry tile
48..58 | gold mine
4F | wheel tower when not animated |
-58 | wheel tower when animated; animation state in map_owner bits 5..0; map_owner bit 6 set = sound already generated |
+58 | wheel tower when animated; animation state in owner bits 5..0; owner bit 6 set = sound already generated |
|
59..5A | bank (sub-arctic or sub-tropical climate) |
@@ -504,9 +514,9 @@ Industry tile
8A..8D | toy shop |
8E..93 | toy factory
-8F | animated part; animation state in map3_lo (valid range 00..31)
-tile animation is started (map3_hi zeroed) on the periodic processing if field 2C in the corresponding industry array entry is nonzero
-while the animation is in progress (see the array at 04328) map3_hi holds the number of animation cycles that have already taken place; when this number reaches 8 the animation is stopped |
+8F | animated part; animation state in m3 (valid range 00..31)
+tile animation is started (m4 zeroed) on the periodic processing if field 2C in the corresponding industry array entry is nonzero
+while the animation is in progress (see the array at 04328) 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) |
@@ -514,71 +524,71 @@ while the animation is in progress (see
A0..A3 | bubble generator
A1 | generators |
-A2 | bubble capture facility; animation state in map3_lo (valid range 00..27) |
+A2 | bubble capture facility; animation state in m3 (valid range 00..27) |
|
A4..A6 | toffee quarry
-A5 | animated part; animation state in map3_lo (valid range 00..45) |
+A5 | animated part; animation state in m3 (valid range 00..45) |
|
A7..AE | sugar mine
-AE | animated part; animation state in map3_lo (valid range 00..5F) |
+AE | animated part; animation state in m3 (valid range 00..5F) |
|
|
-- map2: index into the array of industries
+
- m2: index into the array of industries
-- map_owner bit 7: clear = under construction
+
- owner bit 7: clear = under construction
-- map_owner bits 4..2: construction counter, for buildings under construction incremented on every periodic tile processing
+
- owner bits 4..2: construction counter, for buildings under construction incremented on every periodic tile processing
-- map_owner bits 1..0: stage of construction (3 = completed), incremented when the construction counter wraps around
+
- owner 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)
|
9 |
-map5 bits 7..4 clear: tunnel entrance/exit
+m5 bits 7..4 clear: tunnel entrance/exit
-- map5 bits 3..2: 0 - railway tunnel, 1 - road tunnel
-- map5 bits 1..0 - direction: entrance towards: 0 = NE, 1 = SE, 2 = SW, 3 = NW
-- map_owner: owner of the tunnel
-- map3_lo bits 3..0 = track type for railway tunnel, must be 0 for road tunnel
-- map3_hi bit 7 set = on snow or desert
-- map3hi bit 0 set = track with 'Track'number 0 is reserved by pbs
-- map3hi bit 1 set = track with 'Track'number 1 is reserved by pbs
+- m5 bits 3..2: 0 - railway tunnel, 1 - road tunnel
+- m5 bits 1..0 - direction: entrance towards: 0 = NE, 1 = SE, 2 = SW, 3 = NW
+- owner: owner of the tunnel
+- m3 bits 3..0 = track type for railway tunnel, must be 0 for road tunnel
+- m4 bit 7 set = on snow or desert
+- m4 bit 0 set = track with 'Track'number 0 is reserved by pbs
+- m4 bit 1 set = track with 'Track'number 1 is reserved by pbs
-map5 bit 7 set: bridge
+m5 bit 7 set: bridge
-
-map5 bit 6 clear: bridge ending
+m5 bit 6 clear: bridge ending
-- map5 bit 5: clear - northern, set - southern ending
-- map3_lo bits 3..0 = type of track on the bridge, must be 0 for road bridge
-- map_owner: owner of the bridge
+- m5 bit 5: clear - northern, set - southern ending
+- m3 bits 3..0 = type of track on the bridge, must be 0 for road bridge
+- owner: owner of the bridge
-map5 bit 6 set: bridge middle part
+m5 bit 6 set: bridge middle part
-- map5 bit 5 clear:
+
- m5 bit 5 clear:
-- map5 bits 4..3: land under bridge: 0 - grass, snow or desert, 1 - water
+- m5 bits 4..3: land under bridge: 0 - grass, snow or desert, 1 - water
-map5 bit 5 set:
+m5 bit 5 set:
-- map5 bits 4..3: transport route under bridge: 0 - railway, 1 - road
+- m5 bits 4..3: transport route under bridge: 0 - railway, 1 - road
- - map3_lo bits 7..4 = type of track on the bridge, must be 0 for road bridge
-- map3_lo bits 3..0 = type of track under the bridge, if any
-- map2 bits 3..0: bridge piece (0..5)
-
- map_owner: owner of the land under bridge
+- m3 bits 7..4 = type of track on the bridge, must be 0 for road bridge
+- m3 bits 3..0 = type of track under the bridge, if any
+- m2 bits 3..0: bridge piece (0..5)
+
- owner: owner of the land under bridge
-- map5 bits 2..1: 0 - railway bridge, 1 - road bridge
-- map5 bit 0: clear - bridge in the X direction, set - bridge in the Y direction
-- map2 bits 7..4: bridge type:
+
- m5 bits 2..1: 0 - railway bridge, 1 - road bridge
+- m5 bit 0: clear - bridge in the X direction, set - bridge in the Y direction
+- m2 bits 7..4: bridge type:
Type | Max. speed (mph) | Description |
0 | 20 | wooden |
@@ -593,13 +603,13 @@ map5 bit 5 set:
9 | 160 | girder, steel |
A | 200 | tubular, steel |
-- map3_hi bit 7 set = on snow or desert
+- m4 bit 7 set = on snow or desert
|
A |
-- map5: tile type:
+
- m5: tile type:
00 | transmitter |
01 | lighthouse |
@@ -608,7 +618,7 @@ map5 bit 5 set:
80..93 | company headquarters (5 sets of 4 tiles each, updated quarterly depending on the company performance) |
-- map_owner: owner of the object (for lighthouses and transmitters normally 10)
+- owner: owner of the object (for lighthouses and transmitters normally 10)
|
diff --git a/docs/landscape_grid.html b/docs/landscape_grid.html
--- a/docs/landscape_grid.html
+++ b/docs/landscape_grid.html
@@ -14,22 +14,22 @@
Landscape
-Five arrays are used to encode the information of the contents of the tile.
+Five 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 _map_* is abused for different purposes
+ - - 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)
- - _map_owner[] - 8 bits in size, used to identify the owner of that tile (eg piece of rail, bridge, etc.).
- - _map2[] - 16 bits in size, used to identify the index of the given tile (object) in the (object-)array.
- - _map3[] - 16 bits in size, which is split up into _map3lo[] and _map3hi[] is used for general storage.
- - _map_type_and_height[] - 8 bits in size, stores tile height (lower 4 bits) and tile class (upper 4 bits).
- - _map5[] - 8 bits in size, is used for general storage.
+ - type_height - 8 bits in size, stores tile height (lower 4 bits) and tile class (upper 4 bits)
+ - owner - 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
class |
- _map_owner[L1] (8) |
- _map2[L2] (16) |
- _map3[lo& hi,L3] (16) |
- _map_type_and_height[L4] (8) |
- _map5[L5] (8) |
+ owner[L1] (8) |
+ m2[L2] (16) |
+ m3/m4[L3] (16) |
+ type_height[L4] (8) |
+ m5[L5] (8) |
bits |