summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorskidd13 <skidd13@openttd.org>2007-11-19 21:02:30 +0000
committerskidd13 <skidd13@openttd.org>2007-11-19 21:02:30 +0000
commit71c4325c50ae594a5adf01cac7c9e527b239cdcb (patch)
tree21212e0b25777aac62f30d88b981e2bd624c4616
parent58bb5c752568f8f9a1cb4d9533268d0ecad34e12 (diff)
downloadopenttd-71c4325c50ae594a5adf01cac7c9e527b239cdcb.tar.xz
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
-rw-r--r--src/ai/default/default.cpp10
-rw-r--r--src/ai/trolly/build.cpp2
-rw-r--r--src/ai/trolly/pathfinder.cpp8
-rw-r--r--src/aircraft_cmd.cpp12
-rw-r--r--src/airport_gui.cpp6
-rw-r--r--src/articulated_vehicles.cpp6
-rw-r--r--src/autoreplace_cmd.cpp2
-rw-r--r--src/autoreplace_gui.cpp2
-rw-r--r--src/bridge_map.h4
-rw-r--r--src/build_vehicle_gui.cpp2
-rw-r--r--src/disaster_cmd.cpp16
-rw-r--r--src/economy.cpp32
-rw-r--r--src/elrail.cpp24
-rw-r--r--src/engine.cpp14
-rw-r--r--src/fontcache.cpp4
-rw-r--r--src/gfx.cpp6
-rw-r--r--src/graph_gui.cpp10
-rw-r--r--src/group_cmd.cpp2
-rw-r--r--src/industry_cmd.cpp46
-rw-r--r--src/industry_gui.cpp10
-rw-r--r--src/industry_map.h2
-rw-r--r--src/macros.h2
-rw-r--r--src/main_gui.cpp16
-rw-r--r--src/network/core/udp.cpp4
-rw-r--r--src/network/network_server.cpp4
-rw-r--r--src/newgrf.cpp82
-rw-r--r--src/newgrf_cargo.cpp2
-rw-r--r--src/newgrf_config.cpp8
-rw-r--r--src/newgrf_engine.cpp2
-rw-r--r--src/newgrf_gui.cpp6
-rw-r--r--src/newgrf_house.cpp20
-rw-r--r--src/newgrf_industries.cpp6
-rw-r--r--src/newgrf_industrytiles.cpp14
-rw-r--r--src/newgrf_sound.cpp2
-rw-r--r--src/newgrf_station.cpp28
-rw-r--r--src/newgrf_townname.cpp4
-rw-r--r--src/npf.cpp2
-rw-r--r--src/npf.h2
-rw-r--r--src/oldloader.cpp2
-rw-r--r--src/openttd.cpp24
-rw-r--r--src/order_cmd.cpp8
-rw-r--r--src/pathfind.cpp16
-rw-r--r--src/player.h4
-rw-r--r--src/player_face.h4
-rw-r--r--src/player_gui.cpp22
-rw-r--r--src/players.cpp48
-rw-r--r--src/rail.h4
-rw-r--r--src/rail_cmd.cpp34
-rw-r--r--src/rail_gui.cpp36
-rw-r--r--src/rail_map.h6
-rw-r--r--src/road.h2
-rw-r--r--src/road_cmd.cpp64
-rw-r--r--src/road_gui.cpp2
-rw-r--r--src/road_map.cpp4
-rw-r--r--src/road_map.h8
-rw-r--r--src/roadveh_cmd.cpp42
-rw-r--r--src/saveload.cpp8
-rw-r--r--src/settings.cpp6
-rw-r--r--src/settings_gui.cpp8
-rw-r--r--src/ship_cmd.cpp14
-rw-r--r--src/station.cpp6
-rw-r--r--src/station_cmd.cpp76
-rw-r--r--src/station_gui.cpp22
-rw-r--r--src/station_map.h4
-rw-r--r--src/strgen/strgen.cpp2
-rw-r--r--src/string.cpp2
-rw-r--r--src/strings.cpp2
-rw-r--r--src/timetable_cmd.cpp10
-rw-r--r--src/timetable_gui.cpp4
-rw-r--r--src/town_cmd.cpp18
-rw-r--r--src/town_gui.cpp6
-rw-r--r--src/town_map.h4
-rw-r--r--src/train.h12
-rw-r--r--src/train_cmd.cpp74
-rw-r--r--src/transparency.h2
-rw-r--r--src/tunnel_map.h4
-rw-r--r--src/tunnelbridge_cmd.cpp36
-rw-r--r--src/vehicle.cpp38
-rw-r--r--src/vehicle_gui.cpp8
-rw-r--r--src/viewport.cpp16
-rw-r--r--src/water_cmd.cpp6
-rw-r--r--src/water_map.h2
-rw-r--r--src/widget.cpp10
-rw-r--r--src/win32.cpp2
-rw-r--r--src/window.cpp2
-rw-r--r--src/window.h6
-rw-r--r--src/yapf/follow_track.hpp2
-rw-r--r--src/yapf/yapf_destrail.hpp2
88 files changed, 584 insertions, 584 deletions
diff --git a/src/ai/default/default.cpp b/src/ai/default/default.cpp
index 1d6ca0189..419dd39bb 100644
--- a/src/ai/default/default.cpp
+++ b/src/ai/default/default.cpp
@@ -146,7 +146,7 @@ static EngineID AiChooseTrainToBuild(RailType railtype, Money money, byte flag,
if (!IsCompatibleRail(rvi->railtype, railtype) ||
rvi->railveh_type == RAILVEH_WAGON ||
(rvi->railveh_type == RAILVEH_MULTIHEAD && flag & 1) ||
- !HASBIT(e->player_avail, _current_player) ||
+ !HasBit(e->player_avail, _current_player) ||
e->reliability < 0x8A3D) {
continue;
}
@@ -174,7 +174,7 @@ static EngineID AiChooseRoadVehToBuild(CargoID cargo, Money money, TileIndex til
int32 rating;
CommandCost ret;
- if (!HASBIT(e->player_avail, _current_player) || e->reliability < 0x8A3D) {
+ if (!HasBit(e->player_avail, _current_player) || e->reliability < 0x8A3D) {
continue;
}
@@ -209,7 +209,7 @@ static EngineID AiChooseAircraftToBuild(Money money, byte flag)
const Engine* e = GetEngine(i);
CommandCost ret;
- if (!HASBIT(e->player_avail, _current_player) || e->reliability < 0x8A3D) {
+ if (!HasBit(e->player_avail, _current_player) || e->reliability < 0x8A3D) {
continue;
}
@@ -2412,7 +2412,7 @@ static EngineID AiFindBestWagon(CargoID cargo, RailType railtype)
if (!IsCompatibleRail(rvi->railtype, railtype) ||
rvi->railveh_type != RAILVEH_WAGON ||
- !HASBIT(e->player_avail, _current_player)) {
+ !HasBit(e->player_avail, _current_player)) {
continue;
}
@@ -3366,7 +3366,7 @@ static CommandCost AiDoBuildDefaultAirportBlock(TileIndex tile, const AiDefaultB
CommandCost total_cost, ret;
for (; p->mode == 0; p++) {
- if (!HASBIT(avail_airports, p->attr)) return CMD_ERROR;
+ if (!HasBit(avail_airports, p->attr)) return CMD_ERROR;
ret = DoCommand(TILE_MASK(tile + ToTileIndexDiff(p->tileoffs)), p->attr, 0, flag | DC_AUTO | DC_NO_WATER, CMD_BUILD_AIRPORT);
if (CmdFailed(ret)) return CMD_ERROR;
total_cost.AddCost(ret);
diff --git a/src/ai/trolly/build.cpp b/src/ai/trolly/build.cpp
index 472956bf6..31147b17b 100644
--- a/src/ai/trolly/build.cpp
+++ b/src/ai/trolly/build.cpp
@@ -250,7 +250,7 @@ EngineID AiNew_PickVehicle(Player *p)
// Is it availiable?
// Also, check if the reliability of the vehicle is above the AI_VEHICLE_MIN_RELIABILTY
- if (!HASBIT(e->player_avail, _current_player) || e->reliability * 100 < AI_VEHICLE_MIN_RELIABILTY << 16) continue;
+ if (!HasBit(e->player_avail, _current_player) || e->reliability * 100 < AI_VEHICLE_MIN_RELIABILTY << 16) continue;
/* Rate and compare the engine by speed & capacity */
rating = rvi->max_speed * rvi->capacity;
diff --git a/src/ai/trolly/pathfinder.cpp b/src/ai/trolly/pathfinder.cpp
index 00fcf2fe2..bd243dd31 100644
--- a/src/ai/trolly/pathfinder.cpp
+++ b/src/ai/trolly/pathfinder.cpp
@@ -411,7 +411,7 @@ static int32 AyStar_AiPathFinder_CalculateG(AyStar *aystar, AyStarNode *current,
if (PathFinderInfo->rail_or_road) {
Foundation f = GetRailFoundation(parent_tileh, (TrackBits)(1 << AiNew_GetRailDirection(parent->path.parent->node.tile, parent->path.node.tile, current->tile)));
// Maybe is BRIDGE_NO_FOUNDATION a bit strange here, but it contains just the right information..
- if (IsInclinedFoundation(f) || (!IsFoundation(f) && HASBIT(BRIDGE_NO_FOUNDATION, parent_tileh))) {
+ if (IsInclinedFoundation(f) || (!IsFoundation(f) && HasBit(BRIDGE_NO_FOUNDATION, parent_tileh))) {
res += AI_PATHFINDER_TILE_GOES_UP_PENALTY;
} else {
res += AI_PATHFINDER_FOUNDATION_PENALTY;
@@ -419,7 +419,7 @@ static int32 AyStar_AiPathFinder_CalculateG(AyStar *aystar, AyStarNode *current,
} else {
if (!IsRoad(parent->path.node.tile) || !IsTileType(parent->path.node.tile, MP_TUNNELBRIDGE)) {
Foundation f = GetRoadFoundation(parent_tileh, (RoadBits)AiNew_GetRoadDirection(parent->path.parent->node.tile, parent->path.node.tile, current->tile));
- if (IsInclinedFoundation(f) || (!IsFoundation(f) && HASBIT(BRIDGE_NO_FOUNDATION, parent_tileh))) {
+ if (IsInclinedFoundation(f) || (!IsFoundation(f) && HasBit(BRIDGE_NO_FOUNDATION, parent_tileh))) {
res += AI_PATHFINDER_TILE_GOES_UP_PENALTY;
} else {
res += AI_PATHFINDER_FOUNDATION_PENALTY;
@@ -444,13 +444,13 @@ static int32 AyStar_AiPathFinder_CalculateG(AyStar *aystar, AyStarNode *current,
res += AI_PATHFINDER_BRIDGE_PENALTY * GetBridgeLength(current->tile, parent->path.node.tile);
// Check if we are going up or down, first for the starting point
// In user_data[0] is at the 8th bit the direction
- if (!HASBIT(BRIDGE_NO_FOUNDATION, parent_tileh)) {
+ if (!HasBit(BRIDGE_NO_FOUNDATION, parent_tileh)) {
if (IsLeveledFoundation(GetBridgeFoundation(parent_tileh, (Axis)((current->user_data[0] >> 8) & 1)))) {
res += AI_PATHFINDER_BRIDGE_GOES_UP_PENALTY;
}
}
// Second for the end point
- if (!HASBIT(BRIDGE_NO_FOUNDATION, tileh)) {
+ if (!HasBit(BRIDGE_NO_FOUNDATION, tileh)) {
if (IsLeveledFoundation(GetBridgeFoundation(tileh, (Axis)((current->user_data[0] >> 8) & 1)))) {
res += AI_PATHFINDER_BRIDGE_GOES_UP_PENALTY;
}
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp
index 72d13e0f4..41116eb9d 100644
--- a/src/aircraft_cmd.cpp
+++ b/src/aircraft_cmd.cpp
@@ -291,7 +291,7 @@ CommandCost CmdBuildAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
}
- UnitID unit_num = HASBIT(p2, 0) ? 0 : GetFreeUnitNumber(VEH_AIRCRAFT);
+ UnitID unit_num = HasBit(p2, 0) ? 0 : GetFreeUnitNumber(VEH_AIRCRAFT);
if (unit_num > _patches.max_aircraft)
return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
@@ -364,7 +364,7 @@ CommandCost CmdBuildAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
v->cargo_type = cargo;
- if (HASBIT(EngInfo(p1)->callbackmask, CBM_VEHICLE_REFIT_CAPACITY)) {
+ if (HasBit(EngInfo(p1)->callbackmask, CBM_VEHICLE_REFIT_CAPACITY)) {
callback = GetVehicleCallback(CBID_VEHICLE_REFIT_CAPACITY, 0, 0, v->engine_type, v);
}
@@ -568,7 +568,7 @@ CommandCost CmdSendAircraftToHangar(TileIndex tile, uint32 flags, uint32 p1, uin
if (v->type != VEH_AIRCRAFT || !CheckOwnership(v->owner) || v->IsInDepot()) return CMD_ERROR;
if (v->current_order.type == OT_GOTO_DEPOT && !(p2 & DEPOT_LOCATE_HANGAR)) {
- if (!!(p2 & DEPOT_SERVICE) == HASBIT(v->current_order.flags, OFB_HALT_IN_DEPOT)) {
+ if (!!(p2 & DEPOT_SERVICE) == HasBit(v->current_order.flags, OFB_HALT_IN_DEPOT)) {
/* We called with a different DEPOT_SERVICE setting.
* Now we change the setting to apply the new one and let the vehicle head for the same hangar.
* Note: the if is (true for requesting service == true for ordered to stop in hangar) */
@@ -650,7 +650,7 @@ CommandCost CmdRefitAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
/* Check the refit capacity callback */
uint16 callback = CALLBACK_FAILED;
- if (HASBIT(EngInfo(v->engine_type)->callbackmask, CBM_VEHICLE_REFIT_CAPACITY)) {
+ if (HasBit(EngInfo(v->engine_type)->callbackmask, CBM_VEHICLE_REFIT_CAPACITY)) {
/* Back up the existing cargo type */
CargoID temp_cid = v->cargo_type;
byte temp_subtype = v->cargo_subtype;
@@ -1680,7 +1680,7 @@ static void AircraftEventHandler_HeliTakeOff(Vehicle *v, const AirportFTAClass *
if (v->owner == _local_player && (
EngineHasReplacementForPlayer(p, v->engine_type, v->group_id) ||
((p->engine_renew && v->age - v->max_age > p->engine_renew_months * 30) &&
- HASBIT(GetEngine(v->engine_type)->player_avail, _local_player))
+ HasBit(GetEngine(v->engine_type)->player_avail, _local_player))
)) {
_current_player = _local_player;
DoCommandP(v->tile, v->index, DEPOT_SERVICE | DEPOT_LOCATE_HANGAR, NULL, CMD_SEND_AIRCRAFT_TO_HANGAR | CMD_SHOW_NO_ERROR);
@@ -1957,7 +1957,7 @@ static bool FreeTerminal(Vehicle *v, byte i, byte last_terminal)
{
Station *st = GetStation(v->u.air.targetairport);
for (; i < last_terminal; i++) {
- if (!HASBIT(st->airport_flags, _airport_terminal_flag[i])) {
+ if (!HasBit(st->airport_flags, _airport_terminal_flag[i])) {
/* TERMINAL# HELIPAD# */
v->u.air.state = _airport_terminal_state[i]; // start moving to that terminal/helipad
SETBIT(st->airport_flags, _airport_terminal_flag[i]); // occupy terminal/helipad
diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp
index 9c60950d0..adb391ca0 100644
--- a/src/airport_gui.cpp
+++ b/src/airport_gui.cpp
@@ -160,8 +160,8 @@ static void BuildAirportPickerWndProc(Window *w, WindowEvent *e)
avail_airports = GetValidAirports();
RaiseWindowWidget(w, _selected_airport_type + 7);
- if (!HASBIT(avail_airports, 0) && _selected_airport_type == AT_SMALL) _selected_airport_type = AT_LARGE;
- if (!HASBIT(avail_airports, 1) && _selected_airport_type == AT_LARGE) _selected_airport_type = AT_SMALL;
+ if (!HasBit(avail_airports, 0) && _selected_airport_type == AT_SMALL) _selected_airport_type = AT_LARGE;
+ if (!HasBit(avail_airports, 1) && _selected_airport_type == AT_LARGE) _selected_airport_type = AT_SMALL;
LowerWindowWidget(w, _selected_airport_type + 7);
/* 'Country Airport' starts at widget 7, and if its bit is set, it is
@@ -170,7 +170,7 @@ static void BuildAirportPickerWndProc(Window *w, WindowEvent *e)
* XXX TODO : all airports should be held in arrays, with all relevant data.
* This should be part of newgrf-airports, i suppose
*/
- for (i = 0; i < 9; i++) SetWindowWidgetDisabledState(w, i + 7, !HASBIT(avail_airports, i));
+ for (i = 0; i < 9; i++) SetWindowWidgetDisabledState(w, i + 7, !HasBit(avail_airports, i));
// select default the coverage area to 'Off' (16)
airport = GetAirport(_selected_airport_type);
diff --git a/src/articulated_vehicles.cpp b/src/articulated_vehicles.cpp
index cf04a0c2c..82c6c1add 100644
--- a/src/articulated_vehicles.cpp
+++ b/src/articulated_vehicles.cpp
@@ -17,7 +17,7 @@
uint CountArticulatedParts(EngineID engine_type, bool purchase_window)
{
- if (!HASBIT(EngInfo(engine_type)->callbackmask, CBM_VEHICLE_ARTIC_ENGINE)) return 0;
+ if (!HasBit(EngInfo(engine_type)->callbackmask, CBM_VEHICLE_ARTIC_ENGINE)) return 0;
Vehicle *v = NULL;;
if (!purchase_window) {
@@ -41,7 +41,7 @@ void AddArticulatedParts(Vehicle **vl, VehicleType type)
const Vehicle *v = vl[0];
Vehicle *u = vl[0];
- if (!HASBIT(EngInfo(v->engine_type)->callbackmask, CBM_VEHICLE_ARTIC_ENGINE)) return;
+ if (!HasBit(EngInfo(v->engine_type)->callbackmask, CBM_VEHICLE_ARTIC_ENGINE)) return;
for (uint i = 1; i < MAX_UVALUE(EngineID); i++) {
uint16 callback = GetVehicleCallback(CBID_VEHICLE_ARTIC_ENGINE, i, 0, v->engine_type, v);
@@ -56,7 +56,7 @@ void AddArticulatedParts(Vehicle **vl, VehicleType type)
u = u->Next();
EngineID engine_type = GetFirstEngineOfType(type) + GB(callback, 0, 7);
- bool flip_image = HASBIT(callback, 7);
+ bool flip_image = HasBit(callback, 7);
/* get common values from first engine */
u->direction = v->direction;
diff --git a/src/autoreplace_cmd.cpp b/src/autoreplace_cmd.cpp
index ca0d2c06e..e86acca76 100644
--- a/src/autoreplace_cmd.cpp
+++ b/src/autoreplace_cmd.cpp
@@ -189,7 +189,7 @@ static CommandCost ReplaceVehicle(Vehicle **w, byte flags, Money total_cost)
}
}
- if (new_v->type == VEH_TRAIN && HASBIT(old_v->u.rail.flags, VRF_REVERSE_DIRECTION) && !IsMultiheaded(new_v) && !(new_v->Next() != NULL && IsArticulatedPart(new_v->Next()))) {
+ if (new_v->type == VEH_TRAIN && HasBit(old_v->u.rail.flags, VRF_REVERSE_DIRECTION) && !IsMultiheaded(new_v) && !(new_v->Next() != NULL && IsArticulatedPart(new_v->Next()))) {
// we are autorenewing to a single engine, so we will turn it as the old one was turned as well
SETBIT(new_v->u.rail.flags, VRF_REVERSE_DIRECTION);
}
diff --git a/src/autoreplace_gui.cpp b/src/autoreplace_gui.cpp
index 1b1fe2a63..ee415140d 100644
--- a/src/autoreplace_gui.cpp
+++ b/src/autoreplace_gui.cpp
@@ -164,7 +164,7 @@ static void GenerateReplaceVehList(Window *w, bool draw_left)
if (!EnginesGotCargoInCommon(e, WP(w, replaceveh_d).sel_engine[0])) continue; // the engines needs to be able to carry the same cargo
/* Road vehicles can't be replaced by trams and vice-versa */
- if (type == VEH_ROAD && HASBIT(EngInfo(WP(w, replaceveh_d).sel_engine[0])->misc_flags, EF_ROAD_TRAM) != HASBIT(EngInfo(e)->misc_flags, EF_ROAD_TRAM)) continue;
+ if (type == VEH_ROAD && HasBit(EngInfo(WP(w, replaceveh_d).sel_engine[0])->misc_flags, EF_ROAD_TRAM) != HasBit(EngInfo(e)->misc_flags, EF_ROAD_TRAM)) continue;
if (e == WP(w, replaceveh_d).sel_engine[0]) continue; // we can't replace an engine into itself (that would be autorenew)
}
diff --git a/src/bridge_map.h b/src/bridge_map.h
index 9f48c9238..be4354fe7 100644
--- a/src/bridge_map.h
+++ b/src/bridge_map.h
@@ -22,7 +22,7 @@
static inline bool IsBridge(TileIndex t)
{
assert(IsTileType(t, MP_TUNNELBRIDGE));
- return HASBIT(_m[t].m5, 7);
+ return HasBit(_m[t].m5, 7);
}
/**
@@ -126,7 +126,7 @@ static inline TransportType GetBridgeTransportType(TileIndex t)
static inline bool HasBridgeSnowOrDesert(TileIndex t)
{
assert(IsBridgeTile(t));
- return HASBIT(_m[t].m4, 7);
+ return HasBit(_m[t].m4, 7);
}
diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp
index 408a8baab..3e40584ea 100644
--- a/src/build_vehicle_gui.cpp
+++ b/src/build_vehicle_gui.cpp
@@ -722,7 +722,7 @@ static void GenerateBuildRoadVehList(Window *w)
for (eid = ROAD_ENGINES_INDEX; eid < ROAD_ENGINES_INDEX + NUM_ROAD_ENGINES; eid++) {
if (!IsEngineBuildable(eid, VEH_ROAD, _local_player)) continue;
- if (!HASBIT(bv->filter.roadtypes, HASBIT(EngInfo(eid)->misc_flags, EF_ROAD_TRAM) ? ROADTYPE_TRAM : ROADTYPE_ROAD)) continue;
+ if (!HasBit(bv->filter.roadtypes, HasBit(EngInfo(eid)->misc_flags, EF_ROAD_TRAM) ? ROADTYPE_TRAM : ROADTYPE_ROAD)) continue;
EngList_Add(&bv->eng_list, eid);
if (eid == bv->sel_engine) sel_id = eid;
diff --git a/src/disaster_cmd.cpp b/src/disaster_cmd.cpp
index dc37153c6..53db580e6 100644
--- a/src/disaster_cmd.cpp
+++ b/src/disaster_cmd.cpp
@@ -202,7 +202,7 @@ static void DisasterTick_Zeppeliner(Vehicle *v)
v->tick_counter++;
if (v->current_order.dest < 2) {
- if (HASBIT(v->tick_counter, 0)) return;
+ if (HasBit(v->tick_counter, 0)) return;
GetNewVehiclePosResult gp = GetNewVehiclePos(v);
@@ -305,7 +305,7 @@ static void DisasterTick_Ufo(Vehicle *v)
uint dist;
byte z;
- v->u.disaster.image_override = (HASBIT(++v->tick_counter, 3)) ? SPR_UFO_SMALL_SCOUT_DARKER : SPR_UFO_SMALL_SCOUT;
+ v->u.disaster.image_override = (HasBit(++v->tick_counter, 3)) ? SPR_UFO_SMALL_SCOUT_DARKER : SPR_UFO_SMALL_SCOUT;
if (v->current_order.dest == 0) {
/* Fly around randomly */
@@ -400,7 +400,7 @@ static void DisasterTick_Airplane(Vehicle *v)
{
v->tick_counter++;
v->u.disaster.image_override =
- (v->current_order.dest == 1 && HASBIT(v->tick_counter, 2)) ? SPR_F_15_FIRING : 0;
+ (v->current_order.dest == 1 && HasBit(v->tick_counter, 2)) ? SPR_F_15_FIRING : 0;
GetNewVehiclePosResult gp = GetNewVehiclePos(v);
SetDisasterVehiclePos(v, gp.x, gp.y, v->z_pos);
@@ -473,7 +473,7 @@ static void DisasterTick_Helicopter(Vehicle *v)
{
v->tick_counter++;
v->u.disaster.image_override =
- (v->current_order.dest == 1 && HASBIT(v->tick_counter, 2)) ? SPR_AH_64A_FIRING : 0;
+ (v->current_order.dest == 1 && HasBit(v->tick_counter, 2)) ? SPR_AH_64A_FIRING : 0;
GetNewVehiclePosResult gp = GetNewVehiclePos(v);
SetDisasterVehiclePos(v, gp.x, gp.y, v->z_pos);
@@ -539,7 +539,7 @@ static void DisasterTick_Helicopter(Vehicle *v)
static void DisasterTick_Helicopter_Rotors(Vehicle *v)
{
v->tick_counter++;
- if (HASBIT(v->tick_counter, 0)) return;
+ if (HasBit(v->tick_counter, 0)) return;
if (++v->cur_image > SPR_ROTOR_MOVING_3) v->cur_image = SPR_ROTOR_MOVING_1;
@@ -709,7 +709,7 @@ static void DisasterTick_Submarine(Vehicle *v)
return;
}
- if (!HASBIT(v->tick_counter, 0)) return;
+ if (!HasBit(v->tick_counter, 0)) return;
tile = v->tile + TileOffsByDiagDir(DirToDiagDir(v->direction));
if (IsValidTile(tile)) {
@@ -930,7 +930,7 @@ static void Disaster_Small_Submarine_Init()
r = Random();
x = TileX(r) * TILE_SIZE + TILE_SIZE / 2;
- if (HASBIT(r, 31)) {
+ if (HasBit(r, 31)) {
y = MapMaxX() * TILE_SIZE - TILE_SIZE / 2 - 1;
dir = DIR_NW;
} else {
@@ -955,7 +955,7 @@ static void Disaster_Big_Submarine_Init()
r = Random();
x = TileX(r) * TILE_SIZE + TILE_SIZE / 2;
- if (HASBIT(r, 31)) {
+ if (HasBit(r, 31)) {
y = MapMaxX() * TILE_SIZE - TILE_SIZE / 2 - 1;
dir = DIR_NW;
} else {
diff --git a/src/economy.cpp b/src/economy.cpp
index 8e29da3a0..72f69b698 100644
--- a/src/economy.cpp
+++ b/src/economy.cpp
@@ -328,8 +328,8 @@ void ChangeOwnershipOfPlayerItems(PlayerID old_player, PlayerID new_player)
FOR_ALL_TOWNS(t) {
/* If a player takes over, give the ratings to that player. */
if (new_player != PLAYER_SPECTATOR) {
- if (HASBIT(t->have_ratings, old_player)) {
- if (HASBIT(t->have_ratings, new_player)) {
+ if (HasBit(t->have_ratings, old_player)) {
+ if (HasBit(t->have_ratings, new_player)) {
// use max of the two ratings.
t->ratings[new_player] = max(t->ratings[new_player], t->ratings[old_player]);
} else {
@@ -639,7 +639,7 @@ static void PlayersGenStatistics()
SubtractMoneyFromPlayer(_price.station_value >> 1);
}
- if (!HASBIT(1<<0|1<<3|1<<6|1<<9, _cur_month))
+ if (!HasBit(1<<0|1<<3|1<<6|1<<9, _cur_month))
return;
FOR_ALL_PLAYERS(p) {
@@ -1009,7 +1009,7 @@ static void FindSubsidyCargoRoute(FoundRoute *fr)
if (i == NULL) return;
/* Randomize cargo type */
- if (HASBIT(Random(), 0) && i->produced_cargo[1] != CT_INVALID) {
+ if (HasBit(Random(), 0) && i->produced_cargo[1] != CT_INVALID) {
cargo = i->produced_cargo[1];
trans = i->last_month_pct_transported[1];
total = i->last_month_production[1];
@@ -1179,14 +1179,14 @@ Money GetTransportedGoodsIncome(uint num_pieces, uint dist, byte transit_days, C
const CargoSpec *cs = GetCargo(cargo_type);
/* Use callback to calculate cargo profit, if available */
- if (HASBIT(cs->callback_mask, CBM_CARGO_PROFIT_CALC)) {
+ if (HasBit(cs->callback_mask, CBM_CARGO_PROFIT_CALC)) {
uint32 var18 = min(dist, 0xFFFF) | (min(num_pieces, 0xFF) << 16) | (transit_days << 24);
uint16 callback = GetCargoCallback(CBID_CARGO_PROFIT_CALC, 0, var18, cs);
if (callback != CALLBACK_FAILED) {
int result = GB(callback, 0, 14);
/* Simulate a 15 bit signed value */
- if (HASBIT(callback, 14)) result = 0x4000 - result;
+ if (HasBit(callback, 14)) result = 0x4000 - result;
/* "The result should be a signed multiplier that gets multiplied
* by the amount of cargo moved and the price factor, then gets
@@ -1254,7 +1254,7 @@ static void DeliverGoodsToIndustry(TileIndex xy, CargoID cargo_type, int num_pie
/* Check if matching cargo has been found */
if (i == lengthof(ind->accepts_cargo)) continue;
- if (HASBIT(indspec->callback_flags, CBM_IND_REFUSE_CARGO)) {
+ if (HasBit(indspec->callback_flags, CBM_IND_REFUSE_CARGO)) {
uint16 res = GetIndustryCallback(CBID_INDUSTRY_REFUSE_CARGO, 0, GetReverseCargoTranslation(cargo_type, indspec->grf_prop.grffile), ind, ind->type, ind->xy);
if (res == 0) continue;
}
@@ -1276,9 +1276,9 @@ static void DeliverGoodsToIndustry(TileIndex xy, CargoID cargo_type, int num_pie
best->was_cargo_delivered = true;
best->last_cargo_accepted_at = _date;
- if (HASBIT(callback, CBM_IND_PRODUCTION_CARGO_ARRIVAL) || HASBIT(callback, CBM_IND_PRODUCTION_256_TICKS)) {
+ if (HasBit(callback, CBM_IND_PRODUCTION_CARGO_ARRIVAL) || HasBit(callback, CBM_IND_PRODUCTION_256_TICKS)) {
best->incoming_cargo_waiting[accepted_cargo_index] = min(num_pieces + best->incoming_cargo_waiting[accepted_cargo_index], 0xFFFF);
- if (HASBIT(callback, CBM_IND_PRODUCTION_CARGO_ARRIVAL)) {
+ if (HasBit(callback, CBM_IND_PRODUCTION_CARGO_ARRIVAL)) {
IndustryProductionCallback(best, 0);
} else {
InvalidateWindow(WC_INDUSTRY_VIEW, best->index);
@@ -1447,7 +1447,7 @@ void VehiclePayment(Vehicle *front_v)
CargoPacket *cp = *it;
if (!cp->paid_for &&
cp->source != last_visited &&
- HASBIT(ge->acceptance_pickup, GoodsEntry::ACCEPTANCE) &&
+ HasBit(ge->acceptance_pickup, GoodsEntry::ACCEPTANCE) &&
(front_v->current_order.flags & OF_TRANSFER) == 0) {
/* Deliver goods to the station */
st->time_since_unload = 0;
@@ -1515,7 +1515,7 @@ static void LoadUnloadVehicle(Vehicle *v, int *cargo_left)
/* We have not waited enough time till the next round of loading/unloading */
if (--v->load_unload_time_rem != 0) {
- if (_patches.improved_load && HASBIT(v->current_order.flags, OFB_FULL_LOAD)) {
+ if (_patches.improved_load && HasBit(v->current_order.flags, OFB_FULL_LOAD)) {
/* 'Reserve' this cargo for this vehicle, because we were first. */
for (; v != NULL; v = v->Next()) {
if (v->cargo_cap != 0) cargo_left[v->cargo_type] -= v->cargo_cap - v->cargo.Count();
@@ -1551,19 +1551,19 @@ static void LoadUnloadVehicle(Vehicle *v, int *cargo_left)
if (v->cargo_cap == 0) continue;
byte load_amount = EngInfo(v->engine_type)->load_amount;
- if (_patches.gradual_loading && HASBIT(EngInfo(v->engine_type)->callbackmask, CBM_VEHICLE_LOAD_AMOUNT)) {
+ if (_patches.gradual_loading && HasBit(EngInfo(v->engine_type)->callbackmask, CBM_VEHICLE_LOAD_AMOUNT)) {
uint16 cb_load_amount = GetVehicleCallback(CBID_VEHICLE_LOAD_AMOUNT, 0, 0, v->engine_type, v);
if (cb_load_amount != CALLBACK_FAILED && cb_load_amount != 0) load_amount = cb_load_amount & 0xFF;
}
GoodsEntry *ge = &st->goods[v->cargo_type];
- if (HASBIT(v->vehicle_flags, VF_CARGO_UNLOADING)) {
+ if (HasBit(v->vehicle_flags, VF_CARGO_UNLOADING)) {
uint cargo_count = v->cargo.Count();
uint amount_unloaded = _patches.gradual_loading ? min(cargo_count, load_amount) : cargo_count;
bool remaining; // Are there cargo entities in this vehicle that can still be unloaded here?
- if (HASBIT(ge->acceptance_pickup, GoodsEntry::ACCEPTANCE) && !(u->current_order.flags & OF_TRANSFER)) {
+ if (HasBit(ge->acceptance_pickup, GoodsEntry::ACCEPTANCE) && !(u->current_order.flags & OF_TRANSFER)) {
/* The cargo has reached it's final destination, the packets may now be destroyed */
remaining = v->cargo.MoveTo(NULL, amount_unloaded, CargoList::MTA_FINAL_DELIVERY, last_visited);
@@ -1666,7 +1666,7 @@ static void LoadUnloadVehicle(Vehicle *v, int *cargo_left)
* all wagons at the same time instead of using the same 'improved'
* loading algorithm for the wagons (only fill wagon when there is
* enough to fill the previous wagons) */
- if (_patches.improved_load && HASBIT(u->current_order.flags, OFB_FULL_LOAD)) {
+ if (_patches.improved_load && HasBit(u->current_order.flags, OFB_FULL_LOAD)) {
/* Update left cargo */
for (v = u; v != NULL; v = v->Next()) {
if (v->cargo_cap != 0) cargo_left[v->cargo_type] -= v->cargo_cap - v->cargo.Count();
@@ -1685,7 +1685,7 @@ static void LoadUnloadVehicle(Vehicle *v, int *cargo_left)
}
} else {
bool finished_loading = true;
- if (HASBIT(v->current_order.flags, OFB_FULL_LOAD)) {
+ if (HasBit(v->current_order.flags, OFB_FULL_LOAD)) {
if (_patches.full_load_any) {
/* if the aircraft carries passengers and is NOT full, then
* continue loading, no matter how much mail is in */
diff --git a/src/elrail.cpp b/src/elrail.cpp
index 47f854ddf..4e505a80e 100644
--- a/src/elrail.cpp
+++ b/src/elrail.cpp
@@ -69,7 +69,7 @@
static inline TLG GetTLG(TileIndex t)
{
- return (TLG)((HASBIT(TileX(t), 0) << 1) + HASBIT(TileY(t), 0));
+ return (TLG)((HasBit(TileX(t), 0) << 1) + HasBit(TileY(t), 0));
}
/** Finds which Rail Bits are present on a given tile. For bridge tiles,
@@ -270,7 +270,7 @@ static void DrawCatenaryRailway(const TileInfo *ti)
/* We check whether the track in question (k) is present in the tile
* (TrackSourceTile) */
- if (HASBIT(trackconfig[TrackSourceTile[i][k]], TracksAtPCP[i][k])) {
+ if (HasBit(trackconfig[TrackSourceTile[i][k]], TracksAtPCP[i][k])) {
/* track found, if track is in the neighbour tile, adjust the number
* of the PCP for preferred/allowed determination*/
DiagDirection PCPpos = (TrackSourceTile[i][k] == TS_HOME) ? i : ReverseDiagDir(i);
@@ -282,8 +282,8 @@ static void DrawCatenaryRailway(const TileInfo *ti)
}
/* Deactivate all PPPs if PCP is not used */
- PPPpreferred[i] *= HASBIT(PCPstatus, i);
- PPPallowed[i] *= HASBIT(PCPstatus, i);
+ PPPpreferred[i] *= HasBit(PCPstatus, i);
+ PPPallowed[i] *= HasBit(PCPstatus, i);
/* A station is always "flat", so adjust the tileh accordingly */
if (IsTileType(neighbour, MP_STATION)) tileh[TS_NEIGHBOUR] = SLOPE_FLAT;
@@ -326,16 +326,16 @@ static void DrawCatenaryRailway(const TileInfo *ti)
}
}
- if (PPPallowed[i] != 0 && HASBIT(PCPstatus, i) && !HASBIT(OverridePCP, i)) {
+ if (PPPallowed[i] != 0 && HasBit(PCPstatus, i) && !HasBit(OverridePCP, i)) {
for (k = 0; k < DIR_END; k++) {
byte temp = PPPorder[i][GetTLG(ti->tile)][k];
- if (HASBIT(PPPallowed[i], temp)) {
+ if (HasBit(PPPallowed[i], temp)) {
uint x = ti->x + x_pcp_offsets[i] + x_ppp_offsets[temp];
uint y = ti->y + y_pcp_offsets[i] + y_ppp_offsets[temp];
/* Don't build the pylon if it would be outside the tile */
- if (!HASBIT(OwnedPPPonPCP[i], temp)) {
+ if (!HasBit(OwnedPPPonPCP[i], temp)) {
/* We have a neighour that will draw it, bail out */
if (trackconfig[TS_NEIGHBOUR] != 0) break;
continue; /* No neighbour, go looking for a better position */
@@ -359,10 +359,10 @@ static void DrawCatenaryRailway(const TileInfo *ti)
/* Drawing of pylons is finished, now draw the wires */
for (t = TRACK_BEGIN; t < TRACK_END; t++) {
- if (HASBIT(trackconfig[TS_HOME], t)) {
+ if (HasBit(trackconfig[TS_HOME], t)) {
if (IsTunnelTile(ti->tile)) break; // drawn together with tunnel-roof (see DrawCatenaryOnTunnel())
- byte PCPconfig = HASBIT(PCPstatus, PCPpositions[t][0]) +
- (HASBIT(PCPstatus, PCPpositions[t][1]) << 1);
+ byte PCPconfig = HasBit(PCPstatus, PCPpositions[t][0]) +
+ (HasBit(PCPstatus, PCPpositions[t][1]) << 1);
const SortableSpriteStruct *sss;
int tileh_selector = !(tileh[TS_HOME] % 3) * tileh[TS_HOME] / 3; /* tileh for the slopes, 0 otherwise */
@@ -419,7 +419,7 @@ static void DrawCatenaryOnBridge(const TileInfo *ti)
if (num % 2) {
DiagDirection PCPpos = (axis == AXIS_X ? DIAGDIR_NE : DIAGDIR_NW);
Direction PPPpos = (axis == AXIS_X ? DIR_NW : DIR_NE);
- if (HASBIT(tlg, (axis == AXIS_X ? 0 : 1))) PPPpos = ReverseDir(PPPpos);
+ if (HasBit(tlg, (axis == AXIS_X ? 0 : 1))) PPPpos = ReverseDir(PPPpos);
uint x = ti->x + x_pcp_offsets[PCPpos] + x_ppp_offsets[PPPpos];
uint y = ti->y + y_pcp_offsets[PCPpos] + y_ppp_offsets[PPPpos];
AddSortableSpriteToDraw(pylon_sprites[PPPpos], PAL_NONE, x, y, 1, 1, BB_HEIGHT_UNDER_BRIDGE, height, IsTransparencySet(TO_BUILDINGS), -1, -1);
@@ -429,7 +429,7 @@ static void DrawCatenaryOnBridge(const TileInfo *ti)
if (DistanceMax(ti->tile, start) == length) {
DiagDirection PCPpos = (axis == AXIS_X ? DIAGDIR_SW : DIAGDIR_SE);
Direction PPPpos = (axis == AXIS_X ? DIR_NW : DIR_NE);
- if (HASBIT(tlg, (axis == AXIS_X ? 0 : 1))) PPPpos = ReverseDir(PPPpos);
+ if (HasBit(tlg, (axis == AXIS_X ? 0 : 1))) PPPpos = ReverseDir(PPPpos);
uint x = ti->x + x_pcp_offsets[PCPpos] + x_ppp_offsets[PPPpos];
uint y = ti->y + y_pcp_offsets[PCPpos] + y_ppp_offsets[PPPpos];
AddSortableSpriteToDraw(pylon_sprites[PPPpos], PAL_NONE, x, y, 1, 1, BB_HEIGHT_UNDER_BRIDGE, height, IsTransparencySet(TO_BUILDINGS), -1, -1);
diff --git a/src/engine.cpp b/src/engine.cpp
index 144da2959..ba9fba42e 100644
--- a/src/engine.cpp
+++ b/src/engine.cpp
@@ -165,7 +165,7 @@ void StartupEngines()
e->lifelength = ei->lifelength + _patches.extend_vehicle_life;
/* prevent certain engines from ever appearing. */
- if (!HASBIT(ei->climates, _opt.landscape)) {
+ if (!HasBit(ei->climates, _opt.landscape)) {
e->flags |= ENGINE_AVAILABLE;
e->player_avail = 0;
}
@@ -190,7 +190,7 @@ static void AcceptEnginePreview(EngineID eid, PlayerID player)
assert(rvi->railtype < RAILTYPE_END);
SETBIT(p->avail_railtypes, rvi->railtype);
} else if (e->type == VEH_ROAD) {
- SETBIT(p->avail_roadtypes, HASBIT(EngInfo(eid)->misc_flags, EF_ROAD_TRAM) ? ROADTYPE_TRAM : ROADTYPE_ROAD);
+ SETBIT(p->avail_roadtypes, HasBit(EngInfo(eid)->misc_flags, EF_ROAD_TRAM) ? ROADTYPE_TRAM : ROADTYPE_ROAD);
}
e->preview_player = INVALID_PLAYER;
@@ -210,7 +210,7 @@ static PlayerID GetBestPlayer(PlayerID pp)
best_hist = -1;
best_player = PLAYER_SPECTATOR;
FOR_ALL_PLAYERS(p) {
- if (p->is_active && p->block_preview == 0 && !HASBIT(mask, p->index) &&
+ if (p->is_active && p->block_preview == 0 && !HasBit(mask, p->index) &&
p->old_economy[0].performance_history > best_hist) {
best_hist = p->old_economy[0].performance_history;
best_player = p->index;
@@ -300,7 +300,7 @@ static void NewVehicleAvailable(Engine *e)
FOR_ALL_PLAYERS(p) {
uint block_preview = p->block_preview;
- if (!HASBIT(e->player_avail, p->index)) continue;
+ if (!HasBit(e->player_avail, p->index)) continue;
/* We assume the user did NOT build it.. prove me wrong ;) */
p->block_preview = 20;
@@ -338,7 +338,7 @@ static void NewVehicleAvailable(Engine *e)
if ((index - NUM_TRAIN_ENGINES) < NUM_ROAD_ENGINES) {
/* maybe make another road type available */
FOR_ALL_PLAYERS(p) {
- if (p->is_active) SETBIT(p->avail_roadtypes, HASBIT(EngInfo(index)->misc_flags, EF_ROAD_TRAM) ? ROADTYPE_TRAM : ROADTYPE_ROAD);
+ if (p->is_active) SETBIT(p->avail_roadtypes, HasBit(EngInfo(index)->misc_flags, EF_ROAD_TRAM) ? ROADTYPE_TRAM : ROADTYPE_ROAD);
}
}
AddNewsItem(index, NEWS_FLAGS(NM_CALLBACK, 0, NT_NEW_VEHICLES, DNC_VEHICLEAVAIL), 0, 0);
@@ -436,12 +436,12 @@ bool IsEngineBuildable(EngineID engine, byte type, PlayerID player)
if (e->type != type) return false;
/* check if it's available */
- if (!HASBIT(e->player_avail, player)) return false;
+ if (!HasBit(e->player_avail, player)) return false;
if (type == VEH_TRAIN) {
/* Check if the rail type is available to this player */
const Player *p = GetPlayer(player);
- if (!HASBIT(p->avail_railtypes, RailVehInfo(engine)->railtype)) return false;
+ if (!HasBit(p->avail_railtypes, RailVehInfo(engine)->railtype)) return false;
}
return true;
diff --git a/src/fontcache.cpp b/src/fontcache.cpp
index 6ae3dd456..607265d19 100644
--- a/src/fontcache.cpp
+++ b/src/fontcache.cpp
@@ -434,7 +434,7 @@ const Sprite *GetGlyph(FontSize size, WChar key)
if (size == FS_NORMAL) {
for (y = 0; y < slot->bitmap.rows; y++) {
for (x = 0; x < slot->bitmap.width; x++) {
- if (aa ? (slot->bitmap.buffer[x + y * slot->bitmap.pitch] > 0) : HASBIT(slot->bitmap.buffer[(x / 8) + y * slot->bitmap.pitch], 7 - (x % 8))) {
+ if (aa ? (slot->bitmap.buffer[x + y * slot->bitmap.pitch] > 0) : HasBit(slot->bitmap.buffer[(x / 8) + y * slot->bitmap.pitch], 7 - (x % 8))) {
sprite.data[1 + x + (1 + y) * sprite.width].m = SHADOW_COLOUR;
sprite.data[1 + x + (1 + y) * sprite.width].a = aa ? slot->bitmap.buffer[x + y * slot->bitmap.pitch] : 0xFF;
}
@@ -444,7 +444,7 @@ const Sprite *GetGlyph(FontSize size, WChar key)
for (y = 0; y < slot->bitmap.rows; y++) {
for (x = 0; x < slot->bitmap.width; x++) {
- if (aa ? (slot->bitmap.buffer[x + y * slot->bitmap.pitch] > 0) : HASBIT(slot->bitmap.buffer[(x / 8) + y * slot->bitmap.pitch], 7 - (x % 8))) {
+ if (aa ? (slot->bitmap.buffer[x + y * slot->bitmap.pitch] > 0) : HasBit(slot->bitmap.buffer[(x / 8) + y * slot->bitmap.pitch], 7 - (x % 8))) {
sprite.data[x + y * sprite.width].m = FACE_COLOUR;
sprite.data[x + y * sprite.width].a = aa ? slot->bitmap.buffer[x + y * slot->bitmap.pitch] : 0xFF;
}
diff --git a/src/gfx.cpp b/src/gfx.cpp
index c8152e677..6a7cb51e3 100644
--- a/src/gfx.cpp
+++ b/src/gfx.cpp
@@ -105,8 +105,8 @@ void GfxFillRect(int left, int top, int right, int bottom, int color)
dst = blitter->MoveTo(dpi->dst_ptr, left, top);
- if (!HASBIT(color, PALETTE_MODIFIER_GREYOUT)) {
- if (!HASBIT(color, USE_COLORTABLE)) {
+ if (!HasBit(color, PALETTE_MODIFIER_GREYOUT)) {
+ if (!HasBit(color, USE_COLORTABLE)) {
blitter->DrawRect(dst, right, bottom, (uint8)color);
} else {
blitter->DrawColorMappingRect(dst, right, bottom, GB(color, 0, PALETTE_WIDTH));
@@ -654,7 +654,7 @@ int DoDrawStringTruncated(const char *str, int x, int y, uint16 color, uint maxw
void DrawSprite(SpriteID img, SpriteID pal, int x, int y, const SubSprite *sub)
{
- if (HASBIT(img, PALETTE_MODIFIER_TRANSPARENT)) {
+ if (HasBit(img, PALETTE_MODIFIER_TRANSPARENT)) {
_color_remap_ptr = GetNonSprite(GB(pal, 0, PALETTE_WIDTH)) + 1;
GfxMainBlitter(GetSprite(GB(img, 0, SPRITE_WIDTH)), x, y, BM_TRANSPARENT, sub);
} else if (pal != PAL_NONE) {
diff --git a/src/graph_gui.cpp b/src/graph_gui.cpp
index 1e273a251..4caf34b2d 100644
--- a/src/graph_gui.cpp
+++ b/src/graph_gui.cpp
@@ -131,7 +131,7 @@ static void DrawGraph(const GraphDrawer *gw)
highest_value = x_axis_offset * 2;
for (int i = 0; i < gw->num_dataset; i++) {
- if (!HASBIT(gw->excluded_data, i)) {
+ if (!HasBit(gw->excluded_data, i)) {
for (int j = 0; j < gw->num_on_x_axis; j++) {
Money datapoint = gw->cost[i][j];
@@ -206,7 +206,7 @@ static void DrawGraph(const GraphDrawer *gw)
/* draw lines and dots */
for (int i = 0; i < gw->num_dataset; i++) {
- if (!HASBIT(gw->excluded_data, i)) {
+ if (!HasBit(gw->excluded_data, i)) {
/* Centre the dot between the grid lines. */
x = gw->left + GRAPH_X_POSITION_BEGINNING + (GRAPH_X_POSITION_SEPARATION / 2);
@@ -250,7 +250,7 @@ static void GraphLegendWndProc(Window *w, WindowEvent *e)
switch (e->event) {
case WE_CREATE:
for (uint i = 3; i < w->widget_count; i++) {
- if (!HASBIT(_legend_excluded_players, i - 3)) LowerWindowWidget(w, i);
+ if (!HasBit(_legend_excluded_players, i - 3)) LowerWindowWidget(w, i);
}
break;
@@ -273,7 +273,7 @@ static void GraphLegendWndProc(Window *w, WindowEvent *e)
SetDParam(0, p->index);
SetDParam(1, p->index);
- DrawString(21, 17 + p->index * 12, STR_7021, HASBIT(_legend_excluded_players, p->index) ? TC_BLACK : TC_WHITE);
+ DrawString(21, 17 + p->index * 12, STR_7021, HasBit(_legend_excluded_players, p->index) ? TC_BLACK : TC_WHITE);
}
break;
}
@@ -816,7 +816,7 @@ void ShowCargoPaymentRates()
wi->data = 0;
wi->tooltips = STR_7064_TOGGLE_GRAPH_FOR_CARGO;
- if (!HASBIT(_legend_excluded_cargo, i)) LowerWindowWidget(w, i + 3);
+ if (!HasBit(_legend_excluded_cargo, i)) LowerWindowWidget(w, i + 3);
}
SetWindowDirty(w);
diff --git a/src/group_cmd.cpp b/src/group_cmd.cpp
index 2726c59f9..bb31c9d37 100644
--- a/src/group_cmd.cpp
+++ b/src/group_cmd.cpp
@@ -339,7 +339,7 @@ CommandCost CmdSetGroupReplaceProtection(TileIndex tile, uint32 flags, uint32 p1
if (g->owner != _current_player) return CMD_ERROR;
if (flags & DC_EXEC) {
- g->replace_protection = HASBIT(p2, 0);
+ g->replace_protection = HasBit(p2, 0);
InvalidateWindowData(GetWCForVT(g->vehicle_type), (g->vehicle_type << 11) | VLW_GROUP_LIST | _current_player);
}
diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp
index 1cd625c93..e9fadbc86 100644
--- a/src/industry_cmd.cpp
+++ b/src/industry_cmd.cpp
@@ -68,7 +68,7 @@ void ResetIndustries()
/* once performed, enable only the current climate industries */
for (IndustryType i = 0; i < NUM_INDUSTRYTYPES; i++) {
_industry_specs[i].enabled = i < NEW_INDUSTRYOFFSET &&
- HASBIT(_origin_industry_specs[i].climate_availability, _opt.landscape);
+ HasBit(_origin_industry_specs[i].climate_availability, _opt.landscape);
}
memset(&_industry_tile_specs, 0, sizeof(_industry_tile_specs));
@@ -290,7 +290,7 @@ static void DrawTile_Industry(TileInfo *ti)
GetIndustryConstructionStage(ti->tile))];
image = dits->ground.sprite;
- if (HASBIT(image, PALETTE_MODIFIER_COLOR) && dits->ground.pal == PAL_NONE) {
+ if (HasBit(image, PALETTE_MODIFIER_COLOR) && dits->ground.pal == PAL_NONE) {
pal = GENERAL_SPRITE_COLOR(ind->random_color);
} else {
pal = dits->ground.pal;
@@ -305,7 +305,7 @@ static void DrawTile_Industry(TileInfo *ti)
image = dits->building.sprite;
if (image != 0) {
AddSortableSpriteToDraw(image,
- (HASBIT(image, PALETTE_MODIFIER_COLOR) && dits->building.pal == PAL_NONE) ? GENERAL_SPRITE_COLOR(ind->random_color) : dits->building.pal,
+ (HasBit(image, PALETTE_MODIFIER_COLOR) && dits->building.pal == PAL_NONE) ? GENERAL_SPRITE_COLOR(ind->random_color) : dits->building.pal,
ti->x + dits->subtile_x,
ti->y + dits->subtile_y,
dits->width,
@@ -346,7 +346,7 @@ static void GetAcceptedCargo_Industry(TileIndex tile, AcceptedCargo ac)
const CargoID *accepts_cargo = itspec->accepts_cargo;
const uint8 *acceptance = itspec->acceptance;
- if (HASBIT(itspec->callback_flags, CBM_INDT_ACCEPT_CARGO)) {
+ if (HasBit(itspec->callback_flags, CBM_INDT_ACCEPT_CARGO)) {
uint16 res = GetIndustryTileCallback(CBID_INDTILE_ACCEPT_CARGO, 0, 0, gfx, GetIndustryByTile(tile), tile);
if (res != CALLBACK_FAILED) {
accepts_cargo = raw_accepts_cargo;
@@ -354,7 +354,7 @@ static void GetAcceptedCargo_Industry(TileIndex tile, AcceptedCargo ac)
}
}
- if (HASBIT(itspec->callback_flags, CBM_INDT_CARGO_ACCEPTANCE)) {
+ if (HasBit(itspec->callback_flags, CBM_INDT_CARGO_ACCEPTANCE)) {
uint16 res = GetIndustryTileCallback(CBID_INDTILE_CARGO_ACCEPTANCE, 0, 0, gfx, GetIndustryByTile(tile), tile);
if (res != CALLBACK_FAILED) {
acceptance = raw_acceptance;
@@ -1000,7 +1000,7 @@ static void ProduceIndustryGoods(Industry *i)
/* produce some cargo */
if ((i->counter & 0xFF) == 0) {
- if (HASBIT(indsp->callback_flags, CBM_IND_PRODUCTION_256_TICKS)) IndustryProductionCallback(i, 1);
+ if (HasBit(indsp->callback_flags, CBM_IND_PRODUCTION_256_TICKS)) IndustryProductionCallback(i, 1);
IndustryBehaviour indbehav = indsp->behaviour;
i->produced_cargo_waiting[0] = min(0xffff, i->produced_cargo_waiting[0] + i->production_rate[0]);
@@ -1008,7 +1008,7 @@ static void ProduceIndustryGoods(Industry *i)
if ((indbehav & INDUSTRYBEH_PLANT_FIELDS) != 0) {
bool plant;
- if (HASBIT(indsp->callback_flags, CBM_IND_SPECIAL_EFFECT)) {
+ if (HasBit(indsp->callback_flags, CBM_IND_SPECIAL_EFFECT)) {
plant = (GetIndustryCallback(CBID_INDUSTRY_SPECIAL_EFFECT, Random(), 0, i, i->type, i->xy) != 0);
} else {
plant = CHANCE16(1, 8);
@@ -1018,7 +1018,7 @@ static void ProduceIndustryGoods(Industry *i)
}
if ((indbehav & INDUSTRYBEH_CUT_TREES) != 0) {
bool cut = ((i->counter & 0x1FF) == 0);
- if (HASBIT(indsp->callback_flags, CBM_IND_SPECIAL_EFFECT)) {
+ if (HasBit(indsp->callback_flags, CBM_IND_SPECIAL_EFFECT)) {
cut = (GetIndustryCallback(CBID_INDUSTRY_SPECIAL_EFFECT, 0, 1, i, i->type, i->xy) != 0);
}
@@ -1225,9 +1225,9 @@ static bool CheckIfIndustryTilesAreFree(TileIndex tile, const IndustryTileTable
IndustryBehaviour ind_behav = GetIndustrySpec(type)->behaviour;
/* Perform land/water check if not disabled */
- if (!HASBIT(its->slopes_refused, 5) && (IsWaterTile(cur_tile) == !(ind_behav & INDUSTRYBEH_BUILT_ONWATER))) return false;
+ if (!HasBit(its->slopes_refused, 5) && (IsWaterTile(cur_tile) == !(ind_behav & INDUSTRYBEH_BUILT_ONWATER))) return false;
- if (HASBIT(its->callback_flags, CBM_INDT_SHAPE_CHECK)) {
+ if (HasBit(its->callback_flags, CBM_INDT_SHAPE_CHECK)) {
custom_shape = true;
if (!PerformIndustryTileSlopeCheck(tile, cur_tile, its, type, gfx, itspec_index)) return false;
} else {
@@ -1429,7 +1429,7 @@ static void DoCreateNewIndustry(Industry *i, TileIndex tile, int type, const Ind
i->production_rate[1] = indspec->production_rate[1];
/* don't use smooth economy for industries using production callbacks */
- if (_patches.smooth_economy && !(HASBIT(indspec->callback_flags, CBM_IND_PRODUCTION_256_TICKS) || HASBIT(indspec->callback_flags, CBM_IND_PRODUCTION_CARGO_ARRIVAL))) {
+ if (_patches.smooth_economy && !(HasBit(indspec->callback_flags, CBM_IND_PRODUCTION_256_TICKS) || HasBit(indspec->callback_flags, CBM_IND_PRODUCTION_CARGO_ARRIVAL))) {
i->production_rate[0] = min((RandomRange(256) + 128) * i->production_rate[0] >> 8 , 255);
i->production_rate[1] = min((RandomRange(256) + 128) * i->production_rate[1] >> 8 , 255);
}
@@ -1460,12 +1460,12 @@ static void DoCreateNewIndustry(Industry *i, TileIndex tile, int type, const Ind
i->last_month_production[1] = i->production_rate[1] * 8;
i->founder = _current_player;
- if (HASBIT(indspec->callback_flags, CBM_IND_DECIDE_COLOUR)) {
+ if (HasBit(indspec->callback_flags, CBM_IND_DECIDE_COLOUR)) {
uint16 res = GetIndustryCallback(CBID_INDUSTRY_DECIDE_COLOUR, 0, 0, i, type, INVALID_TILE);
if (res != CALLBACK_FAILED) i->random_color = GB(res, 0, 4);
}
- if (HASBIT(indspec->callback_flags, CBM_IND_INPUT_CARGO_TYPES)) {
+ if (HasBit(indspec->callback_flags, CBM_IND_INPUT_CARGO_TYPES)) {
for (j = 0; j < lengthof(i->accepts_cargo); j++) i->accepts_cargo[j] = CT_INVALID;
for (j = 0; j < lengthof(i->accepts_cargo); j++) {
uint16 res = GetIndustryCallback(CBID_INDUSTRY_INPUT_CARGO_TYPES, j, 0, i, type, INVALID_TILE);
@@ -1474,7 +1474,7 @@ static void DoCreateNewIndustry(Industry *i, TileIndex tile, int type, const Ind
}
}
- if (HASBIT(indspec->callback_flags, CBM_IND_OUTPUT_CARGO_TYPES)) {
+ if (HasBit(indspec->callback_flags, CBM_IND_OUTPUT_CARGO_TYPES)) {
for (j = 0; j < lengthof(i->produced_cargo); j++) i->produced_cargo[j] = CT_INVALID;
for (j = 0; j < lengthof(i->produced_cargo); j++) {
uint16 res = GetIndustryCallback(CBID_INDUSTRY_OUTPUT_CARGO_TYPES, j, 0, i, type, INVALID_TILE);
@@ -1548,7 +1548,7 @@ static Industry *CreateNewIndustryHelper(TileIndex tile, IndustryType type, uint
if (!CheckIfIndustryTilesAreFree(tile, it, itspec_index, type, &custom_shape_check)) return NULL;
- if (HASBIT(GetIndustrySpec(type)->callback_flags, CBM_IND_LOCATION)) {
+ if (HasBit(GetIndustrySpec(type)->callback_flags, CBM_IND_LOCATION)) {
if (!CheckIfCallBackAllowsCreation(tile, type, itspec_index)) return NULL;
} else {
if (!_check_new_industry_procs[indspec->check_proc](tile)) return NULL;
@@ -1873,7 +1873,7 @@ static void CanCargoServiceIndustry(CargoID cargo, Industry *ind, bool *c_accept
/* Check for acceptance of cargo */
for (uint j = 0; j < lengthof(ind->accepts_cargo) && ind->accepts_cargo[j] != CT_INVALID; j++) {
if (cargo == ind->accepts_cargo[j]) {
- if (HASBIT(indspec->callback_flags, CBM_IND_REFUSE_CARGO)) {
+ if (HasBit(indspec->callback_flags, CBM_IND_REFUSE_CARGO)) {
uint16 res = GetIndustryCallback(CBID_INDUSTRY_REFUSE_CARGO,
0, GetReverseCargoTranslation(cargo, indspec->grf_prop.grffile),
ind, ind->type, ind->xy);
@@ -1940,13 +1940,13 @@ int WhoCanServiceIndustry(Industry* ind)
*/
const Order *o;
FOR_VEHICLE_ORDERS(v, o) {
- if (o->type == OT_GOTO_STATION && !HASBIT(o->flags, OFB_TRANSFER)) {
+ if (o->type == OT_GOTO_STATION && !HasBit(o->flags, OFB_TRANSFER)) {
/* Vehicle visits a station to load or unload */
Station *st = GetStation(o->dest);
if (!st->IsValid()) continue;
/* Same cargo produced by industry is dropped here => not serviced by vehicle v */
- if (HASBIT(o->flags, OFB_UNLOAD) && !c_accepts) break;
+ if (HasBit(o->flags, OFB_UNLOAD) && !c_accepts) break;
if (stations.find(st) != stations.end()) {
if (v->owner == _local_player) return 2; // Player services industry
@@ -1998,17 +1998,17 @@ static void ChangeIndustryProduction(Industry *i, bool monthly)
bool standard = true;
bool suppress_message = false;
/* don't use smooth economy for industries using production callbacks */
- bool smooth_economy = _patches.smooth_economy && !(HASBIT(indspec->callback_flags, CBM_IND_PRODUCTION_256_TICKS) || HASBIT(indspec->callback_flags, CBM_IND_PRODUCTION_CARGO_ARRIVAL));
+ bool smooth_economy = _patches.smooth_economy && !(HasBit(indspec->callback_flags, CBM_IND_PRODUCTION_256_TICKS) || HasBit(indspec->callback_flags, CBM_IND_PRODUCTION_CARGO_ARRIVAL));
byte div = 0;
byte mul = 0;
- if (HASBIT(indspec->callback_flags, monthly ? CBM_IND_MONTHLYPROD_CHANGE : CBM_IND_PRODUCTION_CHANGE)) {
+ if (HasBit(indspec->callback_flags, monthly ? CBM_IND_MONTHLYPROD_CHANGE : CBM_IND_PRODUCTION_CHANGE)) {
uint16 res = GetIndustryCallback(monthly ? CBID_INDUSTRY_MONTHLYPROD_CHANGE : CBID_INDUSTRY_PRODUCTION_CHANGE, 0, Random(), i, i->type, i->xy);
if (res != CALLBACK_FAILED) {
standard = false;
- suppress_message = HASBIT(res, 7);
+ suppress_message = HasBit(res, 7);
/* Get the custom message if any */
- if (HASBIT(res, 8)) str = MapGRFStringID(indspec->grf_prop.grffile->grfid, GB(GetRegister(0x100), 0, 16));
+ if (HasBit(res, 8)) str = MapGRFStringID(indspec->grf_prop.grffile->grfid, GB(GetRegister(0x100), 0, 16));
res = GB(res, 0, 4);
switch(res) {
default: NOT_REACHED();
@@ -2213,7 +2213,7 @@ static CommandCost TerraformTile_Industry(TileIndex tile, uint32 flags, uint z_n
const IndustryTileSpec *itspec = GetIndustryTileSpec(gfx);
/* Call callback 3C 'disable autosloping for industry tiles'. */
- if (HASBIT(itspec->callback_flags, CBM_INDT_AUTOSLOPE)) {
+ if (HasBit(itspec->callback_flags, CBM_INDT_AUTOSLOPE)) {
/* If the callback fails, allow autoslope. */
uint16 res = GetIndustryTileCallback(CBID_INDUSTRY_AUTOSLOPE, 0, 0, gfx, GetIndustryByTile(tile), tile);
if ((res == 0) || (res == CALLBACK_FAILED)) return _price.terraform;
diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp
index bc01e2cba..171577c60 100644
--- a/src/industry_gui.cpp
+++ b/src/industry_gui.cpp
@@ -214,7 +214,7 @@ static void BuildDynamicIndustryWndProc(Window *w, WindowEvent *e)
/* Get the additional purchase info text, if it has not already been */
if (_fund_gui.text[WP(w, fnd_d).index] == STR_NULL) { // Have i been called already?
- if (HASBIT(indsp->callback_flags, CBM_IND_FUND_MORE_TEXT)) { // No. Can it be called?
+ if (HasBit(indsp->callback_flags, CBM_IND_FUND_MORE_TEXT)) { // No. Can it be called?
uint16 callback_res = GetIndustryCallback(CBID_INDUSTRY_FUND_MORE_TEXT, 0, 0, NULL, WP(w, fnd_d).select, INVALID_TILE);
if (callback_res != CALLBACK_FAILED) { // Did it failed?
StringID newtxt = GetGRFStringID(indsp->grf_prop.grffile->grfid, 0xD000 + callback_res); // No. here's the new string
@@ -406,7 +406,7 @@ static void IndustryViewWndProc(Window *w, WindowEvent *e)
bool first = true;
bool has_accept = false;
- if (HASBIT(ind->callback_flags, CBM_IND_PRODUCTION_CARGO_ARRIVAL) || HASBIT(ind->callback_flags, CBM_IND_PRODUCTION_256_TICKS)) {
+ if (HasBit(ind->callback_flags, CBM_IND_PRODUCTION_CARGO_ARRIVAL) || HasBit(ind->callback_flags, CBM_IND_PRODUCTION_256_TICKS)) {
for (byte j = 0; j < lengthof(i->accepts_cargo); j++) {
if (i->accepts_cargo[j] == CT_INVALID) continue;
has_accept = true;
@@ -436,7 +436,7 @@ static void IndustryViewWndProc(Window *w, WindowEvent *e)
lines++;
}
- if (HASBIT(ind->callback_flags, CBM_IND_WINDOW_MORE_TEXT)) lines += 2;
+ if (HasBit(ind->callback_flags, CBM_IND_WINDOW_MORE_TEXT)) lines += 2;
for (byte j = 5; j <= 7; j++) {
if (j != 5) w->widget[j].top += lines * 10;
@@ -455,7 +455,7 @@ static void IndustryViewWndProc(Window *w, WindowEvent *e)
SetDParam(0, w->window_number);
DrawWindowWidgets(w);
- if (HASBIT(ind->callback_flags, CBM_IND_PRODUCTION_CARGO_ARRIVAL) || HASBIT(ind->callback_flags, CBM_IND_PRODUCTION_256_TICKS)) {
+ if (HasBit(ind->callback_flags, CBM_IND_PRODUCTION_CARGO_ARRIVAL) || HasBit(ind->callback_flags, CBM_IND_PRODUCTION_256_TICKS)) {
for (byte j = 0; j < lengthof(i->accepts_cargo); j++) {
if (i->accepts_cargo[j] == CT_INVALID) continue;
has_accept = true;
@@ -509,7 +509,7 @@ static void IndustryViewWndProc(Window *w, WindowEvent *e)
}
/* Get the extra message for the GUI */
- if (HASBIT(ind->callback_flags, CBM_IND_WINDOW_MORE_TEXT)) {
+ if (HasBit(ind->callback_flags, CBM_IND_WINDOW_MORE_TEXT)) {
uint16 callback_res = GetIndustryCallback(CBID_INDUSTRY_WINDOW_MORE_TEXT, 0, 0, i, i->type, i->xy);
if (callback_res != CALLBACK_FAILED) {
StringID message = GetGRFStringID(ind->grf_prop.grffile->grfid, 0xD000 + callback_res);
diff --git a/src/industry_map.h b/src/industry_map.h
index ea4579964..6ae571752 100644
--- a/src/industry_map.h
+++ b/src/industry_map.h
@@ -83,7 +83,7 @@ static inline Industry *GetIndustryByTile(TileIndex t)
static inline bool IsIndustryCompleted(TileIndex t)
{
assert(IsTileType(t, MP_INDUSTRY));
- return HASBIT(_m[t].m1, 7);
+ return HasBit(_m[t].m1, 7);
}
IndustryType GetIndustryType(TileIndex tile);
diff --git a/src/macros.h b/src/macros.h
index a4dd78845..5be50cb13 100644
--- a/src/macros.h
+++ b/src/macros.h
@@ -231,7 +231,7 @@ static inline int32 ClampToI32(const int64 a)
* @param y The position of the bit to check, started from the LSB
* @return True if the bit is set, false else.
*/
-template<typename T> static inline bool HASBIT(const T x, const uint8 y)
+template<typename T> static inline bool HasBit(const T x, const uint8 y)
{
return (x & ((T)1U << y)) != 0;
}
diff --git a/src/main_gui.cpp b/src/main_gui.cpp
index 25387237f..02af27d71 100644
--- a/src/main_gui.cpp
+++ b/src/main_gui.cpp
@@ -454,10 +454,10 @@ static void MenuWndProc(Window *w, WindowEvent *e)
y = 1;
for (; count != 0; count--, string++, sel--) {
- TextColour color = HASBIT(dis, 0) ? TC_GREY : (sel == 0) ? TC_WHITE : TC_BLACK;
+ TextColour color = HasBit(dis, 0) ? TC_GREY : (sel == 0) ? TC_WHITE : TC_BLACK;
if (sel == 0) GfxFillRect(x, y, x + w->width - 3, y + 9, 0);
- if (HASBIT(chk, 0)) DrawString(x + 2, y, STR_CHECKMARK, color);
+ if (HasBit(chk, 0)) DrawString(x + 2, y, STR_CHECKMARK, color);
DrawString(x + 2, y, string, color);
y += 10;
@@ -971,12 +971,12 @@ static void ToolbarOptionsClick(Window *w)
w = PopupMainToolbMenu(w, 2, STR_02C3_GAME_OPTIONS, 14, 0);
- if (HASBIT(_display_opt, DO_SHOW_TOWN_NAMES)) SETBIT(x, 6);
- if (HASBIT(_display_opt, DO_SHOW_STATION_NAMES)) SETBIT(x, 7);
- if (HASBIT(_display_opt, DO_SHOW_SIGNS)) SETBIT(x, 8);
- if (HASBIT(_display_opt, DO_WAYPOINTS)) SETBIT(x, 9);
- if (HASBIT(_display_opt, DO_FULL_ANIMATION)) SETBIT(x, 10);
- if (HASBIT(_display_opt, DO_FULL_DETAIL)) SETBIT(x, 11);
+ if (HasBit(_display_opt, DO_SHOW_TOWN_NAMES)) SETBIT(x, 6);
+ if (HasBit(_display_opt, DO_SHOW_STATION_NAMES)) SETBIT(x, 7);
+ if (HasBit(_display_opt, DO_SHOW_SIGNS)) SETBIT(x, 8);
+ if (HasBit(_display_opt, DO_WAYPOINTS)) SETBIT(x, 9);
+ if (HasBit(_display_opt, DO_FULL_ANIMATION)) SETBIT(x, 10);
+ if (HasBit(_display_opt, DO_FULL_DETAIL)) SETBIT(x, 11);
if (IsTransparencySet(TO_HOUSES) && IsTransparencySet(TO_TREES)) SETBIT(x, 12);
if (IsTransparencySet(TO_SIGNS)) SETBIT(x, 13);
WP(w,menu_d).checked_items = x;
diff --git a/src/network/core/udp.cpp b/src/network/core/udp.cpp
index 0c9c74ed1..8da8ba6a6 100644
--- a/src/network/core/udp.cpp
+++ b/src/network/core/udp.cpp
@@ -160,13 +160,13 @@ void NetworkUDPSocketHandler::Send_NetworkGameInfo(Packet *p, const NetworkGameI
/* Count number of GRFs to send information about */
for (c = info->grfconfig; c != NULL; c = c->next) {
- if (!HASBIT(c->flags, GCF_STATIC)) count++;
+ if (!HasBit(c->flags, GCF_STATIC)) count++;
}
p->Send_uint8 (count); // Send number of GRFs
/* Send actual GRF Identifications */
for (c = info->grfconfig; c != NULL; c = c->next) {
- if (!HASBIT(c->flags, GCF_STATIC)) this->Send_GRFIdentifier(p, c);
+ if (!HasBit(c->flags, GCF_STATIC)) this->Send_GRFIdentifier(p, c);
}
}
diff --git a/src/network/network_server.cpp b/src/network/network_server.cpp
index 386c243cc..0c484d516 100644
--- a/src/network/network_server.cpp
+++ b/src/network/network_server.cpp
@@ -197,12 +197,12 @@ DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_CHECK_NEWGRFS)(NetworkTCPSocketHandl
uint grf_count = 0;
for (c = _grfconfig; c != NULL; c = c->next) {
- if (!HASBIT(c->flags, GCF_STATIC)) grf_count++;
+ if (!HasBit(c->flags, GCF_STATIC)) grf_count++;
}
p->Send_uint8 (grf_count);
for (c = _grfconfig; c != NULL; c = c->next) {
- if (!HASBIT(c->flags, GCF_STATIC)) cs->Send_GRFIdentifier(p, c);
+ if (!HasBit(c->flags, GCF_STATIC)) cs->Send_GRFIdentifier(p, c);
}
cs->Send_Packet(p);
diff --git a/src/newgrf.cpp b/src/newgrf.cpp
index 8058d9ff6..d7c4abda2 100644
--- a/src/newgrf.cpp
+++ b/src/newgrf.cpp
@@ -428,7 +428,7 @@ static bool RailVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf
case 0x15: { // Cargo type
uint8 ctype = grf_load_byte(&buf);
- if (ctype < NUM_CARGO && HASBIT(_cargo_mask, ctype)) {
+ if (ctype < NUM_CARGO && HasBit(_cargo_mask, ctype)) {
rvi->cargo_type = ctype;
} else {
rvi->cargo_type = CT_INVALID;
@@ -547,7 +547,7 @@ static bool RailVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf
case 0x27: // Miscellaneous flags
ei->misc_flags = grf_load_byte(&buf);
- _loaded_newgrf_features.has_2CC |= HASBIT(ei->misc_flags, EF_USES_2CC);
+ _loaded_newgrf_features.has_2CC |= HasBit(ei->misc_flags, EF_USES_2CC);
break;
case 0x28: // Cargo classes allowed
@@ -615,7 +615,7 @@ static bool RoadVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf
case 0x10: { // Cargo type
uint8 cargo = grf_load_byte(&buf);
- if (cargo < NUM_CARGO && HASBIT(_cargo_mask, cargo)) {
+ if (cargo < NUM_CARGO && HasBit(_cargo_mask, cargo)) {
rvi->cargo_type = cargo;
} else {
rvi->cargo_type = CT_INVALID;
@@ -666,7 +666,7 @@ static bool RoadVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf
case 0x1C: // Miscellaneous flags
ei->misc_flags = grf_load_byte(&buf);
- _loaded_newgrf_features.has_2CC |= HASBIT(ei->misc_flags, EF_USES_2CC);
+ _loaded_newgrf_features.has_2CC |= HasBit(ei->misc_flags, EF_USES_2CC);
break;
case 0x1D: // Cargo classes allowed
@@ -727,7 +727,7 @@ static bool ShipVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf
case 0x0C: { // Cargo type
uint8 cargo = grf_load_byte(&buf);
- if (cargo < NUM_CARGO && HASBIT(_cargo_mask, cargo)) {
+ if (cargo < NUM_CARGO && HasBit(_cargo_mask, cargo)) {
svi->cargo_type = cargo;
} else {
svi->cargo_type = CT_INVALID;
@@ -772,7 +772,7 @@ static bool ShipVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf
case 0x17: // Miscellaneous flags
ei->misc_flags = grf_load_byte(&buf);
- _loaded_newgrf_features.has_2CC |= HASBIT(ei->misc_flags, EF_USES_2CC);
+ _loaded_newgrf_features.has_2CC |= HasBit(ei->misc_flags, EF_USES_2CC);
break;
case 0x18: // Cargo classes allowed
@@ -876,7 +876,7 @@ static bool AircraftVehicleChangeInfo(uint engine, int numinfo, int prop, byte *
case 0x17: // Miscellaneous flags
ei->misc_flags = grf_load_byte(&buf);
- _loaded_newgrf_features.has_2CC |= HASBIT(ei->misc_flags, EF_USES_2CC);
+ _loaded_newgrf_features.has_2CC |= HasBit(ei->misc_flags, EF_USES_2CC);
break;
case 0x18: // Cargo classes allowed
@@ -948,7 +948,7 @@ static bool StationChangeInfo(uint stid, int numinfo, int prop, byte **bufp, int
dts->ground_sprite = grf_load_word(&buf);
dts->ground_pal = grf_load_word(&buf);
if (dts->ground_sprite == 0) continue;
- if (HASBIT(dts->ground_pal, 15)) {
+ if (HasBit(dts->ground_pal, 15)) {
CLRBIT(dts->ground_pal, 15);
SETBIT(dts->ground_sprite, SPRITE_MODIFIER_USE_OFFSET);
}
@@ -971,16 +971,16 @@ static bool StationChangeInfo(uint stid, int numinfo, int prop, byte **bufp, int
dtss->pal = grf_load_word(&buf);
/* Remap flags as ours collide */
- if (HASBIT(dtss->pal, 15)) {
+ if (HasBit(dtss->pal, 15)) {
CLRBIT(dtss->pal, 15);
SETBIT(dtss->image, SPRITE_MODIFIER_USE_OFFSET);
}
- if (HASBIT(dtss->image, 15)) {
+ if (HasBit(dtss->image, 15)) {
CLRBIT(dtss->image, 15);
SETBIT(dtss->image, PALETTE_MODIFIER_COLOR);
}
- if (HASBIT(dtss->image, 14)) {
+ if (HasBit(dtss->image, 14)) {
CLRBIT(dtss->image, 14);
SETBIT(dtss->image, PALETTE_MODIFIER_TRANSPARENT);
}
@@ -1175,7 +1175,7 @@ static bool BridgeChangeInfo(uint brid, int numinfo, int prop, byte **bufp, int
SpriteID image = grf_load_word(&buf);
SpriteID pal = grf_load_word(&buf);
- if (HASBIT(pal, 15)) {
+ if (HasBit(pal, 15)) {
SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
}
@@ -2335,7 +2335,7 @@ static void SkipAct1(byte *buf, int len)
* defined spritegroup. */
static const SpriteGroup* GetGroupFromGroupID(byte setid, byte type, uint16 groupid)
{
- if (HASBIT(groupid, 15)) return NewCallBackResultSpriteGroup(groupid);
+ if (HasBit(groupid, 15)) return NewCallBackResultSpriteGroup(groupid);
if (groupid >= _cur_grffile->spritegroups_count || _cur_grffile->spritegroups[groupid] == NULL) {
grfmsg(1, "GetGroupFromGroupID(0x%02X:0x%02X): Groupid 0x%04X does not exist, leaving empty", setid, type, groupid);
@@ -2348,7 +2348,7 @@ static const SpriteGroup* GetGroupFromGroupID(byte setid, byte type, uint16 grou
/* Helper function to either create a callback or a result sprite group. */
static const SpriteGroup* CreateGroupFromGroupID(byte feature, byte setid, byte type, uint16 spriteid, uint16 num_sprites)
{
- if (HASBIT(spriteid, 15)) return NewCallBackResultSpriteGroup(spriteid);
+ if (HasBit(spriteid, 15)) return NewCallBackResultSpriteGroup(spriteid);
if (spriteid >= _cur_grffile->spriteset_numsets) {
grfmsg(1, "CreateGroupFromGroupID(0x%02X:0x%02X): Sprite set %u invalid, max %u", setid, type, spriteid, _cur_grffile->spriteset_numsets);
@@ -2424,7 +2424,7 @@ static void NewSpriteGroup(byte *buf, int len)
group = AllocateSpriteGroup();
group->type = SGT_DETERMINISTIC;
- group->g.determ.var_scope = HASBIT(type, 1) ? VSG_SCOPE_PARENT : VSG_SCOPE_SELF;
+ group->g.determ.var_scope = HasBit(type, 1) ? VSG_SCOPE_PARENT : VSG_SCOPE_SELF;
switch (GB(type, 2, 2)) {
default: NOT_REACHED();
@@ -2473,7 +2473,7 @@ static void NewSpriteGroup(byte *buf, int len)
}
/* Continue reading var adjusts while bit 5 is set. */
- } while (HASBIT(varadjust, 5));
+ } while (HasBit(varadjust, 5));
group->g.determ.num_ranges = grf_load_byte(&buf);
if (group->g.determ.num_ranges > 0) group->g.determ.ranges = CallocT<DeterministicSpriteGroupRange>(group->g.determ.num_ranges);
@@ -2498,11 +2498,11 @@ static void NewSpriteGroup(byte *buf, int len)
group = AllocateSpriteGroup();
group->type = SGT_RANDOMIZED;
- group->g.random.var_scope = HASBIT(type, 1) ? VSG_SCOPE_PARENT : VSG_SCOPE_SELF;
+ group->g.random.var_scope = HasBit(type, 1) ? VSG_SCOPE_PARENT : VSG_SCOPE_SELF;
uint8 triggers = grf_load_byte(&buf);
group->g.random.triggers = GB(triggers, 0, 7);
- group->g.random.cmp_mode = HASBIT(triggers, 7) ? RSG_CMP_ALL : RSG_CMP_ANY;
+ group->g.random.cmp_mode = HasBit(triggers, 7) ? RSG_CMP_ALL : RSG_CMP_ANY;
group->g.random.lowest_randbit = grf_load_byte(&buf);
group->g.random.num_groups = grf_load_byte(&buf);
group->g.random.groups = CallocT<const SpriteGroup*>(group->g.random.num_groups);
@@ -2582,19 +2582,19 @@ static void NewSpriteGroup(byte *buf, int len)
group->g.layout.dts->ground_sprite = grf_load_word(&buf);
group->g.layout.dts->ground_pal = grf_load_word(&buf);
/* Remap transparent/colour modifier bits */
- if (HASBIT(group->g.layout.dts->ground_sprite, 14)) {
+ if (HasBit(group->g.layout.dts->ground_sprite, 14)) {
CLRBIT(group->g.layout.dts->ground_sprite, 14);
SETBIT(group->g.layout.dts->ground_sprite, PALETTE_MODIFIER_TRANSPARENT);
}
- if (HASBIT(group->g.layout.dts->ground_sprite, 15)) {
+ if (HasBit(group->g.layout.dts->ground_sprite, 15)) {
CLRBIT(group->g.layout.dts->ground_sprite, 15);
SETBIT(group->g.layout.dts->ground_sprite, PALETTE_MODIFIER_COLOR);
}
- if (HASBIT(group->g.layout.dts->ground_pal, 14)) {
+ if (HasBit(group->g.layout.dts->ground_pal, 14)) {
CLRBIT(group->g.layout.dts->ground_pal, 14);
SETBIT(group->g.layout.dts->ground_sprite, SPRITE_MODIFIER_OPAQUE);
}
- if (HASBIT(group->g.layout.dts->ground_pal, 15)) {
+ if (HasBit(group->g.layout.dts->ground_pal, 15)) {
/* Bit 31 set means this is a custom sprite, so rewrite it to the
* last spriteset defined. */
SpriteID sprite = _cur_grffile->spriteset_start + GB(group->g.layout.dts->ground_sprite, 0, 14) * sprites;
@@ -2612,19 +2612,19 @@ static void NewSpriteGroup(byte *buf, int len)
seq->delta_x = grf_load_byte(&buf);
seq->delta_y = grf_load_byte(&buf);
- if (HASBIT(seq->image, 14)) {
+ if (HasBit(seq->image, 14)) {
CLRBIT(seq->image, 14);
SETBIT(seq->image, PALETTE_MODIFIER_TRANSPARENT);
}
- if (HASBIT(seq->image, 15)) {
+ if (HasBit(seq->image, 15)) {
CLRBIT(seq->image, 15);
SETBIT(seq->image, PALETTE_MODIFIER_COLOR);
}
- if (HASBIT(seq->pal, 14)) {
+ if (HasBit(seq->pal, 14)) {
CLRBIT(seq->pal, 14);
SETBIT(seq->image, SPRITE_MODIFIER_OPAQUE);
}
- if (HASBIT(seq->pal, 15)) {
+ if (HasBit(seq->pal, 15)) {
/* Bit 31 set means this is a custom sprite, so rewrite it to the
* last spriteset defined. */
SpriteID sprite = _cur_grffile->spriteset_start + GB(seq->image, 0, 14) * sprites;
@@ -3112,7 +3112,7 @@ static void FeatureNewName(byte *buf, int len)
uint8 feature = grf_load_byte(&buf);
uint8 lang = grf_load_byte(&buf);
uint8 num = grf_load_byte(&buf);
- bool generic = HASBIT(lang, 7);
+ bool generic = HasBit(lang, 7);
uint16 id = generic ? grf_load_word(&buf) : grf_load_byte(&buf);
CLRBIT(lang, 7);
@@ -3256,7 +3256,7 @@ static void GraphicsNew(byte *buf, int len)
uint8 type = grf_load_byte(&buf);
uint16 num = grf_load_extended(&buf);
uint16 skip_num = 0;
- uint16 offset = HASBIT(type, 7) ? grf_load_extended(&buf) : 0;
+ uint16 offset = HasBit(type, 7) ? grf_load_extended(&buf) : 0;
CLRBIT(type, 7); // Clear the high bit as that only indicates whether there is an offset.
switch (type) {
@@ -3533,7 +3533,7 @@ static void CfgApply(byte *buf, int len)
/* Bit 7 of param_size indicates we should add to the original value
* instead of replacing it. */
- add_value = HASBIT(param_size, 7);
+ add_value = HasBit(param_size, 7);
param_size = GB(param_size, 0, 7);
/* Where to apply the data to within the pseudo sprite data. */
@@ -3870,7 +3870,7 @@ static void GRFLoadError(byte *buf, int len)
/* Skip the error until the activation stage unless bit 7 of the severity
* is set. */
- if (!HASBIT(severity, 7) && _cur_stage == GLS_INIT) {
+ if (!HasBit(severity, 7) && _cur_stage == GLS_INIT) {
grfmsg(7, "GRFLoadError: Skipping non-fatal GRFLoadError in stage %d", _cur_stage);
return;
}
@@ -4075,7 +4075,7 @@ static void ParamSet(byte *buf, int len)
* - it has been set to any value in the newgrf(w).cfg parameter list
* - it OR A PARAMETER WITH HIGHER NUMBER has been set to any value by
* an earlier action D */
- if (HASBIT(oper, 7)) {
+ if (HasBit(oper, 7)) {
if (target < 0x80 && target < _cur_grffile->param_end) {
grfmsg(7, "ParamSet: Param %u already defined, skipping", target);
return;
@@ -4369,7 +4369,7 @@ static void FeatureTownName(byte *buf, int len)
len--;
grfmsg(6, "FeatureTownName: definition 0x%02X", id & 0x7F);
- if (HASBIT(id, 7)) {
+ if (HasBit(id, 7)) {
/* Final definition */
CLRBIT(id, 7);
bool new_scheme = _cur_grffile->grf_version >= 7;
@@ -4421,7 +4421,7 @@ static void FeatureTownName(byte *buf, int len)
byte prob = grf_load_byte(&buf);
len--;
- if (HASBIT(prob, 7)) {
+ if (HasBit(prob, 7)) {
byte ref_id = grf_load_byte(&buf);
len--;
@@ -4893,12 +4893,12 @@ static void ResetCustomIndustries()
if (ind != NULL) {
/* We need to remove the sounds array */
- if (HASBIT(ind->cleanup_flag, CLEAN_RANDOMSOUNDS)) {
+ if (HasBit(ind->cleanup_flag, CLEAN_RANDOMSOUNDS)) {
free((void*)ind->random_sounds);
}
/* We need to remove the tiles layouts */
- if (HASBIT(ind->cleanup_flag, CLEAN_TILELSAYOUT) && ind->table != NULL) {
+ if (HasBit(ind->cleanup_flag, CLEAN_TILELSAYOUT) && ind->table != NULL) {
for (int j = 0; j < ind->num_table; j++) {
/* remove the individual layouts */
if (ind->table[j] != NULL) {
@@ -4952,7 +4952,7 @@ static void ResetNewGRF()
static void ResetNewGRFErrors()
{
for (GRFConfig *c = _grfconfig; c != NULL; c = c->next) {
- if (!HASBIT(c->flags, GCF_COPY) && c->error != NULL) {
+ if (!HasBit(c->flags, GCF_COPY) && c->error != NULL) {
free(c->error->custom_message);
free(c->error->data);
free(c->error);
@@ -5176,7 +5176,7 @@ static void CalculateRefitMasks()
/* Apply cargo translation table to the refit mask */
uint num_cargo = min(32, file->cargo_max);
for (uint i = 0; i < num_cargo; i++) {
- if (!HASBIT(_engine_info[engine].refit_mask, i)) continue;
+ if (!HasBit(_engine_info[engine].refit_mask, i)) continue;
CargoID c = GetCargoIDByLabel(file->cargo_list[i]);
if (c == CT_INVALID) continue;
@@ -5189,7 +5189,7 @@ static void CalculateRefitMasks()
const CargoSpec *cs = GetCargo(c);
if (!cs->IsValid()) continue;
- if (HASBIT(_engine_info[engine].refit_mask, cs->bitnum)) SETBIT(xor_mask, c);
+ if (HasBit(_engine_info[engine].refit_mask, cs->bitnum)) SETBIT(xor_mask, c);
}
}
}
@@ -5471,7 +5471,7 @@ void LoadNewGRFFile(GRFConfig *config, uint file_index, GrfLoadingStage stage)
_cur_grffile = GetFileByFilename(filename);
if (_cur_grffile == NULL) error("File '%s' lost in cache.\n", filename);
if (stage == GLS_RESERVE && config->status != GCS_INITIALISED) return;
- if (stage == GLS_ACTIVATION && !HASBIT(config->flags, GCF_RESERVED)) return;
+ if (stage == GLS_ACTIVATION && !HasBit(config->flags, GCF_RESERVED)) return;
}
if (file_index > LAST_GRF_SLOT) {
@@ -5597,7 +5597,7 @@ void LoadNewGRF(uint load_index, uint file_index)
_cur_spriteid = load_index;
for (GRFConfig *c = _grfconfig; c != NULL; c = c->next) {
if (c->status == GCS_DISABLED || c->status == GCS_NOT_FOUND) continue;
- if (stage > GLS_INIT && HASBIT(c->flags, GCF_INIT_ONLY)) continue;
+ if (stage > GLS_INIT && HasBit(c->flags, GCF_INIT_ONLY)) continue;
/* @todo usererror() */
if (!FioCheckFileExists(c->filename)) error("NewGRF file is missing '%s'", c->filename);
@@ -5621,5 +5621,5 @@ void LoadNewGRF(uint load_index, uint file_index)
bool HasGrfMiscBit(GrfMiscBit bit)
{
- return HASBIT(_misc_grf_features, bit);
+ return HasBit(_misc_grf_features, bit);
}
diff --git a/src/newgrf_cargo.cpp b/src/newgrf_cargo.cpp
index e9323f930..f6548b81d 100644
--- a/src/newgrf_cargo.cpp
+++ b/src/newgrf_cargo.cpp
@@ -104,7 +104,7 @@ CargoID GetCargoTranslation(uint8 cargo, const GRFFile *grffile, bool usebit)
if (grffile->grf_version < 7) {
if (!usebit) return cargo;
/* Else the cargo value is a 'climate independent' 'bitnum' */
- if (HASBIT(_cargo_mask, cargo)) return GetCargoIDByBitnum(cargo);
+ if (HasBit(_cargo_mask, cargo)) return GetCargoIDByBitnum(cargo);
} else {
/* If the GRF contains a translation table (and the cargo is in bounds)
* then get the cargo ID for the label */
diff --git a/src/newgrf_config.cpp b/src/newgrf_config.cpp
index 18235e4ad..dda46f74d 100644
--- a/src/newgrf_config.cpp
+++ b/src/newgrf_config.cpp
@@ -76,7 +76,7 @@ bool FillGRFDetails(GRFConfig *config, bool is_static)
LoadNewGRFFile(config, 62, GLS_SAFETYSCAN);
/* GCF_UNSAFE is set if GLS_SAFETYSCAN finds unsafe actions */
- if (HASBIT(config->flags, GCF_UNSAFE)) return false;
+ if (HasBit(config->flags, GCF_UNSAFE)) return false;
}
return CalcGRFMD5Sum(config);
@@ -86,7 +86,7 @@ bool FillGRFDetails(GRFConfig *config, bool is_static)
void ClearGRFConfig(GRFConfig **config)
{
/* GCF_COPY as in NOT strdupped/alloced the filename, name and info */
- if (!HASBIT((*config)->flags, GCF_COPY)) {
+ if (!HasBit((*config)->flags, GCF_COPY)) {
free((*config)->filename);
free((*config)->name);
free((*config)->info);
@@ -255,7 +255,7 @@ compatible_grf:
* in any case and set the name and info when it is not set already.
* When the GCF_COPY flag is set, it is certain that the filename is
* already a local one, so there is no need to replace it. */
- if (!HASBIT(c->flags, GCF_COPY)) {
+ if (!HasBit(c->flags, GCF_COPY)) {
free(c->filename);
c->filename = strdup(f->filename);
memcpy(c->md5sum, f->md5sum, sizeof(c->md5sum));
@@ -550,7 +550,7 @@ static void Save_NGRF()
int index = 0;
for (GRFConfig *c = _grfconfig; c != NULL; c = c->next) {
- if (HASBIT(c->flags, GCF_STATIC)) continue;
+ if (HasBit(c->flags, GCF_STATIC)) continue;
SlSetArrayIndex(index++);
SlObject(c, _grfconfig_desc);
}
diff --git a/src/newgrf_engine.cpp b/src/newgrf_engine.cpp
index 08b39da3e..70ec67d14 100644
--- a/src/newgrf_engine.cpp
+++ b/src/newgrf_engine.cpp
@@ -660,7 +660,7 @@ static uint32 VehicleGetVariable(const ResolverObject *object, byte variable, by
* bit 8: (Maybe?) Toggled whenever the train reverses.
*/
- if (HASBIT(v->vehicle_flags, VF_BUILT_AS_PROTOTYPE)) SETBIT(modflags, 10);
+ if (HasBit(v->vehicle_flags, VF_BUILT_AS_PROTOTYPE)) SETBIT(modflags, 10);
return variable == 0xFE ? modflags : GB(modflags, 8, 8);
}
diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp
index aa4e308a7..d2ad51ceb 100644
--- a/src/newgrf_gui.cpp
+++ b/src/newgrf_gui.cpp
@@ -94,7 +94,7 @@ static void ShowNewGRFInfo(const GRFConfig *c, uint x, uint y, uint w, uint bott
/* Show flags */
if (c->status == GCS_NOT_FOUND) y += DrawStringMultiLine(x, y, STR_NEWGRF_NOT_FOUND, w, bottom - y);
if (c->status == GCS_DISABLED) y += DrawStringMultiLine(x, y, STR_NEWGRF_DISABLED, w, bottom - y);
- if (HASBIT(c->flags, GCF_COMPATIBLE)) y += DrawStringMultiLine(x, y, STR_NEWGRF_COMPATIBLE_LOADED, w, bottom - y);
+ if (HasBit(c->flags, GCF_COMPATIBLE)) y += DrawStringMultiLine(x, y, STR_NEWGRF_COMPATIBLE_LOADED, w, bottom - y);
/* Draw GRF info if it exists */
if (c->info != NULL && !StrEmpty(c->info)) {
@@ -360,9 +360,9 @@ static void NewGRFWndProc(Window *w, WindowEvent *e)
/* Do not show a "not-failure" colour when it actually failed to load */
if (pal != PALETTE_TO_RED) {
- if (HASBIT(c->flags, GCF_STATIC)) {
+ if (HasBit(c->flags, GCF_STATIC)) {
pal = PALETTE_TO_GREY;
- } else if (HASBIT(c->flags, GCF_COMPATIBLE)) {
+ } else if (HasBit(c->flags, GCF_COMPATIBLE)) {
pal = PALETTE_TO_ORANGE;
}
}
diff --git a/src/newgrf_house.cpp b/src/newgrf_house.cpp
index e23c0b180..169396245 100644
--- a/src/newgrf_house.cpp
+++ b/src/newgrf_house.cpp
@@ -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);
diff --git a/src/newgrf_industries.cpp b/src/newgrf_industries.cpp
index 78c36cc54..99d5ed5fd 100644
--- a/src/newgrf_industries.cpp
+++ b/src/newgrf_industries.cpp
@@ -31,7 +31,7 @@ IndustryTileOverrideManager _industile_mngr(NEW_INDUSTRYTILEOFFSET, NUM_INDUSTRY
IndustryType MapNewGRFIndustryType(IndustryType grf_type, uint32 grf_id)
{
if (grf_type == IT_INVALID) return IT_INVALID;
- if (!HASBIT(grf_type, 7)) return GB(grf_type, 0, 6);
+ if (!HasBit(grf_type, 7)) return GB(grf_type, 0, 6);
return _industry_mngr.GetID(GB(grf_type, 0, 6), grf_id);
}
@@ -200,7 +200,7 @@ uint32 IndustryGetVariable(const ResolverObject *object, byte variable, byte par
case 0x41:
case 0x42: { // waiting cargo, but only if those two callback flags are set
uint16 callback = indspec->callback_flags;
- if (HASBIT(callback, CBM_IND_PRODUCTION_CARGO_ARRIVAL) || HASBIT(callback, CBM_IND_PRODUCTION_256_TICKS)) {
+ if (HasBit(callback, CBM_IND_PRODUCTION_CARGO_ARRIVAL) || HasBit(callback, CBM_IND_PRODUCTION_256_TICKS)) {
return min(industry->incoming_cargo_waiting[variable - 0x40], (uint16)0xFFFF);
} else {
return 0;
@@ -480,7 +480,7 @@ bool CheckIfCallBackAllowsAvailability(IndustryType type, IndustryAvailabilityCa
{
const IndustrySpec *indspec = GetIndustrySpec(type);
- if (HASBIT(indspec->callback_flags, CBM_IND_AVAILABLE)) {
+ if (HasBit(indspec->callback_flags, CBM_IND_AVAILABLE)) {
uint16 res = GetIndustryCallback(CBID_INDUSTRY_AVAILABLE, 0, creation_type, NULL, type, INVALID_TILE);
if (res != CALLBACK_FAILED) {
return (res == 0);
diff --git a/src/newgrf_industrytiles.cpp b/src/newgrf_industrytiles.cpp
index 3804b4ee7..36ab7bc2d 100644
--- a/src/newgrf_industrytiles.cpp
+++ b/src/newgrf_industrytiles.cpp
@@ -182,7 +182,7 @@ void IndustryDrawTileLayout(const TileInfo *ti, const SpriteGroup *group, byte r
if (IS_CUSTOM_SPRITE(image)) image += stage;
- if (HASBIT(image, PALETTE_MODIFIER_COLOR)) {
+ if (HasBit(image, PALETTE_MODIFIER_COLOR)) {
if (pal == 0) {
pal = GENERAL_SPRITE_COLOR(rnd_color);
}
@@ -196,7 +196,7 @@ void IndustryDrawTileLayout(const TileInfo *ti, const SpriteGroup *group, byte r
ti->x + dtss->delta_x, ti->y + dtss->delta_y,
dtss->size_x, dtss->size_y,
dtss->size_z, ti->z + dtss->delta_z,
- !HASBIT(image, SPRITE_MODIFIER_OPAQUE) && IsTransparencySet(TO_INDUSTRIES)
+ !HasBit(image, SPRITE_MODIFIER_OPAQUE) && IsTransparencySet(TO_INDUSTRIES)
);
} else {
AddChildSpriteScreen(image, pal, (byte)dtss->delta_x, (byte)dtss->delta_y, IsTransparencySet(TO_INDUSTRIES));
@@ -227,7 +227,7 @@ bool DrawNewIndustryTile(TileInfo *ti, Industry *i, IndustryGfx gfx, const Indus
if (ti->tileh != SLOPE_FLAT) {
bool draw_old_one = true;
- if (HASBIT(inds->callback_flags, CBM_INDT_DRAW_FOUNDATIONS)) {
+ if (HasBit(inds->callback_flags, CBM_INDT_DRAW_FOUNDATIONS)) {
/* Called to determine the type (if any) of foundation to draw for industry tile */
uint32 callback_res = GetIndustryTileCallback(CBID_INDUSTRY_DRAW_FOUNDATIONS, 0, 0, gfx, i, ti->tile);
draw_old_one = callback_res != 0;
@@ -289,7 +289,7 @@ void AnimateNewIndustryTile(TileIndex tile)
const IndustryTileSpec *itspec = GetIndustryTileSpec(gfx);
byte animation_speed = itspec->animation_speed;
- if (HASBIT(itspec->callback_flags, CBM_INDT_ANIM_SPEED)) {
+ if (HasBit(itspec->callback_flags, CBM_INDT_ANIM_SPEED)) {
uint16 callback_res = GetIndustryTileCallback(CBID_INDTILE_ANIMATION_SPEED, 0, 0, gfx, ind, tile);
if (callback_res != CALLBACK_FAILED) animation_speed = Clamp(callback_res & 0xFF, 0, 16);
}
@@ -304,8 +304,8 @@ void AnimateNewIndustryTile(TileIndex tile)
byte frame = GetIndustryAnimationState(tile);
uint16 num_frames = GB(itspec->animation_info, 0, 8);
- if (HASBIT(itspec->callback_flags, CBM_INDT_ANIM_NEXT_FRAME)) {
- uint16 callback_res = GetIndustryTileCallback(CBID_INDTILE_ANIM_NEXT_FRAME, HASBIT(itspec->animation_special_flags, 0) ? Random() : 0, 0, gfx, ind, tile);
+ if (HasBit(itspec->callback_flags, CBM_INDT_ANIM_NEXT_FRAME)) {
+ uint16 callback_res = GetIndustryTileCallback(CBID_INDTILE_ANIM_NEXT_FRAME, HasBit(itspec->animation_special_flags, 0) ? Random() : 0, 0, gfx, ind, tile);
if (callback_res != CALLBACK_FAILED) {
frame_set_by_callback = true;
@@ -362,7 +362,7 @@ bool StartStopIndustryTileAnimation(TileIndex tile, IndustryAnimationTrigger iat
IndustryGfx gfx = GetIndustryGfx(tile);
const IndustryTileSpec *itspec = GetIndustryTileSpec(gfx);
- if (!HASBIT(itspec->animation_triggers, iat)) return false;
+ if (!HasBit(itspec->animation_triggers, iat)) return false;
Industry *ind = GetIndustryByTile(tile);
ChangeIndustryTileAnimationFrame(tile, iat, random, gfx, ind);
diff --git a/src/newgrf_sound.cpp b/src/newgrf_sound.cpp
index 0663e17da..b2afe179b 100644
--- a/src/newgrf_sound.cpp
+++ b/src/newgrf_sound.cpp
@@ -59,7 +59,7 @@ bool PlayVehicleSound(const Vehicle *v, VehicleSoundEvent event)
if (file == NULL) return false;
/* Check that the vehicle type uses the sound effect callback */
- if (!HASBIT(EngInfo(v->engine_type)->callbackmask, CBM_VEHICLE_SOUND_EFFECT)) return false;
+ if (!HasBit(EngInfo(v->engine_type)->callbackmask, CBM_VEHICLE_SOUND_EFFECT)) return false;
callback = GetVehicleCallback(CBID_VEHICLE_SOUND_EFFECT, event, 0, v->engine_type, v);
if (callback == CALLBACK_FAILED) return false;
diff --git a/src/newgrf_station.cpp b/src/newgrf_station.cpp
index 41625e6c1..9b8663677 100644
--- a/src/newgrf_station.cpp
+++ b/src/newgrf_station.cpp
@@ -402,26 +402,26 @@ static uint32 StationGetVariable(const ResolverObject *object, byte variable, by
switch (variable) {
/* Calculated station variables */
case 0x40:
- if (!HASBIT(_svc.valid, 0)) { _svc.v40 = GetPlatformInfoHelper(tile, false, false, false); SETBIT(_svc.valid, 0); }
+ if (!HasBit(_svc.valid, 0)) { _svc.v40 = GetPlatformInfoHelper(tile, false, false, false); SETBIT(_svc.valid, 0); }
return _svc.v40;
case 0x41:
- if (!HASBIT(_svc.valid, 1)) { _svc.v41 = GetPlatformInfoHelper(tile, true, false, false); SETBIT(_svc.valid, 1); }
+ if (!HasBit(_svc.valid, 1)) { _svc.v41 = GetPlatformInfoHelper(tile, true, false, false); SETBIT(_svc.valid, 1); }
return _svc.v41;
case 0x42: return GetTerrainType(tile) | (GetRailType(tile) << 8);
case 0x43: return st->owner; // Station owner
case 0x44: return 2; // PBS status
case 0x45:
- if (!HASBIT(_svc.valid, 2)) { _svc.v45 = GetRailContinuationInfo(tile); SETBIT(_svc.valid, 2); }
+ if (!HasBit(_svc.valid, 2)) { _svc.v45 = GetRailContinuationInfo(tile); SETBIT(_svc.valid, 2); }
return _svc.v45;
case 0x46:
- if (!HASBIT(_svc.valid, 3)) { _svc.v46 = GetPlatformInfoHelper(tile, false, false, true); SETBIT(_svc.valid, 3); }
+ if (!HasBit(_svc.valid, 3)) { _svc.v46 = GetPlatformInfoHelper(tile, false, false, true); SETBIT(_svc.valid, 3); }
return _svc.v46;
case 0x47:
- if (!HASBIT(_svc.valid, 4)) { _svc.v47 = GetPlatformInfoHelper(tile, true, false, true); SETBIT(_svc.valid, 4); }
+ if (!HasBit(_svc.valid, 4)) { _svc.v47 = GetPlatformInfoHelper(tile, true, false, true); SETBIT(_svc.valid, 4); }
return _svc.v47;
case 0x48: { // Accepted cargo types
@@ -429,12 +429,12 @@ static uint32 StationGetVariable(const ResolverObject *object, byte variable, by
uint32 value = 0;
for (cargo_type = 0; cargo_type < NUM_CARGO; cargo_type++) {
- if (HASBIT(st->goods[cargo_type].acceptance_pickup, GoodsEntry::PICKUP)) SETBIT(value, cargo_type);
+ if (HasBit(st->goods[cargo_type].acceptance_pickup, GoodsEntry::PICKUP)) SETBIT(value, cargo_type);
}
return value;
}
case 0x49:
- if (!HASBIT(_svc.valid, 5)) { _svc.v49 = GetPlatformInfoHelper(tile, false, true, false); SETBIT(_svc.valid, 5); }
+ if (!HasBit(_svc.valid, 5)) { _svc.v49 = GetPlatformInfoHelper(tile, false, true, false); SETBIT(_svc.valid, 5); }
return _svc.v49;
/* Variables which use the parameter */
@@ -524,7 +524,7 @@ static const SpriteGroup *StationResolveReal(const ResolverObject *object, const
break;
}
- if (HASBIT(statspec->flags, 1)) cargo /= (st->trainst_w + st->trainst_h);
+ if (HasBit(statspec->flags, 1)) cargo /= (st->trainst_w + st->trainst_h);
cargo = min(0xfff, cargo);
if (cargo > statspec->cargo_threshold) {
@@ -751,7 +751,7 @@ bool DrawStationTile(int x, int y, RailType railtype, Axis axis, StationClassID
relocation = GetCustomStationRelocation(statspec, NULL, INVALID_TILE);
- if (HASBIT(statspec->callbackmask, CBM_STATION_SPRITE_LAYOUT)) {
+ if (HasBit(statspec->callbackmask, CBM_STATION_SPRITE_LAYOUT)) {
uint16 callback = GetStationCallback(CBID_STATION_SPRITE_LAYOUT, 0x2110000, 0, statspec, NULL, INVALID_TILE);
if (callback != CALLBACK_FAILED) tile = callback;
}
@@ -763,7 +763,7 @@ bool DrawStationTile(int x, int y, RailType railtype, Axis axis, StationClassID
}
image = sprites->ground_sprite;
- if (HASBIT(image, SPRITE_MODIFIER_USE_OFFSET)) {
+ if (HasBit(image, SPRITE_MODIFIER_USE_OFFSET)) {
image += GetCustomStationGroundRelocation(statspec, NULL, INVALID_TILE);
image += rti->custom_ground_offset;
} else {
@@ -775,7 +775,7 @@ bool DrawStationTile(int x, int y, RailType railtype, Axis axis, StationClassID
foreach_draw_tile_seq(seq, sprites->seq) {
Point pt;
image = seq->image;
- if (HASBIT(image, SPRITE_MODIFIER_USE_OFFSET)) {
+ if (HasBit(image, SPRITE_MODIFIER_USE_OFFSET)) {
image += rti->total_offset;
} else {
image += relocation;
@@ -810,7 +810,7 @@ bool IsStationTileBlocked(TileIndex tile)
{
const StationSpec* statspec = GetStationSpec(tile);
- return statspec != NULL && HASBIT(statspec->blocked, GetStationGfx(tile));
+ return statspec != NULL && HasBit(statspec->blocked, GetStationGfx(tile));
}
/* Check if a rail station tile is electrifiable.
@@ -821,6 +821,6 @@ bool IsStationTileElectrifiable(TileIndex tile)
return
statspec == NULL ||
- HASBIT(statspec->pylons, GetStationGfx(tile)) ||
- !HASBIT(statspec->wires, GetStationGfx(tile));
+ HasBit(statspec->pylons, GetStationGfx(tile)) ||
+ !HasBit(statspec->wires, GetStationGfx(tile));
}
diff --git a/src/newgrf_townname.cpp b/src/newgrf_townname.cpp
index 321635d81..1d46e1983 100644
--- a/src/newgrf_townname.cpp
+++ b/src/newgrf_townname.cpp
@@ -44,7 +44,7 @@ void DelGRFTownName(uint32 grfid)
for (int i = 0; i < 128; i++) {
for (int j = 0; j < t->nbparts[i]; j++) {
for (int k = 0; k < t->partlist[i][j].partcount; k++) {
- if (!HASBIT(t->partlist[i][j].parts[k].prob, 7)) free(t->partlist[i][j].parts[k].data.text);
+ if (!HasBit(t->partlist[i][j].parts[k].prob, 7)) free(t->partlist[i][j].parts[k].data.text);
}
free(t->partlist[i][j].parts);
}
@@ -70,7 +70,7 @@ static char *RandomPart(char *buf, GRFTownName *t, uint32 seed, byte id, const c
byte prob = t->partlist[id][i].parts[j].prob;
maxprob -= GB(prob, 0, 7);
if (maxprob > r) continue;
- if (HASBIT(prob, 7)) {
+ if (HasBit(prob, 7)) {
buf = RandomPart(buf, t, seed, t->partlist[id][i].parts[j].data.id, last);
} else {
buf = strecat(buf, t->partlist[id][i].parts[j].data.text, last);
diff --git a/src/npf.cpp b/src/npf.cpp
index 0afee79b0..af42bcb9e 100644
--- a/src/npf.cpp
+++ b/src/npf.cpp
@@ -602,7 +602,7 @@ static void NPFFollowTrack(AyStar* aystar, OpenListNode* current)
/* check correct rail type (mono, maglev, etc) */
if (type == TRANSPORT_RAIL) {
RailType dst_type = GetTileRailType(dst_tile);
- if (!HASBIT(aystar->user_data[NPF_RAILTYPES], dst_type))
+ if (!HasBit(aystar->user_data[NPF_RAILTYPES], dst_type))
return;
}
diff --git a/src/npf.h b/src/npf.h
index 8a4b527cf..f0ec75ac3 100644
--- a/src/npf.h
+++ b/src/npf.h
@@ -112,7 +112,7 @@ void NPFFillWithOrderData(NPFFindStationOrTileData* fstd, Vehicle* v);
*/
static inline bool NPFGetFlag(const AyStarNode* node, NPFNodeFlag flag)
{
- return HASBIT(node->user_data[NPF_NODE_FLAGS], flag);
+ return HasBit(node->user_data[NPF_NODE_FLAGS], flag);
}
/**
diff --git a/src/oldloader.cpp b/src/oldloader.cpp
index ff782faa4..885c4c824 100644
--- a/src/oldloader.cpp
+++ b/src/oldloader.cpp
@@ -605,7 +605,7 @@ static bool LoadOldGood(LoadgameState *ls, int num)
bool ret = LoadChunk(ls, ge, goods_chunk);
if (!ret) return false;
- SB(ge->acceptance_pickup, GoodsEntry::ACCEPTANCE, 1, HASBIT(_waiting_acceptance, 15));
+ SB(ge->acceptance_pickup, GoodsEntry::ACCEPTANCE, 1, HasBit(_waiting_acceptance, 15));
SB(ge->acceptance_pickup, GoodsEntry::PICKUP, 1, _cargo_source != 0xFF);
if (GB(_waiting_acceptance, 0, 12) != 0) {
CargoPacket *cp = new CargoPacket();
diff --git a/src/openttd.cpp b/src/openttd.cpp
index 62eab9aba..ee4796826 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -1133,7 +1133,7 @@ void GameLoop()
StateGameLoop();
#endif /* ENABLE_NETWORK */
- if (!_pause_game && HASBIT(_display_opt, DO_FULL_ANIMATION)) DoPaletteAnimations();
+ if (!_pause_game && HasBit(_display_opt, DO_FULL_ANIMATION)) DoPaletteAnimations();
if (!_pause_game || _cheats.build_in_pause.value) MoveAllTextEffects();
@@ -1160,7 +1160,7 @@ static void ConvertTownOwner()
for (tile = 0; tile != MapSize(); tile++) {
switch (GetTileType(tile)) {
case MP_ROAD:
- if (GB(_m[tile].m5, 4, 2) == ROAD_TILE_CROSSING && HASBIT(_m[tile].m4, 7)) {
+ if (GB(_m[tile].m5, 4, 2) == ROAD_TILE_CROSSING && HasBit(_m[tile].m4, 7)) {
_m[tile].m4 = OWNER_TOWN;
}
/* FALLTHROUGH */
@@ -1375,7 +1375,7 @@ bool AfterLoadGame()
break;
case MP_STATION: {
- if (HASBIT(_m[t].m6, 3)) SETBIT(_m[t].m6, 2);
+ if (HasBit(_m[t].m6, 3)) SETBIT(_m[t].m6, 2);
StationGfx gfx = GetStationGfx(t);
StationType st;
if ( IS_INT_INSIDE(gfx, 0, 8)) { // Railway station
@@ -1534,7 +1534,7 @@ bool AfterLoadGame()
uint tmp = GB(_m[t].m4, 0, 4);
SB(_m[t].m4, 0, 4, GB(_m[t].m2, 0, 4));
SB(_m[t].m2, 0, 4, tmp);
- } else if (HASBIT(_m[t].m5, 2)) {
+ } else if (HasBit(_m[t].m5, 2)) {
/* Split waypoint and depot rail type and remove the subtype. */
CLRBIT(_m[t].m5, 2);
CLRBIT(_m[t].m5, 6);
@@ -1580,7 +1580,7 @@ bool AfterLoadGame()
case MP_TUNNELBRIDGE:
/* Middle part of "old" bridges */
- if (old_bridge && IsBridgeTile(t) && HASBIT(_m[t].m5, 6)) break;
+ if (old_bridge && IsBridgeTile(t) && HasBit(_m[t].m5, 6)) break;
if ((IsTunnel(t) ? GetTunnelTransportType(t) : (old_bridge ? (TransportType)GB(_m[t].m5, 1, 2) : GetBridgeTransportType(t))) == TRANSPORT_ROAD) {
SetRoadTypes(t, ROADTYPES_ROAD);
}
@@ -1597,10 +1597,10 @@ bool AfterLoadGame()
for (TileIndex t = 0; t < map_size; t++) {
if (MayHaveBridgeAbove(t)) ClearBridgeMiddle(t);
if (IsBridgeTile(t)) {
- if (HASBIT(_m[t].m5, 6)) { // middle part
+ if (HasBit(_m[t].m5, 6)) { // middle part
Axis axis = (Axis)GB(_m[t].m5, 0, 1);
- if (HASBIT(_m[t].m5, 5)) { // transport route under bridge?
+ if (HasBit(_m[t].m5, 5)) { // transport route under bridge?
if (GB(_m[t].m5, 3, 2) == TRANSPORT_RAIL) {
MakeRailNormal(
t,
@@ -1738,7 +1738,7 @@ bool AfterLoadGame()
if (wp->deleted == 0) {
const StationSpec *statspec = NULL;
- if (HASBIT(_m[wp->xy].m3, 4))
+ if (HasBit(_m[wp->xy].m3, 4))
statspec = GetCustomStationSpec(STAT_CLASS_WAYP, _m[wp->xy].m4 + 1);
if (statspec != NULL) {
@@ -1772,10 +1772,10 @@ bool AfterLoadGame()
case MP_RAILWAY:
if (HasSignals(t)) {
/* convert PBS signals to combo-signals */
- if (HASBIT(_m[t].m2, 2)) SetSignalType(t, TRACK_X, SIGTYPE_COMBO);
+ if (HasBit(_m[t].m2, 2)) SetSignalType(t, TRACK_X, SIGTYPE_COMBO);
/* move the signal variant back */
- SetSignalVariant(t, TRACK_X, HASBIT(_m[t].m2, 3) ? SIG_SEMAPHORE : SIG_ELECTRIC);
+ SetSignalVariant(t, TRACK_X, HasBit(_m[t].m2, 3) ? SIG_SEMAPHORE : SIG_ELECTRIC);
CLRBIT(_m[t].m2, 3);
}
@@ -1938,7 +1938,7 @@ bool AfterLoadGame()
} else {
/* The "lift has destination" bit has been moved from
* m5[7] to m7[0]. */
- SB(_me[t].m7, 0, 1, HASBIT(_m[t].m5, 7));
+ SB(_me[t].m7, 0, 1, HasBit(_m[t].m5, 7));
CLRBIT(_m[t].m5, 7);
/* The "lift is moving" bit has been removed, as it does
@@ -2037,7 +2037,7 @@ bool AfterLoadGame()
const CargoList::List *packets = v->cargo.Packets();
for (CargoList::List::const_iterator it = packets->begin(); it != packets->end(); it++) {
CargoPacket *cp = *it;
- cp->paid_for = HASBIT(v->vehicle_flags, 2);
+ cp->paid_for = HasBit(v->vehicle_flags, 2);
}
CLRBIT(v->vehicle_flags, 2);
v->cargo.InvalidateCache();
diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp
index ab8bef202..bcc458fa0 100644
--- a/src/order_cmd.cpp
+++ b/src/order_cmd.cpp
@@ -507,7 +507,7 @@ CommandCost CmdDeleteOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
/* NON-stop flag is misused to see if a train is in a station that is
* on his order list or not */
if (sel_ord == u->cur_order_index && u->current_order.type == OT_LOADING &&
- HASBIT(u->current_order.flags, OFB_NON_STOP)) {
+ HasBit(u->current_order.flags, OFB_NON_STOP)) {
u->current_order.flags = 0;
}
@@ -549,7 +549,7 @@ CommandCost CmdSkipToOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
v->LeaveStation();
/* NON-stop flag is misused to see if a train is in a station that is
* on his order list or not */
- if (HASBIT(v->current_order.flags, OFB_NON_STOP)) v->current_order.flags = 0;
+ if (HasBit(v->current_order.flags, OFB_NON_STOP)) v->current_order.flags = 0;
}
InvalidateVehicleOrder(v);
@@ -719,7 +719,7 @@ CommandCost CmdModifyOrder(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
*/
if (sel_ord == u->cur_order_index &&
u->current_order.type != OT_GOTO_DEPOT &&
- HASBIT(u->current_order.flags, OFB_FULL_LOAD) != HASBIT(order->flags, OFB_FULL_LOAD)) {
+ HasBit(u->current_order.flags, OFB_FULL_LOAD) != HasBit(order->flags, OFB_FULL_LOAD)) {
TOGGLEBIT(u->current_order.flags, OFB_FULL_LOAD);
}
InvalidateVehicleOrder(u);
@@ -902,7 +902,7 @@ CommandCost CmdOrderRefit(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
InvalidateVehicleOrder(u);
/* If the vehicle already got the current depot set as current order, then update current order as well */
- if (u->cur_order_index == order_number && HASBIT(u->current_order.flags, OFB_PART_OF_ORDERS)) {
+ if (u->cur_order_index == order_number && HasBit(u->current_order.flags, OFB_PART_OF_ORDERS)) {
u->current_order.refit_cargo = cargo;
u->current_order.refit_subtype = subtype;
}
diff --git a/src/pathfind.cpp b/src/pathfind.cpp
index fb0fc98bd..68602667f 100644
--- a/src/pathfind.cpp
+++ b/src/pathfind.cpp
@@ -185,7 +185,7 @@ static void TPFMode2(TrackPathFinder* tpf, TileIndex tile, DiagDirection directi
}
continue_here:;
- tpf->the_dir = (Trackdir)(i + (HASBIT(_otherdir_mask[direction], i) ? 8 : 0));
+ tpf->the_dir = (Trackdir)(i + (HasBit(_otherdir_mask[direction], i) ? 8 : 0));
if (!tpf->enum_proc(tile, tpf->userdata, tpf->the_dir, tpf->rd.cur_length, NULL)) {
TPFMode2(tpf, tile, _tpf_new_direction[tpf->the_dir]);
@@ -410,16 +410,16 @@ void FollowTrack(TileIndex tile, uint16 flags, uint sub_type, DiagDirection dire
tpf.rd.depth = 0;
tpf.rd.pft_var6 = 0;
- tpf.var2 = HASBIT(flags, 15) ? 0x43 : 0xFF; // 0x8000
+ tpf.var2 = HasBit(flags, 15) ? 0x43 : 0xFF; // 0x8000
- tpf.disable_tile_hash = HASBIT(flags, 12); // 0x1000
- tpf.hasbit_13 = HASBIT(flags, 13); // 0x2000
+ tpf.disable_tile_hash = HasBit(flags, 12); // 0x1000
+ tpf.hasbit_13 = HasBit(flags, 13); // 0x2000
tpf.tracktype = (TransportType)(flags & 0xFF);
tpf.sub_type = sub_type;
- if (HASBIT(flags, 11)) {
+ if (HasBit(flags, 11)) {
tpf.rd.pft_var6 = 0xFF;
tpf.enum_proc(tile, data, INVALID_TRACKDIR, 0, 0);
TPFMode2(&tpf, tile, direction);
@@ -746,7 +746,7 @@ start_at:
/* We are not driving into the tunnel, or it is an invalid tunnel */
continue;
}
- if (!HASBIT(tpf->railtypes, GetRailType(tile))) {
+ if (!HasBit(tpf->railtypes, GetRailType(tile))) {
bits = TRACK_BIT_NONE;
break;
}
@@ -796,7 +796,7 @@ start_at:
/* Check that the tile contains exactly one track */
if (bits == 0 || KillFirstBit(bits) != 0) break;
- if (!HASBIT(tpf->railtypes, GetRailType(tile))) {
+ if (!HasBit(tpf->railtypes, GetRailType(tile))) {
bits = TRACK_BIT_NONE;
break;
}
@@ -822,7 +822,7 @@ start_at:
* bits, not just reachable ones, to prevent infinite loops. */
if (bits == TRACK_BIT_NONE || TracksOverlap(allbits)) break;
- if (!HASBIT(tpf->railtypes, GetRailType(tile))) {
+ if (!HasBit(tpf->railtypes, GetRailType(tile))) {
bits = TRACK_BIT_NONE;
break;
}
diff --git a/src/player.h b/src/player.h
index 98f3f6f83..5216714e7 100644
--- a/src/player.h
+++ b/src/player.h
@@ -263,7 +263,7 @@ byte GetPlayerRoadtypes(PlayerID p);
*/
static inline bool HasRailtypeAvail(const Player *p, const RailType Railtype)
{
- return HASBIT(p->avail_railtypes, Railtype);
+ return HasBit(p->avail_railtypes, Railtype);
}
/** Finds out, whether given player has all given RoadTypes available
@@ -297,7 +297,7 @@ static inline bool IsInteractivePlayer(PlayerID pi)
void DrawPlayerIcon(PlayerID p, int x, int y);
/* Validate functions for rail building */
-static inline bool ValParamRailtype(const uint32 rail) { return HASBIT(GetPlayer(_current_player)->avail_railtypes, rail);}
+static inline bool ValParamRailtype(const uint32 rail) { return HasBit(GetPlayer(_current_player)->avail_railtypes, rail);}
/* Validate functions for road building */
static inline bool ValParamRoadType(const RoadType rt) { return HasRoadTypesAvail(_current_player, RoadTypeToRoadTypes(rt));}
diff --git a/src/player_face.h b/src/player_face.h
index f28a880f6..aceec8c4b 100644
--- a/src/player_face.h
+++ b/src/player_face.h
@@ -169,7 +169,7 @@ static inline void ScaleAllPlayerFaceBits(PlayerFace &pf)
GenderEthnicity ge = (GenderEthnicity)GB(pf, _pf_info[PFV_GEN_ETHN].offset, _pf_info[PFV_GEN_ETHN].length); // gender & ethnicity of the face
/* Is a male face with moustache. Need to reduce CPU load in the loop. */
- bool is_moust_male = !HASBIT(ge, GENDER_FEMALE) && GetPlayerFaceBits(pf, PFV_HAS_MOUSTACHE, ge) != 0;
+ bool is_moust_male = !HasBit(ge, GENDER_FEMALE) && GetPlayerFaceBits(pf, PFV_HAS_MOUSTACHE, ge) != 0;
for (PlayerFaceVariable pfv = PFV_EYE_COLOUR; pfv < PFV_END; pfv++) { // scales all other variables
@@ -202,7 +202,7 @@ static inline void RandomPlayerFaceBits(PlayerFace &pf, GenderEthnicity ge, bool
if (adv) {
SetPlayerFaceBits(pf, PFV_GEN_ETHN, ge, ge);
} else {
- SetPlayerFaceBits(pf, PFV_GENDER, ge, HASBIT(ge, GENDER_FEMALE));
+ SetPlayerFaceBits(pf, PFV_GENDER, ge, HasBit(ge, GENDER_FEMALE));
}
/* scales all player face bits to the correct scope */
diff --git a/src/player_gui.cpp b/src/player_gui.cpp
index a4ae1c245..1218f305d 100644
--- a/src/player_gui.cpp
+++ b/src/player_gui.cpp
@@ -171,7 +171,7 @@ static void PlayerFinancesWndProc(Window *w, WindowEvent *e)
bool stickied = !!(w->flags4 & WF_STICKY);
PlayerID player = (PlayerID)w->window_number;
DeleteWindow(w);
- DoShowPlayerFinances(player, !HASBIT(mode, 0), stickied);
+ DoShowPlayerFinances(player, !HasBit(mode, 0), stickied);
} break;
case 6: /* increase loan */
@@ -272,7 +272,7 @@ static void ShowColourDropDownMenu(Window *w, uint32 widget)
LiveryScheme scheme;
/* Disallow other player colours for the primary colour */
- if (HASBIT(WP(w, livery_d).sel, LS_DEFAULT) && widget == 10) {
+ if (HasBit(WP(w, livery_d).sel, LS_DEFAULT) && widget == 10) {
const Player *p;
FOR_ALL_PLAYERS(p) {
if (p->is_active && p->index != _local_player) SETBIT(used_colours, p->player_color);
@@ -281,7 +281,7 @@ static void ShowColourDropDownMenu(Window *w, uint32 widget)
/* Get the first selected livery to use as the default dropdown item */
for (scheme = LS_BEGIN; scheme < LS_END; scheme++) {
- if (HASBIT(WP(w, livery_d).sel, scheme)) break;
+ if (HasBit(WP(w, livery_d).sel, scheme)) break;
}
if (scheme == LS_END) scheme = LS_DEFAULT;
livery = &GetPlayer((PlayerID)w->window_number)->livery[scheme];
@@ -313,7 +313,7 @@ static void SelectPlayerLiveryWndProc(Window *w, WindowEvent *e)
if (!(WP(w, livery_d).sel == 0)) {
for (scheme = LS_BEGIN; scheme < LS_END; scheme++) {
- if (HASBIT(WP(w, livery_d).sel, scheme)) break;
+ if (HasBit(WP(w, livery_d).sel, scheme)) break;
}
if (scheme == LS_END) scheme = LS_DEFAULT;
}
@@ -325,7 +325,7 @@ static void SelectPlayerLiveryWndProc(Window *w, WindowEvent *e)
for (scheme = LS_DEFAULT; scheme < LS_END; scheme++) {
if (livery_class[scheme] == WP(w, livery_d).livery_class) {
- bool sel = HASBIT(WP(w, livery_d).sel, scheme) != 0;
+ bool sel = HasBit(WP(w, livery_d).sel, scheme) != 0;
if (scheme != LS_DEFAULT) {
DrawSprite(p->livery[scheme].in_use ? SPR_BOX_CHECKED : SPR_BOX_EMPTY, PAL_NONE, 2, y);
@@ -417,7 +417,7 @@ static void SelectPlayerLiveryWndProc(Window *w, WindowEvent *e)
LiveryScheme scheme;
for (scheme = LS_DEFAULT; scheme < LS_END; scheme++) {
- if (HASBIT(WP(w, livery_d).sel, scheme)) {
+ if (HasBit(WP(w, livery_d).sel, scheme)) {
DoCommandP(0, scheme | (e->we.dropdown.button == 10 ? 0 : 256), e->we.dropdown.index, NULL, CMD_SET_PLAYER_COLOR);
}
}
@@ -490,8 +490,8 @@ void DrawPlayerFace(PlayerFace pf, int color, int x, int y)
{
GenderEthnicity ge = (GenderEthnicity)GetPlayerFaceBits(pf, PFV_GEN_ETHN, GE_WM);
- bool has_moustache = !HASBIT(ge, GENDER_FEMALE) && GetPlayerFaceBits(pf, PFV_HAS_MOUSTACHE, ge) != 0;
- bool has_tie_earring = !HASBIT(ge, GENDER_FEMALE) || GetPlayerFaceBits(pf, PFV_HAS_TIE_EARRING, ge) != 0;
+ bool has_moustache = !HasBit(ge, GENDER_FEMALE) && GetPlayerFaceBits(pf, PFV_HAS_MOUSTACHE, ge) != 0;
+ bool has_tie_earring = !HasBit(ge, GENDER_FEMALE) || GetPlayerFaceBits(pf, PFV_HAS_TIE_EARRING, ge) != 0;
bool has_glasses = GetPlayerFaceBits(pf, PFV_HAS_GLASSES, ge) != 0;
SpriteID pal;
@@ -686,7 +686,7 @@ static void SelectPlayerFaceWndProc(Window *w, WindowEvent *e)
{
PlayerFace *pf = &WP(w, facesel_d).face; // pointer to the player face bits
GenderEthnicity ge = (GenderEthnicity)GB(*pf, _pf_info[PFV_GEN_ETHN].offset, _pf_info[PFV_GEN_ETHN].length); // get the gender and ethnicity
- bool is_female = HASBIT(ge, GENDER_FEMALE); // get the gender: 0 == male and 1 == female
+ bool is_female = HasBit(ge, GENDER_FEMALE); // get the gender: 0 == male and 1 == female
bool is_moust_male = !is_female && GetPlayerFaceBits(*pf, PFV_HAS_MOUSTACHE, ge) != 0; // is a male face with moustache
switch (e->event) {
@@ -698,8 +698,8 @@ static void SelectPlayerFaceWndProc(Window *w, WindowEvent *e)
/* advanced player face selection window */
if (WP(w, facesel_d).advanced) {
/* lower the non-selected ethnicity button */
- SetWindowWidgetLoweredState(w, PFW_WIDGET_ETHNICITY_EUR, !HASBIT(ge, ETHNICITY_BLACK));
- SetWindowWidgetLoweredState(w, PFW_WIDGET_ETHNICITY_AFR, HASBIT(ge, ETHNICITY_BLACK));
+ SetWindowWidgetLoweredState(w, PFW_WIDGET_ETHNICITY_EUR, !HasBit(ge, ETHNICITY_BLACK));
+ SetWindowWidgetLoweredState(w, PFW_WIDGET_ETHNICITY_AFR, HasBit(ge, ETHNICITY_BLACK));
/* Disable dynamically the widgets which PlayerFaceVariable has less than 2 options
diff --git a/src/players.cpp b/src/players.cpp
index 3a3ace897..4d2f21b26 100644
--- a/src/players.cpp
+++ b/src/players.cpp
@@ -90,12 +90,12 @@ PlayerFace ConvertFromOldPlayerFace(uint32 face)
PlayerFace pf = 0;
GenderEthnicity ge = GE_WM;
- if (HASBIT(face, 31)) SetBitT(ge, GENDER_FEMALE);
- if (HASBIT(face, 27) && (HASBIT(face, 26) == HASBIT(face, 19))) SetBitT(ge, ETHNICITY_BLACK);
+ if (HasBit(face, 31)) SetBitT(ge, GENDER_FEMALE);
+ if (HasBit(face, 27) && (HasBit(face, 26) == HasBit(face, 19))) SetBitT(ge, ETHNICITY_BLACK);
SetPlayerFaceBits(pf, PFV_GEN_ETHN, ge, ge);
SetPlayerFaceBits(pf, PFV_HAS_GLASSES, ge, GB(face, 28, 3) <= 1);
- SetPlayerFaceBits(pf, PFV_EYE_COLOUR, ge, HASBIT(ge, ETHNICITY_BLACK) ? 0 : ClampU(GB(face, 20, 3), 5, 7) - 5);
+ SetPlayerFaceBits(pf, PFV_EYE_COLOUR, ge, HasBit(ge, ETHNICITY_BLACK) ? 0 : ClampU(GB(face, 20, 3), 5, 7) - 5);
SetPlayerFaceBits(pf, PFV_CHIN, ge, ScalePlayerFaceValue(PFV_CHIN, ge, GB(face, 4, 2)));
SetPlayerFaceBits(pf, PFV_EYEBROWS, ge, ScalePlayerFaceValue(PFV_EYEBROWS, ge, GB(face, 6, 4)));
SetPlayerFaceBits(pf, PFV_HAIR, ge, ScalePlayerFaceValue(PFV_HAIR, ge, GB(face, 16, 4)));
@@ -104,14 +104,14 @@ PlayerFace ConvertFromOldPlayerFace(uint32 face)
SetPlayerFaceBits(pf, PFV_GLASSES, ge, GB(face, 28, 1));
uint lips = GB(face, 10, 4);
- if (!HASBIT(ge, GENDER_FEMALE) && lips < 4) {
+ if (!HasBit(ge, GENDER_FEMALE) && lips < 4) {
SetPlayerFaceBits(pf, PFV_HAS_MOUSTACHE, ge, true);
SetPlayerFaceBits(pf, PFV_MOUSTACHE, ge, max(lips, 1U) - 1);
} else {
- if (!HASBIT(ge, GENDER_FEMALE)) {
+ if (!HasBit(ge, GENDER_FEMALE)) {
lips = lips * 15 / 16;
lips -= 3;
- if (HASBIT(ge, ETHNICITY_BLACK) && lips > 8) lips = 0;
+ if (HasBit(ge, ETHNICITY_BLACK) && lips > 8) lips = 0;
} else {
lips = ScalePlayerFaceValue(PFV_LIPS, ge, lips);
}
@@ -127,9 +127,9 @@ PlayerFace ConvertFromOldPlayerFace(uint32 face)
}
uint tie_earring = GB(face, 24, 4);
- if (!HASBIT(ge, GENDER_FEMALE) || tie_earring < 3) { // Not all females have an earring
- if (HASBIT(ge, GENDER_FEMALE)) SetPlayerFaceBits(pf, PFV_HAS_TIE_EARRING, ge, true);
- SetPlayerFaceBits(pf, PFV_TIE_EARRING, ge, HASBIT(ge, GENDER_FEMALE) ? tie_earring : ScalePlayerFaceValue(PFV_TIE_EARRING, ge, tie_earring / 2));
+ if (!HasBit(ge, GENDER_FEMALE) || tie_earring < 3) { // Not all females have an earring
+ if (HasBit(ge, GENDER_FEMALE)) SetPlayerFaceBits(pf, PFV_HAS_TIE_EARRING, ge, true);
+ SetPlayerFaceBits(pf, PFV_TIE_EARRING, ge, HasBit(ge, GENDER_FEMALE) ? tie_earring : ScalePlayerFaceValue(PFV_TIE_EARRING, ge, tie_earring / 2));
}
return pf;
@@ -146,8 +146,8 @@ bool IsValidPlayerFace(PlayerFace pf)
if (!ArePlayerFaceBitsValid(pf, PFV_GEN_ETHN, GE_WM)) return false;
GenderEthnicity ge = (GenderEthnicity)GetPlayerFaceBits(pf, PFV_GEN_ETHN, GE_WM);
- bool has_moustache = !HASBIT(ge, GENDER_FEMALE) && GetPlayerFaceBits(pf, PFV_HAS_MOUSTACHE, ge) != 0;
- bool has_tie_earring = !HASBIT(ge, GENDER_FEMALE) || GetPlayerFaceBits(pf, PFV_HAS_TIE_EARRING, ge) != 0;
+ bool has_moustache = !HasBit(ge, GENDER_FEMALE) && GetPlayerFaceBits(pf, PFV_HAS_MOUSTACHE, ge) != 0;
+ bool has_tie_earring = !HasBit(ge, GENDER_FEMALE) || GetPlayerFaceBits(pf, PFV_HAS_TIE_EARRING, ge) != 0;
bool has_glasses = GetPlayerFaceBits(pf, PFV_HAS_GLASSES, ge) != 0;
if (!ArePlayerFaceBitsValid(pf, PFV_EYE_COLOUR, ge)) return false;
@@ -197,14 +197,14 @@ static void SubtractMoneyFromAnyPlayer(Player *p, CommandCost cost)
tmp.AddCost(cost);
p->yearly_expenses[0][_yearly_expenses_type] = tmp.GetCost();
- if (HASBIT(1 << EXPENSES_TRAIN_INC |
+ if (HasBit(1 << EXPENSES_TRAIN_INC |
1 << EXPENSES_ROADVEH_INC |
1 << EXPENSES_AIRCRAFT_INC |
1 << EXPENSES_SHIP_INC, _yearly_expenses_type)) {
tmp = CommandCost(p->cur_economy.income);
tmp.AddCost(-cost.GetCost());
p->cur_economy.income = tmp.GetCost();
- } else if (HASBIT(1 << EXPENSES_TRAIN_RUN |
+ } else if (HasBit(1 << EXPENSES_TRAIN_RUN |
1 << EXPENSES_ROADVEH_RUN |
1 << EXPENSES_AIRCRAFT_RUN |
1 << EXPENSES_SHIP_RUN |
@@ -597,8 +597,8 @@ byte GetPlayerRailtypes(PlayerID p)
const Engine* e = GetEngine(i);
const EngineInfo *ei = EngInfo(i);
- if (e->type == VEH_TRAIN && HASBIT(ei->climates, _opt.landscape) &&
- (HASBIT(e->player_avail, p) || _date >= e->intro_date + 365)) {
+ if (e->type == VEH_TRAIN && HasBit(ei->climates, _opt.landscape) &&
+ (HasBit(e->player_avail, p) || _date >= e->intro_date + 365)) {
const RailVehicleInfo *rvi = RailVehInfo(i);
if (rvi->railveh_type != RAILVEH_WAGON) {
@@ -620,9 +620,9 @@ byte GetPlayerRoadtypes(PlayerID p)
const Engine* e = GetEngine(i);
const EngineInfo *ei = EngInfo(i);
- if (e->type == VEH_ROAD && HASBIT(ei->climates, _opt.landscape) &&
- (HASBIT(e->player_avail, p) || _date >= e->intro_date + 365)) {
- SETBIT(rt, HASBIT(ei->misc_flags, EF_ROAD_TRAM) ? ROADTYPE_TRAM : ROADTYPE_ROAD);
+ if (e->type == VEH_ROAD && HasBit(ei->climates, _opt.landscape) &&
+ (HasBit(e->player_avail, p) || _date >= e->intro_date + 365)) {
+ SETBIT(rt, HasBit(ei->misc_flags, EF_ROAD_TRAM) ? ROADTYPE_TRAM : ROADTYPE_ROAD);
}
}
@@ -677,11 +677,11 @@ CommandCost CmdSetAutoReplace(TileIndex tile, uint32 flags, uint32 p1, uint32 p2
p = GetPlayer(_current_player);
switch (GB(p1, 0, 3)) {
case 0:
- if (p->engine_renew == HASBIT(p2, 0))
+ if (p->engine_renew == HasBit(p2, 0))
return CMD_ERROR;
if (flags & DC_EXEC) {
- p->engine_renew = HASBIT(p2, 0);
+ p->engine_renew = HasBit(p2, 0);
if (IsLocalPlayer()) {
_patches.autorenew = p->engine_renew;
InvalidateWindow(WC_GAME_OPTIONS, 0);
@@ -735,7 +735,7 @@ CommandCost CmdSetAutoReplace(TileIndex tile, uint32 flags, uint32 p1, uint32 p2
return CMD_ERROR;
/* make sure that the player can actually buy the new engine */
- if (!HASBIT(GetEngine(new_engine_type)->player_avail, _current_player))
+ if (!HasBit(GetEngine(new_engine_type)->player_avail, _current_player))
return CMD_ERROR;
cost = AddEngineReplacementForPlayer(p, old_engine_type, new_engine_type, id_g, flags);
@@ -750,7 +750,7 @@ CommandCost CmdSetAutoReplace(TileIndex tile, uint32 flags, uint32 p1, uint32 p2
case 4:
if (flags & DC_EXEC) {
- p->engine_renew = HASBIT(p1, 15);
+ p->engine_renew = HasBit(p1, 15);
p->engine_renew_months = (int16)GB(p1, 16, 16);
p->engine_renew_money = (uint32)p2;
@@ -763,11 +763,11 @@ CommandCost CmdSetAutoReplace(TileIndex tile, uint32 flags, uint32 p1, uint32 p2
}
break;
case 5:
- if (p->renew_keep_length == HASBIT(p2, 0))
+ if (p->renew_keep_length == HasBit(p2, 0))
return CMD_ERROR;
if (flags & DC_EXEC) {
- p->renew_keep_length = HASBIT(p2, 0);
+ p->renew_keep_length = HasBit(p2, 0);
if (IsLocalPlayer()) {
InvalidateWindow(WC_REPLACE_VEHICLE, VEH_TRAIN);
}
diff --git a/src/rail.h b/src/rail.h
index 00adf6183..4503b0a94 100644
--- a/src/rail.h
+++ b/src/rail.h
@@ -759,7 +759,7 @@ static inline const RailtypeInfo *GetRailTypeInfo(RailType railtype)
*/
static inline bool IsCompatibleRail(RailType enginetype, RailType tiletype)
{
- return HASBIT(GetRailTypeInfo(enginetype)->compatible_railtypes, tiletype);
+ return HasBit(GetRailTypeInfo(enginetype)->compatible_railtypes, tiletype);
}
/**
@@ -772,7 +772,7 @@ static inline bool IsCompatibleRail(RailType enginetype, RailType tiletype)
*/
static inline bool HasPowerOnRail(RailType enginetype, RailType tiletype)
{
- return HASBIT(GetRailTypeInfo(enginetype)->powered_railtypes, tiletype);
+ return HasBit(GetRailTypeInfo(enginetype)->powered_railtypes, tiletype);
}
/**
diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp
index a1b840dbd..19895e230 100644
--- a/src/rail_cmd.cpp
+++ b/src/rail_cmd.cpp
@@ -360,7 +360,7 @@ CommandCost CmdBuildSingleRail(TileIndex tile, uint32 flags, uint32 p1, uint32 p
case MP_ROAD:
#define M(x) (1 << (x))
/* Level crossings may only be built on these slopes */
- if (!HASBIT(M(SLOPE_SEN) | M(SLOPE_ENW) | M(SLOPE_NWS) | M(SLOPE_NS) | M(SLOPE_WSE) | M(SLOPE_EW) | M(SLOPE_FLAT), tileh)) {
+ if (!HasBit(M(SLOPE_SEN) | M(SLOPE_ENW) | M(SLOPE_NWS) | M(SLOPE_NS) | M(SLOPE_WSE) | M(SLOPE_EW) | M(SLOPE_FLAT), tileh)) {
return_cmd_error(STR_1000_LAND_SLOPED_IN_WRONG_DIRECTION);
}
#undef M
@@ -601,7 +601,7 @@ static CommandCost ValidateAutoDrag(Trackdir *trackdir, TileIndex start, TileInd
(trdy <= 0 && dy > 0) ||
(trdy >= 0 && dy < 0)
) {
- if (!HASBIT(*trackdir, 3)) { // first direction is invalid, try the other
+ if (!HasBit(*trackdir, 3)) { // first direction is invalid, try the other
SetBitT(*trackdir, 3); // reverse the direction
trdx = -trdx;
trdy = -trdy;
@@ -636,7 +636,7 @@ static CommandCost CmdRailTrackHelper(TileIndex tile, uint32 flags, uint32 p1, u
CommandCost ret, total_cost;
Track track = (Track)GB(p2, 4, 3);
Trackdir trackdir;
- byte mode = HASBIT(p2, 7);
+ byte mode = HasBit(p2, 7);
RailType railtype = (RailType)GB(p2, 0, 4);
TileIndex end_tile;
@@ -783,8 +783,8 @@ CommandCost CmdBuildTrainDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p
CommandCost CmdBuildSingleSignal(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
Track track = (Track)GB(p1, 0, 3);
- bool pre_signal = HASBIT(p1, 3);
- SignalVariant sigvar = (pre_signal ^ HASBIT(p1, 4)) ? SIG_SEMAPHORE : SIG_ELECTRIC;
+ bool pre_signal = HasBit(p1, 3);
+ SignalVariant sigvar = (pre_signal ^ HasBit(p1, 4)) ? SIG_SEMAPHORE : SIG_ELECTRIC;
CommandCost cost;
if (!ValParamTrackOrientation(track) || !IsTileType(tile, MP_RAILWAY) || !EnsureNoTrainOnTrack(tile, track))
@@ -946,10 +946,10 @@ static CommandCost CmdSignalTrackHelper(TileIndex tile, uint32 flags, uint32 p1,
TileIndex start_tile = tile;
Track track = (Track)GB(p2, 0, 3);
- bool mode = HASBIT(p2, 3);
- bool semaphores = HASBIT(p2, 4);
- bool remove = HASBIT(p2, 5);
- bool autofill = HASBIT(p2, 6);
+ bool mode = HasBit(p2, 3);
+ bool semaphores = HasBit(p2, 4);
+ bool remove = HasBit(p2, 5);
+ bool autofill = HasBit(p2, 6);
Trackdir trackdir = TrackToTrackdir(track);
byte signal_density = GB(p2, 24, 8);
@@ -1006,8 +1006,8 @@ static CommandCost CmdSignalTrackHelper(TileIndex tile, uint32 flags, uint32 p1,
/* Pick the correct orientation for the track direction */
signals = 0;
- if (HASBIT(signal_dir, 0)) signals |= SignalAlongTrackdir(trackdir);
- if (HASBIT(signal_dir, 1)) signals |= SignalAgainstTrackdir(trackdir);
+ if (HasBit(signal_dir, 0)) signals |= SignalAlongTrackdir(trackdir);
+ if (HasBit(signal_dir, 1)) signals |= SignalAgainstTrackdir(trackdir);
ret = DoCommand(tile, p1, signals, flags, remove ? CMD_REMOVE_SIGNALS : CMD_BUILD_SIGNALS);
@@ -1662,7 +1662,7 @@ static void DrawTile_Track(TileInfo *ti)
DrawTrackBits(ti, rails);
- if (HASBIT(_display_opt, DO_FULL_DETAIL)) DrawTrackDetails(ti);
+ if (HasBit(_display_opt, DO_FULL_DETAIL)) DrawTrackDetails(ti);
if (GetRailType(ti->tile) == RAILTYPE_ELECTRIC) DrawCatenary(ti);
@@ -1702,7 +1702,7 @@ static void DrawTile_Track(TileInfo *ti)
const Station* st = ComposeWaypointStation(ti->tile);
uint gfx = 2;
- if (HASBIT(statspec->callbackmask, CBM_STATION_SPRITE_LAYOUT)) {
+ if (HasBit(statspec->callbackmask, CBM_STATION_SPRITE_LAYOUT)) {
uint16 callback = GetStationCallback(CBID_STATION_SPRITE_LAYOUT, 0, 0, statspec, st, ti->tile);
if (callback != CALLBACK_FAILED) gfx = callback;
}
@@ -1717,7 +1717,7 @@ static void DrawTile_Track(TileInfo *ti)
relocation = GetCustomStationRelocation(statspec, st, ti->tile);
image = dts->ground_sprite;
- if (HASBIT(image, SPRITE_MODIFIER_USE_OFFSET)) {
+ if (HasBit(image, SPRITE_MODIFIER_USE_OFFSET)) {
image += GetCustomStationGroundRelocation(statspec, st, ti->tile);
image += rti->custom_ground_offset;
} else {
@@ -1747,13 +1747,13 @@ default_waypoint:
/* Unlike stations, our default waypoint has no variation for
* different railtype, so don't use the railtype offset if
* no relocation is set */
- if (HASBIT(image, SPRITE_MODIFIER_USE_OFFSET)) {
+ if (HasBit(image, SPRITE_MODIFIER_USE_OFFSET)) {
image += rti->total_offset;
} else {
image += relocation;
}
- if (!IsTransparencySet(TO_BUILDINGS) && HASBIT(image, PALETTE_MODIFIER_COLOR)) {
+ if (!IsTransparencySet(TO_BUILDINGS) && HasBit(image, PALETTE_MODIFIER_COLOR)) {
pal = _drawtile_track_palette;
} else {
pal = dtss->pal;
@@ -1785,7 +1785,7 @@ static void DrawTileSequence(int x, int y, SpriteID ground, const DrawTileSeqStr
Point pt = RemapCoords(dtss->delta_x, dtss->delta_y, dtss->delta_z);
SpriteID image = dtss->image + offset;
- DrawSprite(image, HASBIT(image, PALETTE_MODIFIER_COLOR) ? palette : PAL_NONE, x + pt.x, y + pt.y);
+ DrawSprite(image, HasBit(image, PALETTE_MODIFIER_COLOR) ? palette : PAL_NONE, x + pt.x, y + pt.y);
}
}
diff --git a/src/rail_gui.cpp b/src/rail_gui.cpp
index 18add393e..5c3483f12 100644
--- a/src/rail_gui.cpp
+++ b/src/rail_gui.cpp
@@ -719,19 +719,19 @@ static void CheckSelectedSize(Window *w, const StationSpec *statspec)
{
if (statspec == NULL || _railstation.dragdrop) return;
- if (HASBIT(statspec->disallowed_platforms, _railstation.numtracks - 1)) {
+ if (HasBit(statspec->disallowed_platforms, _railstation.numtracks - 1)) {
RaiseWindowWidget(w, _railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN);
_railstation.numtracks = 1;
- while (HASBIT(statspec->disallowed_platforms, _railstation.numtracks - 1)) {
+ while (HasBit(statspec->disallowed_platforms, _railstation.numtracks - 1)) {
_railstation.numtracks++;
}
LowerWindowWidget(w, _railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN);
}
- if (HASBIT(statspec->disallowed_lengths, _railstation.platlength - 1)) {
+ if (HasBit(statspec->disallowed_lengths, _railstation.platlength - 1)) {
RaiseWindowWidget(w, _railstation.platlength + BRSW_PLATFORM_LEN_BEGIN);
_railstation.platlength = 1;
- while (HASBIT(statspec->disallowed_lengths, _railstation.platlength - 1)) {
+ while (HasBit(statspec->disallowed_lengths, _railstation.platlength - 1)) {
_railstation.platlength++;
}
LowerWindowWidget(w, _railstation.platlength + BRSW_PLATFORM_LEN_BEGIN);
@@ -781,8 +781,8 @@ static void StationBuildWndProc(Window *w, WindowEvent *e)
SetWindowWidgetDisabledState(w, bits + BRSW_PLATFORM_NUM_1, disable);
SetWindowWidgetDisabledState(w, bits + BRSW_PLATFORM_LEN_1, disable);
} else {
- SetWindowWidgetDisabledState(w, bits + BRSW_PLATFORM_NUM_1, HASBIT(statspec->disallowed_platforms, bits) || disable);
- SetWindowWidgetDisabledState(w, bits + BRSW_PLATFORM_LEN_1, HASBIT(statspec->disallowed_lengths, bits) || disable);
+ SetWindowWidgetDisabledState(w, bits + BRSW_PLATFORM_NUM_1, HasBit(statspec->disallowed_platforms, bits) || disable);
+ SetWindowWidgetDisabledState(w, bits + BRSW_PLATFORM_LEN_1, HasBit(statspec->disallowed_lengths, bits) || disable);
}
}
@@ -825,7 +825,7 @@ static void StationBuildWndProc(Window *w, WindowEvent *e)
const StationSpec *statspec = GetCustomStationSpec(_railstation.station_class, i);
if (statspec != NULL && statspec->name != 0) {
- if (HASBIT(statspec->callbackmask, CBM_STATION_AVAIL) && GetStationCallback(CBID_STATION_AVAILABILITY, 0, 0, statspec, NULL, INVALID_TILE) == 0) {
+ if (HasBit(statspec->callbackmask, CBM_STATION_AVAIL) && GetStationCallback(CBID_STATION_AVAILABILITY, 0, 0, statspec, NULL, INVALID_TILE) == 0) {
GfxFillRect(8, y - 2, 127, y + 10, (1 << PALETTE_MODIFIER_GREYOUT));
}
@@ -864,10 +864,10 @@ static void StationBuildWndProc(Window *w, WindowEvent *e)
_railstation.dragdrop = false;
const StationSpec *statspec = _railstation.newstations ? GetCustomStationSpec(_railstation.station_class, _railstation.station_type) : NULL;
- if (statspec != NULL && HASBIT(statspec->disallowed_lengths, _railstation.platlength - 1)) {
+ if (statspec != NULL && HasBit(statspec->disallowed_lengths, _railstation.platlength - 1)) {
/* The previously selected number of platforms in invalid */
for (uint i = 0; i < 7; i++) {
- if (!HASBIT(statspec->disallowed_lengths, i)) {
+ if (!HasBit(statspec->disallowed_lengths, i)) {
RaiseWindowWidget(w, _railstation.platlength + BRSW_PLATFORM_LEN_BEGIN);
_railstation.platlength = i + 1;
break;
@@ -896,10 +896,10 @@ static void StationBuildWndProc(Window *w, WindowEvent *e)
_railstation.dragdrop = false;
const StationSpec *statspec = _railstation.newstations ? GetCustomStationSpec(_railstation.station_class, _railstation.station_type) : NULL;
- if (statspec != NULL && HASBIT(statspec->disallowed_platforms, _railstation.numtracks - 1)) {
+ if (statspec != NULL && HasBit(statspec->disallowed_platforms, _railstation.numtracks - 1)) {
/* The previously selected number of tracks in invalid */
for (uint i = 0; i < 7; i++) {
- if (!HASBIT(statspec->disallowed_platforms, i)) {
+ if (!HasBit(statspec->disallowed_platforms, i)) {
RaiseWindowWidget(w, _railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN);
_railstation.numtracks = i + 1;
break;
@@ -920,18 +920,18 @@ static void StationBuildWndProc(Window *w, WindowEvent *e)
/* get the first allowed length/number of platforms */
const StationSpec *statspec = _railstation.newstations ? GetCustomStationSpec(_railstation.station_class, _railstation.station_type) : NULL;
- if (statspec != NULL && HASBIT(statspec->disallowed_lengths, _railstation.platlength - 1)) {
+ if (statspec != NULL && HasBit(statspec->disallowed_lengths, _railstation.platlength - 1)) {
for (uint i = 0; i < 7; i++) {
- if (!HASBIT(statspec->disallowed_lengths, i)) {
+ if (!HasBit(statspec->disallowed_lengths, i)) {
RaiseWindowWidget(w, _railstation.platlength + BRSW_PLATFORM_LEN_BEGIN);
_railstation.platlength = i + 1;
break;
}
}
}
- if (statspec != NULL && HASBIT(statspec->disallowed_platforms, _railstation.numtracks - 1)) {
+ if (statspec != NULL && HasBit(statspec->disallowed_platforms, _railstation.numtracks - 1)) {
for (uint i = 0; i < 7; i++) {
- if (!HASBIT(statspec->disallowed_platforms, i)) {
+ if (!HasBit(statspec->disallowed_platforms, i)) {
RaiseWindowWidget(w, _railstation.numtracks + BRSW_PLATFORM_NUM_BEGIN);
_railstation.numtracks = i + 1;
break;
@@ -970,7 +970,7 @@ static void StationBuildWndProc(Window *w, WindowEvent *e)
/* Check station availability callback */
statspec = GetCustomStationSpec(_railstation.station_class, y);
if (statspec != NULL &&
- HASBIT(statspec->callbackmask, CBM_STATION_AVAIL) &&
+ HasBit(statspec->callbackmask, CBM_STATION_AVAIL) &&
GetStationCallback(CBID_STATION_AVAILABILITY, 0, 0, statspec, NULL, INVALID_TILE) == 0) return;
_railstation.station_type = y;
@@ -1221,7 +1221,7 @@ static void BuildWaypointWndProc(Window *w, WindowEvent *e)
DrawWaypointSprite(2 + i * 68, 25, w->hscroll.pos + i, _cur_railtype);
if (statspec != NULL &&
- HASBIT(statspec->callbackmask, CBM_STATION_AVAIL) &&
+ HasBit(statspec->callbackmask, CBM_STATION_AVAIL) &&
GetStationCallback(CBID_STATION_AVAILABILITY, 0, 0, statspec, NULL, INVALID_TILE) == 0) {
GfxFillRect(4 + i * 68, 18, 67 + i * 68, 75, (1 << PALETTE_MODIFIER_GREYOUT));
}
@@ -1241,7 +1241,7 @@ static void BuildWaypointWndProc(Window *w, WindowEvent *e)
/* Check station availability callback */
const StationSpec *statspec = GetCustomStationSpec(STAT_CLASS_WAYP, type);
if (statspec != NULL &&
- HASBIT(statspec->callbackmask, CBM_STATION_AVAIL) &&
+ HasBit(statspec->callbackmask, CBM_STATION_AVAIL) &&
GetStationCallback(CBID_STATION_AVAILABILITY, 0, 0, statspec, NULL, INVALID_TILE) == 0) return;
_cur_waypoint_type = type;
diff --git a/src/rail_map.h b/src/rail_map.h
index 364394cff..2b20e9598 100644
--- a/src/rail_map.h
+++ b/src/rail_map.h
@@ -140,7 +140,7 @@ static inline void SetTrackBits(TileIndex t, TrackBits b)
*/
static inline bool HasTrack(TileIndex tile, Track track)
{
- return HASBIT(GetTrackBits(tile), track);
+ return HasBit(GetTrackBits(tile), track);
}
/**
@@ -298,7 +298,7 @@ static inline uint GetSignalStates(TileIndex tile)
*/
static inline SignalState GetSingleSignalState(TileIndex t, byte signalbit)
{
- return (SignalState)HASBIT(GetSignalStates(t), signalbit);
+ return (SignalState)HasBit(GetSignalStates(t), signalbit);
}
/**
@@ -329,7 +329,7 @@ static inline uint GetPresentSignals(TileIndex tile)
*/
static inline bool IsSignalPresent(TileIndex t, byte signalbit)
{
- return HASBIT(GetPresentSignals(t), signalbit);
+ return HasBit(GetPresentSignals(t), signalbit);
}
/**
diff --git a/src/road.h b/src/road.h
index e97600f1a..506868b95 100644
--- a/src/road.h
+++ b/src/road.h
@@ -54,7 +54,7 @@ static inline bool IsValidRoadType(RoadType rt)
*/
static inline bool AreValidRoadTypes(RoadTypes rts)
{
- return HASBIT(rts, ROADTYPE_ROAD) || HASBIT(rts, ROADTYPE_TRAM);
+ return HasBit(rts, ROADTYPE_ROAD) || HasBit(rts, ROADTYPE_TRAM);
}
/**
diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp
index 0ae4da4af..60b2729c7 100644
--- a/src/road_cmd.cpp
+++ b/src/road_cmd.cpp
@@ -139,7 +139,7 @@ CommandCost CmdRemoveRoad(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
RoadBits pieces = Extract<RoadBits, 0>(p1);
RoadTypes rts = GetRoadTypes(tile);
/* The tile doesn't have the given road type */
- if (!HASBIT(rts, rt)) return CMD_ERROR;
+ if (!HasBit(rts, rt)) return CMD_ERROR;
if (!CheckAllowRemoveRoad(tile, pieces, &edge_road, rt)) return CMD_ERROR;
@@ -231,7 +231,7 @@ CommandCost CmdRemoveRoad(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
/* Don't allow road to be removed from the crossing when there is tram;
* we can't draw the crossing without trambits ;) */
- if (rt == ROADTYPE_ROAD && HASBIT(GetRoadTypes(tile), ROADTYPE_TRAM) && ((flags & DC_EXEC) || !HASBIT(p1, 6))) return CMD_ERROR;
+ if (rt == ROADTYPE_ROAD && HasBit(GetRoadTypes(tile), ROADTYPE_TRAM) && ((flags & DC_EXEC) || !HasBit(p1, 6))) return CMD_ERROR;
if (flags & DC_EXEC) {
if (rt == ROADTYPE_ROAD) {
@@ -419,7 +419,7 @@ CommandCost CmdBuildRoad(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if (!EnsureNoVehicleOnGround(tile)) return CMD_ERROR;
all_bits = GetAllRoadBits(tile);
- if (!HASBIT(GetRoadTypes(tile), rt)) break;
+ if (!HasBit(GetRoadTypes(tile), rt)) break;
existing = GetRoadBits(tile, rt);
RoadBits merged = existing | pieces;
@@ -445,7 +445,7 @@ CommandCost CmdBuildRoad(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
} break;
case ROAD_TILE_CROSSING:
- if (HASBIT(GetRoadTypes(tile), rt)) return_cmd_error(STR_1007_ALREADY_BUILT);
+ if (HasBit(GetRoadTypes(tile), rt)) return_cmd_error(STR_1007_ALREADY_BUILT);
all_bits = GetCrossingRoadBits(tile);
if (pieces & ComplementRoadBits(all_bits)) goto do_clear;
break;
@@ -464,7 +464,7 @@ CommandCost CmdBuildRoad(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
}
/* Level crossings may only be built on these slopes */
- if (!HASBIT(VALID_LEVEL_CROSSING_SLOPES, tileh)) {
+ if (!HasBit(VALID_LEVEL_CROSSING_SLOPES, tileh)) {
return_cmd_error(STR_1000_LAND_SLOPED_IN_WRONG_DIRECTION);
}
@@ -496,7 +496,7 @@ CommandCost CmdBuildRoad(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
case MP_STATION:
if (!IsDriveThroughStopTile(tile)) return CMD_ERROR;
- if (HASBIT(GetRoadTypes(tile), rt)) return_cmd_error(STR_1007_ALREADY_BUILT);
+ if (HasBit(GetRoadTypes(tile), rt)) return_cmd_error(STR_1007_ALREADY_BUILT);
/* Don't allow "upgrading" the roadstop when vehicles are already driving on it */
if (!EnsureNoVehicleOnGround(tile)) return CMD_ERROR;
break;
@@ -504,7 +504,7 @@ CommandCost CmdBuildRoad(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
case MP_TUNNELBRIDGE:
if ((IsTunnel(tile) && GetTunnelTransportType(tile) != TRANSPORT_ROAD) ||
(IsBridge(tile) && GetBridgeTransportType(tile) != TRANSPORT_ROAD)) return CMD_ERROR;
- if (HASBIT(GetRoadTypes(tile), rt)) return_cmd_error(STR_1007_ALREADY_BUILT);
+ if (HasBit(GetRoadTypes(tile), rt)) return_cmd_error(STR_1007_ALREADY_BUILT);
/* Don't allow "upgrading" the bridge/tunnel when vehicles are already driving on it */
if (!EnsureNoVehicleOnGround(tile)) return CMD_ERROR;
break;
@@ -639,11 +639,11 @@ CommandCost CmdBuildLongRoad(TileIndex end_tile, uint32 flags, uint32 p1, uint32
if (!IsValidRoadType(rt) || !ValParamRoadType(rt)) return CMD_ERROR;
/* Only drag in X or Y direction dictated by the direction variable */
- if (!HASBIT(p2, 2) && TileY(start_tile) != TileY(end_tile)) return CMD_ERROR; // x-axis
- if (HASBIT(p2, 2) && TileX(start_tile) != TileX(end_tile)) return CMD_ERROR; // y-axis
+ if (!HasBit(p2, 2) && TileY(start_tile) != TileY(end_tile)) return CMD_ERROR; // x-axis
+ if (HasBit(p2, 2) && TileX(start_tile) != TileX(end_tile)) return CMD_ERROR; // y-axis
/* Swap start and ending tile, also the half-tile drag var (bit 0 and 1) */
- if (start_tile > end_tile || (start_tile == end_tile && HASBIT(p2, 0))) {
+ if (start_tile > end_tile || (start_tile == end_tile && HasBit(p2, 0))) {
TileIndex t = start_tile;
start_tile = end_tile;
end_tile = t;
@@ -654,17 +654,17 @@ CommandCost CmdBuildLongRoad(TileIndex end_tile, uint32 flags, uint32 p1, uint32
/* On the X-axis, we have to swap the initial bits, so they
* will be interpreted correctly in the GTTS. Futhermore
* when you just 'click' on one tile to build them. */
- if (HASBIT(p2, 2) == (start_tile == end_tile && HASBIT(p2, 0) == HASBIT(p2, 1))) drd ^= DRD_BOTH;
+ if (HasBit(p2, 2) == (start_tile == end_tile && HasBit(p2, 0) == HasBit(p2, 1))) drd ^= DRD_BOTH;
/* No disallowed direction bits have to be toggled */
- if (!HASBIT(p2, 5)) drd = DRD_NONE;
+ if (!HasBit(p2, 5)) drd = DRD_NONE;
tile = start_tile;
/* Start tile is the small number. */
for (;;) {
- RoadBits bits = HASBIT(p2, 2) ? ROAD_Y : ROAD_X;
+ RoadBits bits = HasBit(p2, 2) ? ROAD_Y : ROAD_X;
- if (tile == end_tile && !HASBIT(p2, 1)) bits &= ROAD_NW | ROAD_NE;
- if (tile == start_tile && HASBIT(p2, 0)) bits &= ROAD_SE | ROAD_SW;
+ if (tile == end_tile && !HasBit(p2, 1)) bits &= ROAD_NW | ROAD_NE;
+ if (tile == start_tile && HasBit(p2, 0)) bits &= ROAD_SE | ROAD_SW;
ret = DoCommand(tile, drd << 6 | rt << 4 | bits, 0, flags, CMD_BUILD_ROAD);
if (CmdFailed(ret)) {
@@ -692,7 +692,7 @@ CommandCost CmdBuildLongRoad(TileIndex end_tile, uint32 flags, uint32 p1, uint32
if (tile == end_tile) break;
- tile += HASBIT(p2, 2) ? TileDiffXY(0, 1) : TileDiffXY(1, 0);
+ tile += HasBit(p2, 2) ? TileDiffXY(0, 1) : TileDiffXY(1, 0);
}
return !had_success ? CMD_ERROR : cost;
@@ -722,11 +722,11 @@ CommandCost CmdRemoveLongRoad(TileIndex end_tile, uint32 flags, uint32 p1, uint3
if (!IsValidRoadType(rt)) return CMD_ERROR;
/* Only drag in X or Y direction dictated by the direction variable */
- if (!HASBIT(p2, 2) && TileY(start_tile) != TileY(end_tile)) return CMD_ERROR; // x-axis
- if (HASBIT(p2, 2) && TileX(start_tile) != TileX(end_tile)) return CMD_ERROR; // y-axis
+ if (!HasBit(p2, 2) && TileY(start_tile) != TileY(end_tile)) return CMD_ERROR; // x-axis
+ if (HasBit(p2, 2) && TileX(start_tile) != TileX(end_tile)) return CMD_ERROR; // y-axis
/* Swap start and ending tile, also the half-tile drag var (bit 0 and 1) */
- if (start_tile > end_tile || (start_tile == end_tile && HASBIT(p2, 0))) {
+ if (start_tile > end_tile || (start_tile == end_tile && HasBit(p2, 0))) {
TileIndex t = start_tile;
start_tile = end_tile;
end_tile = t;
@@ -737,10 +737,10 @@ CommandCost CmdRemoveLongRoad(TileIndex end_tile, uint32 flags, uint32 p1, uint3
tile = start_tile;
/* Start tile is the small number. */
for (;;) {
- RoadBits bits = HASBIT(p2, 2) ? ROAD_Y : ROAD_X;
+ RoadBits bits = HasBit(p2, 2) ? ROAD_Y : ROAD_X;
- if (tile == end_tile && !HASBIT(p2, 1)) bits &= ROAD_NW | ROAD_NE;
- if (tile == start_tile && HASBIT(p2, 0)) bits &= ROAD_SE | ROAD_SW;
+ if (tile == end_tile && !HasBit(p2, 1)) bits &= ROAD_NW | ROAD_NE;
+ if (tile == start_tile && HasBit(p2, 0)) bits &= ROAD_SE | ROAD_SW;
/* try to remove the halves. */
if (bits != 0) {
@@ -760,7 +760,7 @@ CommandCost CmdRemoveLongRoad(TileIndex end_tile, uint32 flags, uint32 p1, uint3
if (tile == end_tile) break;
- tile += HASBIT(p2, 2) ? TileDiffXY(0, 1) : TileDiffXY(1, 0);
+ tile += HasBit(p2, 2) ? TileDiffXY(0, 1) : TileDiffXY(1, 0);
}
return (cost.GetCost() == 0) ? CMD_ERROR : cost;
@@ -846,7 +846,7 @@ static CommandCost ClearTile_Road(TileIndex tile, byte flags)
RoadTypes rts = GetRoadTypes(tile);
CommandCost ret;
for (RoadType rt = ROADTYPE_ROAD; rt < ROADTYPE_END; rt++) {
- if (HASBIT(rts, rt)) {
+ if (HasBit(rts, rt)) {
CommandCost tmp_ret = DoCommand(tile, rt << 4 | GetRoadBits(tile, rt), 0, flags, CMD_REMOVE_ROAD);
if (CmdFailed(tmp_ret)) return tmp_ret;
ret.AddCost(tmp_ret);
@@ -866,7 +866,7 @@ static CommandCost ClearTile_Road(TileIndex tile, byte flags)
/* Must iterate over the roadtypes in a reverse manner because
* tram tracks must be removed before the road bits. */
for (RoadType rt = ROADTYPE_HWAY; rt >= ROADTYPE_ROAD; rt--) {
- if (HASBIT(rts, rt)) {
+ if (HasBit(rts, rt)) {
CommandCost tmp_ret = DoCommand(tile, 1 << 6 | rt << 4 | GetCrossingRoadBits(tile), 0, flags, CMD_REMOVE_ROAD);
if (CmdFailed(tmp_ret)) return tmp_ret;
ret.AddCost(tmp_ret);
@@ -1053,7 +1053,7 @@ static void DrawRoadBits(TileInfo* ti)
if (tram != ROAD_NONE) DrawTramCatenary(ti, tram);
/* Return if full detail is disabled, or we are zoomed fully out. */
- if (!HASBIT(_display_opt, DO_FULL_DETAIL) || _cur_dpi->zoom > ZOOM_LVL_DETAIL) return;
+ if (!HasBit(_display_opt, DO_FULL_DETAIL) || _cur_dpi->zoom > ZOOM_LVL_DETAIL) return;
/* Draw extra details. */
for (drts = _road_display_table[roadside][road]; drts->image != 0; drts++) {
@@ -1091,7 +1091,7 @@ static void DrawTile_Road(TileInfo *ti)
}
DrawGroundSprite(image, pal);
- if (HASBIT(GetRoadTypes(ti->tile), ROADTYPE_TRAM)) {
+ if (HasBit(GetRoadTypes(ti->tile), ROADTYPE_TRAM)) {
DrawGroundSprite(SPR_TRAMWAY_OVERLAY + (GetCrossingRoadAxis(ti->tile) ^ 1), pal);
DrawTramCatenary(ti, GetCrossingRoadBits(ti->tile));
}
@@ -1109,7 +1109,7 @@ static void DrawTile_Road(TileInfo *ti)
palette = PLAYER_SPRITE_COLOR(GetTileOwner(ti->tile));
- if (HASBIT(GetRoadTypes(ti->tile), ROADTYPE_TRAM)) {
+ if (HasBit(GetRoadTypes(ti->tile), ROADTYPE_TRAM)) {
dts = &_tram_depot[GetRoadDepotDirection(ti->tile)];
} else {
dts = &_road_depot[GetRoadDepotDirection(ti->tile)];
@@ -1121,7 +1121,7 @@ static void DrawTile_Road(TileInfo *ti)
SpriteID image = dtss->image;
SpriteID pal;
- if (!IsTransparencySet(TO_BUILDINGS) && HASBIT(image, PALETTE_MODIFIER_COLOR)) {
+ if (!IsTransparencySet(TO_BUILDINGS) && HasBit(image, PALETTE_MODIFIER_COLOR)) {
pal = palette;
} else {
pal = PAL_NONE;
@@ -1156,7 +1156,7 @@ void DrawRoadDepotSprite(int x, int y, DiagDirection dir, RoadType rt)
Point pt = RemapCoords(dtss->delta_x, dtss->delta_y, dtss->delta_z);
SpriteID image = dtss->image;
- DrawSprite(image, HASBIT(image, PALETTE_MODIFIER_COLOR) ? palette : PAL_NONE, x + pt.x, y + pt.y);
+ DrawSprite(image, HasBit(image, PALETTE_MODIFIER_COLOR) ? palette : PAL_NONE, x + pt.x, y + pt.y);
}
}
@@ -1417,7 +1417,7 @@ static void ChangeTileOwner_Road(TileIndex tile, PlayerID old_player, PlayerID n
}
for (RoadType rt = ROADTYPE_ROAD; rt < ROADTYPE_END; rt++) {
- if (!HASBIT(GetRoadTypes(tile), rt)) continue;
+ if (!HasBit(GetRoadTypes(tile), rt)) continue;
if (GetRoadOwner(tile, rt) == old_player) {
SetRoadOwner(tile, rt, new_player == PLAYER_SPECTATOR ? OWNER_NONE : new_player);
@@ -1440,7 +1440,7 @@ static CommandCost TerraformTile_Road(TileIndex tile, uint32 flags, uint z_new,
if (_patches.build_on_slopes && AutoslopeEnabled()) {
switch (GetRoadTileType(tile)) {
case ROAD_TILE_CROSSING:
- if (!IsSteepSlope(tileh_new) && (GetTileMaxZ(tile) == z_new + GetSlopeMaxZ(tileh_new)) && HASBIT(VALID_LEVEL_CROSSING_SLOPES, tileh_new)) return _price.terraform;
+ if (!IsSteepSlope(tileh_new) && (GetTileMaxZ(tile) == z_new + GetSlopeMaxZ(tileh_new)) && HasBit(VALID_LEVEL_CROSSING_SLOPES, tileh_new)) return _price.terraform;
break;
case ROAD_TILE_DEPOT:
diff --git a/src/road_gui.cpp b/src/road_gui.cpp
index 5d67fb50a..30dac2391 100644
--- a/src/road_gui.cpp
+++ b/src/road_gui.cpp
@@ -190,7 +190,7 @@ void CcRoadDepot(bool success, TileIndex tile, uint32 p1, uint32 p2)
ResetObjectToPlace();
BuildRoadOutsideStation(tile, dir);
/* For a drive-through road stop build connecting road for other entrance */
- if (HASBIT(p2, 1)) BuildRoadOutsideStation(tile, ReverseDiagDir(dir));
+ if (HasBit(p2, 1)) BuildRoadOutsideStation(tile, ReverseDiagDir(dir));
}
}
diff --git a/src/road_map.cpp b/src/road_map.cpp
index 091e5ca7a..7dc26f079 100644
--- a/src/road_map.cpp
+++ b/src/road_map.cpp
@@ -16,7 +16,7 @@
RoadBits GetAnyRoadBits(TileIndex tile, RoadType rt)
{
- if (!HASBIT(GetRoadTypes(tile), rt)) return ROAD_NONE;
+ if (!HasBit(GetRoadTypes(tile), rt)) return ROAD_NONE;
switch (GetTileType(tile)) {
case MP_ROAD:
@@ -51,7 +51,7 @@ TrackBits GetAnyRoadTrackBits(TileIndex tile, RoadType rt)
uint32 r;
/* Don't allow local authorities to build roads through road depots or road stops. */
- if ((IsTileType(tile, MP_ROAD) && IsTileDepotType(tile, TRANSPORT_ROAD)) || (IsTileType(tile, MP_STATION) && !IsDriveThroughStopTile(tile)) || !HASBIT(GetRoadTypes(tile), rt)) {
+ if ((IsTileType(tile, MP_ROAD) && IsTileDepotType(tile, TRANSPORT_ROAD)) || (IsTileType(tile, MP_STATION) && !IsDriveThroughStopTile(tile)) || !HasBit(GetRoadTypes(tile), rt)) {
return TRACK_BIT_NONE;
}
diff --git a/src/road_map.h b/src/road_map.h
index fd28b4209..f68ef8322 100644
--- a/src/road_map.h
+++ b/src/road_map.h
@@ -206,13 +206,13 @@ static inline void BarCrossing(TileIndex t)
static inline bool IsCrossingBarred(TileIndex t)
{
assert(GetRoadTileType(t) == ROAD_TILE_CROSSING);
- return HASBIT(_m[t].m4, 5);
+ return HasBit(_m[t].m4, 5);
}
#define IsOnDesert IsOnSnow
static inline bool IsOnSnow(TileIndex t)
{
- return HASBIT(_m[t].m3, 7);
+ return HasBit(_m[t].m3, 7);
}
#define ToggleDesert ToggleSnow
@@ -311,10 +311,10 @@ static inline void MakeRoadNormal(TileIndex t, RoadBits bits, RoadTypes rot, Tow
SetTileOwner(t, road);
_m[t].m2 = town;
_m[t].m3 = 0;
- _m[t].m4 = (HASBIT(rot, ROADTYPE_TRAM) ? bits : 0) << 4 | (HASBIT(rot, ROADTYPE_ROAD) ? bits : 0);
+ _m[t].m4 = (HasBit(rot, ROADTYPE_TRAM) ? bits : 0) << 4 | (HasBit(rot, ROADTYPE_ROAD) ? bits : 0);
_m[t].m5 = ROAD_TILE_NORMAL << 6;
SetRoadOwner(t, ROADTYPE_TRAM, tram);
- SB(_m[t].m6, 2, 4, HASBIT(rot, ROADTYPE_HWAY) ? bits : 0);
+ SB(_m[t].m6, 2, 4, HasBit(rot, ROADTYPE_HWAY) ? bits : 0);
_me[t].m7 = rot << 5 | hway;
}
diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp
index def45112a..cd4d0a572 100644
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -177,7 +177,7 @@ CommandCost CmdBuildRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if (!IsTileDepotType(tile, TRANSPORT_ROAD)) return CMD_ERROR;
if (!IsTileOwner(tile, _current_player)) return CMD_ERROR;
- if (HASBIT(GetRoadTypes(tile), ROADTYPE_TRAM) != HASBIT(EngInfo(p1)->misc_flags, EF_ROAD_TRAM)) return_cmd_error(STR_DEPOT_WRONG_DEPOT_TYPE);
+ if (HasBit(GetRoadTypes(tile), ROADTYPE_TRAM) != HasBit(EngInfo(p1)->misc_flags, EF_ROAD_TRAM)) return_cmd_error(STR_DEPOT_WRONG_DEPOT_TYPE);
uint num_vehicles = 1 + CountArticulatedParts(p1, false);
@@ -192,7 +192,7 @@ CommandCost CmdBuildRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
v = vl[0];
/* find the first free roadveh id */
- unit_num = HASBIT(p2, 0) ? 0 : GetFreeUnitNumber(VEH_ROAD);
+ unit_num = HasBit(p2, 0) ? 0 : GetFreeUnitNumber(VEH_ROAD);
if (unit_num > _patches.max_roadveh)
return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
@@ -252,7 +252,7 @@ CommandCost CmdBuildRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
v->random_bits = VehicleRandomBits();
SetRoadVehFront(v);
- v->u.road.roadtype = HASBIT(EngInfo(v->engine_type)->misc_flags, EF_ROAD_TRAM) ? ROADTYPE_TRAM : ROADTYPE_ROAD;
+ v->u.road.roadtype = HasBit(EngInfo(v->engine_type)->misc_flags, EF_ROAD_TRAM) ? ROADTYPE_TRAM : ROADTYPE_ROAD;
v->u.road.compatible_roadtypes = RoadTypeToRoadTypes(v->u.road.roadtype);
v->u.road.cached_veh_length = GetRoadVehLength(v);
@@ -476,7 +476,7 @@ CommandCost CmdSendRoadVehToDepot(TileIndex tile, uint32 flags, uint32 p1, uint3
/* If the current orders are already goto-depot */
if (v->current_order.type == OT_GOTO_DEPOT) {
- if (!!(p2 & DEPOT_SERVICE) == HASBIT(v->current_order.flags, OFB_HALT_IN_DEPOT)) {
+ if (!!(p2 & DEPOT_SERVICE) == HasBit(v->current_order.flags, OFB_HALT_IN_DEPOT)) {
/* We called with a different DEPOT_SERVICE setting.
* Now we change the setting to apply the new one and let the vehicle head for the same depot.
* Note: the if is (true for requesting service == true for ordered to stop in depot) */
@@ -492,7 +492,7 @@ CommandCost CmdSendRoadVehToDepot(TileIndex tile, uint32 flags, uint32 p1, uint3
if (flags & DC_EXEC) {
/* If the orders to 'goto depot' are in the orders list (forced servicing),
* then skip to the next order; effectively cancelling this forced service */
- if (HASBIT(v->current_order.flags, OFB_PART_OF_ORDERS))
+ if (HasBit(v->current_order.flags, OFB_PART_OF_ORDERS))
v->cur_order_index++;
v->current_order.type = OT_DUMMY;
@@ -597,7 +597,7 @@ static void ClearCrashedStation(Vehicle *v)
rs->SetEntranceBusy(false);
/* Free the parking bay */
- rs->FreeBay(HASBIT(v->u.road.state, RVS_USING_SECOND_BAY));
+ rs->FreeBay(HasBit(v->u.road.state, RVS_USING_SECOND_BAY));
}
static void DeleteLastRoadVeh(Vehicle *v)
@@ -1274,7 +1274,7 @@ do_it:;
uint best_maxlen = (uint)-1;
uint bitmask = (uint)trackdirs;
for (int i = 0; bitmask != 0; bitmask >>= 1, i++) {
- if (HASBIT(bitmask, 0)) {
+ if (HasBit(bitmask, 0)) {
if (best_track == INVALID_TRACKDIR) best_track = (Trackdir)i; // in case we don't find the path, just pick a track
frd.maxtracklen = (uint)-1;
frd.mindist = (uint)-1;
@@ -1291,7 +1291,7 @@ do_it:;
found_best_track:;
- if (HASBIT(signal, best_track)) return INVALID_TRACKDIR;
+ if (HasBit(signal, best_track)) return INVALID_TRACKDIR;
return best_track;
}
@@ -1416,7 +1416,7 @@ static Trackdir FollowPreviousRoadVehicle(const Vehicle *v, const Vehicle *prev,
if (diag_dir == INVALID_DIAGDIR) return INVALID_TRACKDIR;
dir = DiagdirToDiagTrackdir(diag_dir);
- } else if (HASBIT(prev_state, RVS_IN_DT_ROAD_STOP)) {
+ } else if (HasBit(prev_state, RVS_IN_DT_ROAD_STOP)) {
dir = (Trackdir)(prev_state & RVSB_ROAD_STOP_TRACKDIR_MASK);
} else if (prev_state < TRACKDIR_END) {
if (already_reversed && prev->tile != tile) {
@@ -1519,7 +1519,7 @@ static bool IndividualRoadVehicleController(Vehicle *v, const Vehicle *prev)
return false;
}
- if ((IsTunnelTile(gp.new_tile) || IsBridgeTile(gp.new_tile)) && HASBIT(VehicleEnterTile(v, gp.new_tile, gp.x, gp.y), VETS_ENTERED_WORMHOLE)) {
+ if ((IsTunnelTile(gp.new_tile) || IsBridgeTile(gp.new_tile)) && HasBit(VehicleEnterTile(v, gp.new_tile, gp.x, gp.y), VETS_ENTERED_WORMHOLE)) {
/* Vehicle has just entered a bridge or tunnel */
v->cur_image = v->GetImage(v->direction);
v->UpdateDeltaXY(v->direction);
@@ -1538,7 +1538,7 @@ static bool IndividualRoadVehicleController(Vehicle *v, const Vehicle *prev)
* For a drive-through road stop use 'straight road' move data.
* In this case v->u.road.state is masked to give the road stop entry direction. */
rd = _road_drive_data[v->u.road.roadtype][(
- (HASBIT(v->u.road.state, RVS_IN_DT_ROAD_STOP) ? v->u.road.state & RVSB_ROAD_STOP_TRACKDIR_MASK : v->u.road.state) +
+ (HasBit(v->u.road.state, RVS_IN_DT_ROAD_STOP) ? v->u.road.state & RVSB_ROAD_STOP_TRACKDIR_MASK : v->u.road.state) +
(_opt.road_side << RVS_DRIVE_SIDE)) ^ v->u.road.overtaking][v->u.road.frame + 1];
if (rd.x & RDE_NEXT_TILE) {
@@ -1633,7 +1633,7 @@ again:
}
r = VehicleEnterTile(v, tile, x, y);
- if (HASBIT(r, VETS_CANNOT_ENTER)) {
+ if (HasBit(r, VETS_CANNOT_ENTER)) {
if (!IsTileType(tile, MP_TUNNELBRIDGE)) {
v->cur_speed = 0;
return false;
@@ -1655,15 +1655,15 @@ again:
/* Vehicle is leaving a road stop tile, mark bay as free
* For drive-through stops, only do it if the vehicle stopped here */
- if (IsStandardRoadStopTile(v->tile) || HASBIT(v->u.road.state, RVS_IS_STOPPING)) {
- rs->FreeBay(HASBIT(v->u.road.state, RVS_USING_SECOND_BAY));
+ if (IsStandardRoadStopTile(v->tile) || HasBit(v->u.road.state, RVS_IS_STOPPING)) {
+ rs->FreeBay(HasBit(v->u.road.state, RVS_USING_SECOND_BAY));
CLRBIT(v->u.road.state, RVS_IS_STOPPING);
}
if (IsStandardRoadStopTile(v->tile)) rs->SetEntranceBusy(false);
}
}
- if (!HASBIT(r, VETS_ENTERED_WORMHOLE)) {
+ if (!HasBit(r, VETS_ENTERED_WORMHOLE)) {
v->tile = tile;
v->u.road.state = (byte)dir;
v->u.road.frame = start_frame;
@@ -1730,7 +1730,7 @@ again:
if (IsRoadVehFront(v) && RoadVehFindCloseTo(v, x, y, newdir) != NULL) return false;
r = VehicleEnterTile(v, v->tile, x, y);
- if (HASBIT(r, VETS_CANNOT_ENTER)) {
+ if (HasBit(r, VETS_CANNOT_ENTER)) {
v->cur_speed = 0;
return false;
}
@@ -1826,7 +1826,7 @@ again:
if (IsDriveThroughStopTile(next_tile) && (GetRoadStopType(next_tile) == type)) {
RoadStop *rs_n = GetRoadStopByTile(next_tile, type);
- if (rs_n->IsFreeBay(HASBIT(v->u.road.state, RVS_USING_SECOND_BAY))) {
+ if (rs_n->IsFreeBay(HasBit(v->u.road.state, RVS_USING_SECOND_BAY))) {
/* Bay in next stop along is free - use it */
ClearSlot(v);
rs_n->num_vehicles++;
@@ -1897,14 +1897,14 @@ again:
/* Check tile position conditions - i.e. stop position in depot,
* entry onto bridge or into tunnel */
r = VehicleEnterTile(v, v->tile, x, y);
- if (HASBIT(r, VETS_CANNOT_ENTER)) {
+ if (HasBit(r, VETS_CANNOT_ENTER)) {
v->cur_speed = 0;
return false;
}
/* Move to next frame unless vehicle arrived at a stop position
* in a depot or entered a tunnel/bridge */
- if (!HASBIT(r, VETS_ENTERED_WORMHOLE)) v->u.road.frame++;
+ if (!HasBit(r, VETS_ENTERED_WORMHOLE)) v->u.road.frame++;
v->cur_image = v->GetImage(v->direction);
v->UpdateDeltaXY(v->direction);
@@ -2126,7 +2126,7 @@ CommandCost CmdRefitRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
CommandCost cost;
CargoID new_cid = GB(p2, 0, 8);
byte new_subtype = GB(p2, 8, 8);
- bool only_this = HASBIT(p2, 16);
+ bool only_this = HasBit(p2, 16);
uint16 capacity = CALLBACK_FAILED;
uint total_capacity = 0;
@@ -2149,7 +2149,7 @@ CommandCost CmdRefitRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if (v->cargo_cap == 0) continue;
- if (HASBIT(EngInfo(v->engine_type)->callbackmask, CBM_VEHICLE_REFIT_CAPACITY)) {
+ if (HasBit(EngInfo(v->engine_type)->callbackmask, CBM_VEHICLE_REFIT_CAPACITY)) {
/* Back up the cargo type */
CargoID temp_cid = v->cargo_type;
byte temp_subtype = v->cargo_subtype;
diff --git a/src/saveload.cpp b/src/saveload.cpp
index f3e07ee0a..5a17a822b 100644
--- a/src/saveload.cpp
+++ b/src/saveload.cpp
@@ -218,13 +218,13 @@ static inline void SlWriteUint64(uint64 x)
static uint SlReadSimpleGamma()
{
uint i = SlReadByte();
- if (HASBIT(i, 7)) {
+ if (HasBit(i, 7)) {
i &= ~0x80;
- if (HASBIT(i, 6)) {
+ if (HasBit(i, 6)) {
i &= ~0x40;
- if (HASBIT(i, 5)) {
+ if (HasBit(i, 5)) {
i &= ~0x20;
- if (HASBIT(i, 4))
+ if (HasBit(i, 4))
SlError(STR_GAME_SAVELOAD_ERROR_BROKEN_SAVEGAME, "Unsupported gamma");
i = (i << 8) | SlReadByte();
}
diff --git a/src/settings.cpp b/src/settings.cpp
index 082495c03..aab88256e 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -570,7 +570,7 @@ static void make_manyofmany(char *buf, const char *many, uint32 x)
start = many;
while (*many != 0 && *many != '|') many++; // advance to the next element
- if (HASBIT(x, 0)) { // item found, copy it
+ if (HasBit(x, 0)) { // item found, copy it
if (!init) *buf++ = '|';
init = false;
if (start == many) {
@@ -1670,9 +1670,9 @@ static GRFConfig *GRFLoadConfig(IniFile *ini, const char *grpname, bool is_stati
if (c->status == GCS_NOT_FOUND) {
msg = "not found";
- } else if (HASBIT(c->flags, GCF_UNSAFE)) {
+ } else if (HasBit(c->flags, GCF_UNSAFE)) {
msg = "unsafe for static use";
- } else if (HASBIT(c->flags, GCF_SYSTEM)) {
+ } else if (HasBit(c->flags, GCF_SYSTEM)) {
msg = "system NewGRF";
} else {
msg = "unknown";
diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp
index 672deb989..abe7cc189 100644
--- a/src/settings_gui.cpp
+++ b/src/settings_gui.cpp
@@ -477,9 +477,9 @@ static void GameDifficultyWndProc(Window *w, WindowEvent *e)
y = GAMEDIFF_WND_TOP_OFFSET;
for (i = 0; i != GAME_DIFFICULTY_NUM; i++) {
- DrawFrameRect( 5, y, 5 + 8, y + 8, 3, HASBIT(click_a, i) ? FR_LOWERED : FR_NONE);
- DrawFrameRect(15, y, 15 + 8, y + 8, 3, HASBIT(click_b, i) ? FR_LOWERED : FR_NONE);
- if (HASBIT(disabled, i) || (_networking && !_network_server)) {
+ DrawFrameRect( 5, y, 5 + 8, y + 8, 3, HasBit(click_a, i) ? FR_LOWERED : FR_NONE);
+ DrawFrameRect(15, y, 15 + 8, y + 8, 3, HasBit(click_b, i) ? FR_LOWERED : FR_NONE);
+ if (HasBit(disabled, i) || (_networking && !_network_server)) {
int color = (1 << PALETTE_MODIFIER_GREYOUT) | _colour_gradient[COLOUR_YELLOW][2];
GfxFillRect( 6, y + 1, 6 + 8, y + 8, color);
GfxFillRect(16, y + 1, 16 + 8, y + 8, color);
@@ -526,7 +526,7 @@ static void GameDifficultyWndProc(Window *w, WindowEvent *e)
/* Clicked disabled button? */
dis = (_game_mode == GM_NORMAL) ? DIFF_INGAME_DISABLED_BUTTONS : 0;
- if (HASBIT(dis, btn))
+ if (HasBit(dis, btn))
return;
_difficulty_timeout = 5;
diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp
index 8b6ad4e72..331f91cbb 100644
--- a/src/ship_cmd.cpp
+++ b/src/ship_cmd.cpp
@@ -672,7 +672,7 @@ static void ShipController(Vehicle *v)
} else {
/* Not inside depot */
r = VehicleEnterTile(v, gp.new_tile, gp.x, gp.y);
- if (HASBIT(r, VETS_CANNOT_ENTER)) goto reverse_direction;
+ if (HasBit(r, VETS_CANNOT_ENTER)) goto reverse_direction;
/* A leave station order only needs one tick to get processed, so we can
* always skip ahead. */
@@ -742,9 +742,9 @@ static void ShipController(Vehicle *v)
/* Call the landscape function and tell it that the vehicle entered the tile */
r = VehicleEnterTile(v, gp.new_tile, gp.x, gp.y);
- if (HASBIT(r, VETS_CANNOT_ENTER)) goto reverse_direction;
+ if (HasBit(r, VETS_CANNOT_ENTER)) goto reverse_direction;
- if (!HASBIT(r, VETS_ENTERED_WORMHOLE)) {
+ if (!HasBit(r, VETS_ENTERED_WORMHOLE)) {
v->tile = gp.new_tile;
v->u.ship.state = TrackToTrackBits(track);
}
@@ -823,7 +823,7 @@ CommandCost CmdBuildShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if (!IsTileOwner(tile, _current_player)) return CMD_ERROR;
v = new Ship();
- unit_num = HASBIT(p2, 0) ? 0 : GetFreeUnitNumber(VEH_SHIP);
+ unit_num = HasBit(p2, 0) ? 0 : GetFreeUnitNumber(VEH_SHIP);
AutoPtrT<Vehicle> v_auto_delete = v;
if (v == NULL || unit_num > _patches.max_ships)
@@ -1004,7 +1004,7 @@ CommandCost CmdSendShipToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p
/* If the current orders are already goto-depot */
if (v->current_order.type == OT_GOTO_DEPOT) {
- if (!!(p2 & DEPOT_SERVICE) == HASBIT(v->current_order.flags, OFB_HALT_IN_DEPOT)) {
+ if (!!(p2 & DEPOT_SERVICE) == HasBit(v->current_order.flags, OFB_HALT_IN_DEPOT)) {
/* We called with a different DEPOT_SERVICE setting.
* Now we change the setting to apply the new one and let the vehicle head for the same depot.
* Note: the if is (true for requesting service == true for ordered to stop in depot) */
@@ -1020,7 +1020,7 @@ CommandCost CmdSendShipToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p
if (flags & DC_EXEC) {
/* If the orders to 'goto depot' are in the orders list (forced servicing),
* then skip to the next order; effectively cancelling this forced service */
- if (HASBIT(v->current_order.flags, OFB_PART_OF_ORDERS))
+ if (HasBit(v->current_order.flags, OFB_PART_OF_ORDERS))
v->cur_order_index++;
v->current_order.type = OT_DUMMY;
@@ -1084,7 +1084,7 @@ CommandCost CmdRefitShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
SET_EXPENSES_TYPE(EXPENSES_SHIP_RUN);
/* Check the refit capacity callback */
- if (HASBIT(EngInfo(v->engine_type)->callbackmask, CBM_VEHICLE_REFIT_CAPACITY)) {
+ if (HasBit(EngInfo(v->engine_type)->callbackmask, CBM_VEHICLE_REFIT_CAPACITY)) {
/* Back up the existing cargo type */
CargoID temp_cid = v->cargo_type;
byte temp_subtype = v->cargo_subtype;
diff --git a/src/station.cpp b/src/station.cpp
index d6d0f7a65..a00fc232b 100644
--- a/src/station.cpp
+++ b/src/station.cpp
@@ -439,7 +439,7 @@ bool RoadStop::HasFreeBay() const
bool RoadStop::IsFreeBay(uint nr) const
{
assert(nr < MAX_BAY_COUNT);
- return HASBIT(status, nr);
+ return HasBit(status, nr);
}
/**
@@ -453,7 +453,7 @@ uint RoadStop::AllocateBay()
/* Find the first free bay. If the bit is set, the bay is free. */
uint bay_nr = 0;
- while (!HASBIT(status, bay_nr)) bay_nr++;
+ while (!HasBit(status, bay_nr)) bay_nr++;
CLRBIT(status, bay_nr);
return bay_nr;
@@ -483,7 +483,7 @@ void RoadStop::FreeBay(uint nr)
/** Checks whether the entrance of the road stop is occupied by a vehicle */
bool RoadStop::IsEntranceBusy() const
{
- return HASBIT(status, 7);
+ return HasBit(status, 7);
}
/** Makes an entrance occupied or free */
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index 515534728..bd6129d28 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -276,7 +276,7 @@ static bool GenerateStationName(Station *st, TileIndex tile, int flag)
}
/* check mine? */
- if (HASBIT(free_names, M(STR_SV_STNAME_MINES))) {
+ if (HasBit(free_names, M(STR_SV_STNAME_MINES))) {
if (CountMapSquareAround(tile, CMSAMine) >= 2) {
found = M(STR_SV_STNAME_MINES);
goto done;
@@ -286,14 +286,14 @@ static bool GenerateStationName(Station *st, TileIndex tile, int flag)
/* check close enough to town to get central as name? */
if (DistanceMax(tile, t->xy) < 8) {
found = M(STR_SV_STNAME);
- if (HASBIT(free_names, M(STR_SV_STNAME))) goto done;
+ if (HasBit(free_names, M(STR_SV_STNAME))) goto done;
found = M(STR_SV_STNAME_CENTRAL);
- if (HASBIT(free_names, M(STR_SV_STNAME_CENTRAL))) goto done;
+ if (HasBit(free_names, M(STR_SV_STNAME_CENTRAL))) goto done;
}
/* Check lakeside */
- if (HASBIT(free_names, M(STR_SV_STNAME_LAKESIDE)) &&
+ if (HasBit(free_names, M(STR_SV_STNAME_LAKESIDE)) &&
DistanceFromEdge(tile) < 20 &&
CountMapSquareAround(tile, CMSAWater) >= 5) {
found = M(STR_SV_STNAME_LAKESIDE);
@@ -301,7 +301,7 @@ static bool GenerateStationName(Station *st, TileIndex tile, int flag)
}
/* Check woods */
- if (HASBIT(free_names, M(STR_SV_STNAME_WOODS)) && (
+ if (HasBit(free_names, M(STR_SV_STNAME_WOODS)) && (
CountMapSquareAround(tile, CMSATree) >= 8 ||
CountMapSquareAround(tile, CMSAForest) >= 2)
) {
@@ -316,10 +316,10 @@ static bool GenerateStationName(Station *st, TileIndex tile, int flag)
uint z2 = GetTileZ(t->xy);
if (z < z2) {
found = M(STR_SV_STNAME_VALLEY);
- if (HASBIT(free_names, M(STR_SV_STNAME_VALLEY))) goto done;
+ if (HasBit(free_names, M(STR_SV_STNAME_VALLEY))) goto done;
} else if (z > z2) {
found = M(STR_SV_STNAME_HEIGHTS);
- if (HASBIT(free_names, M(STR_SV_STNAME_HEIGHTS))) goto done;
+ if (HasBit(free_names, M(STR_SV_STNAME_HEIGHTS))) goto done;
}
}
@@ -415,7 +415,7 @@ static uint GetAcceptanceMask(const Station *st)
uint mask = 0;
for (CargoID i = 0; i < NUM_CARGO; i++) {
- if (HASBIT(st->goods[i].acceptance_pickup, GoodsEntry::ACCEPTANCE)) mask |= 1 << i;
+ if (HasBit(st->goods[i].acceptance_pickup, GoodsEntry::ACCEPTANCE)) mask |= 1 << i;
}
return mask;
}
@@ -642,13 +642,13 @@ static void UpdateStationAcceptance(Station *st, bool show_msg)
/* Test each cargo type to see if its acceptange has changed */
for (CargoID i = 0; i < NUM_CARGO; i++) {
- if (HASBIT(new_acc, i)) {
- if (!HASBIT(old_acc, i) && num_acc < lengthof(accepts)) {
+ if (HasBit(new_acc, i)) {
+ if (!HasBit(old_acc, i) && num_acc < lengthof(accepts)) {
/* New cargo is accepted */
accepts[num_acc++] = i;
}
} else {
- if (HASBIT(old_acc, i) && num_rej < lengthof(rejects)) {
+ if (HasBit(old_acc, i) && num_rej < lengthof(rejects)) {
/* Old cargo is no longer accepted */
rejects[num_rej++] = i;
}
@@ -933,7 +933,7 @@ CommandCost CmdBuildRailroadStation(TileIndex tile_org, uint32 flags, uint32 p1,
if (_patches.adjacent_stations) {
if (est != INVALID_STATION) {
- if (HASBIT(p1, 24)) {
+ if (HasBit(p1, 24)) {
/* You can't build an adjacent station over the top of one that
* already exists. */
return_cmd_error(STR_MUST_REMOVE_RAILWAY_STATION_FIRST);
@@ -946,7 +946,7 @@ CommandCost CmdBuildRailroadStation(TileIndex tile_org, uint32 flags, uint32 p1,
} else {
/* There's no station here. Don't check the tiles surrounding this
* one if the player wanted to build an adjacent station. */
- if (HASBIT(p1, 24)) check_surrounding = false;
+ if (HasBit(p1, 24)) check_surrounding = false;
}
}
@@ -1006,12 +1006,12 @@ CommandCost CmdBuildRailroadStation(TileIndex tile_org, uint32 flags, uint32 p1,
/* Perform NewStation checks */
/* Check if the station size is permitted */
- if (HASBIT(statspec->disallowed_platforms, numtracks - 1) || HASBIT(statspec->disallowed_lengths, plat_len - 1)) {
+ if (HasBit(statspec->disallowed_platforms, numtracks - 1) || HasBit(statspec->disallowed_lengths, plat_len - 1)) {
return CMD_ERROR;
}
/* Check if the station is buildable */
- if (HASBIT(statspec->callbackmask, CBM_STATION_AVAIL) && GetStationCallback(CBID_STATION_AVAILABILITY, 0, 0, statspec, NULL, INVALID_TILE) == 0) {
+ if (HasBit(statspec->callbackmask, CBM_STATION_AVAIL) && GetStationCallback(CBID_STATION_AVAILABILITY, 0, 0, statspec, NULL, INVALID_TILE) == 0) {
return CMD_ERROR;
}
}
@@ -1328,8 +1328,8 @@ static RoadStop **FindRoadStopSpot(bool truck_station, Station* st)
*/
CommandCost CmdBuildRoadStop(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
- bool type = HASBIT(p2, 0);
- bool is_drive_through = HASBIT(p2, 1);
+ bool type = HasBit(p2, 0);
+ bool is_drive_through = HasBit(p2, 1);
bool build_over_road = is_drive_through && IsTileType(tile, MP_ROAD) && GetRoadTileType(tile) == ROAD_TILE_NORMAL;
bool town_owned_road = build_over_road && IsTileOwner(tile, OWNER_TOWN);
RoadTypes rts = (RoadTypes)GB(p2, 2, 3);
@@ -1337,7 +1337,7 @@ CommandCost CmdBuildRoadStop(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if (!AreValidRoadTypes(rts) || !HasRoadTypesAvail(_current_player, rts)) return CMD_ERROR;
/* Trams only have drive through stops */
- if (!is_drive_through && HASBIT(rts, ROADTYPE_TRAM)) return CMD_ERROR;
+ if (!is_drive_through && HasBit(rts, ROADTYPE_TRAM)) return CMD_ERROR;
/* Saveguard the parameters */
if (!IsValidDiagDirection((DiagDirection)p1)) return CMD_ERROR;
@@ -1361,8 +1361,8 @@ CommandCost CmdBuildRoadStop(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if (!EnsureNoVehicleOnGround(tile)) return CMD_ERROR;
RoadTypes cur_rts = GetRoadTypes(tile);
- if (GetRoadOwner(tile, ROADTYPE_ROAD) != OWNER_TOWN && HASBIT(cur_rts, ROADTYPE_ROAD) && !CheckOwnership(GetRoadOwner(tile, ROADTYPE_ROAD))) return CMD_ERROR;
- if (HASBIT(cur_rts, ROADTYPE_TRAM) && !CheckOwnership(GetRoadOwner(tile, ROADTYPE_TRAM))) return CMD_ERROR;
+ if (GetRoadOwner(tile, ROADTYPE_ROAD) != OWNER_TOWN && HasBit(cur_rts, ROADTYPE_ROAD) && !CheckOwnership(GetRoadOwner(tile, ROADTYPE_ROAD))) return CMD_ERROR;
+ if (HasBit(cur_rts, ROADTYPE_TRAM) && !CheckOwnership(GetRoadOwner(tile, ROADTYPE_TRAM))) return CMD_ERROR;
/* Do not remove roadtypes! */
rts |= cur_rts;
@@ -1372,7 +1372,7 @@ CommandCost CmdBuildRoadStop(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
Station *st = NULL;
- if (!_patches.adjacent_stations || !HASBIT(p2, 5)) {
+ if (!_patches.adjacent_stations || !HasBit(p2, 5)) {
st = GetStationAround(tile, 1, 1, INVALID_STATION);
if (st == CHECK_STATIONS_ERR) return CMD_ERROR;
}
@@ -1646,7 +1646,7 @@ CommandCost CmdBuildAirport(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION);
/* Check if a valid, buildable airport was chosen for construction */
- if (p1 > lengthof(_airport_sections) || !HASBIT(GetValidAirports(), p1)) return CMD_ERROR;
+ if (p1 > lengthof(_airport_sections) || !HasBit(GetValidAirports(), p1)) return CMD_ERROR;
if (!(flags & DC_NO_TOWN_RATING) && !CheckIfAuthorityAllows(tile))
return CMD_ERROR;
@@ -1677,7 +1677,7 @@ CommandCost CmdBuildAirport(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
Station *st = NULL;
- if (!_patches.adjacent_stations || !HASBIT(p2, 0)) {
+ if (!_patches.adjacent_stations || !HasBit(p2, 0)) {
st = GetStationAround(tile, w, h, INVALID_STATION);
if (st == CHECK_STATIONS_ERR) return CMD_ERROR;
}
@@ -1970,7 +1970,7 @@ CommandCost CmdBuildDock(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
/* middle */
Station *st = NULL;
- if (!_patches.adjacent_stations || !HASBIT(p1, 0)) {
+ if (!_patches.adjacent_stations || !HasBit(p1, 0)) {
st = GetStationAround(
tile + ToTileIndexDiff(_dock_tileoffs_chkaround[direction]),
_dock_w_chk[direction], _dock_h_chk[direction], INVALID_STATION);
@@ -2109,7 +2109,7 @@ static void DrawTile_Station(TileInfo *ti)
relocation = GetCustomStationRelocation(statspec, st, ti->tile);
- if (HASBIT(statspec->callbackmask, CBM_STATION_SPRITE_LAYOUT)) {
+ if (HasBit(statspec->callbackmask, CBM_STATION_SPRITE_LAYOUT)) {
uint16 callback = GetStationCallback(CBID_STATION_SPRITE_LAYOUT, 0, 0, statspec, st, ti->tile);
if (callback != CALLBACK_FAILED) tile = (callback & ~1) + GetRailStationAxis(ti->tile);
}
@@ -2124,7 +2124,7 @@ static void DrawTile_Station(TileInfo *ti)
if (t == NULL || t->seq == NULL) t = &_station_display_datas[GetStationType(ti->tile)][GetStationGfx(ti->tile)];
SpriteID image = t->ground_sprite;
- if (HASBIT(image, SPRITE_MODIFIER_USE_OFFSET)) {
+ if (HasBit(image, SPRITE_MODIFIER_USE_OFFSET)) {
image += GetCustomStationGroundRelocation(statspec, st, ti->tile);
image += rti->custom_ground_offset;
} else {
@@ -2133,13 +2133,13 @@ static void DrawTile_Station(TileInfo *ti)
/* station_land array has been increased from 82 elements to 114
* but this is something else. If AI builds station with 114 it looks all weird */
- DrawGroundSprite(image, HASBIT(image, PALETTE_MODIFIER_COLOR) ? palette : PAL_NONE);
+ DrawGroundSprite(image, HasBit(image, PALETTE_MODIFIER_COLOR) ? palette : PAL_NONE);
if (GetRailType(ti->tile) == RAILTYPE_ELECTRIC && IsStationTileElectrifiable(ti->tile)) DrawCatenary(ti);
- if (HASBIT(roadtypes, ROADTYPE_TRAM)) {
+ if (HasBit(roadtypes, ROADTYPE_TRAM)) {
Axis axis = GetRoadStopDir(ti->tile) == DIAGDIR_NE ? AXIS_X : AXIS_Y;
- DrawGroundSprite((HASBIT(roadtypes, ROADTYPE_ROAD) ? SPR_TRAMWAY_OVERLAY : SPR_TRAMWAY_TRAM) + (axis ^ 1), PAL_NONE);
+ DrawGroundSprite((HasBit(roadtypes, ROADTYPE_ROAD) ? SPR_TRAMWAY_OVERLAY : SPR_TRAMWAY_TRAM) + (axis ^ 1), PAL_NONE);
DrawTramCatenary(ti, axis == AXIS_X ? ROAD_X : ROAD_Y);
}
@@ -2148,14 +2148,14 @@ static void DrawTile_Station(TileInfo *ti)
const DrawTileSeqStruct *dtss;
foreach_draw_tile_seq(dtss, t->seq) {
image = dtss->image;
- if (relocation == 0 || HASBIT(image, SPRITE_MODIFIER_USE_OFFSET)) {
+ if (relocation == 0 || HasBit(image, SPRITE_MODIFIER_USE_OFFSET)) {
image += rti->total_offset;
} else {
image += relocation;
}
SpriteID pal;
- if (!IsTransparencySet(TO_BUILDINGS) && HASBIT(image, PALETTE_MODIFIER_COLOR)) {
+ if (!IsTransparencySet(TO_BUILDINGS) && HasBit(image, PALETTE_MODIFIER_COLOR)) {
pal = palette;
} else {
pal = dtss->pal;
@@ -2182,7 +2182,7 @@ void StationPickerDrawSprite(int x, int y, StationType st, RailType railtype, Ro
const DrawTileSprites *t = &_station_display_datas[st][image];
SpriteID img = t->ground_sprite;
- DrawSprite(img + rti->total_offset, HASBIT(img, PALETTE_MODIFIER_COLOR) ? pal : PAL_NONE, x, y);
+ DrawSprite(img + rti->total_offset, HasBit(img, PALETTE_MODIFIER_COLOR) ? pal : PAL_NONE, x, y);
if (roadtype == ROADTYPE_TRAM) {
DrawSprite(SPR_TRAMWAY_TRAM + (t->ground_sprite == SPR_ROAD_PAVED_STRAIGHT_X ? 1 : 0), PAL_NONE, x, y);
@@ -2439,12 +2439,12 @@ static void UpdateStationRating(Station *st)
/* Slowly increase the rating back to his original level in the case we
* didn't deliver cargo yet to this station. This happens when a bribe
* failed while you didn't moved that cargo yet to a station. */
- if (!HASBIT(ge->acceptance_pickup, GoodsEntry::PICKUP) && ge->rating < INITIAL_STATION_RATING) {
+ if (!HasBit(ge->acceptance_pickup, GoodsEntry::PICKUP) && ge->rating < INITIAL_STATION_RATING) {
ge->rating++;
}
/* Only change the rating if we are moving this cargo */
- if (HASBIT(ge->acceptance_pickup, GoodsEntry::PICKUP)) {
+ if (HasBit(ge->acceptance_pickup, GoodsEntry::PICKUP)) {
byte_inc_sat(&ge->days_since_pickup);
int rating = 0;
@@ -2463,7 +2463,7 @@ static void UpdateStationRating(Station *st)
(rating += 13, true);
}
- if (IsValidPlayer(st->owner) && HASBIT(st->town->statues, st->owner)) rating += 26;
+ if (IsValidPlayer(st->owner) && HasBit(st->town->statues, st->owner)) rating += 26;
{
byte days = ge->days_since_pickup;
@@ -2893,8 +2893,8 @@ static CommandCost ClearTile_Station(TileIndex tile, byte flags)
switch (GetStationType(tile)) {
case STATION_RAIL: return_cmd_error(STR_300B_MUST_DEMOLISH_RAILROAD);
case STATION_AIRPORT: return_cmd_error(STR_300E_MUST_DEMOLISH_AIRPORT_FIRST);
- case STATION_TRUCK: return_cmd_error(HASBIT(GetRoadTypes(tile), ROADTYPE_TRAM) ? STR_3047_MUST_DEMOLISH_CARGO_TRAM_STATION : STR_3047_MUST_DEMOLISH_TRUCK_STATION);
- case STATION_BUS: return_cmd_error(HASBIT(GetRoadTypes(tile), ROADTYPE_TRAM) ? STR_3046_MUST_DEMOLISH_PASSENGER_TRAM_STATION : STR_3046_MUST_DEMOLISH_BUS_STATION);
+ case STATION_TRUCK: return_cmd_error(HasBit(GetRoadTypes(tile), ROADTYPE_TRAM) ? STR_3047_MUST_DEMOLISH_CARGO_TRAM_STATION : STR_3047_MUST_DEMOLISH_TRUCK_STATION);
+ case STATION_BUS: return_cmd_error(HasBit(GetRoadTypes(tile), ROADTYPE_TRAM) ? STR_3046_MUST_DEMOLISH_PASSENGER_TRAM_STATION : STR_3046_MUST_DEMOLISH_BUS_STATION);
case STATION_BUOY: return_cmd_error(STR_306A_BUOY_IN_THE_WAY);
case STATION_DOCK: return_cmd_error(STR_304D_MUST_DEMOLISH_DOCK_FIRST);
case STATION_OILRIG:
@@ -3128,7 +3128,7 @@ void SaveLoad_STNS(Station *st)
GoodsEntry *ge = &st->goods[i];
SlObject(ge, _goods_desc);
if (CheckSavegameVersion(68)) {
- SB(ge->acceptance_pickup, GoodsEntry::ACCEPTANCE, 1, HASBIT(_waiting_acceptance, 15));
+ SB(ge->acceptance_pickup, GoodsEntry::ACCEPTANCE, 1, HasBit(_waiting_acceptance, 15));
if (GB(_waiting_acceptance, 0, 12) != 0) {
/* Don't construct the packet with station here, because that'll fail with old savegames */
CargoPacket *cp = new CargoPacket();
diff --git a/src/station_gui.cpp b/src/station_gui.cpp
index f7293fefd..023cc400a 100644
--- a/src/station_gui.cpp
+++ b/src/station_gui.cpp
@@ -137,7 +137,7 @@ static int CDECL StationWaitingSorter(const void *a, const void *b)
Money sum1 = 0, sum2 = 0;
for (CargoID j = 0; j < NUM_CARGO; j++) {
- if (!HASBIT(_cargo_filter, j)) continue;
+ if (!HasBit(_cargo_filter, j)) continue;
if (!st1->goods[j].cargo.Empty()) sum1 += GetTransportedGoodsIncome(st1->goods[j].cargo.Count(), 20, 50, j);
if (!st2->goods[j].cargo.Empty()) sum2 += GetTransportedGoodsIncome(st2->goods[j].cargo.Count(), 20, 50, j);
}
@@ -161,8 +161,8 @@ static int CDECL StationRatingMaxSorter(const void *a, const void *b)
byte maxr2 = 0;
for (CargoID j = 0; j < NUM_CARGO; j++) {
- if (HASBIT(st1->goods[j].acceptance_pickup, GoodsEntry::PICKUP)) maxr1 = max(maxr1, st1->goods[j].rating);
- if (HASBIT(st2->goods[j].acceptance_pickup, GoodsEntry::PICKUP)) maxr2 = max(maxr2, st2->goods[j].rating);
+ if (HasBit(st1->goods[j].acceptance_pickup, GoodsEntry::PICKUP)) maxr1 = max(maxr1, st1->goods[j].rating);
+ if (HasBit(st2->goods[j].acceptance_pickup, GoodsEntry::PICKUP)) maxr2 = max(maxr2, st2->goods[j].rating);
}
return (_internal_sort_order & 1) ? maxr2 - maxr1 : maxr1 - maxr2;
@@ -231,7 +231,7 @@ static void BuildStationsList(plstations_d* sl, PlayerID owner, byte facilities,
for (CargoID j = 0; j < NUM_CARGO; j++) {
if (!st->goods[j].cargo.Empty()) {
num_waiting_cargo++; //count number of waiting cargo
- if (HASBIT(cargo_filter, j)) {
+ if (HasBit(cargo_filter, j)) {
station_sort[n++] = st;
break;
}
@@ -290,7 +290,7 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e)
if (_cargo_filter == _cargo_filter_max) _cargo_filter = _cargo_mask;
for (uint i = 0; i < 5; i++) {
- if (HASBIT(facilities, i)) LowerWindowWidget(w, i + STATIONLIST_WIDGET_TRAIN);
+ if (HasBit(facilities, i)) LowerWindowWidget(w, i + STATIONLIST_WIDGET_TRAIN);
}
SetWindowWidgetLoweredState(w, STATIONLIST_WIDGET_FACILALL, facilities == (FACIL_TRAIN | FACIL_TRUCK_STOP | FACIL_BUS_STOP | FACIL_AIRPORT | FACIL_DOCK));
SetWindowWidgetLoweredState(w, STATIONLIST_WIDGET_CARGOALL, _cargo_filter == _cargo_mask && include_empty);
@@ -329,7 +329,7 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e)
const CargoSpec *cs = GetCargo(c);
if (!cs->IsValid()) continue;
- cg_ofst = HASBIT(_cargo_filter, c) ? 2 : 1;
+ cg_ofst = HasBit(_cargo_filter, c) ? 2 : 1;
GfxFillRect(x + cg_ofst, y + cg_ofst, x + cg_ofst + 10 , y + cg_ofst + 7, cs->rating_colour);
DrawStringCentered(x + 6 + cg_ofst, y + cg_ofst, cs->abbrev, TC_BLACK);
x += 14;
@@ -404,7 +404,7 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e)
ToggleWidgetLoweredState(w, e->we.click.widget);
} else {
for (uint i = 0; facilities != 0; i++, facilities >>= 1) {
- if (HASBIT(facilities, 0)) RaiseWindowWidget(w, i + STATIONLIST_WIDGET_TRAIN);
+ if (HasBit(facilities, 0)) RaiseWindowWidget(w, i + STATIONLIST_WIDGET_TRAIN);
}
SETBIT(facilities, e->we.click.widget - STATIONLIST_WIDGET_TRAIN);
LowerWindowWidget(w, e->we.click.widget);
@@ -444,7 +444,7 @@ static void PlayerStationsWndProc(Window *w, WindowEvent *e)
case STATIONLIST_WIDGET_SORTBY: /*flip sorting method asc/desc*/
sl->flags ^= SL_ORDER; //DESC-flag
- station_sort.order = HASBIT(sl->flags, 0);
+ station_sort.order = HasBit(sl->flags, 0);
sl->flags |= SL_RESORT;
w->flags4 |= 5 << WF_TIMEOUT_SHL;
LowerWindowWidget(w, STATIONLIST_WIDGET_SORTBY);
@@ -615,7 +615,7 @@ void ShowPlayerStations(PlayerID player)
wi->data = 0;
wi->tooltips = STR_USE_CTRL_TO_SELECT_MORE;
- if (HASBIT(_cargo_filter, c)) LowerWindowWidget(w, STATIONLIST_WIDGET_CARGOSTART + i);
+ if (HasBit(_cargo_filter, c)) LowerWindowWidget(w, STATIONLIST_WIDGET_CARGOSTART + i);
i++;
}
@@ -772,7 +772,7 @@ static void DrawStationViewWindow(Window *w)
for (CargoID i = 0; i < NUM_CARGO; i++) {
if (b >= endof(_userstring) - 5 - 1) break;
- if (HASBIT(st->goods[i].acceptance_pickup, GoodsEntry::ACCEPTANCE)) {
+ if (HasBit(st->goods[i].acceptance_pickup, GoodsEntry::ACCEPTANCE)) {
if (first) {
first = false;
} else {
@@ -798,7 +798,7 @@ static void DrawStationViewWindow(Window *w)
if (!cs->IsValid()) continue;
const GoodsEntry *ge = &st->goods[i];
- if (!HASBIT(ge->acceptance_pickup, GoodsEntry::PICKUP)) continue;
+ if (!HasBit(ge->acceptance_pickup, GoodsEntry::PICKUP)) continue;
SetDParam(0, cs->name);
SetDParam(2, ge->rating * 101 >> 8);
diff --git a/src/station_map.h b/src/station_map.h
index 05d3abcba..4c72d1dad 100644
--- a/src/station_map.h
+++ b/src/station_map.h
@@ -116,7 +116,7 @@ static inline bool IsDriveThroughStopTile(TileIndex t)
static inline bool GetStopBuiltOnTownRoad(TileIndex t)
{
assert(IsDriveThroughStopTile(t));
- return HASBIT(_m[t].m6, 2);
+ return HasBit(_m[t].m6, 2);
}
@@ -173,7 +173,7 @@ static inline bool IsHangarTile(TileIndex t)
static inline Axis GetRailStationAxis(TileIndex t)
{
assert(IsRailwayStation(t));
- return HASBIT(GetStationGfx(t), 0) ? AXIS_Y : AXIS_X;
+ return HasBit(GetStationGfx(t), 0) ? AXIS_Y : AXIS_X;
}
diff --git a/src/strgen/strgen.cpp b/src/strgen/strgen.cpp
index 9b9c2dca3..54ea8544e 100644
--- a/src/strgen/strgen.cpp
+++ b/src/strgen/strgen.cpp
@@ -221,7 +221,7 @@ size_t Utf8Validate(const char *s)
{
uint32 c;
- if (!HASBIT(s[0], 7)) {
+ if (!HasBit(s[0], 7)) {
/* 1 byte */
return 1;
} else if (GB(s[0], 5, 3) == 6 && IsUtf8Part(s[1])) {
diff --git a/src/string.cpp b/src/string.cpp
index 12e6b5823..fbbf5ea9f 100644
--- a/src/string.cpp
+++ b/src/string.cpp
@@ -214,7 +214,7 @@ size_t Utf8Decode(WChar *c, const char *s)
{
assert(c != NULL);
- if (!HASBIT(s[0], 7)) {
+ if (!HasBit(s[0], 7)) {
/* Single byte character: 0xxxxxxx */
*c = s[0];
return 1;
diff --git a/src/strings.cpp b/src/strings.cpp
index 09a9ccc44..ed84ee6ca 100644
--- a/src/strings.cpp
+++ b/src/strings.cpp
@@ -139,7 +139,7 @@ static char *GetStringWithArgs(char *buffr, uint string, const int64 *argv, cons
case 26:
/* Include string within newgrf text (format code 81) */
- if (HASBIT(index, 10)) {
+ if (HasBit(index, 10)) {
StringID string = GetGRFStringID(0, 0xD000 + GB(index, 0, 10));
return GetStringWithArgs(buffr, string, argv, last);
}
diff --git a/src/timetable_cmd.cpp b/src/timetable_cmd.cpp
index 0db355978..b5ebecff8 100644
--- a/src/timetable_cmd.cpp
+++ b/src/timetable_cmd.cpp
@@ -23,7 +23,7 @@ static void ChangeTimetable(Vehicle *v, VehicleOrderID order_number, uint16 time
order->wait_time = time;
}
- if (v->cur_order_index == order_number && HASBIT(v->current_order.flags, OFB_PART_OF_ORDERS)) {
+ if (v->cur_order_index == order_number && HasBit(v->current_order.flags, OFB_PART_OF_ORDERS)) {
if (is_journey) {
v->current_order.travel_time = time;
} else {
@@ -61,7 +61,7 @@ CommandCost CmdChangeTimetable(TileIndex tile, uint32 flags, uint32 p1, uint32 p
Order *order = GetVehicleOrder(v, order_number);
if (order == NULL) return CMD_ERROR;
- bool is_journey = HASBIT(p1, 24);
+ bool is_journey = HasBit(p1, 24);
if (!is_journey) {
if (order->type != OT_GOTO_STATION) return_cmd_error(STR_TIMETABLE_ONLY_WAIT_AT_STATIONS);
if (_patches.new_nonstop && (order->flags & OF_NON_STOP)) return_cmd_error(STR_TIMETABLE_NOT_STOPPING_HERE);
@@ -154,14 +154,14 @@ void UpdateVehicleTimetable(Vehicle *v, bool travelling)
/* Make sure the timetable only starts when the vehicle reaches the first
* order, not when travelling from the depot to the first station. */
- if (v->cur_order_index == 0 && !HASBIT(v->vehicle_flags, VF_TIMETABLE_STARTED)) {
+ if (v->cur_order_index == 0 && !HasBit(v->vehicle_flags, VF_TIMETABLE_STARTED)) {
SETBIT(v->vehicle_flags, VF_TIMETABLE_STARTED);
return;
}
- if (!HASBIT(v->vehicle_flags, VF_TIMETABLE_STARTED)) return;
+ if (!HasBit(v->vehicle_flags, VF_TIMETABLE_STARTED)) return;
- if (HASBIT(v->vehicle_flags, VF_AUTOFILL_TIMETABLE)) {
+ if (HasBit(v->vehicle_flags, VF_AUTOFILL_TIMETABLE)) {
if (timetabled == 0) {
/* Round the time taken up to the nearest day, as this will avoid
* confusion for people who are timetabling in days, and can be
diff --git a/src/timetable_gui.cpp b/src/timetable_gui.cpp
index e6ac218b9..9e01d48b1 100644
--- a/src/timetable_gui.cpp
+++ b/src/timetable_gui.cpp
@@ -76,7 +76,7 @@ static void DrawTimetableWindow(Window *w)
DisableWindowWidget(w, 9);
}
- SetWindowWidgetLoweredState(w, 9, HASBIT(v->vehicle_flags, VF_AUTOFILL_TIMETABLE));
+ SetWindowWidgetLoweredState(w, 9, HasBit(v->vehicle_flags, VF_AUTOFILL_TIMETABLE));
SetDParam(0, v->index);
DrawWindowWidgets(w);
@@ -262,7 +262,7 @@ static void TimetableWndProc(Window *w, WindowEvent *we)
break;
case 9: /* Autofill the timetable. */
- DoCommandP(0, v->index, HASBIT(v->vehicle_flags, VF_AUTOFILL_TIMETABLE) ? 0 : 1, NULL, CMD_AUTOFILL_TIMETABLE | CMD_MSG(STR_CAN_T_TIMETABLE_VEHICLE));
+ DoCommandP(0, v->index, HasBit(v->vehicle_flags, VF_AUTOFILL_TIMETABLE) ? 0 : 1, NULL, CMD_AUTOFILL_TIMETABLE | CMD_MSG(STR_CAN_T_TIMETABLE_VEHICLE));
break;
}
diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp
index 867379205..464685635 100644
--- a/src/town_cmd.cpp
+++ b/src/town_cmd.cpp
@@ -356,7 +356,7 @@ static void MakeSingleHouseBigger(TileIndex tile)
if (GetHouseConstructionTick(tile) != 0) return;
/* Check and/or */
- if (HASBIT(GetHouseSpecs(GetHouseType(tile))->callback_mask, CBM_HOUSE_CONSTRUCTION_STATE_CHANGE)) {
+ if (HasBit(GetHouseSpecs(GetHouseType(tile))->callback_mask, CBM_HOUSE_CONSTRUCTION_STATE_CHANGE)) {
uint16 callback_res = GetHouseCallback(CBID_HOUSE_CONSTRUCTION_STATE_CHANGE, 0, 0, GetHouseType(tile), GetTownByTile(tile), tile);
if (callback_res != CALLBACK_FAILED) ChangeHouseAnimationFrame(tile, callback_res);
}
@@ -413,7 +413,7 @@ static void TileLoop_Town(TileIndex tile)
r = Random();
- if (HASBIT(hs->callback_mask, CBM_HOUSE_PRODUCE_CARGO)) {
+ if (HasBit(hs->callback_mask, CBM_HOUSE_PRODUCE_CARGO)) {
for (uint i = 0; i < 256; i++) {
uint16 callback = GetHouseCallback(CBID_HOUSE_PRODUCE_CARGO, i, r, house_id, t, tile);
@@ -467,7 +467,7 @@ static void TileLoop_Town(TileIndex tile)
_current_player = OWNER_TOWN;
if (hs->building_flags & BUILDING_HAS_1_TILE &&
- HASBIT(t->flags12, TOWN_IS_FUNDED) &&
+ HasBit(t->flags12, TOWN_IS_FUNDED) &&
CanDeleteHouse(tile) &&
max(_cur_year - GetHouseConstructionYear(tile), 0) >= hs->minimum_life &&
--t->time_until_rebuild == 0) {
@@ -533,7 +533,7 @@ static void GetAcceptedCargo_Town(TileIndex tile, AcceptedCargo ac)
}
/* Check for custom accepted cargo types */
- if (HASBIT(hs->callback_mask, CBM_HOUSE_ACCEPT_CARGO)) {
+ if (HasBit(hs->callback_mask, CBM_HOUSE_ACCEPT_CARGO)) {
uint16 callback = GetHouseCallback(CBID_HOUSE_ACCEPT_CARGO, 0, 0, GetHouseType(tile), GetTownByTile(tile), tile);
if (callback != CALLBACK_FAILED) {
/* Replace accepted cargo types with translated values from callback */
@@ -544,12 +544,12 @@ static void GetAcceptedCargo_Town(TileIndex tile, AcceptedCargo ac)
}
/* Check for custom cargo acceptance */
- if (HASBIT(hs->callback_mask, CBM_HOUSE_CARGO_ACCEPTANCE)) {
+ if (HasBit(hs->callback_mask, CBM_HOUSE_CARGO_ACCEPTANCE)) {
uint16 callback = GetHouseCallback(CBID_HOUSE_CARGO_ACCEPTANCE, 0, 0, GetHouseType(tile), GetTownByTile(tile), tile);
if (callback != CALLBACK_FAILED) {
if (accepts[0] != CT_INVALID) ac[accepts[0]] = GB(callback, 0, 4);
if (accepts[1] != CT_INVALID) ac[accepts[1]] = GB(callback, 4, 4);
- if (_opt.landscape != LT_TEMPERATE && HASBIT(callback, 12)) {
+ if (_opt.landscape != LT_TEMPERATE && HasBit(callback, 12)) {
/* The 'S' bit indicates food instead of goods */
ac[CT_FOOD] = GB(callback, 8, 4);
} else {
@@ -591,7 +591,7 @@ static bool GrowTown(Town *t);
static void TownTickHandler(Town *t)
{
- if (HASBIT(t->flags12, TOWN_IS_FUNDED)) {
+ if (HasBit(t->flags12, TOWN_IS_FUNDED)) {
int i = t->grow_counter - 1;
if (i < 0) {
if (GrowTown(t)) {
@@ -1715,7 +1715,7 @@ static void DoBuildTownHouse(Town *t, TileIndex tile)
if ((hs->extra_flags & BUILDING_IS_HISTORICAL) && !_generating_world) continue;
- if (HASBIT(hs->callback_mask, CBM_HOUSE_ALLOW_CONSTRUCTION)) {
+ if (HasBit(hs->callback_mask, CBM_HOUSE_ALLOW_CONSTRUCTION)) {
uint16 callback_res = GetHouseCallback(CBID_HOUSE_ALLOW_CONSTRUCTION, 0, 0, house, t, tile);
if (callback_res != CALLBACK_FAILED && callback_res == 0) continue;
}
@@ -2098,7 +2098,7 @@ CommandCost CmdDoTownAction(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
t = GetTown(p1);
- if (!HASBIT(GetMaskOfTownActions(NULL, _current_player, t), p2)) return CMD_ERROR;
+ if (!HasBit(GetMaskOfTownActions(NULL, _current_player, t), p2)) return CMD_ERROR;
SET_EXPENSES_TYPE(EXPENSES_OTHER);
diff --git a/src/town_gui.cpp b/src/town_gui.cpp
index 2f7381e62..8bd7ff527 100644
--- a/src/town_gui.cpp
+++ b/src/town_gui.cpp
@@ -95,7 +95,7 @@ uint GetMaskOfTownActions(int *nump, PlayerID pid, const Town *t)
continue;
/* Is the player not able to build a statue ? */
- if (cur == TACT_BUILD_STATUE && HASBIT(t->statues, pid))
+ if (cur == TACT_BUILD_STATUE && HasBit(t->statues, pid))
continue;
if (avail >= _town_action_costs[i] * ref) {
@@ -132,7 +132,7 @@ static void TownAuthorityWndProc(Window *w, WindowEvent *e)
SetVScrollCount(w, numact + 1);
- if (WP(w,def_d).data_1 != -1 && !HASBIT(buttons, WP(w,def_d).data_1))
+ if (WP(w,def_d).data_1 != -1 && !HasBit(buttons, WP(w,def_d).data_1))
WP(w,def_d).data_1 = -1;
SetWindowWidgetDisabledState(w, 6, WP(w, def_d).data_1 == -1);
@@ -151,7 +151,7 @@ static void TownAuthorityWndProc(Window *w, WindowEvent *e)
/* Draw list of players */
y = 25;
FOR_ALL_PLAYERS(p) {
- if (p->is_active && (HASBIT(t->have_ratings, p->index) || t->exclusivity == p->index)) {
+ if (p->is_active && (HasBit(t->have_ratings, p->index) || t->exclusivity == p->index)) {
DrawPlayerIcon(p->index, 2, y);
SetDParam(0, p->index);
diff --git a/src/town_map.h b/src/town_map.h
index 1230d8f71..71c6dbaa6 100644
--- a/src/town_map.h
+++ b/src/town_map.h
@@ -77,7 +77,7 @@ static inline void SetHouseType(TileIndex t, HouseID house_id)
*/
static inline bool LiftHasDestination(TileIndex t)
{
- return HASBIT(_me[t].m7, 0);
+ return HasBit(_me[t].m7, 0);
}
/**
@@ -166,7 +166,7 @@ static inline void SetHouseAnimationFrame(TileIndex t, byte frame)
static inline bool IsHouseCompleted(TileIndex t)
{
assert(IsTileType(t, MP_HOUSE));
- return HASBIT(_m[t].m3, 7);
+ return HasBit(_m[t].m3, 7);
}
/**
diff --git a/src/train.h b/src/train.h
index 51c6bf2a8..653ba2543 100644
--- a/src/train.h
+++ b/src/train.h
@@ -32,7 +32,7 @@ enum TrainSubtype {
static inline bool IsFrontEngine(const Vehicle *v)
{
assert(v->type == VEH_TRAIN);
- return HASBIT(v->subtype, Train_Front);
+ return HasBit(v->subtype, Train_Front);
}
/** Set front engine state
@@ -60,7 +60,7 @@ static inline void ClearFrontEngine(Vehicle *v)
static inline bool IsArticulatedPart(const Vehicle *v)
{
assert(v->type == VEH_TRAIN);
- return HASBIT(v->subtype, Train_Articulated_Part);
+ return HasBit(v->subtype, Train_Articulated_Part);
}
/** Set a vehicle to be an articulated part
@@ -88,7 +88,7 @@ static inline void ClearArticulatedPart(Vehicle *v)
static inline bool IsTrainWagon(const Vehicle *v)
{
assert(v->type == VEH_TRAIN);
- return HASBIT(v->subtype, Train_Wagon);
+ return HasBit(v->subtype, Train_Wagon);
}
/** Set a vehicle to be a wagon
@@ -116,7 +116,7 @@ static inline void ClearTrainWagon(Vehicle *v)
static inline bool IsTrainEngine(const Vehicle *v)
{
assert(v->type == VEH_TRAIN);
- return HASBIT(v->subtype, Train_Engine);
+ return HasBit(v->subtype, Train_Engine);
}
/** Set engine status
@@ -144,7 +144,7 @@ static inline void ClearTrainEngine(Vehicle *v)
static inline bool IsFreeWagon(const Vehicle *v)
{
assert(v->type == VEH_TRAIN);
- return HASBIT(v->subtype, Train_Free_Wagon);
+ return HasBit(v->subtype, Train_Free_Wagon);
}
/** Set if a vehicle is a free wagon
@@ -172,7 +172,7 @@ static inline void ClearFreeWagon(Vehicle *v)
static inline bool IsMultiheaded(const Vehicle *v)
{
assert(v->type == VEH_TRAIN);
- return HASBIT(v->subtype, Train_Multiheaded);
+ return HasBit(v->subtype, Train_Multiheaded);
}
/** Set if a vehicle is a multiheaded engine
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index 4489a0bea..03e5068ac 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -90,7 +90,7 @@ void TrainPowerChanged(Vehicle* v)
}
}
- if (HASBIT(u->u.rail.flags, VRF_POWEREDWAGON) && (wagon_has_power)) {
+ if (HasBit(u->u.rail.flags, VRF_POWEREDWAGON) && (wagon_has_power)) {
total_power += RailVehInfo(u->u.rail.first_engine)->pow_wag_power;
}
}
@@ -125,7 +125,7 @@ static void TrainCargoChanged(Vehicle* v)
vweight += GetVehicleProperty(u, 0x16, RailVehInfo(u->engine_type)->weight);
/* powered wagons have extra weight added */
- if (HASBIT(u->u.rail.flags, VRF_POWEREDWAGON))
+ if (HasBit(u->u.rail.flags, VRF_POWEREDWAGON))
vweight += RailVehInfo(u->u.rail.first_engine)->pow_wag_weight;
}
@@ -197,14 +197,14 @@ void TrainConsistChanged(Vehicle* v)
if (!IsArticulatedPart(u)) {
/* Check powered wagon / visual effect callback */
- if (HASBIT(EngInfo(u->engine_type)->callbackmask, CBM_TRAIN_WAGON_POWER)) {
+ if (HasBit(EngInfo(u->engine_type)->callbackmask, CBM_TRAIN_WAGON_POWER)) {
uint16 callback = GetVehicleCallback(CBID_TRAIN_WAGON_POWER, 0, 0, u->engine_type, u);
if (callback != CALLBACK_FAILED) u->u.rail.cached_vis_effect = callback;
}
if (rvi_v->pow_wag_power != 0 && rvi_u->railveh_type == RAILVEH_WAGON &&
- UsesWagonOverride(u) && !HASBIT(u->u.rail.cached_vis_effect, 7)) {
+ UsesWagonOverride(u) && !HasBit(u->u.rail.cached_vis_effect, 7)) {
/* wagon is powered */
SETBIT(u->u.rail.flags, VRF_POWEREDWAGON); // cache 'powered' status
} else {
@@ -219,7 +219,7 @@ void TrainConsistChanged(Vehicle* v)
/* Some electric engines can be allowed to run on normal rail. It happens to all
* existing electric engines when elrails are disabled and then re-enabled */
- if (HASBIT(u->u.rail.flags, VRF_EL_ENGINE_ALLOWED_NORMAL_RAIL)) {
+ if (HasBit(u->u.rail.flags, VRF_EL_ENGINE_ALLOWED_NORMAL_RAIL)) {
u->u.rail.railtype = RAILTYPE_RAIL;
u->u.rail.compatible_railtypes |= (1 << RAILTYPE_RAIL);
}
@@ -240,7 +240,7 @@ void TrainConsistChanged(Vehicle* v)
/* check the vehicle length (callback) */
uint16 veh_len = CALLBACK_FAILED;
- if (HASBIT(EngInfo(u->engine_type)->callbackmask, CBM_VEHICLE_LENGTH)) {
+ if (HasBit(EngInfo(u->engine_type)->callbackmask, CBM_VEHICLE_LENGTH)) {
veh_len = GetVehicleCallback(CBID_VEHICLE_LENGTH, 0, 0, u->engine_type, u);
}
if (veh_len == CALLBACK_FAILED) veh_len = rvi_u->shorten_factor;
@@ -386,9 +386,9 @@ static int GetTrainAcceleration(Vehicle *v, bool mode)
if (u->u.rail.track == TRACK_BIT_DEPOT) max_speed = min(max_speed, 61);
- if (HASBIT(u->u.rail.flags, VRF_GOINGUP)) {
+ if (HasBit(u->u.rail.flags, VRF_GOINGUP)) {
incl += u->u.rail.cached_veh_weight * 60; //3% slope, quite a bit actually
- } else if (HASBIT(u->u.rail.flags, VRF_GOINGDOWN)) {
+ } else if (HasBit(u->u.rail.flags, VRF_GOINGDOWN)) {
incl -= u->u.rail.cached_veh_weight * 60;
}
}
@@ -463,7 +463,7 @@ int Train::GetImage(Direction direction) const
int img = this->spritenum;
int base;
- if (HASBIT(this->u.rail.flags, VRF_REVERSE_DIRECTION)) direction = ReverseDir(direction);
+ if (HasBit(this->u.rail.flags, VRF_REVERSE_DIRECTION)) direction = ReverseDir(direction);
if (is_custom_sprite(img)) {
base = GetCustomVehicleSprite(this, (Direction)(direction + 4 * IS_CUSTOM_SECONDHEAD_SPRITE(img)));
@@ -701,7 +701,7 @@ CommandCost CmdBuildRailVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32
Vehicle *v = vl[0];
- UnitID unit_num = HASBIT(p2, 0) ? 0 : GetFreeUnitNumber(VEH_TRAIN);
+ UnitID unit_num = HasBit(p2, 0) ? 0 : GetFreeUnitNumber(VEH_TRAIN);
if (unit_num > _patches.max_trains)
return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
@@ -774,7 +774,7 @@ CommandCost CmdBuildRailVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32
UpdateTrainAcceleration(v);
UpdateTrainGroupID(v);
- if (!HASBIT(p2, 1)) { // check if the cars should be added to the new vehicle
+ if (!HasBit(p2, 1)) { // check if the cars should be added to the new vehicle
NormalizeTrainVehInDepot(v);
}
@@ -972,7 +972,7 @@ CommandCost CmdMoveRailVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p
if (IsRearDualheaded(src)) return_cmd_error(STR_REAR_ENGINE_FOLLOW_FRONT_ERROR);
/* when moving all wagons, we can't have the same src_head and dst_head */
- if (HASBIT(p2, 0) && src_head == dst_head) return CommandCost();
+ if (HasBit(p2, 0) && src_head == dst_head) return CommandCost();
{
int max_len = _patches.mammoth_trains ? 100 : 9;
@@ -993,7 +993,7 @@ CommandCost CmdMoveRailVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p
/* We are moving between rows, so only count the wagons from the source
* row that are being moved. */
- if (HASBIT(p2, 0)) {
+ if (HasBit(p2, 0)) {
const Vehicle *u;
for (u = src_head; u != src && u != NULL; u = GetNextVehicle(u))
src_len--;
@@ -1049,7 +1049,7 @@ CommandCost CmdMoveRailVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p
}
}
- if (HASBIT(p2, 0)) {
+ if (HasBit(p2, 0)) {
/* unlink ALL wagons */
if (src != src_head) {
Vehicle *v = src_head;
@@ -1343,7 +1343,7 @@ CommandCost CmdSellRailWagon(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
* up on a new line to be added to the newly built loco. Replace it is.
* Totally braindead cause building a new engine adds all loco-less
* engines to its train anyways */
- if (p2 == 2 && HASBIT(ori_subtype, Train_Front)) {
+ if (p2 == 2 && HasBit(ori_subtype, Train_Front)) {
Vehicle *tmp;
for (v = first; v != NULL; v = tmp) {
tmp = GetNextVehicle(v);
@@ -1464,14 +1464,14 @@ static void SwapTrainFlags(byte *swap_flag1, byte *swap_flag2)
CLRBIT(*swap_flag2, VRF_GOINGDOWN);
/* Reverse the rail-flags (if needed) */
- if (HASBIT(flag1, VRF_GOINGUP)) {
+ if (HasBit(flag1, VRF_GOINGUP)) {
SETBIT(*swap_flag2, VRF_GOINGDOWN);
- } else if (HASBIT(flag1, VRF_GOINGDOWN)) {
+ } else if (HasBit(flag1, VRF_GOINGDOWN)) {
SETBIT(*swap_flag2, VRF_GOINGUP);
}
- if (HASBIT(flag2, VRF_GOINGUP)) {
+ if (HasBit(flag2, VRF_GOINGUP)) {
SETBIT(*swap_flag1, VRF_GOINGDOWN);
- } else if (HASBIT(flag2, VRF_GOINGDOWN)) {
+ } else if (HasBit(flag2, VRF_GOINGDOWN)) {
SETBIT(*swap_flag1, VRF_GOINGUP);
}
}
@@ -1640,7 +1640,7 @@ CommandCost CmdReverseTrainDirection(TileIndex tile, uint32 flags, uint32 p1, ui
if (p2) {
/* turn a single unit around */
- if (IsMultiheaded(v) || HASBIT(EngInfo(v->engine_type)->callbackmask, CBM_VEHICLE_ARTIC_ENGINE)) {
+ if (IsMultiheaded(v) || HasBit(EngInfo(v->engine_type)->callbackmask, CBM_VEHICLE_ARTIC_ENGINE)) {
return_cmd_error(STR_ONLY_TURN_SINGLE_UNIT);
}
@@ -1705,7 +1705,7 @@ CommandCost CmdRefitRailVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32
{
CargoID new_cid = GB(p2, 0, 8);
byte new_subtype = GB(p2, 8, 8);
- bool only_this = HASBIT(p2, 16);
+ bool only_this = HasBit(p2, 16);
if (!IsValidVehicleID(p1)) return CMD_ERROR;
@@ -1731,7 +1731,7 @@ CommandCost CmdRefitRailVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32
if (v->cargo_cap != 0) {
uint16 amount = CALLBACK_FAILED;
- if (HASBIT(EngInfo(v->engine_type)->callbackmask, CBM_VEHICLE_REFIT_CAPACITY)) {
+ if (HasBit(EngInfo(v->engine_type)->callbackmask, CBM_VEHICLE_REFIT_CAPACITY)) {
/* Back up the vehicle's cargo type */
CargoID temp_cid = v->cargo_type;
byte temp_subtype = v->cargo_subtype;
@@ -1902,7 +1902,7 @@ CommandCost CmdSendTrainToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32
if (v->vehstatus & VS_CRASHED) return CMD_ERROR;
if (v->current_order.type == OT_GOTO_DEPOT) {
- if (!!(p2 & DEPOT_SERVICE) == HASBIT(v->current_order.flags, OFB_HALT_IN_DEPOT)) {
+ if (!!(p2 & DEPOT_SERVICE) == HasBit(v->current_order.flags, OFB_HALT_IN_DEPOT)) {
/* We called with a different DEPOT_SERVICE setting.
* Now we change the setting to apply the new one and let the vehicle head for the same depot.
* Note: the if is (true for requesting service == true for ordered to stop in depot) */
@@ -1916,7 +1916,7 @@ CommandCost CmdSendTrainToDepot(TileIndex tile, uint32 flags, uint32 p1, uint32
if (p2 & DEPOT_DONT_CANCEL) return CMD_ERROR; // Requested no cancelation of depot orders
if (flags & DC_EXEC) {
- if (HASBIT(v->current_order.flags, OFB_PART_OF_ORDERS)) {
+ if (HasBit(v->current_order.flags, OFB_PART_OF_ORDERS)) {
v->cur_order_index++;
}
@@ -1974,7 +1974,7 @@ static void HandleLocomotiveSmokeCloud(const Vehicle* v)
const RailVehicleInfo *rvi = RailVehInfo(v->engine_type);
int effect_offset = GB(v->u.rail.cached_vis_effect, 0, 4) - 8;
byte effect_type = GB(v->u.rail.cached_vis_effect, 4, 2);
- bool disable_effect = HASBIT(v->u.rail.cached_vis_effect, 6);
+ bool disable_effect = HasBit(v->u.rail.cached_vis_effect, 6);
/* no smoke? */
if ((rvi->railveh_type == RAILVEH_WAGON && effect_type == 0) ||
@@ -1999,7 +1999,7 @@ static void HandleLocomotiveSmokeCloud(const Vehicle* v)
int x = _vehicle_smoke_pos[v->direction] * effect_offset;
int y = _vehicle_smoke_pos[(v->direction + 2) % 8] * effect_offset;
- if (HASBIT(v->u.rail.flags, VRF_REVERSE_DIRECTION)) {
+ if (HasBit(v->u.rail.flags, VRF_REVERSE_DIRECTION)) {
x = -x;
y = -y;
}
@@ -2260,7 +2260,7 @@ static Track ChooseTrainTrack(Vehicle* v, TileIndex tile, DiagDirection enterdir
/* handle "path not found" state */
if (path_not_found) {
/* PF didn't find the route */
- if (!HASBIT(v->u.rail.flags, VRF_NO_PATH_TO_DESTINATION)) {
+ if (!HasBit(v->u.rail.flags, VRF_NO_PATH_TO_DESTINATION)) {
/* it is first time the problem occurred, set the "path not found" flag */
SETBIT(v->u.rail.flags, VRF_NO_PATH_TO_DESTINATION);
/* and notify user about the event */
@@ -2275,7 +2275,7 @@ static Track ChooseTrainTrack(Vehicle* v, TileIndex tile, DiagDirection enterdir
}
} else {
/* route found, is the train marked with "path not found" flag? */
- if (HASBIT(v->u.rail.flags, VRF_NO_PATH_TO_DESTINATION)) {
+ if (HasBit(v->u.rail.flags, VRF_NO_PATH_TO_DESTINATION)) {
/* clear the flag as the PF's problem was solved */
CLRBIT(v->u.rail.flags, VRF_NO_PATH_TO_DESTINATION);
/* can we also delete the "News" item somehow? */
@@ -2493,7 +2493,7 @@ static int UpdateTrainSpeed(Vehicle *v)
{
uint accel;
- if (v->vehstatus & VS_STOPPED || HASBIT(v->u.rail.flags, VRF_REVERSING)) {
+ if (v->vehstatus & VS_STOPPED || HasBit(v->u.rail.flags, VRF_REVERSING)) {
if (_patches.realistic_acceleration) {
accel = GetTrainAcceleration(v, AM_BRAKE) * 2;
} else {
@@ -2629,7 +2629,7 @@ static bool CheckCompatibleRail(const Vehicle *v, TileIndex tile)
return
IsTileOwner(tile, v->owner) && (
!IsFrontEngine(v) ||
- HASBIT(v->u.rail.compatible_railtypes, GetRailType(tile))
+ HasBit(v->u.rail.compatible_railtypes, GetRailType(tile))
);
}
@@ -2839,10 +2839,10 @@ static void TrainController(Vehicle *v, bool update_image)
if (IsFrontEngine(v) && !TrainCheckIfLineEnds(v)) return;
uint32 r = VehicleEnterTile(v, gp.new_tile, gp.x, gp.y);
- if (HASBIT(r, VETS_CANNOT_ENTER)) {
+ if (HasBit(r, VETS_CANNOT_ENTER)) {
goto invalid_rail;
}
- if (HASBIT(r, VETS_ENTERED_STATION)) {
+ if (HasBit(r, VETS_ENTERED_STATION)) {
TrainEnterStation(v, r >> VETS_STATION_ID_OFFSET);
return;
}
@@ -2942,7 +2942,7 @@ static void TrainController(Vehicle *v, bool update_image)
/* Call the landscape function and tell it that the vehicle entered the tile */
uint32 r = VehicleEnterTile(v, gp.new_tile, gp.x, gp.y);
- if (HASBIT(r, VETS_CANNOT_ENTER)) {
+ if (HasBit(r, VETS_CANNOT_ENTER)) {
goto invalid_rail;
}
@@ -2953,7 +2953,7 @@ static void TrainController(Vehicle *v, bool update_image)
if (IsFrontEngine(v)) v->load_unload_time_rem = 0;
- if (!HASBIT(r, VETS_ENTERED_WORMHOLE)) {
+ if (!HasBit(r, VETS_ENTERED_WORMHOLE)) {
v->tile = gp.new_tile;
if (GetTileRailType(gp.new_tile) != GetTileRailType(gp.old_tile)) {
@@ -2979,7 +2979,7 @@ static void TrainController(Vehicle *v, bool update_image)
min(v->cur_speed, GetBridge(GetBridgeType(v->tile))->speed);
}
- if (!(IsTunnelTile(gp.new_tile) || IsBridgeTile(gp.new_tile)) || !HASBIT(VehicleEnterTile(v, gp.new_tile, gp.x, gp.y), VETS_ENTERED_WORMHOLE)) {
+ if (!(IsTunnelTile(gp.new_tile) || IsBridgeTile(gp.new_tile)) || !HasBit(VehicleEnterTile(v, gp.new_tile, gp.x, gp.y), VETS_ENTERED_WORMHOLE)) {
v->x_pos = gp.x;
v->y_pos = gp.y;
VehiclePositionChanged(v);
@@ -3283,7 +3283,7 @@ static void TrainLocoHandler(Vehicle *v, bool mode)
v->breakdown_ctr--;
}
- if (HASBIT(v->u.rail.flags, VRF_REVERSING) && v->cur_speed == 0) {
+ if (HasBit(v->u.rail.flags, VRF_REVERSING) && v->cur_speed == 0) {
ReverseTrainDirection(v);
}
@@ -3532,7 +3532,7 @@ void ConvertOldMultiheadToNew()
FOR_ALL_VEHICLES(v) {
if (v->type == VEH_TRAIN) {
- if (HASBIT(v->subtype, 7) && ((v->subtype & ~0x80) == 0 || (v->subtype & ~0x80) == 4)) {
+ if (HasBit(v->subtype, 7) && ((v->subtype & ~0x80) == 0 || (v->subtype & ~0x80) == 4)) {
Vehicle *u = v;
BEGIN_ENUM_WAGONS(u) {
diff --git a/src/transparency.h b/src/transparency.h
index 3dae9cecc..02daf7b20 100644
--- a/src/transparency.h
+++ b/src/transparency.h
@@ -35,7 +35,7 @@ extern TransparencyOptionBits _transparency_opt;
*/
static inline bool IsTransparencySet(TransparencyOption to)
{
- return (HASBIT(_transparency_opt, to) && _game_mode != GM_MENU);
+ return (HasBit(_transparency_opt, to) && _game_mode != GM_MENU);
}
/**
diff --git a/src/tunnel_map.h b/src/tunnel_map.h
index 8396ae2c9..e4092cf15 100644
--- a/src/tunnel_map.h
+++ b/src/tunnel_map.h
@@ -20,7 +20,7 @@
static inline bool IsTunnel(TileIndex t)
{
assert(IsTileType(t, MP_TUNNELBRIDGE));
- return !HASBIT(_m[t].m5, 7);
+ return !HasBit(_m[t].m5, 7);
}
@@ -67,7 +67,7 @@ static inline TransportType GetTunnelTransportType(TileIndex t)
static inline bool HasTunnelSnowOrDesert(TileIndex t)
{
assert(IsTunnelTile(t));
- return HASBIT(_m[t].m4, 7);
+ return HasBit(_m[t].m4, 7);
}
/**
diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp
index ee995dbb1..7a6ba1f30 100644
--- a/src/tunnelbridge_cmd.cpp
+++ b/src/tunnelbridge_cmd.cpp
@@ -118,12 +118,12 @@ static CommandCost CheckBridgeSlopeNorth(Axis axis, Slope tileh)
uint32 valid;
valid = M(SLOPE_FLAT) | (axis == AXIS_X ? M(SLOPE_NE) : M(SLOPE_NW));
- if (HASBIT(valid, tileh)) return CommandCost();
+ if (HasBit(valid, tileh)) return CommandCost();
valid =
BRIDGE_FULL_LEVELED_FOUNDATION | M(SLOPE_N) | M(SLOPE_STEEP_N) |
(axis == AXIS_X ? M(SLOPE_E) | M(SLOPE_STEEP_E) : M(SLOPE_W) | M(SLOPE_STEEP_W));
- if (HASBIT(valid, tileh)) return CommandCost(_price.terraform);
+ if (HasBit(valid, tileh)) return CommandCost(_price.terraform);
return CMD_ERROR;
}
@@ -133,12 +133,12 @@ static CommandCost CheckBridgeSlopeSouth(Axis axis, Slope tileh)
uint32 valid;
valid = M(SLOPE_FLAT) | (axis == AXIS_X ? M(SLOPE_SW) : M(SLOPE_SE));
- if (HASBIT(valid, tileh)) return CommandCost();
+ if (HasBit(valid, tileh)) return CommandCost();
valid =
BRIDGE_FULL_LEVELED_FOUNDATION | M(SLOPE_S) | M(SLOPE_STEEP_S) |
(axis == AXIS_X ? M(SLOPE_W) | M(SLOPE_STEEP_W) : M(SLOPE_E) | M(SLOPE_STEEP_E));
- if (HASBIT(valid, tileh)) return CommandCost(_price.terraform);
+ if (HasBit(valid, tileh)) return CommandCost(_price.terraform);
return CMD_ERROR;
}
@@ -210,7 +210,7 @@ CommandCost CmdBuildBridge(TileIndex end_tile, uint32 flags, uint32 p1, uint32 p
if (p1 >= MapSize()) return CMD_ERROR;
/* type of bridge */
- if (HASBIT(p2, 15)) {
+ if (HasBit(p2, 15)) {
railtype = INVALID_RAILTYPE; // road bridge
roadtypes = (RoadTypes)GB(p2, 8, 3);
if (!AreValidRoadTypes(roadtypes) || !HasRoadTypesAvail(_current_player, roadtypes)) return CMD_ERROR;
@@ -252,10 +252,10 @@ CommandCost CmdBuildBridge(TileIndex end_tile, uint32 flags, uint32 p1, uint32 p
tileh_end = GetTileSlope(tile_end, &z_end);
if (IsSteepSlope(tileh_start)) z_start += TILE_HEIGHT;
- if (HASBIT(BRIDGE_FULL_LEVELED_FOUNDATION, tileh_start)) z_start += TILE_HEIGHT;
+ if (HasBit(BRIDGE_FULL_LEVELED_FOUNDATION, tileh_start)) z_start += TILE_HEIGHT;
if (IsSteepSlope(tileh_end)) z_end += TILE_HEIGHT;
- if (HASBIT(BRIDGE_FULL_LEVELED_FOUNDATION, tileh_end)) z_end += TILE_HEIGHT;
+ if (HasBit(BRIDGE_FULL_LEVELED_FOUNDATION, tileh_end)) z_end += TILE_HEIGHT;
if (z_start != z_end) return_cmd_error(STR_BRIDGEHEADS_NOT_SAME_HEIGHT);
@@ -462,7 +462,7 @@ CommandCost CmdBuildTunnel(TileIndex start_tile, uint32 flags, uint32 p1, uint32
CommandCost ret;
_build_tunnel_endtile = 0;
- if (!HASBIT(p1, 9)) {
+ if (!HasBit(p1, 9)) {
if (!ValParamRailtype(p1)) return CMD_ERROR;
} else {
const RoadTypes rts = (RoadTypes)GB(p1, 0, 3);
@@ -828,7 +828,7 @@ static void DrawBridgePillars(const PalSpriteID *psid, const TileInfo* ti, Axis
{
SpriteID image = psid->sprite;
if (image != 0) {
- bool drawfarpillar = !HASBIT(GetBridgeFlags(type), 0);
+ bool drawfarpillar = !HasBit(GetBridgeFlags(type), 0);
/* "side" specifies the side the pillars stand on.
* The length of the pillars is then set to the height of the bridge over the corners of this edge.
@@ -839,7 +839,7 @@ static void DrawBridgePillars(const PalSpriteID *psid, const TileInfo* ti, Axis
*
* I have no clue, why this was done this way.
*/
- bool side = HASBIT(image, 0);
+ bool side = HasBit(image, 0);
/* "dir" means the edge the pillars stand on */
DiagDirection dir = AxisToDiagDir(axis);
@@ -873,8 +873,8 @@ static void DrawBridgePillars(const PalSpriteID *psid, const TileInfo* ti, Axis
Foundation GetBridgeFoundation(Slope tileh, Axis axis)
{
- if (HASBIT(BRIDGE_NO_FOUNDATION, tileh)) return FOUNDATION_NONE;
- if (HASBIT(BRIDGE_FULL_LEVELED_FOUNDATION, tileh)) return FlatteningFoundation(tileh);
+ if (HasBit(BRIDGE_NO_FOUNDATION, tileh)) return FOUNDATION_NONE;
+ if (HasBit(BRIDGE_FULL_LEVELED_FOUNDATION, tileh)) return FlatteningFoundation(tileh);
return InclinedFoundation(axis);
}
@@ -964,7 +964,7 @@ static void DrawTile_TunnelBridge(TileInfo *ti)
DiagDirection dir = GetTunnelDirection(ti->tile);
RoadTypes rts = GetRoadTypes(ti->tile);
- if (HASBIT(rts, ROADTYPE_TRAM)) {
+ if (HasBit(rts, ROADTYPE_TRAM)) {
static const SpriteID tunnel_sprites[2][4] = { { 28, 78, 79, 27 }, { 5, 76, 77, 4 } };
DrawGroundSprite(SPR_TRAMWAY_BASE + tunnel_sprites[rts - ROADTYPES_TRAM][dir], PAL_NONE);
@@ -1036,7 +1036,7 @@ static void DrawTile_TunnelBridge(TileInfo *ti)
if (GetBridgeTransportType(ti->tile) == TRANSPORT_ROAD) {
RoadTypes rts = GetRoadTypes(ti->tile);
- if (HASBIT(rts, ROADTYPE_TRAM)) {
+ if (HasBit(rts, ROADTYPE_TRAM)) {
uint offset = GetBridgeRampDirection(ti->tile);
uint z = ti->z;
if (ti->tileh != SLOPE_FLAT) {
@@ -1046,7 +1046,7 @@ static void DrawTile_TunnelBridge(TileInfo *ti)
offset += 2;
}
/* DrawBridgeTramBits() calls EndSpriteCombine() and StartSpriteCombine() */
- DrawBridgeTramBits(ti->x, ti->y, z, offset, HASBIT(rts, ROADTYPE_ROAD));
+ DrawBridgeTramBits(ti->x, ti->y, z, offset, HasBit(rts, ROADTYPE_ROAD));
}
EndSpriteCombine();
} else if (GetRailType(ti->tile) == RAILTYPE_ELECTRIC) {
@@ -1168,9 +1168,9 @@ void DrawBridgeMiddle(const TileInfo* ti)
if (GetBridgeTransportType(rampsouth) == TRANSPORT_ROAD) {
RoadTypes rts = GetRoadTypes(rampsouth);
- if (HASBIT(rts, ROADTYPE_TRAM)) {
+ if (HasBit(rts, ROADTYPE_TRAM)) {
/* DrawBridgeTramBits() calls EndSpriteCombine() and StartSpriteCombine() */
- DrawBridgeTramBits(x, y, bridge_z, axis ^ 1, HASBIT(rts, ROADTYPE_ROAD));
+ DrawBridgeTramBits(x, y, bridge_z, axis ^ 1, HasBit(rts, ROADTYPE_ROAD));
} else {
EndSpriteCombine();
StartSpriteCombine();
@@ -1234,7 +1234,7 @@ static uint GetSlopeZ_TunnelBridge(TileIndex tile, uint x, uint y)
if (5 <= pos && pos <= 10) {
uint delta;
- if (HASBIT(BRIDGE_HORZ_RAMP, tileh)) return z + TILE_HEIGHT;
+ if (HasBit(BRIDGE_HORZ_RAMP, tileh)) return z + TILE_HEIGHT;
switch (dir) {
default: NOT_REACHED();
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index b91b232a9..957093552 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -234,7 +234,7 @@ void AfterLoadVehicles()
FOR_ALL_VEHICLES(v) {
switch (v->type) {
case VEH_ROAD:
- v->u.road.roadtype = HASBIT(EngInfo(v->engine_type)->misc_flags, EF_ROAD_TRAM) ? ROADTYPE_TRAM : ROADTYPE_ROAD;
+ v->u.road.roadtype = HasBit(EngInfo(v->engine_type)->misc_flags, EF_ROAD_TRAM) ? ROADTYPE_TRAM : ROADTYPE_ROAD;
v->u.road.compatible_roadtypes = RoadTypeToRoadTypes(v->u.road.roadtype);
/* FALL THROUGH */
case VEH_TRAIN:
@@ -587,7 +587,7 @@ static Vehicle* _first_veh_in_depot_list;
void VehicleEnteredDepotThisTick(Vehicle *v)
{
/* we need to set v->leave_depot_instantly as we have no control of it's contents at this time */
- if (HASBIT(v->current_order.flags, OFB_HALT_IN_DEPOT) && !HASBIT(v->current_order.flags, OFB_PART_OF_ORDERS) && v->current_order.type == OT_GOTO_DEPOT) {
+ if (HasBit(v->current_order.flags, OFB_HALT_IN_DEPOT) && !HasBit(v->current_order.flags, OFB_PART_OF_ORDERS) && v->current_order.type == OT_GOTO_DEPOT) {
/* we keep the vehicle in the depot since the user ordered it to stay */
v->leave_depot_instantly = false;
} else {
@@ -655,7 +655,7 @@ void CallVehicleTicks()
*/
bool CanRefitTo(EngineID engine_type, CargoID cid_to)
{
- return HASBIT(EngInfo(engine_type)->refit_mask, cid_to);
+ return HasBit(EngInfo(engine_type)->refit_mask, cid_to);
}
/** Find the first cargo type that an engine can be refitted to.
@@ -668,7 +668,7 @@ CargoID FindFirstRefittableCargo(EngineID engine_type)
if (refit_mask != 0) {
for (CargoID cid = 0; cid < NUM_CARGO; cid++) {
- if (HASBIT(refit_mask, cid)) return cid;
+ if (HasBit(refit_mask, cid)) return cid;
}
}
@@ -1405,8 +1405,8 @@ void CheckVehicle32Day(Vehicle *v)
uint16 callback = GetVehicleCallback(CBID_VEHICLE_32DAY_CALLBACK, 0, 0, v->engine_type, v);
if (callback == CALLBACK_FAILED) return;
- if (HASBIT(callback, 0)) TriggerVehicle(v, VEHICLE_TRIGGER_CALLBACK_32); // Trigger vehicle trigger 10
- if (HASBIT(callback, 1)) v->colormap = PAL_NONE; // Update colormap via callback 2D
+ if (HasBit(callback, 0)) TriggerVehicle(v, VEHICLE_TRIGGER_CALLBACK_32); // Trigger vehicle trigger 10
+ if (HasBit(callback, 1)) v->colormap = PAL_NONE; // Update colormap via callback 2D
}
void DecreaseVehicleValue(Vehicle *v)
@@ -1523,8 +1523,8 @@ CommandCost CmdMassStartStopVehicle(TileIndex tile, uint32 flags, uint32 p1, uin
uint i;
uint stop_command;
VehicleType vehicle_type = (VehicleType)GB(p2, 0, 5);
- bool start_stop = HASBIT(p2, 5);
- bool vehicle_list_window = HASBIT(p2, 6);
+ bool start_stop = HasBit(p2, 5);
+ bool vehicle_list_window = HasBit(p2, 6);
switch (vehicle_type) {
case VEH_TRAIN: stop_command = CMD_START_STOP_TRAIN; break;
@@ -1754,7 +1754,7 @@ CommandCost CmdCloneVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if (flags & DC_EXEC) {
w = GetVehicle(_new_vehicle_id);
- if (v->type == VEH_TRAIN && HASBIT(v->u.rail.flags, VRF_REVERSE_DIRECTION)) {
+ if (v->type == VEH_TRAIN && HasBit(v->u.rail.flags, VRF_REVERSE_DIRECTION)) {
SETBIT(w->u.rail.flags, VRF_REVERSE_DIRECTION);
}
@@ -2117,7 +2117,7 @@ uint8 CalcPercentVehicleFilled(Vehicle *v, StringID *color)
count += v->cargo.Count();
max += v->cargo_cap;
if (v->cargo_cap != 0) {
- unloading += HASBIT(v->vehicle_flags, VF_CARGO_UNLOADING) ? 1 : 0;
+ unloading += HasBit(v->vehicle_flags, VF_CARGO_UNLOADING) ? 1 : 0;
loading |= (u->current_order.flags & OF_UNLOAD) == 0 && st->goods[v->cargo_type].days_since_pickup != 255;
cars++;
}
@@ -2204,11 +2204,11 @@ void VehicleEnterDepot(Vehicle *v)
}
}
- if (HASBIT(t.flags, OFB_PART_OF_ORDERS)) {
+ if (HasBit(t.flags, OFB_PART_OF_ORDERS)) {
/* Part of orders */
UpdateVehicleTimetable(v, true);
v->cur_order_index++;
- } else if (HASBIT(t.flags, OFB_HALT_IN_DEPOT)) {
+ } else if (HasBit(t.flags, OFB_HALT_IN_DEPOT)) {
/* Force depot visit */
v->vehstatus |= VS_STOPPED;
if (v->owner == _local_player) {
@@ -2520,7 +2520,7 @@ bool CanBuildVehicleInfrastructure(VehicleType type)
/* Can we actually build the vehicle type? */
EngineID e;
FOR_ALL_ENGINEIDS_OF_TYPE(e, type) {
- if (HASBIT(GetEngine(e)->player_avail, _local_player)) return true;
+ if (HasBit(GetEngine(e)->player_avail, _local_player)) return true;
}
return false;
}
@@ -2572,7 +2572,7 @@ const Livery *GetEngineLivery(EngineID engine_type, PlayerID player, EngineID pa
scheme = LS_FREIGHT_WAGON;
}
} else {
- bool is_mu = HASBIT(EngInfo(engine_type)->misc_flags, EF_RAIL_IS_MU);
+ bool is_mu = HasBit(EngInfo(engine_type)->misc_flags, EF_RAIL_IS_MU);
switch (rvi->engclass) {
default: NOT_REACHED();
@@ -2593,7 +2593,7 @@ const Livery *GetEngineLivery(EngineID engine_type, PlayerID player, EngineID pa
case VEH_ROAD: {
const RoadVehicleInfo *rvi = RoadVehInfo(engine_type);
if (cargo_type == CT_INVALID) cargo_type = rvi->cargo_type;
- if (HASBIT(EngInfo(engine_type)->misc_flags, EF_ROAD_TRAM)) {
+ if (HasBit(EngInfo(engine_type)->misc_flags, EF_ROAD_TRAM)) {
/* Tram */
scheme = IsCargoInClass(cargo_type, CC_PASSENGERS) ? LS_PASSENGER_TRAM : LS_FREIGHT_TRAM;
} else {
@@ -2638,7 +2638,7 @@ static SpriteID GetEngineColourMap(EngineID engine_type, PlayerID player, Engine
if (map != PAL_NONE) return map;
/* Check if we should use the colour map callback */
- if (HASBIT(EngInfo(engine_type)->callbackmask, CBM_VEHICLE_COLOUR_REMAP)) {
+ if (HasBit(EngInfo(engine_type)->callbackmask, CBM_VEHICLE_COLOUR_REMAP)) {
uint16 callback = GetVehicleCallback(CBID_VEHICLE_COLOUR_MAPPING, 0, 0, engine_type, v);
/* A return value of 0xC000 is stated to "use the default two-color
* maps" which happens to be the failure action too... */
@@ -2646,7 +2646,7 @@ static SpriteID GetEngineColourMap(EngineID engine_type, PlayerID player, Engine
map = GB(callback, 0, 14);
/* If bit 14 is set, then the company colours are applied to the
* map else it's returned as-is. */
- if (!HASBIT(callback, 14)) {
+ if (!HasBit(callback, 14)) {
/* Update cache */
if (v != NULL) ((Vehicle*)v)->colormap = map;
return map;
@@ -2654,7 +2654,7 @@ static SpriteID GetEngineColourMap(EngineID engine_type, PlayerID player, Engine
}
}
- bool twocc = HASBIT(EngInfo(engine_type)->misc_flags, EF_USES_2CC);
+ bool twocc = HasBit(EngInfo(engine_type)->misc_flags, EF_USES_2CC);
if (map == PAL_NONE) map = twocc ? (SpriteID)SPR_2CCMAP_BASE : (SpriteID)PALETTE_RECOLOR_START;
@@ -3115,7 +3115,7 @@ void Vehicle::HandleLoading(bool mode)
uint wait_time = max(this->current_order.wait_time - this->lateness_counter, 0);
/* Not the first call for this tick, or still loading */
- if (mode || !HASBIT(this->vehicle_flags, VF_LOADING_FINISHED) ||
+ if (mode || !HasBit(this->vehicle_flags, VF_LOADING_FINISHED) ||
(_patches.timetabling && this->current_order_time < wait_time)) return;
this->PlayLeaveStationSound();
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index 43986f575..87875c986 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -205,10 +205,10 @@ static RefitList *BuildRefitList(const Vehicle *v)
/* Loop through all cargos in the refit mask */
for (CargoID cid = 0; cid < NUM_CARGO && num_lines < max_lines; cid++) {
/* Skip cargo type if it's not listed */
- if (!HASBIT(cmask, cid)) continue;
+ if (!HasBit(cmask, cid)) continue;
/* Check the vehicle's callback mask for cargo suffixes */
- if (HASBIT(callbackmask, CBM_VEHICLE_CARGO_SUFFIX)) {
+ if (HasBit(callbackmask, CBM_VEHICLE_CARGO_SUFFIX)) {
/* Make a note of the original cargo type. It has to be
* changed to test the cargo & subtype... */
CargoID temp_cargo = u->cargo_type;
@@ -504,7 +504,7 @@ uint ShowRefitOptionsList(int x, int y, uint w, EngineID engine)
/* Add each cargo type to the list */
for (CargoID cid = 0; cid < NUM_CARGO; cid++) {
- if (!HASBIT(cmask, cid)) continue;
+ if (!HasBit(cmask, cid)) continue;
if (!first) b = strecpy(b, ", ", lastof(_userstring));
first = false;
@@ -1987,7 +1987,7 @@ static void DrawVehicleViewWindow(Window *w)
SetDParam(0, depot->town_index);
SetDParam(1, v->GetDisplaySpeed());
}
- if (HASBIT(v->current_order.flags, OFB_HALT_IN_DEPOT) && !HASBIT(v->current_order.flags, OFB_PART_OF_ORDERS)) {
+ if (HasBit(v->current_order.flags, OFB_HALT_IN_DEPOT) && !HasBit(v->current_order.flags, OFB_PART_OF_ORDERS)) {
str = _heading_for_depot_strings[v->type] + _patches.vehicle_speed;
} else {
str = _heading_for_depot_service_strings[v->type] + _patches.vehicle_speed;
diff --git a/src/viewport.cpp b/src/viewport.cpp
index 775d44f32..dde8a7fe8 100644
--- a/src/viewport.cpp
+++ b/src/viewport.cpp
@@ -1062,7 +1062,7 @@ static void ViewportAddTownNames(DrawPixelInfo *dpi)
Town *t;
int left, top, right, bottom;
- if (!HASBIT(_display_opt, DO_SHOW_TOWN_NAMES) || _game_mode == GM_MENU)
+ if (!HasBit(_display_opt, DO_SHOW_TOWN_NAMES) || _game_mode == GM_MENU)
return;
left = dpi->left;
@@ -1138,7 +1138,7 @@ static void ViewportAddStationNames(DrawPixelInfo *dpi)
int left, top, right, bottom;
const Station *st;
- if (!HASBIT(_display_opt, DO_SHOW_STATION_NAMES) || _game_mode == GM_MENU)
+ if (!HasBit(_display_opt, DO_SHOW_STATION_NAMES) || _game_mode == GM_MENU)
return;
left = dpi->left;
@@ -1208,7 +1208,7 @@ static void ViewportAddSigns(DrawPixelInfo *dpi)
const Sign *si;
int left, top, right, bottom;
- if (!HASBIT(_display_opt, DO_SHOW_SIGNS))
+ if (!HasBit(_display_opt, DO_SHOW_SIGNS))
return;
left = dpi->left;
@@ -1278,7 +1278,7 @@ static void ViewportAddWaypoints(DrawPixelInfo *dpi)
const Waypoint *wp;
int left, top, right, bottom;
- if (!HASBIT(_display_opt, DO_WAYPOINTS))
+ if (!HasBit(_display_opt, DO_WAYPOINTS))
return;
left = dpi->left;
@@ -1818,7 +1818,7 @@ static bool CheckClickOnTown(const ViewPort *vp, int x, int y)
{
const Town *t;
- if (!HASBIT(_display_opt, DO_SHOW_TOWN_NAMES)) return false;
+ if (!HasBit(_display_opt, DO_SHOW_TOWN_NAMES)) return false;
switch (vp->zoom) {
case ZOOM_LVL_NORMAL:
@@ -1876,7 +1876,7 @@ static bool CheckClickOnStation(const ViewPort *vp, int x, int y)
{
const Station *st;
- if (!HASBIT(_display_opt, DO_SHOW_STATION_NAMES)) return false;
+ if (!HasBit(_display_opt, DO_SHOW_STATION_NAMES)) return false;
switch (vp->zoom) {
case ZOOM_LVL_NORMAL:
@@ -1934,7 +1934,7 @@ static bool CheckClickOnSign(const ViewPort *vp, int x, int y)
{
const Sign *si;
- if (!HASBIT(_display_opt, DO_SHOW_SIGNS) || _current_player == PLAYER_SPECTATOR) return false;
+ if (!HasBit(_display_opt, DO_SHOW_SIGNS) || _current_player == PLAYER_SPECTATOR) return false;
switch (vp->zoom) {
case ZOOM_LVL_NORMAL:
@@ -1992,7 +1992,7 @@ static bool CheckClickOnWaypoint(const ViewPort *vp, int x, int y)
{
const Waypoint *wp;
- if (!HASBIT(_display_opt, DO_WAYPOINTS)) return false;
+ if (!HasBit(_display_opt, DO_WAYPOINTS)) return false;
switch (vp->zoom) {
case ZOOM_LVL_NORMAL:
diff --git a/src/water_cmd.cpp b/src/water_cmd.cpp
index ce6329ca0..f91682449 100644
--- a/src/water_cmd.cpp
+++ b/src/water_cmd.cpp
@@ -240,7 +240,7 @@ CommandCost CmdBuildCanal(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if (p1 >= MapSize()) return CMD_ERROR;
/* Outside of the editor you can only build canals, not oceans */
- if (HASBIT(p2, 0) && _game_mode != GM_EDITOR) return CMD_ERROR;
+ if (HasBit(p2, 0) && _game_mode != GM_EDITOR) return CMD_ERROR;
x = TileX(tile);
y = TileY(tile);
@@ -265,14 +265,14 @@ CommandCost CmdBuildCanal(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
}
/* can't make water of water! */
- if (IsTileType(tile, MP_WATER) && (!IsTileOwner(tile, OWNER_WATER) || HASBIT(p2, 0))) continue;
+ if (IsTileType(tile, MP_WATER) && (!IsTileOwner(tile, OWNER_WATER) || HasBit(p2, 0))) continue;
ret = DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
if (CmdFailed(ret)) return ret;
cost.AddCost(ret);
if (flags & DC_EXEC) {
- if (TileHeight(tile) == 0 && HASBIT(p2, 0)) {
+ if (TileHeight(tile) == 0 && HasBit(p2, 0)) {
MakeWater(tile);
} else {
MakeCanal(tile, _current_player);
diff --git a/src/water_map.h b/src/water_map.h
index b1c8f4c16..fe1aab9e5 100644
--- a/src/water_map.h
+++ b/src/water_map.h
@@ -67,7 +67,7 @@ static inline bool IsWaterTile(TileIndex t)
static inline TileIndex GetOtherShipDepotTile(TileIndex t)
{
- return t + (HASBIT(_m[t].m5, 0) ? -1 : 1) * (HASBIT(_m[t].m5, 1) ? TileDiffXY(0, 1) : TileDiffXY(1, 0));
+ return t + (HasBit(_m[t].m5, 0) ? -1 : 1) * (HasBit(_m[t].m5, 1) ? TileDiffXY(0, 1) : TileDiffXY(1, 0));
}
static inline TileIndex IsShipDepot(TileIndex t)
diff --git a/src/widget.cpp b/src/widget.cpp
index 0fe09ac1a..6e9c73b7f 100644
--- a/src/widget.cpp
+++ b/src/widget.cpp
@@ -496,12 +496,12 @@ static int GetDropdownItem(const Window *w)
return - 1;
item = y / 10;
- if (item >= WP(w,dropdown_d).num_items || (HASBIT(WP(w,dropdown_d).disabled_state, item) && !HASBIT(WP(w,dropdown_d).hidden_state, item)) || WP(w,dropdown_d).items[item] == 0)
+ if (item >= WP(w,dropdown_d).num_items || (HasBit(WP(w,dropdown_d).disabled_state, item) && !HasBit(WP(w,dropdown_d).hidden_state, item)) || WP(w,dropdown_d).items[item] == 0)
return - 1;
/* Skip hidden items -- +1 for each hidden item before the clicked item. */
for (counter = 0; item >= counter; ++counter)
- if (HASBIT(WP(w,dropdown_d).hidden_state, counter)) item++;
+ if (HasBit(WP(w,dropdown_d).hidden_state, counter)) item++;
return item;
}
@@ -525,14 +525,14 @@ static void DropdownMenuWndProc(Window *w, WindowEvent *e)
height = w->widget[0].bottom - 3;
for (i = 0; WP(w,dropdown_d).items[i] != INVALID_STRING_ID; i++, sel--) {
- if (HASBIT(WP(w,dropdown_d).hidden_state, i)) continue;
+ if (HasBit(WP(w,dropdown_d).hidden_state, i)) continue;
if (y >= 0 && y <= height) {
if (WP(w,dropdown_d).items[i] != STR_NULL) {
if (sel == 0) GfxFillRect(x + 1, y, x + width, y + 9, 0);
DrawStringTruncated(x + 2, y, WP(w,dropdown_d).items[i], sel == 0 ? TC_WHITE : TC_BLACK, x + width);
- if (HASBIT(WP(w,dropdown_d).disabled_state, i)) {
+ if (HasBit(WP(w,dropdown_d).disabled_state, i)) {
GfxFillRect(x, y, x + width, y + 9,
(1 << PALETTE_MODIFIER_GREYOUT) | _colour_gradient[_dropdown_menu_widgets[0].color][5]
);
@@ -630,7 +630,7 @@ void ShowDropDownMenu(Window *w, const StringID *strings, int selected, int butt
uint j;
for (j = 0; strings[j] != INVALID_STRING_ID; j++) {
- if (HASBIT(hidden_mask, j)) i--;
+ if (HasBit(hidden_mask, j)) i--;
}
}
diff --git a/src/win32.cpp b/src/win32.cpp
index 14ae640f1..c0479f64a 100644
--- a/src/win32.cpp
+++ b/src/win32.cpp
@@ -951,7 +951,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
#if !defined(WINCE)
/* Check if a win9x user started the win32 version */
- if (HASBIT(GetVersion(), 31)) error("This version of OpenTTD doesn't run on windows 95/98/ME.\nPlease download the win9x binary and try again.");
+ if (HasBit(GetVersion(), 31)) error("This version of OpenTTD doesn't run on windows 95/98/ME.\nPlease download the win9x binary and try again.");
#endif
/* For UNICODE we need to convert the commandline to char* _AND_
diff --git a/src/window.cpp b/src/window.cpp
index 1bea74183..3f6ac8471 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -1908,7 +1908,7 @@ int GetMenuItemIndex(const Window *w, int x, int y)
y /= 10;
if (y < WP(w, const menu_d).item_count &&
- !HASBIT(WP(w, const menu_d).disabled_items, y)) {
+ !HasBit(WP(w, const menu_d).disabled_items, y)) {
return y;
}
}
diff --git a/src/window.h b/src/window.h
index 7dcb1fc6d..00cf40b98 100644
--- a/src/window.h
+++ b/src/window.h
@@ -645,7 +645,7 @@ static inline void EnableWindowWidget(Window *w, byte widget_index)
static inline bool IsWindowWidgetDisabled(const Window *w, byte widget_index)
{
assert(widget_index < w->widget_count);
- return HASBIT(w->widget[widget_index].display_flags, WIDG_DISABLED);
+ return HasBit(w->widget[widget_index].display_flags, WIDG_DISABLED);
}
/**
@@ -691,7 +691,7 @@ static inline void ShowWindowWidget(Window *w, byte widget_index)
static inline bool IsWindowWidgetHidden(const Window *w, byte widget_index)
{
assert(widget_index < w->widget_count);
- return HASBIT(w->widget[widget_index].display_flags, WIDG_HIDDEN);
+ return HasBit(w->widget[widget_index].display_flags, WIDG_HIDDEN);
}
/**
@@ -746,7 +746,7 @@ static inline void RaiseWindowWidget(Window *w, byte widget_index)
static inline bool IsWindowWidgetLowered(const Window *w, byte widget_index)
{
assert(widget_index < w->widget_count);
- return HASBIT(w->widget[widget_index].display_flags, WIDG_LOWERED);
+ return HasBit(w->widget[widget_index].display_flags, WIDG_LOWERED);
}
void InitWindowSystem();
diff --git a/src/yapf/follow_track.hpp b/src/yapf/follow_track.hpp
index bc2f72eed..75fff5109 100644
--- a/src/yapf/follow_track.hpp
+++ b/src/yapf/follow_track.hpp
@@ -197,7 +197,7 @@ protected:
// rail transport is possible only on compatible rail types
if (IsRailTT()) {
RailType rail_type = GetTileRailType(m_new_tile);
- if (!HASBIT(m_veh->u.rail.compatible_railtypes, rail_type)) {
+ if (!HasBit(m_veh->u.rail.compatible_railtypes, rail_type)) {
// incompatible rail type
m_err = EC_RAIL_TYPE;
return false;
diff --git a/src/yapf/yapf_destrail.hpp b/src/yapf/yapf_destrail.hpp
index 3a65ba8cc..157c3b6d2 100644
--- a/src/yapf/yapf_destrail.hpp
+++ b/src/yapf/yapf_destrail.hpp
@@ -18,7 +18,7 @@ public:
bool IsCompatibleRailType(RailType rt)
{
- return HASBIT(m_compatible_railtypes, rt);
+ return HasBit(m_compatible_railtypes, rt);
}
};