forked from mirror/OpenTTD
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
This commit is contained in:
@@ -321,14 +321,14 @@ void DrawTileLayout(const TileInfo *ti, const SpriteGroup *group, byte stage, Ho
|
||||
|
||||
if (IS_CUSTOM_SPRITE(image)) image += stage;
|
||||
|
||||
if ((HASBIT(image, SPRITE_MODIFIER_OPAQUE) || !IsTransparencySet(TO_HOUSES)) && HASBIT(image, PALETTE_MODIFIER_COLOR)) {
|
||||
if ((HasBit(image, SPRITE_MODIFIER_OPAQUE) || !IsTransparencySet(TO_HOUSES)) && HasBit(image, PALETTE_MODIFIER_COLOR)) {
|
||||
if (pal == 0) {
|
||||
const HouseSpec *hs = GetHouseSpecs(house_id);
|
||||
if (HASBIT(hs->callback_mask, CBM_HOUSE_COLOUR)) {
|
||||
if (HasBit(hs->callback_mask, CBM_HOUSE_COLOUR)) {
|
||||
uint16 callback = GetHouseCallback(CBID_HOUSE_COLOUR, 0, 0, house_id, GetTownByTile(ti->tile), ti->tile);
|
||||
if (callback != CALLBACK_FAILED) {
|
||||
/* If bit 14 is set, we should use a 2cc colour map, else use the callback value. */
|
||||
pal = HASBIT(callback, 14) ? GB(callback, 0, 8) + SPR_2CCMAP_BASE : callback;
|
||||
pal = HasBit(callback, 14) ? GB(callback, 0, 8) + SPR_2CCMAP_BASE : callback;
|
||||
}
|
||||
} else {
|
||||
pal = hs->random_colour[OriginalTileRandomiser(ti->x, ti->y)] + PALETTE_RECOLOR_START;
|
||||
@@ -380,7 +380,7 @@ void AnimateNewHouseTile(TileIndex tile)
|
||||
byte animation_speed = hs->animation_speed;
|
||||
bool frame_set_by_callback = false;
|
||||
|
||||
if (HASBIT(hs->callback_mask, CBM_HOUSE_ANIMATION_SPEED)) {
|
||||
if (HasBit(hs->callback_mask, CBM_HOUSE_ANIMATION_SPEED)) {
|
||||
uint16 callback_res = GetHouseCallback(CBID_HOUSE_ANIMATION_SPEED, 0, 0, GetHouseType(tile), GetTownByTile(tile), tile);
|
||||
if (callback_res != CALLBACK_FAILED) animation_speed = Clamp(callback_res & 0xFF, 2, 16);
|
||||
}
|
||||
@@ -394,7 +394,7 @@ void AnimateNewHouseTile(TileIndex tile)
|
||||
byte frame = GetHouseAnimationFrame(tile);
|
||||
byte num_frames = GB(hs->animation_frames, 0, 7);
|
||||
|
||||
if (HASBIT(hs->callback_mask, CBM_HOUSE_ANIMATION_NEXT_FRAME)) {
|
||||
if (HasBit(hs->callback_mask, CBM_HOUSE_ANIMATION_NEXT_FRAME)) {
|
||||
uint32 param = (hs->extra_flags & CALLBACK_1A_RANDOM_BITS) ? Random() : 0;
|
||||
uint16 callback_res = GetHouseCallback(CBID_HOUSE_ANIMATION_NEXT_FRAME, param, 0, GetHouseType(tile), GetTownByTile(tile), tile);
|
||||
|
||||
@@ -423,7 +423,7 @@ void AnimateNewHouseTile(TileIndex tile)
|
||||
if (!frame_set_by_callback) {
|
||||
if (frame < num_frames) {
|
||||
frame++;
|
||||
} else if (frame == num_frames && HASBIT(hs->animation_frames, 7)) {
|
||||
} else if (frame == num_frames && HasBit(hs->animation_frames, 7)) {
|
||||
/* This animation loops, so start again from the beginning */
|
||||
frame = 0;
|
||||
} else {
|
||||
@@ -461,7 +461,7 @@ bool CanDeleteHouse(TileIndex tile)
|
||||
if ((IsValidPlayer(_current_player) && IsHumanPlayer(_current_player))
|
||||
|| _current_player == OWNER_WATER || _current_player == OWNER_NONE) return true;
|
||||
|
||||
if (HASBIT(hs->callback_mask, CBM_HOUSE_DENY_DESTRUCTION)) {
|
||||
if (HasBit(hs->callback_mask, CBM_HOUSE_DENY_DESTRUCTION)) {
|
||||
uint16 callback_res = GetHouseCallback(CBID_HOUSE_DENY_DESTRUCTION, 0, 0, GetHouseType(tile), GetTownByTile(tile), tile);
|
||||
return (callback_res == CALLBACK_FAILED || callback_res == 0);
|
||||
} else {
|
||||
@@ -473,7 +473,7 @@ static void AnimationControl(TileIndex tile, uint16 random_bits)
|
||||
{
|
||||
const HouseSpec *hs = GetHouseSpecs(GetHouseType(tile));
|
||||
|
||||
if (HASBIT(hs->callback_mask, CBM_HOUSE_ANIMATION_START_STOP)) {
|
||||
if (HasBit(hs->callback_mask, CBM_HOUSE_ANIMATION_START_STOP)) {
|
||||
uint32 param = (hs->extra_flags & SYNCHRONISED_CALLBACK_1B) ? (GB(Random(), 0, 16) | random_bits << 16) : Random();
|
||||
uint16 callback_res = GetHouseCallback(CBID_HOUSE_ANIMATION_START_STOP, param, 0, GetHouseType(tile), GetTownByTile(tile), tile);
|
||||
|
||||
@@ -493,7 +493,7 @@ bool NewHouseTileLoop(TileIndex tile)
|
||||
TriggerHouse(tile, HOUSE_TRIGGER_TILE_LOOP);
|
||||
TriggerHouse(tile, HOUSE_TRIGGER_TILE_LOOP_TOP);
|
||||
|
||||
if (HASBIT(hs->callback_mask, CBM_HOUSE_ANIMATION_START_STOP)) {
|
||||
if (HasBit(hs->callback_mask, CBM_HOUSE_ANIMATION_START_STOP)) {
|
||||
/* If this house is marked as having a synchronised callback, all the
|
||||
* tiles will have the callback called at once, rather than when the
|
||||
* tile loop reaches them. This should only be enabled for the northern
|
||||
@@ -511,7 +511,7 @@ bool NewHouseTileLoop(TileIndex tile)
|
||||
}
|
||||
|
||||
/* Check callback 21, which determines if a house should be destroyed. */
|
||||
if (HASBIT(hs->callback_mask, CBM_HOUSE_DESTRUCTION)) {
|
||||
if (HasBit(hs->callback_mask, CBM_HOUSE_DESTRUCTION)) {
|
||||
uint16 callback_res = GetHouseCallback(CBID_HOUSE_DESTRUCTION, 0, 0, GetHouseType(tile), GetTownByTile(tile), tile);
|
||||
if (callback_res != CALLBACK_FAILED && callback_res > 0) {
|
||||
ClearTownHouse(GetTownByTile(tile), tile);
|
||||
|
Reference in New Issue
Block a user