1
0
Fork 0

Change: Move some bits in water tiles for alignment purposes.

pull/8480/head
J0anJosep 2023-05-10 19:47:55 +02:00
parent 98539782c4
commit cf2a12dfc4
5 changed files with 33 additions and 20 deletions

View File

@ -1047,55 +1047,55 @@
</tr>
<tr>
<td nowrap valign=top><tt>10</tt>..<tt>1B</tt>&nbsp; </td>
<td nowrap valign=top><tt>40</tt>..<tt>4B</tt>&nbsp; </td>
<td align=left>canal locks
<table>
<tr>
<td nowrap valign=top><tt>10</tt>&nbsp; </td>
<td nowrap valign=top><tt>40</tt>&nbsp; </td>
<td align=left>middle part, (SW-NE direction)</td>
</tr>
<tr>
<td nowrap valign=top><tt>11</tt>&nbsp; </td>
<td nowrap valign=top><tt>41</tt>&nbsp; </td>
<td align=left>middle part, (NW-SE direction)</td>
</tr>
<tr>
<td nowrap valign=top><tt>12</tt>&nbsp; </td>
<td nowrap valign=top><tt>42</tt>&nbsp; </td>
<td align=left>middle part, (NE-SW direction)</td>
</tr>
<tr>
<td nowrap valign=top><tt>13</tt>&nbsp; </td>
<td nowrap valign=top><tt>43</tt>&nbsp; </td>
<td align=left>middle part, (SE-NW direction)</td>
</tr>
<tr>
<td nowrap valign=top><tt>14</tt>&nbsp; </td>
<td nowrap valign=top><tt>44</tt>&nbsp; </td>
<td align=left>lower part, (SW-NE direction)</td>
</tr>
<tr>
<td nowrap valign=top><tt>15</tt>&nbsp; </td>
<td nowrap valign=top><tt>45</tt>&nbsp; </td>
<td align=left>lower part, (NW-SE direction)</td>
</tr>
<tr>
<td nowrap valign=top><tt>16</tt>&nbsp; </td>
<td nowrap valign=top><tt>46</tt>&nbsp; </td>
<td align=left>lower part, (NE-SW direction)</td>
</tr>
<tr>
<td nowrap valign=top><tt>17</tt>&nbsp; </td>
<td nowrap valign=top><tt>47</tt>&nbsp; </td>
<td align=left>lower part, (SE-NW direction)</td>
</tr>
<tr>
<td nowrap valign=top><tt>18</tt>&nbsp; </td>
<td nowrap valign=top><tt>48</tt>&nbsp; </td>
<td align=left>upper part, (SW-NE direction)</td>
</tr>
<tr>
<td nowrap valign=top><tt>19</tt>&nbsp; </td>
<td nowrap valign=top><tt>49</tt>&nbsp; </td>
<td align=left>upper part, (NW-SE direction)</td>
</tr>
<tr>
<td nowrap valign=top><tt>1A</tt>&nbsp; </td>
<td nowrap valign=top><tt>4A</tt>&nbsp; </td>
<td align=left>upper part, (NE-SW direction)</td>
</tr>
<tr>
<td nowrap valign=top><tt>1B</tt>&nbsp; </td>
<td nowrap valign=top><tt>4B</tt>&nbsp; </td>
<td align=left>upper part, (SE-NW direction)</td>
</tr>
</table>

View File

