mirror of https://github.com/OpenTTD/OpenTTD
(svn r20335) -Codechange: change the name of some unmovable map accessors
parent
f44c51577b
commit
ffedcc6533
|
@ -1803,8 +1803,8 @@ bool AfterLoadGame()
|
||||||
|
|
||||||
/* Reordering/generalisation of the unmovable bits. */
|
/* Reordering/generalisation of the unmovable bits. */
|
||||||
UnmovableType type = GetUnmovableType(t);
|
UnmovableType type = GetUnmovableType(t);
|
||||||
SetCompanyHQSize(t, type == UNMOVABLE_HQ ? GB(_m[t].m3, 2, 3) : 0);
|
SetUnmovableAnimationStage(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);
|
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! */
|
/* Make sure those bits are clear as well! */
|
||||||
_m[t].m4 = 0;
|
_m[t].m4 = 0;
|
||||||
|
|
|
@ -46,6 +46,9 @@
|
||||||
return UnmovableSpec::Get(GetUnmovableType(tile));
|
return UnmovableSpec::Get(GetUnmovableType(tile));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** We encode the company HQ size in the animation stage. */
|
||||||
|
#define GetCompanyHQSize GetUnmovableAnimationStage
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroy a HQ.
|
* Destroy a HQ.
|
||||||
* During normal gameplay you can only implicitely destroy a HQ when you are
|
* 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));
|
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)];
|
const DrawTileSprites *t = &_unmovable_display_datas[GetCompanyHQSize(ti->tile) << 2 | GB(offset, 4, 1) << 1 | GB(offset, 0, 1)];
|
||||||
DrawGroundSprite(t->ground.sprite, palette);
|
DrawGroundSprite(t->ground.sprite, palette);
|
||||||
|
|
||||||
|
|
|
@ -106,52 +106,51 @@ static inline TownID GetStatueTownID(TileIndex t)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the 'stage' of the HQ.
|
* Get animation stage/counter of this tile.
|
||||||
* @param t a tile of the HQ.
|
* @param t The tile to query.
|
||||||
* @pre IsTileType(t, MP_UNMOVABLE)
|
* @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));
|
assert(IsTileType(t, MP_UNMOVABLE));
|
||||||
return GB(_m[t].m6, 2, 4);
|
return GB(_m[t].m6, 2, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the 'stage' of the HQ.
|
* Set animation stage/counter of this tile.
|
||||||
* @param t a tile of the HQ.
|
* @param t The tile to query.
|
||||||
* @param size the actual stage of the HQ
|
* @param stage The stage of this tile.
|
||||||
* @pre IsTileType(t, MP_UNMOVABLE)
|
* @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));
|
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.
|
* Get offset to the northern most tile.
|
||||||
* The scetion is in fact which side of teh HQ the tile represent
|
* @param t The tile to get the offset from.
|
||||||
* @param t a tile of the HQ.
|
* @return The offset to the northern most tile of this structure.
|
||||||
* @pre IsTileType(t, MP_UNMOVABLE)
|
* @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));
|
assert(IsTileType(t, MP_UNMOVABLE));
|
||||||
return _m[t].m3;
|
return _m[t].m3;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the 'section' of the HQ.
|
* Set offset to the northern most tile.
|
||||||
* @param t a tile of the HQ.
|
* @param t The tile to set the offset of.
|
||||||
* @param section to be set.
|
* @param offset The offset to the northern most tile of this structure.
|
||||||
* @pre IsTileType(t, MP_UNMOVABLE)
|
* @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));
|
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)
|
static inline void EnlargeCompanyHQ(TileIndex t, byte size)
|
||||||
{
|
{
|
||||||
assert(GetCompanyHQSection(t) == 0);
|
assert(GetUnmovableOffset(t) == 0);
|
||||||
assert(size <= 4);
|
assert(size <= 4);
|
||||||
if (size <= GetCompanyHQSize(t)) return;
|
if (size <= GetUnmovableAnimationStage(t)) return;
|
||||||
|
|
||||||
SetCompanyHQSize(t, size);
|
SetUnmovableAnimationStage(t, size);
|
||||||
SetCompanyHQSize(t + TileDiffXY(0, 1), size);
|
SetUnmovableAnimationStage(t + TileDiffXY(0, 1), size);
|
||||||
SetCompanyHQSize(t + TileDiffXY(1, 0), size);
|
SetUnmovableAnimationStage(t + TileDiffXY(1, 0), size);
|
||||||
SetCompanyHQSize(t + TileDiffXY(1, 1), size);
|
SetUnmovableAnimationStage(t + TileDiffXY(1, 1), size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue