Darkvater@1487: 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.
pasky@464:
pasky@464:
Darkvater@1487: OTTD's class-specific periodic tile processing routine is called once every +256 ticks for each tile.
pasky@464:
pasky@464:
pasky@464:
pasky@464: Class | Meaning & details of encoding |
pasky@464:
pasky@464: 0 |
pasky@464:
pasky@464: - map5 bits 4..0: tile type:
pasky@464:
pasky@464: 00 | bare land |
pasky@464: 01 | 1/3 grass |
pasky@464: 02 | 2/3 grass |
pasky@464: 03 | full grass |
pasky@464: 07 | rough land |
pasky@464: 0B | rocks |
pasky@464: 0F | fields; type of fields in map3_lo bits 3..0 (legal values: 0 through 9) |
pasky@464: 10 | 1/4 snow |
pasky@464: 11 | 2/4 snow |
pasky@464: 12 | 3/4 snow |
pasky@464: 13 | full snow |
pasky@464: 15 | partial desert |
pasky@464: 17 | full desert |
pasky@464:
pasky@464:
pasky@464: - 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)
pasky@464:
(for snow and desert, these bits are not used, tile is updated on every periodic processing)
pasky@464:
pasky@464: - map_owner: owner of the tile (normally 10)
pasky@464:
pasky@464: - 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
pasky@464:
pasky@464:
pasky@464: |
pasky@464:
pasky@464: 1 |
pasky@464: map5 bit 7 clear: railway track
pasky@464:
pasky@464: - map5 bits 0..5: track layout: bit set = track present:
pasky@464:
pasky@464: bit 0: | in the X direction |
pasky@464: bit 1: | in the Y direction |
pasky@464: bit 2: | in the north corner (direction W-E) |
pasky@464: bit 3: | in the south corner (direction W-E) |
pasky@464: bit 4: | in the west corner (direction N-S) |
pasky@464: bit 5: | in the east corner (direction N-S) |
pasky@464:
pasky@464: - map5 bit 6 set = with signals:
pasky@464:
pasky@464: - map3_lo bits 7..4: bit set = signal present:
pasky@464:
pasky@464: - For track in the X direction:
pasky@464:
pasky@464: bit 6: | signal in the SW direction |
pasky@464: bit 7: | signal in the NE direction |
pasky@464:
pasky@464: - For track in the Y direction:
pasky@464:
pasky@464: bit 6: | signal in the NW direction |
pasky@464: bit 7: | signal in the SE direction |
pasky@464:
pasky@464: - For tracks in the W-E direction:
pasky@464:
pasky@464: bit 4: | signal in the W direction on the track in the S corner |
pasky@464: bit 5: | signal in the E direction on the track in the S corner |
pasky@464: bit 6: | signal in the W direction on the track in the N corner |
pasky@464: bit 7: | signal in the E direction on the track in the N corner |
pasky@464:
pasky@464: - For tracks in the N-S direction:
pasky@464:
pasky@464: bit 4: | signal in the S direction on the track in the E corner |
pasky@464: bit 5: | signal in the N direction on the track in the E corner |
pasky@464: bit 6: | signal in the S direction on the track in the W corner |
pasky@464: bit 7: | signal in the N direction on the track in the W corner |
pasky@464:
pasky@464:
pasky@464: - map2 bits 7..4: bit clear = signal shows red; same bits as in map3_lo
pasky@464: - OpenTTD bits in map3_hi:
pasky@464:
pasky@464: bits 1..0: | type of signal: |
pasky@464: 00: | normal signals |
pasky@464: 01: | pre-signals |
pasky@464: 10: | exit-signals |
pasky@464: 11: | combo-signals |
pasky@464: bit 2: | set = semaphore signals, clear = light signals |
pasky@464:
pasky@464:
pasky@464: - map_owner: owner of the track
pasky@464:
pasky@464: - map2 bits 0..3:
pasky@464:
pasky@464: 0 | on bare land |
pasky@464: 1 | on grass, no fences |
pasky@464: 2 | fence on the NW side |
pasky@464: 3 | fence on the SE side |
pasky@464: 4 | fences on the NW and SE sides |
pasky@464: 5 | fence on the NE side |
pasky@464: 6 | fence on the SW side |
pasky@464: 7 | fences on the NE and SW sides |
pasky@464: 8 | fence on the E side (track in the W corner) |
pasky@464: 9 | fence on the W side (track in the E corner) |
pasky@464: A | fence on the S side (track in the N corner) |
pasky@464: B | fence on the N side (track in the S corner) |
pasky@464: C | on snow or desert |
pasky@464:
pasky@464: - map3_lo bits 0..3 = track type: 0 - conventional railway, 1 - monorail, 2 - maglev
pasky@464:
pasky@464:
pasky@464: map5 bits 7 and 6 set: railway depot / checkpoints
pasky@464:
pasky@464: - map5 value C0..C3: railway depot
pasky@464:
map5 bits 1..0 - direction: exit towards: 00 = NE, 01 = SE, 02 = SW, 03 = NW
pasky@464: - map5 value C4..C5: checkpoint
pasky@464:
bit 0: clear = in X direction, set = in Y direction
pasky@464:
pasky@464:
pasky@464: - map_owner: owner of the depot / checkpoint
pasky@464: - map3_lo bits 0..3 = track type
pasky@464: - map3_lo bit 4 = use custom sprite (valid only for the checkpoint)
pasky@464: - map3_hi = custom station id
pasky@464:
pasky@464: |
pasky@464:
pasky@464: 2 |
pasky@464: map5 bits 7..4 clear: road
pasky@464:
pasky@464: - map5 bits 3..0: road layout: bit set = road piece present:
pasky@464:
pasky@464: bit 0: | NW piece |
pasky@464: bit 1: | SW piece |
pasky@464: bit 2: | SE piece |
pasky@464: bit 3: | NE piece |
pasky@464:
pasky@464: - map_owner: owner of the road
celestar@1264: - map2: Index into the array of towns, 0 for non-town roads
celestar@1264: - map3_hi bits 0..3: counter for the roadworks
celestar@1264: - 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
pasky@464: - map3_hi bit 7 set = on snow or desert
pasky@464:
pasky@464: map5 bit 4 set, bits 7..5 clear: level crossing
pasky@464:
pasky@464: - map5 bit 3: clear - road in the X direction, set - road in the Y direction (railway track always perpendicular)
pasky@464: - map5 bit 2: set if crossing lights are on
pasky@464: - map_owner: owner of the railway track
celestar@1264: - map2: Index into the array of towns, 0 for non-town roads
pasky@464: - map3_lo bits 0..7: owner of the road
pasky@464: - map3_hi bits 3..0: track type
celestar@1264: - map3_hi bits 4..6: 0 - on bare land, 1 - on grass, 2 or higher - paved
pasky@464: - map3_hi bit 7 set = on snow or desert
pasky@464:
pasky@464: map5 bit 5 set: road depot
pasky@464:
pasky@464: - map5 bits 3..0 - direction: exit towards: 0 = NE, 1 = SE, 2 = SW, 3 = NW
pasky@464: - map_owner: owner of the depot
pasky@464: - map3_hi bit 7 set = on snow or desert (not displayed, but set internally)
pasky@464:
pasky@464: |
pasky@464:
pasky@464: 3 |
pasky@464: Town building
pasky@464:
pasky@464: |
pasky@464:
pasky@464: 4 |
pasky@464: Trees
pasky@464:
pasky@464: - map5 bits 7..6: number of trees minus one
pasky@464: - 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
pasky@464: - map3_lo bits 7..0: type of trees:
pasky@464:
pasky@464: 00..0B | temperate climate trees |
pasky@464: 0C..13 | sub-arctic climate trees |
pasky@464: 14..1A | rainforest trees |
pasky@464: 1B | cactus plants |
pasky@464: 1C..1F | sub-tropical climate, non-rainforest, non-desert trees |
pasky@464: 20..28 | toyland trees |
pasky@464:
pasky@464: (note: the actually displayed set of trees depends on both type and number of trees)
pasky@464:
pasky@464: - map3_hi bits 7..5: type of hedge on the SW border of the tile (1 through 6, or 0=none)
pasky@464: - map3_hi bits 4..2: type of hedge on the SE border of the tile (1 through 6, or 0=none)
pasky@464: - map2 bits 5..4:
pasky@464:
pasky@464: 0 | on grass |
pasky@464: 1 | on rough land |
pasky@464: 2 | on snow or desert; map2 bits 7..6 - amount of snow or desert (for desert always set to 3 in TTD)
pasky@464: |
pasky@464:
pasky@464: - 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)
pasky@464: - map_owner: owner (normally 10)
pasky@464:
pasky@464: |
pasky@464:
pasky@464: 5 |
pasky@464: Station tile
pasky@464:
pasky@464: - map5: tile type:
pasky@464:
pasky@464: 00..07 | railway station
pasky@464: 00..01 - open platform, 02..03 - open platform with station building, 04....07 - roofed platform
pasky@464: bit 0: clear = in X direction, set = in Y direction
pasky@464: |
pasky@464: 08..33 | large airport
pasky@464:
pasky@464: 0B | pad 1 |
pasky@464: 16..19 | runway middle |
pasky@464: 1A | runway ending |
pasky@464: 1C | control tower |
pasky@464: 20 | hangar |
pasky@464: 21 | pad 3 |
pasky@464: 22 | pad 2 |
pasky@464: 27..32 | radar (animated) |
pasky@464: 33 | transmitter |
pasky@464:
pasky@464: The initial layout of a large airport is (rows in Y direction, columns in X direction):
pasky@464:
pasky@464: 1F 1B 1E 33 26 1A
pasky@464: 09 24 0B 0C 0D 16
pasky@464: 21 1D 23 0E 0F 17
pasky@464: 09 22 0D 11 10 18
pasky@464: 09 08 14 13 12 19
pasky@464: 20 0A 15 1C 27 1A
pasky@464:
pasky@464: |
pasky@464: 34..41 | small airport
pasky@464:
pasky@464: 3A..3D | field with the wind meter (animated) |
pasky@464: 3E | runway south ending |
pasky@464: 3F | runway middle |
pasky@464: 40 | runway north ending |
pasky@464: 41 | hangar |
pasky@464:
pasky@464: The initial layout of a small airport is (rows in Y direction, columns in X direction):
pasky@464:
pasky@464: 36 3A 40
pasky@464: 35 39 3F
pasky@464: 34 38 3F
pasky@464: 41 37 3E
pasky@464:
pasky@464: |
pasky@464: 42 | heliport |
pasky@464: 43..46 | lorry loading area;
pasky@464: exit towards: 43 - NE, 44 - SE, 45 - SW, 46 - NW
pasky@464: |
pasky@464: 47..4A | bus station;
pasky@464: exit towards: 47 - NE, 48 - SE, 49 - SW, 4A - NW
pasky@464: | 4B | oilfield |
pasky@464: 4C..51 | ship dock;
pasky@464: 4C - SW coast part, 4D - NW coast part, 4E - NE coast part, 4F - SE coast part, 50 - X direction water part, 51 - Y direction water part
pasky@464: | 52 | buoy |
pasky@464:
pasky@464: |
pasky@464:
pasky@464:
pasky@464: - map_owner: owner of the station
pasky@464: - map2: index into the array of stations
pasky@464: - map3_lo bits 0..3: track type for railway stations, must be 0 for all the other stations
pasky@464: - map3_lo bit 4 = use custom sprite (valid only railway stations FOR NOW)
pasky@464: - map3_hi = custom station id
pasky@464:
pasky@464: |
pasky@464:
pasky@464: 6 |
pasky@464:
pasky@464: - map5: tile type:
pasky@464:
pasky@464: 00 | water |
pasky@464: 01 | coast or riverbank |
pasky@464: 10..1B | canal locks
pasky@464:
pasky@464: 10 | middle part, (SW-NE direction)
pasky@464: | 11 | middle part, (NW-SE direction)
pasky@464: | 12 | middle part, (NE-SW direction)
pasky@464: | 13 | middle part, (SE-NW direction)
pasky@464: | 14 | lower part, (SW-NE direction)
pasky@464: | 15 | lower part, (NW-SE direction)
pasky@464: | 16 | lower part, (NE-SW direction)
pasky@464: | 17 | lower part, (SE-NW direction)
pasky@464: | 18 | upper part, (SW-NE direction)
pasky@464: | 19 | upper part, (NW-SE direction)
pasky@464: | 1A | upper part, (NE-SW direction)
pasky@464: | 1B | upper part, (SE-NW direction)
pasky@464: |
pasky@464: | 80..83 | ship depots
pasky@464:
pasky@464: 80 | ship depot, NE part (X direction)
pasky@464: | 81 | ship depot, SW part (X direction)
pasky@464: | 82 | ship depot, NW part (Y direction)
pasky@464: | 83 | ship depot, SE part (Y direction)
pasky@464:
pasky@464: |
pasky@464:
pasky@464:
pasky@464: |
pasky@464:
pasky@464: - map_owner: owner (for water and coasts normally 11)
pasky@464:
pasky@464: |
pasky@464:
pasky@464: 7 |
pasky@464: Void
pasky@464:
pasky@464: 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.
pasky@464:
pasky@464: |
pasky@464:
pasky@464: 8 |
pasky@464: Industry tile
pasky@464:
pasky@464: - map5: type:
pasky@464:
(note: this is not the same as the industry type stored in the array of industries)
pasky@464:
pasky@464: 00..06 | coal mine
pasky@464:
pasky@464: 00 | wheel tower when not animated |
pasky@464: 01 | wheel tower when animated; animation state in map_owner bits 5..0; map_owner bit 6 set = sound already generated |
pasky@464:
pasky@464: |
pasky@464: 07..0A | power station
pasky@464:
pasky@464: 08 | chimney |
pasky@464: 0A | transformer; animation progress in map_owner bits 5..2 (valid range 0..7) |
pasky@464:
pasky@464: |
pasky@464: 0B..0F | sawmill |
pasky@464: 10..11 | forest
pasky@464:
pasky@464: 11 | trees cut down |
pasky@464:
pasky@464: |
pasky@464: 12..17 | oil refinery |
pasky@464: 18..1C | oil rig |
pasky@464: 1D..20 | oil wells
pasky@464:
pasky@464: 1D | not animated |
pasky@464: 1E..20 | various stages of animation; progress of animation in map_owner bits 1..0 |
pasky@464:
pasky@464: |
pasky@464: 21..26 | farm |
pasky@464: 27..2A | factory (temperate climate) |
pasky@464: 2B..2E | printing works |
pasky@464: 2F..33 | copper ore mine
pasky@464:
pasky@464: 2F | wheel tower when not animated |
pasky@464: 30 | wheel tower when animated; animation state in map_owner bits 5..0; map_owner bit 6 set = sound already generated |
pasky@464: 31 | chimney |
pasky@464:
pasky@464: |
pasky@464: 34..39 | steel mill |
pasky@464: 3A..3B | bank (temperate climate) |
pasky@464: 3C..3F | food processing plant |
pasky@464: 40..47 | paper mill |
pasky@464: 48..58 | gold mine
pasky@464:
pasky@464: 4F | wheel tower when not animated |
pasky@464: 58 | wheel tower when animated; animation state in map_owner bits 5..0; map_owner bit 6 set = sound already generated |
pasky@464:
pasky@464: |
pasky@464: 59..5A | bank (sub-arctic or sub-tropical climate) |
pasky@464: 5B..63 | diamond mine |
pasky@464: 64..73 | iron ore mine |
pasky@464: 74 | fruit plantation |
pasky@464: 75 | rubber plantation |
pasky@464: 76..77 | water supply |
pasky@464: 78 | water tower |
pasky@464: 79..7C | factory (sub-tropical climate) |
pasky@464: 7D..80 | lumber mill |
pasky@464: 81..82 | candyfloss forest
pasky@464:
pasky@464: 82 | candyfloss 'trees' cut down |
pasky@464:
pasky@464: |
pasky@464: 83..86 | sweet factory |
pasky@464: 87..88 | battery farm
pasky@464:
pasky@464: 88 | batteries 'reaped' |
pasky@464:
pasky@464: |
pasky@464: 89 | cola wells |
pasky@464: 8A..8D | toy shop |
pasky@464: 8E..93 | toy factory
pasky@464:
pasky@464: 8F | animated part; animation state in map3_lo (valid range 00..31)
pasky@464: tile animation is started (map3_hi zeroed) on the periodic processing if field 2C in the corresponding industry array entry is nonzero
pasky@464: 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 |
pasky@464:
pasky@464: |
pasky@464: 94..9B | plastic fountains (various stages of cyclic animation) |
pasky@464: 9C..9F | fizzy drink factory |
pasky@464: A0..A3 | bubble generator
pasky@464:
pasky@464: A1 | generators |
pasky@464: A2 | bubble capture facility; animation state in map3_lo (valid range 00..27) |
pasky@464:
pasky@464: |
pasky@464: A4..A6 | toffee quarry
pasky@464:
pasky@464: A5 | animated part; animation state in map3_lo (valid range 00..45) |
pasky@464:
pasky@464: |
pasky@464: A7..AE | sugar mine
pasky@464:
pasky@464: AE | animated part; animation state in map3_lo (valid range 00..5F) |
pasky@464:
pasky@464: |
pasky@464: |
pasky@464:
pasky@464: - map2: index into the array of industries
pasky@464:
pasky@464: - map_owner bit 7: clear = under construction
pasky@464:
pasky@464: - map_owner bits 4..2: construction counter, for buildings under construction incremented on every periodic tile processing
pasky@464:
pasky@464:
pasky@464: - map_owner bits 1..0: stage of construction (3 = completed), incremented when the construction counter wraps around
pasky@464:
the meaning is different for some animated tiles which are never under construction (types 01, 1E..20, 30, 58; see above)
pasky@464:
pasky@464:
pasky@464: |
pasky@464:
pasky@464: 9 |
pasky@464: map5 bits 7..4 clear: tunnel entrance/exit
pasky@464:
pasky@464: - map5 bits 3..2: 0 - railway tunnel, 1 - road tunnel
pasky@464: - map5 bits 1..0 - direction: entrance towards: 0 = NE, 1 = SE, 2 = SW, 3 = NW
pasky@464: - map_owner: owner of the tunnel
pasky@464: - map3_lo bits 3..0 = track type for railway tunnel, must be 0 for road tunnel
pasky@464: - map3_hi bit 7 set = on snow or desert
pasky@464:
pasky@464: map5 bit 7 set: bridge
pasky@464: -
pasky@464: map5 bit 6 clear: bridge ending
pasky@464:
pasky@464: - map5 bit 5: clear - northern, set - southern ending
pasky@464: - map3_lo bits 3..0 = type of track on the bridge, must be 0 for road bridge
pasky@464: - map_owner: owner of the bridge
pasky@464:
pasky@464: map5 bit 6 set: bridge middle part
pasky@464:
pasky@464: - map5 bit 5 clear:
pasky@464:
pasky@464: - map5 bits 4..3: land under bridge: 0 - grass, snow or desert, 1 - water
pasky@464:
pasky@464: map5 bit 5 set:
pasky@464:
pasky@464: - map5 bits 4..3: transport route under bridge: 0 - railway, 1 - road
pasky@464:
pasky@464: - map3_lo bits 7..4 = type of track on the bridge, must be 0 for road bridge
pasky@464: - map3_lo bits 3..0 = type of track under the bridge, if any
pasky@464: - map2 bits 3..0: bridge piece (0..5)
pasky@464:
- map_owner: owner of the land under bridge
pasky@464:
pasky@464: - map5 bits 2..1: 0 - railway bridge, 1 - road bridge
pasky@464: - map5 bit 0: clear - bridge in the X direction, set - bridge in the Y direction
pasky@464: - map2 bits 7..4: bridge type:
pasky@464:
pasky@464: Type | Max. speed (mph) | Description |
pasky@464: 0 | 20 | wooden |
pasky@464: 1 | 30 | concrete |
pasky@464: 2 | 40 | girder, steel |
pasky@464: 3 | 50 | suspension, concrete |
pasky@464: 4 | 60 | suspension, steel |
pasky@464: 5 | 70 | suspension, steel |
pasky@464: 6 | 100 | cantilever, steel |
pasky@464: 7 | 130 | cantilever, steel |
pasky@464: 8 | 150 | cantilever, steel |
pasky@464: 9 | 160 | girder, steel |
pasky@464: A | 200 | tubular, steel |
pasky@464:
pasky@464: - map3_hi bit 7 set = on snow or desert
pasky@464:
pasky@464: |
pasky@464:
pasky@464: A |
pasky@464:
pasky@464: - map5: tile type:
pasky@464:
pasky@464: 00 | transmitter |
pasky@464: 01 | lighthouse |
pasky@464: 02 | company statue |
pasky@464: 03 | company-owned land |
pasky@464: 80..93 | company headquarters (5 sets of 4 tiles each, updated quarterly depending on the company performance) |
pasky@464:
pasky@464:
pasky@464: - map_owner: owner of the object (for lighthouses and transmitters normally 10)
pasky@464:
pasky@464: |
pasky@464:
pasky@464:
Darkvater@1487: Classes B through F are reserved. The presence of a tile in one of the reserved classes will crash OTTD.
pasky@464: |
pasky@464:
pasky@464:
pasky@464:
pasky@464: