From 5f9c89173498401fca62af1623db357f6f34342b Mon Sep 17 00:00:00 2001 From: belugas Date: Thu, 11 Jan 2007 02:05:13 +0000 Subject: (svn r8050) -Codechange: Rename map member extra to m6, since its usage has been widden. Only doc landscape_grid.html has been updated, landscape.html will be done latter. -CodeChange: Replace a direct access to m6 with SetTropicZone in InitializeLandscape, as it is the only part of m6 still untouched without the brute-forced m6=0 --- src/bridge_map.h | 8 ++++---- src/clear_map.h | 4 ++-- src/landscape.cpp | 2 +- src/map.h | 2 +- src/misc.cpp | 19 ++++++++++--------- src/misc_gui.cpp | 2 +- src/oldloader.cpp | 8 ++++---- src/tile.h | 4 ++-- src/void_map.h | 2 +- 9 files changed, 26 insertions(+), 25 deletions(-) (limited to 'src') 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); diff --git a/src/map.h b/src/map.h index fdc7525d0..10202e5c6 100644 --- a/src/map.h +++ b/src/map.h @@ -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 */ -- cgit v1.2.3-70-g09d2