1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="content-type">
<meta name="Description" content="Structure of OpenTTD (OTTD) landscape arrays #2">
<title>OpenTTD Landscape Internals - #2</title>
<style type="text/css">
.freebits { background-color: rgb(30, 178, 54);}
.abuse { background-color: rgb(255, 58, 31);}
.style7 {font-family: "Courier New", Courier, mono}
.style8 {background-color: rgb(30, 178, 54); font-family: "Courier New", Courier, mono; }
.style9 {background-color: rgb(255, 58, 31); font-family: "Courier New", Courier, mono; }
</style>
</head>
<body style="direction: ltr;">
<h3 style="font-weight: bold;">Landscape</h3>
<span style="font-weight: bold;"></span>Five arrays are used to encode the information of the contents of the tile.
This can be seen in the <a href="landscape.html">Landscape</a> 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.
<ul>
<li><span style="font-weight: bold;"><span class="freebits">O</span></span> - bit is free</li>
<li><span style="font-weight: bold;">X</span> - bit is used</li>
<li><span style="font-weight: bold;"><span class="abuse"> </span></span> - bit of _map_* is abused for different purposes</li>
<li><b>NOTE: </b>counting the bits starts with bit0 in the most left position (eg. a bit screwed LE format; BIT by BIT) </li>
</ul>
<p>
<ul>
<li><span style="font-weight: bold;">_map_owner[]</span> - 8 bits in size, used to identify the owner of that tile (eg piece of rail, bridge, etc.).</li>
<li><span style="font-weight: bold;">_map2[]</span> - 16 bits in size, used to identify the index of the given tile (object) in the (object-)array.</li>
<li><span style="font-weight: bold;">_map3[]</span> - 16 bits in size, which is split up into _map3lo[] and _map3hi[] is used for general storage.</li>
<li><span style="font-weight: bold;">_map_type_and_height[]</span> - 8 bits in size, stores tile height (lower 4 bits) and tile class (upper 4 bits).</li>
<li><span style="font-weight: bold;">_map5[]</span> - 8 bits in size, is used for general storage.</li>
</ul>
<table style="text-align: left;" border="1" cellpadding="2"
cellspacing="2" width="100%">
<tbody>
<tr>
<th style="white-space: nowrap; text-align: left;">class</th>
<th style="white-space: nowrap; text-align: center;">_map_owner[L1] (8)</th>
<th style="white-space: nowrap; text-align: center;">_map2[L2] (16)</th>
<th style="white-space: nowrap; text-align: center;">_map3[lo& hi,L3] (16)</th>
<th style="white-space: nowrap; text-align: center;">_map_type_and_height[L4] (8)</th>
<th style="white-space: nowrap; text-align: center;">_map5[L5] (8)</th>
</tr>
<tr>
<td style="white-space: nowrap; text-align: left;">bits</td>
<td style="white-space: nowrap; text-align: center;"><span class="style7">0123 4567 </span></td>
<td style="white-space: nowrap; text-align: center;"><span class="style7">0123 4567 0123 4567 </span></td>
<td style="white-space: nowrap; text-align: center;"><span class="style7">0123 4567 0123 4567 </span></td>
<td style="white-space: nowrap; text-align: center;"><span class="style7">0123 4567</span></td>
<td style="white-space: nowrap; text-align: center;"><span class="style7">0123 4567</span></td>
</tr>
<tr>
<td style="white-space: nowrap; text-align: left;">(0) ground</td>
<td style="white-space: nowrap; text-align: center;"><span class="style7">XXXX XXXX</span></td>
<td style="white-space: nowrap; text-align: center;"><span class="style8">OOOO OOOO OOOO OOOO</span></td>
<td style="white-space: nowrap; text-align: center;"><span class="style7">XXXX <span class="freebits">OOOO OO</span>XX XXXX</span></td>
<td style="white-space: nowrap; text-align: center;"><span class="style7">XXXX XXXX</span></td>
<td style="white-space: nowrap; text-align: center;"><span class="style7">XXXX X<span class="freebits">O</span>XX</span></td>
</tr>
<tr>
<td style="white-space: nowrap; text-align: left;">(1) rail</td>
<td style="white-space: nowrap; text-align: center;"><span class="style9">XXXX XXXX</span></td>
<td style="white-space: nowrap; text-align: center;"><span class="style7">XXXX XXXX <span class="freebits">OOOO OOOO</span><br>
</span></td>
<td style="white-space: nowrap; text-align: center;"><span class="style7">XXXX XXXX XX<span class="freebits">O</span>X<span class="freebits"> OOOO</span><br>
</span></td>
<td style="white-space: nowrap; text-align: center;"><span class="style7">XXXX XXXX</span></td>
<td style="white-space: nowrap; text-align: center;"><span class="style7">XXXX XXXX<br>
</span></td>
</tr>
<tr>
<td>
<ul>
<li style="white-space: nowrap; text-align: left;">depot/checkpoint</li>
</ul>
</td>
<td style="text-align: center;"><span class="style7">-inherit-</span></td>
<td style="text-align: center;"><span class="style8">OOOO OOOO OOOO OOOO</span></td>
<td style="text-align: center;"><span class="style7">XXXX X<span class="freebits">OOO</span> XXXX XXXX</span></td>
<td style="text-align: center;"><span class="style7">-inherit-</span></td>
<td style="white-space: nowrap; text-align: center;"><span class="style7">XXX<span class="freebits">O OO</span>XX</span></td>
</tr>
<tr>
<td style="white-space: nowrap; text-align: left;">(2) road</td>
<td style="text-align: center;"><span class="style7">XXXX XXXX</span></td>
<td style="text-align: center;"><span class="style9">XXXX XXXX XXXX XXXX</span></td>
<td style="text-align: center;"><span class="style8">OOOO OOOO</span><span class="style7"> XXXX XXXX</span></td>
<td style="text-align: center;"><span class="style7">XXXX XXXX</span></td>
<td style="text-align: center;"><span class="style7">XXXX XXXX</span></td>
</tr>
<tr>
<td>
<ul>
<li style="white-space: nowrap; text-align: left;">level crossing</li>
</ul>
</td>
<td style="text-align: center;"><span class="style7">-inherit-</span></td>
<td style="text-align: center;"><span class="style9">XXXX XXXX XXXX XXXX</span></td>
<td style="text-align: center;"><span class="style7">XXXX XXXX XXXX XXXX</span></td>
<td style="text-align: center;"><span class="style7">-inherit-</span></td>
<td style="text-align: center;"><span class="style8">OO</span><span class="style7">XX XXXX</span></td>
</tr>
<tr>
<td>
<ul>
<li style="white-space: nowrap; text-align: left;">road depot</li>
</ul>
</td>
<td style="text-align: center;"><span class="style7">-inherit-</span></td>
<td style="text-align: center;"><span class="style8">OOOO OOOO OOOO OOOO</span></td>
<td style="text-align: center;"><span class="style8">OOOO OOOO OOOO OOO</span><span class="style7">X</span></td>
<td style="text-align: center;"><span class="style7">-inherit-</span></td>
<td style="text-align: center;"><span class="style7">XXXX XXXX</span></td>
</tr>
<tr>
<td style="white-space: nowrap; text-align: left;">(3) town</td>
<td style="white-space: nowrap; text-align: center;"><span class="style9">XXXX XXXX</span></td>
<td style="white-space: nowrap; text-align: center;"><span class="style7">XXXX XXXX XXXX XXXX<br>
</span></td>
<td style="white-space: nowrap; text-align: center;"><span class="style7">XXXX XXXX XXXX XXXX<br>
</span></td>
<td style="white-space: nowrap; text-align: center;"><span class="style7">XXXX XXXX</span></td>
<td style="white-space: nowrap; text-align: center;"><span class="style7">XXXX XX<span class="freebits">O</span>X</span></td>
</tr>
<tr>
<td style="white-space: nowrap; text-align: left;">(4) trees</td>
<td style="white-space: nowrap; text-align: center;"><span class="style9">XXXX XXXX</span></td>
<td style="white-space: nowrap; text-align: center;"><span class="style7">XXXX XX<span class="freebits">OO OOOO OOOO</span></span></td>
<td style="white-space: nowrap; text-align: center;"><span class="style7">XXXX XXXX <span class="freebits">OO</span>XX XXXX</span></td>
<td style="white-space: nowrap; text-align: center;"><span class="style7">XXXX XXXX</span></td>
<td style="white-space: nowrap; text-align: center;"><span class="style7">XXX<span class="freebits">O OO</span>XX</span></td>
</tr>
<tr>
<td style="white-space: nowrap; text-align: left;">(5) station</td>
<td style="white-space: nowrap; text-align: center;"><span class="style7">XXXX XXXX</span></td>
<td style="white-space: nowrap; text-align: center;"><span class="style7">XXXX XXXX XXXX XXXX</span></td>
<td style="white-space: nowrap; text-align: center;"><span class="style7">XXXX X<span class="freebits">OOO</span> XXXX XXXX</span></td>
<td style="white-space: nowrap; text-align: center;"><span class="style7">XXXX XXXX</span></td>
<td style="white-space: nowrap; text-align: center;"><span class="style7">XXXX XXXX</span></td>
</tr>
<tr>
<td style="white-space: nowrap; text-align: left;">(6) water</td>
<td style="white-space: nowrap; text-align: center;"><span class="style7">XXXX XXXX</span></td>
<td style="white-space: nowrap; text-align: center;"><span class="style8">OOOO OOOO OOOO OOOO</span></td>
<td style="white-space: nowrap; text-align: center;"><span class="style8">OOOO OOOO OOOO OOOO</span></td>
<td style="white-space: nowrap; text-align: center;"><span class="style7">XXXX XXXX</span></td>
<td style="white-space: nowrap; text-align: center;"><span class="style7">XXXX XXXX</span></td>
</tr>
<tr>
<td style="white-space: nowrap; text-align: left;">(8) industry</td>
<td style="white-space: nowrap; text-align: center;"><span class="style9">XXXX X</span><span class="style8">OO</span><span class="style9">X</span></td>
<td style="white-space: nowrap; text-align: center;"><span class="style7">XXXX XXXX XXXX XXXX</span></td>
<td style="white-space: nowrap; text-align: center;"><span class="style8">OOOO OOOO OOOO OOOO</span></td>
<td style="white-space: nowrap; text-align: center;"><span class="style7">XXXX XXXX</span></td>
<td style="white-space: nowrap; text-align: center;"><span class="style7">XXXX XXXX</span></td>
</tr>
<tr>
<td>
<ul>
<li style="white-space: nowrap; text-align: left;">bubble/sugar/toffee</li>
</ul>
</td>
<td style="text-align: center;"><span class="style7">-inherit-</span></td>
<td style="text-align: center;"><span class="style7">-inherit-</span></td>
<td style="text-align: center;"><span class="style7">XXXX XXXX <span class="freebits">OOOO OOOO</span></span></td>
<td style="text-align: center;"><span class="style7">-inherit-</span></td>
<td style="text-align: center;"><span class="style7">-inherit-</span></td>
</tr>
<tr>
<td>
<ul>
<li style="white-space: nowrap; text-align: left;">toy factory</li>
</ul>
</td>
<td style="text-align: center;"><span class="style7">-inherit-</span></td>
<td style="text-align: center;"><span class="style7">-inherit-</span></td>
<td style="text-align: center;"><span class="style7">XXXX XXXX XXXX XXXX</span></td>
<td style="text-align: center;"><span class="style7">-inherit-</span></td>
<td style="text-align: center;"><span class="style7">-inherit-</span></td>
</tr>
<tr>
<td>
<ul>
<li style="white-space: nowrap; text-align: left;">gold/copper/coal</li>
</ul>
</td>
<td style="text-align: center;"><span class="style7">XXXX XXXX</span></td>
<td style="text-align: center;"><span class="style7">-inherit-</span></td>
<td style="text-align: center;"><span class="style7">-inherit-</span></td>
<td style="text-align: center;"><span class="style7">-inherit-</span></td>
<td style="text-align: center;"><span class="style7">-inherit-</span></td>
</tr>
<tr>
<td>
<ul>
<li style="white-space: nowrap; text-align: left;">oil wells</li>
</ul>
</td>
<td style="text-align: center;"><span class="style7">-inherit-</span></td>
<td style="text-align: center;"><span class="style7">-inherit-</span></td>
<td style="text-align: center;"><span class="style7">-inherit-</span></td>
<td style="text-align: center;"><span class="style7">-inherit-</span></td>
<td style="text-align: center;"><span class="style7">-inherit-</span></td>
</tr>
<tr>
<td>
<ul>
<li style="white-space: nowrap; text-align: left;">power station</li>
</ul>
</td>
<td style="text-align: center;"><span class="style7">XXXX XX<span class="freebits">O</span>X</span></td>
<td style="text-align: center;"><span class="style7">-inherit-</span></td>
<td style="text-align: center;"><span class="style7">-inherit-</span></td>
<td style="text-align: center;"><span class="style7">-inherit-</span></td>
<td style="text-align: center;"><span class="style7">-inherit-</span></td>
</tr>
<tr>
<td style="white-space: nowrap; text-align: left;">(9) tunnel</td>
<td style="white-space: nowrap; text-align: center;"><span class="style7">XXXX XXXX</span></td>
<td style="white-space: nowrap; text-align: center;"><span class="style8">OOOO OOOO OOOO OOOO</span></td>
<td style="white-space: nowrap; text-align: center;"><span class="style7">XXXX <span class="freebits">OOOO OOOO OOO</span>X</span></td>
<td style="white-space: nowrap; text-align: center;"><span class="style7">XXXX XXXX</span></td>
<td style="white-space: nowrap; text-align: center;"><span class="style7">XXXX XXXX</span></td>
</tr>
<tr>
<td>
<ul>
<li style="white-space: nowrap; text-align: left;">bridge</li>
</ul>
</td>
<td style="text-align: center;"><span class="style7">XXXX XXXX</span></td>
<td style="text-align: center;"><span class="style9">XXXX XXXX</span> <span class="style8">OOOO OOOO</span></td>
<td style="text-align: center;"><span class="style7">XXXX XXXX <span class="freebits">OOOO OOO</span>X</span></td>
<td style="text-align: center;"><span class="style7">XXXX XXXX</span></td>
<td style="text-align: center;"><span class="style7">XXXX XXXX</span></td>
</tr>
<tr>
<td style="white-space: nowrap; text-align: left;">(10) various (HQ)</td>
<td style="white-space: nowrap; text-align: center;"><span class="style7">XXXX XXXX</span></td>
<td style="white-space: nowrap; text-align: center;"><span class="style8">OOOO OOOO OOOO OOOO</span></td>
<td style="white-space: nowrap; text-align: center;"><span class="style8">OOOO OOOO OOOO OOOO</span></td>
<td style="white-space: nowrap; text-align: center;"><span class="style7">XXXX XXXX</span></td>
<td style="white-space: nowrap; text-align: center;"><span class="style7">XXXX XXXX</span></td>
</tr>
</tbody>
</table>
</body>
</html>
|