summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/economy.cpp6
-rw-r--r--src/macros.h2
-rw-r--r--src/road.cpp2
-rw-r--r--src/road_cmd.cpp12
-rw-r--r--src/roadveh_cmd.cpp2
-rw-r--r--src/vehicle_gui.cpp4
6 files changed, 14 insertions, 14 deletions
diff --git a/src/economy.cpp b/src/economy.cpp
index 793c0b960..216622c6c 100644
--- a/src/economy.cpp
+++ b/src/economy.cpp
@@ -69,7 +69,7 @@ Money CalculateCompanyValue(const Player* p)
uint num = 0;
FOR_ALL_STATIONS(st) {
- if (st->owner == owner) num += COUNTBITS(st->facilities);
+ if (st->owner == owner) num += CountBits(st->facilities);
}
value += num * _price.station_value * 25;
@@ -141,7 +141,7 @@ int UpdateCompanyRatingAndValue(Player *p, bool update)
const Station* st;
FOR_ALL_STATIONS(st) {
- if (st->owner == owner) num += COUNTBITS(st->facilities);
+ if (st->owner == owner) num += CountBits(st->facilities);
}
_score_part[owner][SCORE_STATIONS] = num;
}
@@ -186,7 +186,7 @@ int UpdateCompanyRatingAndValue(Player *p, bool update)
/* Generate score for variety of cargo */
{
- uint num = COUNTBITS(p->cargo_types);
+ uint num = CountBits(p->cargo_types);
_score_part[owner][SCORE_CARGO] = num;
if (update) p->cargo_types = 0;
}
diff --git a/src/macros.h b/src/macros.h
index 260c87e50..8d9759235 100644
--- a/src/macros.h
+++ b/src/macros.h
@@ -432,7 +432,7 @@ static inline uint KillFirstBit2x64(uint value)
* @param value the value to count the number of bits in.
* @return the number of bits.
*/
-template<typename T> static inline uint COUNTBITS(T value)
+template<typename T> static inline uint CountBits(T value)
{
register uint num;
diff --git a/src/road.cpp b/src/road.cpp
index ae806647f..20472cac9 100644
--- a/src/road.cpp
+++ b/src/road.cpp
@@ -42,7 +42,7 @@ RoadBits CleanUpRoadBits(const TileIndex tile, RoadBits org_rb)
/* Accept only connective tiles */
connective = (neighbor_rb & mirrored_rb) || // Neighbor has got the fitting RoadBit
- COUNTBITS(neighbor_rb) == 1; // Neighbor has got only one Roadbit
+ CountBits(neighbor_rb) == 1; // Neighbor has got only one Roadbit
} break;
diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp
index bc2c86444..886593b33 100644
--- a/src/road_cmd.cpp
+++ b/src/road_cmd.cpp
@@ -220,7 +220,7 @@ CommandCost CmdRemoveRoad(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
MarkTileDirtyByTile(tile);
}
}
- return CommandCost(COUNTBITS(c) * _price.remove_road);
+ return CommandCost(CountBits(c) * _price.remove_road);
}
case ROAD_TILE_CROSSING: {
@@ -352,7 +352,7 @@ static CommandCost CheckRoadSlope(Slope tileh, RoadBits* pieces, RoadBits existi
/* Single bits on slopes.
* We check for the roads that need at least 2 bits */
if (_patches.build_on_slopes && !_is_old_ai_player &&
- existing == ROAD_NONE && COUNTBITS(*pieces) == 1 &&
+ existing == ROAD_NONE && CountBits(*pieces) == 1 &&
(_valid_tileh_slopes_road[2][tileh] & *pieces) == ROAD_NONE) {
return CommandCost(_price.terraform);
}
@@ -531,7 +531,7 @@ do_clear:;
pieces &= ComplementRoadBits(existing);
}
- cost.AddCost(COUNTBITS(pieces) * _price.build_road);
+ cost.AddCost(CountBits(pieces) * _price.build_road);
if (IsTileType(tile, MP_TUNNELBRIDGE)) {
/* Pay for *every* tile of the bridge or tunnel */
cost.MultiplyCost(DistanceManhattan(IsTunnel(tile) ? GetOtherTunnelEnd(tile) : GetOtherBridgeEnd(tile), tile));
@@ -838,7 +838,7 @@ static CommandCost ClearTile_Road(TileIndex tile, byte flags)
/* Clear the road if only one piece is on the tile OR the AI tries
* to clear town road OR we are not using the DC_AUTO flag */
- if ((COUNTBITS(b) == 1 && GetRoadBits(tile, ROADTYPE_TRAM) == ROAD_NONE) ||
+ if ((CountBits(b) == 1 && GetRoadBits(tile, ROADTYPE_TRAM) == ROAD_NONE) ||
((flags & DC_AI_BUILDING) && IsTileOwner(tile, OWNER_TOWN)) ||
!(flags & DC_AUTO)
) {
@@ -906,7 +906,7 @@ Foundation GetRoadFoundation(Slope tileh, RoadBits bits)
* created directly, but the state itself is still perfectly drawable.
* However, as we do not want this to be build directly, we need to check
* for that situation in here. */
- return (tileh != 0 && COUNTBITS(bits) == 1) ? FOUNDATION_LEVELED : FOUNDATION_NONE;
+ return (tileh != 0 && CountBits(bits) == 1) ? FOUNDATION_LEVELED : FOUNDATION_NONE;
}
if ((~_valid_tileh_slopes_road[1][tileh] & bits) == 0) return FOUNDATION_LEVELED;
}
@@ -1241,7 +1241,7 @@ static void TileLoop_Road(TileIndex tile)
/* Show an animation to indicate road work */
if (t->road_build_months != 0 &&
(DistanceManhattan(t->xy, tile) < 8 || grp != 0) &&
- GetRoadTileType(tile) == ROAD_TILE_NORMAL && COUNTBITS(GetAllRoadBits(tile)) > 1 ) {
+ GetRoadTileType(tile) == ROAD_TILE_NORMAL && CountBits(GetAllRoadBits(tile)) > 1 ) {
if (GetTileSlope(tile, NULL) == SLOPE_FLAT && EnsureNoVehicleOnGround(tile) && CHANCE16(1, 40)) {
StartRoadWorks(tile);
diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp
index d42e639c8..67f592c06 100644
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -1100,7 +1100,7 @@ static void RoadZPosAffectSpeed(Vehicle *v, byte old_z)
static int PickRandomBit(uint bits)
{
uint i;
- uint num = RandomRange(COUNTBITS(bits));
+ uint num = RandomRange(CountBits(bits));
for (i = 0; !(bits & 1) || (int)--num >= 0; bits >>= 1, i++) {}
return i;
diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp
index 2f35c9da1..6d0f0f85f 100644
--- a/src/vehicle_gui.cpp
+++ b/src/vehicle_gui.cpp
@@ -485,7 +485,7 @@ uint ShowRefitOptionsList(int x, int y, uint w, EngineID engine)
char *b = _userstring;
/* Draw nothing if the engine is not refittable */
- if (COUNTBITS(cmask) <= 1) return 0;
+ if (CountBits(cmask) <= 1) return 0;
b = InlineString(b, STR_PURCHASE_INFO_REFITTABLE_TO);
@@ -495,7 +495,7 @@ uint ShowRefitOptionsList(int x, int y, uint w, EngineID engine)
} else {
/* Check if we are able to refit to more cargo types and unable to. If
* so, invert the cargo types to list those that we can't refit to. */
- if (COUNTBITS(cmask ^ lmask) < COUNTBITS(cmask)) {
+ if (CountBits(cmask ^ lmask) < CountBits(cmask)) {
cmask ^= lmask;
b = InlineString(b, STR_PURCHASE_INFO_ALL_BUT);
}