@ -246,7 +246,7 @@ the array so you can quickly see what is used and what is not.
<td class="bits" rowspan=3><span class="free">OOOO OOOO OOOO OOOO</span></td>
<td class="bits" rowspan=4><span class="free">OOOO OOOO</span></td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
<td class="bits"><span class="used" title="Water tile type: coast, clear, lock, depot">O<span class="usable">OO</span>O</span> <span class="free">OOO</span><span class="used" title="Sea shore flag">X</span></td>
<td class="bits"><span class="used" title="Water tile type: coast or water (00), lock (01), depot (10)">OO</span><span class="free">OO OOO</span><span class="used" title="Sea shore flag">X</span></td>
<td class="bits" rowspan=4><span class="free">OOOO OOOO</span></td>
<td class="bits" rowspan=4><span class="free">OOOO OOOO</td>
<td class="bits" rowspan=4><span class="free">OOOO OOOO OOOO OOOO</span></td>
@ -254,18 +254,18 @@ the array so you can quickly see what is used and what is not.
<tr>
<td class="caption">canal, river</td>
<td class="bits"><span class="used" title="Canal/river random bits">XXXX XXXX</span></td>
<td class="bits"><span class="used" title="Water tile type: coast, clear, lock, depot">O<span class="usable">OO</span>O</span> <span class="free">OOOO</span></td>
<td class="bits"><span class="used" title="Water tile type: coast or water (00), lock (01), depot (10)">OO</span><span class="free">OO OOOO</span></td>
</tr>
<tr>
<td class="caption">lock</td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
<td class="bits"><span class="used" title="Water tile type: coast, clear, lock, depot">O<span class="usable">OO</span>1</span> <span class="used" title="Lock part">XX</span> <span class="used" title="Lock orientation m5[1..0]">XX</span></td>
<td class="bits"><span class="used" title="Water tile type: coast or water (00), lock (01), depot (10)">O1</span><span class="free">OO</span><span class="used" title="Lock part">XX</span> <span class="used" title="Lock orientation m5[1..0]">XX</span></td>
</tr>
<tr>
<td class="caption">shipdepot</td>
<td class="bits"><span class="pool" title="Depot index on pool">XXXX XXXX XXXX XXXX</span></td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
<td class="bits"><span class="used" title="Water tile type: coast, clear, lock, depot">1<span class="usable">OOO</span></span> <span class="free">OO</span><span class="used" title="Depot axis">X</span> <span class="used" title="Depot part">X</span></td>
<td class="bits"><span class="used" title="Water tile type: coast or water (00), lock (01), depot (10)">1O</span><span class="free">OOOO</span><span class="used" title="Depot axis">X</span> <span class="used" title="Depot part">X</span></td>
</tr>
<tr>
<td rowspan=2>8</td>

View File

@ -15,6 +15,7 @@
#include "../map_func.h"
#include "../core/bitmath_func.hpp"
#include "../fios.h"
#include "../tile_map.h"
#include "../safeguards.h"
@ -243,6 +244,16 @@ struct MAP5ChunkHandler : ChunkHandler {
SlCopy(buf.data(), MAP_SL_BUF_SIZE, SLE_UINT8);
for (uint j = 0; j != MAP_SL_BUF_SIZE; j++) Tile(i++).m5() = buf[j];
}
if (IsSavegameVersionBefore(SLV_ALIGN_WATER_BITS)) {
/* Move some bits for alignment purposes. */
for (TileIndex i = 0; i != size; i++) {
if (IsTileType(i, MP_WATER)) {
SB(Tile(i).m5(), 6, 1, GB(Tile(i).m5(), 4, 1));
SB(Tile(i).m5(), 4, 1, 0);
}
}
}
}
void Save() const override

View File

@ -389,6 +389,8 @@ enum SaveLoadVersion : uint16_t {
SLV_DEPOTID_BACKUP_ORDERS, ///< 314 PR#XXXXX Backup orders are indexed through DepotIDs.
SLV_ALIGN_WATER_BITS, ///< 315 PR#XXXXX Align some water bits in the map array.
SL_MAX_VERSION, ///< Highest possible saveload version
};

View File

@ -17,12 +17,12 @@
* Bit field layout of m5 for water tiles.
*/
enum WaterTileTypeBitLayout {
WBL_TYPE_BEGIN = 4, ///< Start of the 'type' bitfield.
WBL_TYPE_COUNT = 4, ///< Length of the 'type' bitfield.
WBL_TYPE_BEGIN = 6, ///< Start of the 'type' bitfield.
WBL_TYPE_COUNT = 2, ///< Length of the 'type' bitfield.
WBL_TYPE_NORMAL = 0x0, ///< Clear water or coast ('type' bitfield).
WBL_TYPE_LOCK = 0x1, ///< Lock ('type' bitfield).
WBL_TYPE_DEPOT = 0x8, ///< Depot ('type' bitfield).
WBL_TYPE_DEPOT = 0x2, ///< Depot ('type' bitfield).
WBL_COAST_FLAG = 0, ///< Flag for coast.