diff options
-rw-r--r-- | docs/landscape_grid.html | 65 | ||||
-rw-r--r-- | src/bridge_map.h | 8 | ||||
-rw-r--r-- | src/clear_map.h | 4 | ||||
-rw-r--r-- | src/landscape.cpp | 2 | ||||
-rw-r--r-- | src/map.h | 2 | ||||
-rw-r--r-- | src/misc.cpp | 19 | ||||
-rw-r--r-- | src/misc_gui.cpp | 2 | ||||
-rw-r--r-- | src/oldloader.cpp | 8 | ||||
-rw-r--r-- | src/tile.h | 4 | ||||
-rw-r--r-- | src/void_map.h | 2 |
10 files changed, 69 insertions, 47 deletions
diff --git a/docs/landscape_grid.html b/docs/landscape_grid.html index 88988d9d2..bec609422 100644 --- a/docs/landscape_grid.html +++ b/docs/landscape_grid.html @@ -16,7 +16,7 @@ </head> <body style="direction: ltr;"> <h3 style="font-weight: bold;">Landscape</h3> -<span style="font-weight: bold;"></span>Five attributes hold the information about a tile. +<span style="font-weight: bold;"></span>Six attributes hold the information about a 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> @@ -32,22 +32,25 @@ the array so you can quickly see what is used and what is not. <li><span style="font-weight: bold;">m3</span> - 8 bits in size, is used for general storage</li> <li><span style="font-weight: bold;">m4</span> - 8 bits in size, is used for general storage</li> <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, special meaning : lower 2 bits only valid in tropic climate, upper 2 bits for bridges</li> </ul> <table align=center border="1" cellpadding="2" cellspacing="2"> <tbody> <tr> <th colspan=2>class</th> + <th>type_height (8)</th> <th>m1 (8)</th> <th>m2 (16)</th> <th>m3 (8)</th> <th>m4 (8)</th> - <th>type_height (8)</th> <th>m5 (8)</th> + <th>m6 (8)</th> </tr> <tr> <td colspan=2 class="caption">bits</td> <td class="bits">7654 3210</td> + <td class="bits">7654 3210</td> <td class="bits">FEDC BA98 7654 3210</td> <td class="bits">7654 3210</td> <td class="bits">7654 3210</td> @@ -58,129 +61,143 @@ the array so you can quickly see what is used and what is not. <td rowspan="2">0</td> <td class="caption">ground</td> <td class="bits">XXXX XXXX</td> + <td class="bits">XXXX XXXX</td> <td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td> <td class="bits"><span class="free">OOOO OOOO</span></td> <td class="bits">XXXX XX<span class="free">OO</span></td> <td class="bits">XXXX XXXX</td> - <td class="bits">XXXX XXXX</td> + <td class="bits">XX<span class="free">OO OO</span>XX</td> </tr> <tr> <td class="caption">farmland</td> <td class="bits">-inherit-</td> + <td class="bits">-inherit-</td> <td class="bits">XXXX XXXX XXXX XXXX</td> <td class="bits"><span class="free">OOOO</span> XXXX</td> <td class="bits">-inherit-</td> - <td class="bits">-inherit-</td> <td class="bits"><span class="free">OOO</span>X XXXX</td> + <td class="bits">XX<span class="free">OO OO</span>XX</td> </tr> <tr> <td rowspan=3>1</td> <td class="caption">rail</td> <td class="bits">XXXX XXXX</td> + <td class="bits">XXXX XXXX</td> <td class="bits"><span class="free">OOOO OOOO</span> XXXX XXXX</td> <td class="bits">XXXX XXXX</td> <td class="bits"><span class="free">OOOO O</span>XXX</td> <td class="bits">XXXX XXXX</td> - <td class="bits">XXXX XXXX</td> + <td class="bits">XX<span class="free">OO OO</span>XX</td> </tr> <tr> <td class="caption">depot</td> <td class="bits">-inherit-</td> + <td class="bits">-inherit-</td> <td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td> <td class="bits"><span class="free">OOOO</span> XXXX</td> <td class="bits"><span class="free">OOOO</span> XXXX</td> - <td class="bits">-inherit-</td> <td class="bits">XX<span class="free">OO O</span>XXX</td> + <td class="bits">XX<span class="free">OO OO</span>XX</td> </tr> <tr> <td class="caption">waypoint</td> <td class="bits">-inherit-</td> + <td class="bits">-inherit-</td> <td class="bits">XXXX XXXX XXXX XXXX</td> <td class="bits"><span class="free">OOOO</span> XXXX</td> <td class="bits"><span class="free">OOOO</span> XXXX</td> - <td class="bits">-inherit-</td> <td class="bits">XX<span class="free">OO O</span>XXX</td> + <td class="bits">XX<span class="free">OO OO</span>XX</td> </tr> <tr> <td rowspan=3>2</td> <td class="caption">road</td> <td class="bits">XXXX XXXX</td> + <td class="bits">XXXX XXXX</td> <td class="bits">XXXX XXXX XXXX XXXX</td> <td class="bits"><span class="free">OOOO OOOO</span></td> <td class="bits">XXXX XXXX</td> <td class="bits">XXXX XXXX</td> - <td class="bits">XXXX XXXX</td> + <td class="bits">XX<span class="free">OO OO</span>XX</td> </tr> <tr> <td class="caption">level crossing</td> <td class="bits">-inherit-</td> <td class="bits">-inherit-</td> + <td class="bits">-inherit-</td> <td class="bits">XXXX XXXX</td> <td class="bits">XXXX XXXX</td> - <td class="bits">-inherit-</td> <td class="bits">XXXX XX<span class="free">OO</span></td> + <td class="bits">XX<span class="free">OO OO</span>XX</td> </tr> <tr> <td class="caption">road depot</td> <td class="bits">-inherit-</td> + <td class="bits">-inherit-</td> <td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td> <td class="bits"><span class="free">OOOO OOOO</span></td> <td class="bits">X<span class="free">OOO OOOO</span></td> - <td class="bits">-inherit-</td> <td class="bits">XXXX XXXX</td> + <td class="bits">XX<span class="free">OO OO</span>XX</td> </tr> <tr> <td>3</td> <td class="caption">town</td> + <td class="bits">XXXX XXXX</td> <td class="bits"><span class="abuse">XXXX XXXX</span></td> <td class="bits">XXXX XXXX XXXX XXXX</td> <td class="bits">XX<span class="free">OO OOOO</span></td> <td class="bits">XXXX XXXX</td> - <td class="bits">XXXX XXXX</td> <td class="bits">X<span class="free">O</span>XX XXXX</td> + <td class="bits"><span class="free">OOOO OO</span>XX</td> </tr> <tr> <td>4</td> <td class="caption">trees</td> <td class="bits">XXXX XXXX</td> + <td class="bits">XXXX XXXX</td> <td class="bits"><span class="free">OOOO OOOO</span> XXXX XXXX</td> <td class="bits">XXXX XXXX</td> <td class="bits">XXXX XX<span class="free">OO</span></td> - <td class="bits">XXXX XXXX</td> <td class="bits">XX<span class="free">OO O</span>XXX</td> + <td class="bits"><span class="free">OOOO OO</span>XX</td> </tr> <tr> <td>5</td> <td class="caption">station</td> <td class="bits">XXXX XXXX</td> - <td class="bits">XXXX XXXX XXXX XXXX</td> <td class="bits">XXXX XXXX</td> + <td class="bits">XXXX XXXX XXXX XXXX</td> <td class="bits">XXXX XXXX</td> <td class="bits">XXXX XXXX</td> <td class="bits">XXXX XXXX</td> + <td class="bits"><span class="free">OOOO OO</span>XX</td> </tr> <tr> <td>6</td> <td class="caption">water</td> <td class="bits">XXXX XXXX</td> + <td class="bits">XXXX XXXX</td> <td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td> <td class="bits"><span class="free">OOOO OOOO</span></td> <td class="bits"><span class="free">OOOO OOOO</span></td> - <td class="bits">XXXX XXXX</td> - <td class="bits">XXXX XXXX</td> + <td class="bits"><span class="free">OOOO OO</span>XX</td> + <td class="bits">XX<span class="free">OO OO</span>XX</td> </tr> <tr> <td rowspan=3>8</td> <td class="caption">industry</td> + <td class="bits">XXXX XXXX</td> <td class="bits"><span class="abuse">X</span><span class="free">OO</span><span class="abuse">X XXXX</span></td> <td class="bits">XXXX XXXX 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">XXXX XXXX</td> - <td class="bits">XXXX XXXX</td> + <td class="bits"><span class="free">OOOO OO</span>XX</td> </tr> <tr> - <td>bubble/sugar/toffee, gold/copper/coal, oil wells, power station</td> + <td>bubble/sugar/toffee,<BR>gold/copper/coal,<BR>oil wells, power station</td> + <td class="bits">-inherit-</td> <td class="bits"><span class="abuse">X</span><span class="free">OOO OOOO</span></td> <td class="bits">-inherit-</td> <td class="bits">XXXX XXXX</td> @@ -190,6 +207,7 @@ the array so you can quickly see what is used and what is not. </tr> <tr> <td>toy factory</td> + <td class="bits">-inherit-</td> <td class="bits"><span class="abuse">X</span><span class="free">OOO OOOO</span></td> <td class="bits">-inherit-</td> <td class="bits">XXXX XXXX</td> @@ -199,32 +217,35 @@ the array so you can quickly see what is used and what is not. </tr> <tr> <td rowspan=2>9</td> - <td class="caption">tunnel</td> + <td class="caption">tunnel entrance</td> + <td class="bits">XXXX XXXX</td> <td class="bits">XXXX XXXX</td> <td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td> <td class="bits"><span class="free">OOOO</span> XXXX</td> <td class="bits">X<span class="free">OOO OOOO</span></td> - <td class="bits">XXXX XXXX</td> <td class="bits">X<span class="free">OOO</span> XXXX</td> + <td class="bits">XX<span class="free">OO OO</span>XX</td> </tr> <tr> <td>bridge ramp</td> <td class="bits">XXXX XXXX</td> + <td class="bits">XXXX XXXX</td> <td class="bits"><span class="free">OOOO OOOO</span> <span class="abuse">XXXX</span> <span class="free">OOOO</span></td> <td class="bits"><span class="free">OOOO</span> XXXX</td> <td class="bits">X<span class="free">OOO OOOO</span></td> - <td class="bits">XXXX XXXX</td> <td class="bits">X<span class="free">OOO</span> XXXX</td> + <td class="bits">XX<span class="free">OO OO</span>XX</td> </tr> <tr> <td>A</td> - <td class="caption">various (HQ)</td> + <td class="caption">unmovables</td> + <td class="bits">XXXX XXXX</td> <td class="bits">XXXX XXXX</td> <td class="bits"><span class="free">OOOO OOOO OOOO OOOO</span></td> <td class="bits"><span class="free">OOOO OOOO</span></td> <td class="bits"><span class="free">OOOO OOOO</span></td> <td class="bits">XXXX XXXX</td> - <td class="bits">XXXX XXXX</td> + <td class="bits">XX<span class="free">OO OO</span>XX</td> </tr> </tbody> </table> diff --git a/src/bridge_map.h b/src/bridge_map.h index 1cda0da9d..260917e19 100644 --- a/src/bridge_map.h +++ b/src/bridge_map.h @@ -41,7 +41,7 @@ static inline bool MayHaveBridgeAbove(TileIndex t) static inline bool IsBridgeAbove(TileIndex t) { assert(MayHaveBridgeAbove(t)); - return GB(_m[t].extra, 6, 2) != 0; + return GB(_m[t].m6, 6, 2) != 0; } @@ -70,7 +70,7 @@ static inline DiagDirection GetBridgeRampDirection(TileIndex t) static inline Axis GetBridgeAxis(TileIndex t) { assert(IsBridgeAbove(t)); - return (Axis)(GB(_m[t].extra, 6, 2) - 1); + return (Axis)(GB(_m[t].m6, 6, 2) - 1); } @@ -121,7 +121,7 @@ uint GetBridgeFoundation(Slope tileh, Axis axis); static inline void ClearSingleBridgeMiddle(TileIndex t, Axis a) { assert(MayHaveBridgeAbove(t)); - CLRBIT(_m[t].extra, 6 + a); + CLRBIT(_m[t].m6, 6 + a); } @@ -134,7 +134,7 @@ static inline void ClearBridgeMiddle(TileIndex t) static inline void SetBridgeMiddle(TileIndex t, Axis a) { assert(MayHaveBridgeAbove(t)); - SETBIT(_m[t].extra, 6 + a); + SETBIT(_m[t].m6, 6 + a); } diff --git a/src/clear_map.h b/src/clear_map.h index dd7a15061..88c3f4af0 100644 --- a/src/clear_map.h +++ b/src/clear_map.h @@ -126,7 +126,7 @@ static inline void MakeClear(TileIndex t, ClearGround g, uint density) { /* If this is a non-bridgeable tile, clear the bridge bits while the rest * of the tile information is still here. */ - if (!MayHaveBridgeAbove(t)) SB(_m[t].extra, 6, 2, 0); + if (!MayHaveBridgeAbove(t)) SB(_m[t].m6, 6, 2, 0); SetTileType(t, MP_CLEAR); SetTileOwner(t, OWNER_NONE); @@ -134,7 +134,7 @@ static inline void MakeClear(TileIndex t, ClearGround g, uint density) _m[t].m3 = 0; _m[t].m4 = 0 << 5 | 0 << 2; SetClearGroundDensity(t, g, density); - SB(_m[t].extra, 2, 4, 0); + SB(_m[t].m6, 2, 4, 0); ///< Clear the rest of m6, bits 2 to 5 } diff --git a/src/landscape.cpp b/src/landscape.cpp index 2f05fc2ba..2b8a2033b 100644 --- a/src/landscape.cpp +++ b/src/landscape.cpp @@ -415,7 +415,7 @@ void InitializeLandscape(void) for (x = 0; x < maxx; x++) { MakeClear(sizex * y + x, CLEAR_GRASS, 3); SetTileHeight(sizex * y + x, 0); - _m[sizex * y + x].extra = 0; + SetTropicZone(sizex * y + x, TROPICZONE_INVALID); ClearBridgeMiddle(sizex * y + x); } MakeVoid(sizex * y + x); @@ -23,7 +23,7 @@ typedef struct Tile { byte m3; byte m4; byte m5; - byte extra; + byte m6; } Tile; extern Tile* _m; diff --git a/src/misc.cpp b/src/misc.cpp index d753445e9..39714bb55 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -546,8 +546,9 @@ static void Save_MAP5(void) } } -static void Load_MAPE(void) +static void Load_MAP6(void) { + /* Still available for loading old games */ uint size = MapSize(); uint i; @@ -558,10 +559,10 @@ static void Load_MAPE(void) SlArray(buf, lengthof(buf), SLE_UINT8); for (j = 0; j != lengthof(buf); j++) { - _m[i++].extra = GB(buf[j], 0, 2); - _m[i++].extra = GB(buf[j], 2, 2); - _m[i++].extra = GB(buf[j], 4, 2); - _m[i++].extra = GB(buf[j], 6, 2); + _m[i++].m6 = GB(buf[j], 0, 2); + _m[i++].m6 = GB(buf[j], 2, 2); + _m[i++].m6 = GB(buf[j], 4, 2); + _m[i++].m6 = GB(buf[j], 6, 2); } } } else { @@ -570,12 +571,12 @@ static void Load_MAPE(void) uint j; SlArray(buf, lengthof(buf), SLE_UINT8); - for (j = 0; j != lengthof(buf); j++) _m[i++].extra = buf[j]; + for (j = 0; j != lengthof(buf); j++) _m[i++].m6 = buf[j]; } } } -static void Save_MAPE(void) +static void Save_MAP6(void) { uint size = MapSize(); uint i; @@ -585,7 +586,7 @@ static void Save_MAPE(void) uint8 buf[4096]; uint j; - for (j = 0; j != lengthof(buf); j++) buf[j] = _m[i++].extra; + for (j = 0; j != lengthof(buf); j++) buf[j] = _m[i++].m6; SlArray(buf, lengthof(buf), SLE_UINT8); } } @@ -625,7 +626,7 @@ extern const ChunkHandler _misc_chunk_handlers[] = { { 'M3LO', Save_MAP3, Load_MAP3, CH_RIFF }, { 'M3HI', Save_MAP4, Load_MAP4, CH_RIFF }, { 'MAP5', Save_MAP5, Load_MAP5, CH_RIFF }, - { 'MAPE', Save_MAPE, Load_MAPE, CH_RIFF }, + { 'MAPE', Save_MAP6, Load_MAP6, CH_RIFF }, { 'NAME', Save_NAME, Load_NAME, CH_ARRAY}, { 'DATE', SaveLoad_DATE, SaveLoad_DATE, CH_RIFF}, diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index 0da96faf7..fab2129e2 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -183,7 +183,7 @@ static void Place_LandInfo(TileIndex tile) DEBUG(misc, LANDINFOD_LEVEL, "m3 = %#x", _m[tile].m3); DEBUG(misc, LANDINFOD_LEVEL, "m4 = %#x", _m[tile].m4); DEBUG(misc, LANDINFOD_LEVEL, "m5 = %#x", _m[tile].m5); - DEBUG(misc, LANDINFOD_LEVEL, "extra = %#x", _m[tile].extra); + DEBUG(misc, LANDINFOD_LEVEL, "m6 = %#x", _m[tile].m6); #undef LANDINFOD_LEVEL } diff --git a/src/oldloader.cpp b/src/oldloader.cpp index 98a1e9223..b920ffc9a 100644 --- a/src/oldloader.cpp +++ b/src/oldloader.cpp @@ -1344,10 +1344,10 @@ static bool LoadOldMapPart1(LoadgameState *ls, int num) } for (i = 0; i < OLD_MAP_SIZE / 4; i++) { byte b = ReadByte(ls); - _m[i * 4 + 0].extra = GB(b, 0, 2); - _m[i * 4 + 1].extra = GB(b, 2, 2); - _m[i * 4 + 2].extra = GB(b, 4, 2); - _m[i * 4 + 3].extra = GB(b, 6, 2); + _m[i * 4 + 0].m6 = GB(b, 0, 2); + _m[i * 4 + 1].m6 = GB(b, 2, 2); + _m[i * 4 + 2].m6 = GB(b, 4, 2); + _m[i * 4 + 3].m6 = GB(b, 6, 2); } return !ls->failed; diff --git a/src/tile.h b/src/tile.h index 0de85ac5b..ac7eb93a7 100644 --- a/src/tile.h +++ b/src/tile.h @@ -105,7 +105,7 @@ static inline bool IsTileOwner(TileIndex tile, Owner owner) static inline void SetTropicZone(TileIndex tile, TropicZone type) { assert(tile < MapSize()); - SB(_m[tile].extra, 0, 2, type); + SB(_m[tile].m6, 0, 2, type); } /** @@ -117,6 +117,6 @@ static inline void SetTropicZone(TileIndex tile, TropicZone type) static inline TropicZone GetTropicZone(TileIndex tile) { assert(tile < MapSize()); - return (TropicZone)GB(_m[tile].extra, 0, 2); + return (TropicZone)GB(_m[tile].m6, 0, 2); } #endif /* TILE_H */ diff --git a/src/void_map.h b/src/void_map.h index 552a8c705..21658746e 100644 --- a/src/void_map.h +++ b/src/void_map.h @@ -12,7 +12,7 @@ static inline void MakeVoid(TileIndex t) _m[t].m3 = 0; _m[t].m4 = 0; _m[t].m5 = 0; - _m[t].extra = 0; + _m[t].m6 = 0; } #endif /* VOID_MAP_H */ |