Five arrays are used to encode the information of the contents of each tile. These arrays are referred to as <ahref="#_landscape1">map_owner</a>, <ahref="#_landscape2">map2</a>, <ahref="#_landscape3">map3_lo</a>, <ahref="#_landscape4">type_and_height</a> and <ahref="#_landscape5">map5</a>. 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 <ahref="landscape_grid.html">Landscape grid</a> page.
Five arrays are used to encode the information of the contents of each tile. These arrays are referred to as "<spanstyle="font-weight: bold;">map_owner</span>", "<spanstyle="font-weight: bold;">map2</span>", "<spanstyle="font-weight: bold;">map3_lo|_hi</span>", "<spanstyle="font-weight: bold;">map_type_and_height</span>" and "<spanstyle="font-weight: bold;">map5</span>". 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 <ahref="landscape_grid.html">Landscape grid</a> page.
</p>
<p>
<aname="OwnershipInfo">Owner values</a><tt>00</tt> through <tt>07</tt> are companies (they're indices into the <ahref="#_CompanyArray">array of companies</a>), <tt>10</tt> is no owner, <tt>11</tt> appears to be reserved for water, <tt>80</tt> and above are towns (in this case the low 7 bits contain an index into the <ahref="#_TownArray">town array</a>).
</p>
<p>
TTD's class-specific periodic tile processing routine is called once every +256 ticks for each tile.
OTTD's class-specific periodic tile processing routine is called once every +256 ticks for each tile.
</p>
<tableborder=1cellpadding=3>
@ -606,13 +603,13 @@ map5 bit 5 set:
</td></tr>
<tr><tdcolspan=2>
Classes <tt>B</tt> through <tt>F</tt> are reserved. The presence of a tile in one of the reserved classes will crash TTD.
Classes <tt>B</tt> through <tt>F</tt> are reserved. The presence of a tile in one of the reserved classes will crash OTTD.
<metaname="Description"content="Structure of OpenTTD (OTTD) landscape arrays #2">
<title>OpenTTD Landscape Internals - #2</title>
<styletype="text/css">
.freebits { background-color: rgb(30, 178, 54);}
.abuse { background-color: rgb(255, 58, 31);}
</style>
</head>
<bodystyle="direction: ltr;">
<h3style="font-weight: bold;">Landscape</h3>
<spanstyle="font-weight: bold;"></span>Five
arrays are used to encode the information of the contents of the tile.
This can be seen in the <ahref="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.<br>
<spanstyle="font-weight: bold;"></span>Five arrays are used to encode the information of the contents of the tile.
This can be seen in the <ahref="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><spanstyle="font-weight: bold;">O</span>
- bit is free</li>
<li><spanstyle="font-weight: bold;">X</span>
- bit is used</li>
<li><spanstyle="font-weight: bold;"><spanclass="freebits">O</span></span> - bit is free</li>
<li><spanstyle="font-weight: bold;">X</span> - bit is used</li>
<li><spanstyle="font-weight: bold;"><spanclass="abuse"> </span></span> - bit of _map_* is abused for different purposes</li>
</ul>
<p>
<ul>
<li><spanstyle="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><spanstyle="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><spanstyle="font-weight: bold;">_map3[]</span> - 16 bits in size, which is split up into _map3lo[] and _map3hi[] is used for general storage.</li>
<li><spanstyle="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><spanstyle="font-weight: bold;">_map5[]</span> - 8 bits in size, is used for general storage.</li>