summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Nelson <peter1138@openttd.org>2018-05-23 11:48:01 +0100
committerPeterN <peter@fuzzle.org>2018-07-26 13:27:40 +0100
commit65548c37a840ca48378180df1bf8857b087f7329 (patch)
treea50d70c04fd9d7415426fa60d8439fed80f6655a
parent8090580f771b40c727f9a66e8bc43d443fbe5fbf (diff)
downloadopenttd-65548c37a840ca48378180df1bf8857b087f7329.tar.xz
Change: Extend map array by 2 bytes with a uint16.
-rw-r--r--docs/landscape_grid.html27
-rw-r--r--src/map_type.h5
-rw-r--r--src/saveload/map_sl.cpp27
3 files changed, 56 insertions, 3 deletions
diff --git a/docs/landscape_grid.html b/docs/landscape_grid.html
index d34fe9840..f5404a577 100644
--- a/docs/landscape_grid.html
+++ b/docs/landscape_grid.html
@@ -37,6 +37,7 @@ the array so you can quickly see what is used and what is not.
<li><span style="font-weight: bold;">m5</span> - 8 bits in size, is used for general storage</li>
<li><span style="font-weight: bold;">m6</span> - 8 bits in size, is used for general storage</li>
<li><span style="font-weight: bold;">m7</span> - 8 bits in size, is used for general storage</li>
+ <li><span style="font-weight: bold;">m8</span> - 16 bits in size, is used for general storage</li>
</ul>
<table align=center border="1" cellpadding="2" cellspacing="2">
@@ -52,6 +53,7 @@ the array so you can quickly see what is used and what is not.
<th>m5 (8)</th>
<th>m6 (8)</th>
<th>m7 (8)</th>
+ <th>m8 (16)</th>
</tr>
<tr>
<td colspan=2 class="caption">bits</td>
@@ -64,6 +66,7 @@ the array so you can quickly see what is used and what is not.
<td class="bits">7654 3210</td>
<td class="bits">7654 3210</td>
<td class="bits">7654 3210</td>
+ <td class="bits">FEDC BA98 7654 3210</td>
</tr>
<tr>
<td rowspan="2">0</td>
@@ -77,6 +80,7 @@ the array so you can quickly see what is used and what is not.
<td class="bits">XXXX XXXX</td>
<td class="bits"><span class="free">OOO</span>X XX<span class="free">OO</span></td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
+ <td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td>
</tr>
<tr>
<td class="caption">farmland</td>
@@ -89,6 +93,7 @@ the array so you can quickly see what is used and what is not.
<td class="bits">-inherit-</td>
<td class="bits"><span class="free">OOO</span>X XX<span class="free">OO</span></td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
+ <td class="bits">-inherit-</td>
</tr>
<tr>
<td rowspan=3>1</td>
@@ -102,6 +107,7 @@ the array so you can quickly see what is used and what is not.
<td class="bits">XXXX XXXX</td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
+ <td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td>
</tr>
<tr>
<td class="caption">rail with signals</td>
@@ -114,6 +120,7 @@ the array so you can quickly see what is used and what is not.
<td class="bits">-inherit-</td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
+ <td class="bits">-inherit-</td>
</tr>
<tr>
<td class="caption">depot</td>
@@ -126,6 +133,7 @@ the array so you can quickly see what is used and what is not.
<td class="bits">XX<span class="free">O</span>X <span class="free">OO</span>XX</td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
+ <td class="bits">-inherit-</td>
</tr>
<tr>
<td rowspan=3>2</td>
@@ -139,6 +147,7 @@ the array so you can quickly see what is used and what is not.
<td class="bits">XXXX XXXX</td>
<td class="bits"><span class="free">OO</span>XX X<span class="free">OOO</span></td>
<td class="bits">XXX<span class="free">O</span> XXXX</td>
+ <td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td>
</tr>
<tr>
<td class="caption">level crossing</td>
@@ -151,6 +160,7 @@ the array so you can quickly see what is used and what is not.
<td class="bits">XXXX<span class="free"> OOO</span>X</td>
<td class="bits"><span class="free">OO</span>XX X<span class="free">OOO</span></td>
<td class="bits">XXXX XXXX</td>
+ <td class="bits">-inherit-</td>
</tr>
<tr>
<td class="caption">road depot</td>
@@ -163,6 +173,7 @@ the array so you can quickly see what is used and what is not.
<td class="bits">XX<span class="free">OO OO</span>XX</td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
<td class="bits">XXX<span class="free">O</span> XXXX</td>
+ <td class="bits">-inherit-</td>
</tr>
<tr>
<td>3</td>
@@ -176,6 +187,7 @@ the array so you can quickly see what is used and what is not.
<td class="bits">XXX<span class="abuse">X XXXX</span></td>
<td class="bits"><span class="abuse">XXXX XX</span><span class="free">OO</span></td>
<td class="bits">XXXX <span class="abuse">XXXX</span></td>
+ <td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td>
</tr>
<tr>
<td>4</td>
@@ -189,6 +201,7 @@ the array so you can quickly see what is used and what is not.
<td class="bits">XX<span class="free">OO O</span>XXX</td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
+ <td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td>
</tr>
<tr>
<td rowspan=7>5</td>
@@ -202,6 +215,7 @@ the array so you can quickly see what is used and what is not.
<td class="bits">XXXX XXXX</td>
<td class="bits"><span class="free">OO</span>XX XX<span class="free">OO</span></td>
<td class="bits">XXXX XXXX</td>
+ <td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td>
</tr>
<tr>
<td class="caption">rail waypoint</td>
@@ -214,6 +228,7 @@ the array so you can quickly see what is used and what is not.
<td class="bits">-inherit-</td>
<td class="bits">-inherit-</td>
<td class="bits">-inherit-</td>
+ <td class="bits">-inherit-</td>
</tr>
<tr>
<td class="caption">road stop</td>
@@ -226,6 +241,7 @@ the array so you can quickly see what is used and what is not.
<td class="bits"><span class="option">~~~~ ~</span>XXX</td>
<td class="bits"><span class="free">OO</span>XX X<span class="free">OOO</span></td>
<td class="bits">XX<span class="free">O</span>X XXXX</td>
+ <td class="bits">-inherit-</td>
</tr>
<tr>
<td class="caption">dock</td>
@@ -238,6 +254,7 @@ the array so you can quickly see what is used and what is not.
<td class="bits"><span class="option">~~~~ ~</span>XXX</td>
<td class="bits"><span class="free">OO</span>XX X<span class="free">OOO</span></td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
+ <td class="bits">-inherit-</td>
</tr>
<tr>
<td class="caption">airport</td>
@@ -250,6 +267,7 @@ the array so you can quickly see what is used and what is not.
<td class="bits">XXXX XXXX</td>
<td class="bits"><span class="free">OO</span>XX X<span class="free">OOO</span></td>
<td class="bits">XXXX XXXX</td>
+ <td class="bits">-inherit-</td>
</tr>
<tr>
<td class="caption">buoy</td>
@@ -262,6 +280,7 @@ the array so you can quickly see what is used and what is not.
<td class="bits"><span class="option">~~~~ ~~~~</span></td>
<td class="bits"><span class="free">OO</span>XX X<span class="free">OOO</span></td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
+ <td class="bits">-inherit-</td>
</tr>
<tr>
<td class="caption">oilrig</td>
@@ -274,6 +293,7 @@ the array so you can quickly see what is used and what is not.
<td class="bits"><span class="option">~~~~ ~~~~</span></td>
<td class="bits"><span class="free">OO</span>XX X<span class="free">OOO</span></td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
+ <td class="bits">-inherit-</td>
</tr>
<tr>
<td rowspan=3>6</td>
@@ -287,6 +307,7 @@ the array so you can quickly see what is used and what is not.
<td class="bits">X<span class="option">~~</span>X XXXX</td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
+ <td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td>
</tr>
<tr>
<td class="caption">canal, river</td>
@@ -299,6 +320,7 @@ the array so you can quickly see what is used and what is not.
<td class="bits">-inherit-</td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
+ <td class="bits">-inherit-</td>
</tr>
<tr>
<td class="caption">shipdepot</td>
@@ -311,6 +333,7 @@ the array so you can quickly see what is used and what is not.
<td class="bits">-inherit-</td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
+ <td class="bits">-inherit-</td>
</tr>
<tr>
<td>8</td>
@@ -324,6 +347,7 @@ the array so you can quickly see what is used and what is not.
<td class="bits">XXXX XXXX</td>
<td class="bits"><span class="free">OO</span>XX XX<span class="free">OO</span></td>
<td class="bits">XXXX XXXX</td>
+ <td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td>
</tr>
<tr>
<td rowspan=2>9</td>
@@ -337,6 +361,7 @@ the array so you can quickly see what is used and what is not.
<td class="bits">X<span class="free">OO</span>X XXXX</td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
<td class="bits">XXXX XXXX</td>
+ <td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td>
</tr>
<tr>
<td>bridge ramp</td>
@@ -349,6 +374,7 @@ the array so you can quickly see what is used and what is not.
<td class="bits">-inherit-</td>
<td class="bits"><span class="free">OO</span>XX XX<span class="free">OO</span></td>
<td class="bits">-inherit-</td>
+ <td class="bits">-inherit-</td>
</tr>
<tr>
<td rowspan=2>A</td>
@@ -362,6 +388,7 @@ the array so you can quickly see what is used and what is not.
<td class="bits">XXXX XXXX</td>
<td class="bits"><span class="free">OOOO OOOO</span></td>
<td class="bits">XXXX XXXX</td>
+ <td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td>
</tr>
</tbody>
</table>
diff --git a/src/map_type.h b/src/map_type.h
index 620885e5d..7af391b46 100644
--- a/src/map_type.h
+++ b/src/map_type.h
@@ -33,8 +33,9 @@ assert_compile(sizeof(Tile) == 8);
* Look at docs/landscape.html for the exact meaning of the members.
*/
struct TileExtended {
- byte m6; ///< General purpose
- byte m7; ///< Primarily used for newgrf support
+ byte m6; ///< General purpose
+ byte m7; ///< Primarily used for newgrf support
+ uint16 m8; ///< General purpose
};
/**
diff --git a/src/saveload/map_sl.cpp b/src/saveload/map_sl.cpp
index 86a185ca4..693ddb7ce 100644
--- a/src/saveload/map_sl.cpp
+++ b/src/saveload/map_sl.cpp
@@ -272,6 +272,30 @@ static void Save_MAP7()
}
}
+static void Load_MAP8()
+{
+ SmallStackSafeStackAlloc<uint16, MAP_SL_BUF_SIZE> buf;
+ TileIndex size = MapSize();
+
+ for (TileIndex i = 0; i != size;) {
+ SlArray(buf, MAP_SL_BUF_SIZE, SLE_UINT16);
+ for (uint j = 0; j != MAP_SL_BUF_SIZE; j++) _me[i++].m8 = buf[j];
+ }
+}
+
+static void Save_MAP8()
+{
+ SmallStackSafeStackAlloc<uint16, MAP_SL_BUF_SIZE> buf;
+ TileIndex size = MapSize();
+
+ SlSetLength(size * sizeof(uint16));
+ for (TileIndex i = 0; i != size;) {
+ for (uint j = 0; j != MAP_SL_BUF_SIZE; j++) buf[j] = _me[i++].m8;
+ SlArray(buf, MAP_SL_BUF_SIZE, SLE_UINT16);
+ }
+}
+
+
extern const ChunkHandler _map_chunk_handlers[] = {
{ 'MAPS', Save_MAPS, Load_MAPS, NULL, Check_MAPS, CH_RIFF },
{ 'MAPT', Save_MAPT, Load_MAPT, NULL, NULL, CH_RIFF },
@@ -282,5 +306,6 @@ extern const ChunkHandler _map_chunk_handlers[] = {
{ 'M3HI', Save_MAP4, Load_MAP4, NULL, NULL, CH_RIFF },
{ 'MAP5', Save_MAP5, Load_MAP5, NULL, NULL, CH_RIFF },
{ 'MAPE', Save_MAP6, Load_MAP6, NULL, NULL, CH_RIFF },
- { 'MAP7', Save_MAP7, Load_MAP7, NULL, NULL, CH_RIFF | CH_LAST },
+ { 'MAP7', Save_MAP7, Load_MAP7, NULL, NULL, CH_RIFF },
+ { 'MAP8', Save_MAP8, Load_MAP8, NULL, NULL, CH_RIFF | CH_LAST },
};