(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
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -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
|
||||
}
|
||||
|
||||
|
||||
|
@@ -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;
|
||||
|
19
src/misc.cpp
19
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},
|
||||
|
@@ -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
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
|
@@ -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 */
|
||||
|
@@ -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 */
|
||||
|
Reference in New Issue
Block a user