(svn r20335) -Codechange: change the name of some unmovable map accessors

pull/155/head
rubidium 14 years ago
parent 5ed887648c
commit eb0fa68722

@ -1803,8 +1803,8 @@ bool AfterLoadGame()
/* Reordering/generalisation of the unmovable bits. */
UnmovableType type = GetUnmovableType(t);
SetCompanyHQSize(t, type == UNMOVABLE_HQ ? GB(_m[t].m3, 2, 3) : 0);
SetCompanyHQSection(t, type == UNMOVABLE_HQ ? GB(_m[t].m3, 1, 1) << 4 | GB(_m[t].m3, 0, 1) : 0);
SetUnmovableAnimationStage(t, type == UNMOVABLE_HQ ? GB(_m[t].m3, 2, 3) : 0);
SetUnmovableOffset(t, type == UNMOVABLE_HQ ? GB(_m[t].m3, 1, 1) << 4 | GB(_m[t].m3, 0, 1) : 0);
/* Make sure those bits are clear as well! */
_m[t].m4 = 0;

@ -46,6 +46,9 @@
return UnmovableSpec::Get(GetUnmovableType(tile));
}
/** We encode the company HQ size in the animation stage. */
#define GetCompanyHQSize GetUnmovableAnimationStage
/**
* Destroy a HQ.
* During normal gameplay you can only implicitely destroy a HQ when you are
@ -255,7 +258,7 @@ static void DrawTile_Unmovable(TileInfo *ti)
PaletteID palette = COMPANY_SPRITE_COLOUR(GetTileOwner(ti->tile));
uint8 offset = GetCompanyHQSection(ti->tile);
uint8 offset = GetUnmovableOffset(ti->tile);
const DrawTileSprites *t = &_unmovable_display_datas[GetCompanyHQSize(ti->tile) << 2 | GB(offset, 4, 1) << 1 | GB(offset, 0, 1)];
DrawGroundSprite(t->ground.sprite, palette);

@ -106,52 +106,51 @@ static inline TownID GetStatueTownID(TileIndex t)
}
/**
* Get the 'stage' of the HQ.
* @param t a tile of the HQ.
* Get animation stage/counter of this tile.
* @param t The tile to query.
* @pre IsTileType(t, MP_UNMOVABLE)
* @return the 'stage' of the HQ.
* @return The animation 'stage' of the tile.
*/
static inline byte GetCompanyHQSize(TileIndex t)
static inline byte GetUnmovableAnimationStage(TileIndex t)
{
assert(IsTileType(t, MP_UNMOVABLE));
return GB(_m[t].m6, 2, 4);
}
/**
* Set the 'stage' of the HQ.
* @param t a tile of the HQ.
* @param size the actual stage of the HQ
* Set animation stage/counter of this tile.
* @param t The tile to query.
* @param stage The stage of this tile.
* @pre IsTileType(t, MP_UNMOVABLE)
*/
static inline void SetCompanyHQSize(TileIndex t, uint8 size)
static inline void SetUnmovableAnimationStage(TileIndex t, uint8 stage)
{
assert(IsTileType(t, MP_UNMOVABLE));
SB(_m[t].m6, 2, 4, size);
SB(_m[t].m6, 2, 4, stage);
}
/**
* Get the 'section' of the HQ.
* The scetion is in fact which side of teh HQ the tile represent
* @param t a tile of the HQ.
* Get offset to the northern most tile.
* @param t The tile to get the offset from.
* @return The offset to the northern most tile of this structure.
* @pre IsTileType(t, MP_UNMOVABLE)
* @return the 'section' of the HQ.
*/
static inline byte GetCompanyHQSection(TileIndex t)
static inline byte GetUnmovableOffset(TileIndex t)
{
assert(IsTileType(t, MP_UNMOVABLE));
return _m[t].m3;
}
/**
* Set the 'section' of the HQ.
* @param t a tile of the HQ.
* @param section to be set.
* Set offset to the northern most tile.
* @param t The tile to set the offset of.
* @param offset The offset to the northern most tile of this structure.
* @pre IsTileType(t, MP_UNMOVABLE)
*/
static inline void SetCompanyHQSection(TileIndex t, uint8 section)
static inline void SetUnmovableOffset(TileIndex t, uint8 offset)
{
assert(IsTileType(t, MP_UNMOVABLE));
_m[t].m3 = section;
_m[t].m3 = offset;
}
/**
@ -163,14 +162,14 @@ static inline void SetCompanyHQSection(TileIndex t, uint8 section)
*/
static inline void EnlargeCompanyHQ(TileIndex t, byte size)
{
assert(GetCompanyHQSection(t) == 0);
assert(GetUnmovableOffset(t) == 0);
assert(size <= 4);
if (size <= GetCompanyHQSize(t)) return;
if (size <= GetUnmovableAnimationStage(t)) return;
SetCompanyHQSize(t, size);
SetCompanyHQSize(t + TileDiffXY(0, 1), size);
SetCompanyHQSize(t + TileDiffXY(1, 0), size);
SetCompanyHQSize(t + TileDiffXY(1, 1), size);
SetUnmovableAnimationStage(t, size);
SetUnmovableAnimationStage(t + TileDiffXY(0, 1), size);
SetUnmovableAnimationStage(t + TileDiffXY(1, 0), size);
SetUnmovableAnimationStage(t + TileDiffXY(1, 1), size);
}

Loading…
Cancel
Save