Changeset - r7832:a9b062f087f1
[Not reviewed]
master
0 6 0
truelight - 17 years ago 2007-11-04 22:47:34
truelight@openttd.org
(svn r11382) -Codechange: renamed COUNTBITS to CountBits, as it is no longer a macro (skidd13)
6 files changed with 14 insertions and 14 deletions:
0 comments (0 inline, 0 general)
src/economy.cpp
Show inline comments
 
@@ -69,7 +69,7 @@ Money CalculateCompanyValue(const Player
 
	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 *
 
		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 *
 

	
 
/* 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;
 
	}
src/macros.h
Show inline comments
 
@@ -432,7 +432,7 @@ static inline uint KillFirstBit2x64(uint
 
 * @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;
 

	
src/road.cpp
Show inline comments
 
@@ -42,7 +42,7 @@ RoadBits CleanUpRoadBits(const TileIndex
 

	
 
					/* 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;
 

	
src/road_cmd.cpp
Show inline comments
 
@@ -220,7 +220,7 @@ CommandCost CmdRemoveRoad(TileIndex tile
 
					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 
 
	/* 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(TileIn
 

	
 
			/* 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
 
			 * 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);
 

	
src/roadveh_cmd.cpp
Show inline comments
 
@@ -1100,7 +1100,7 @@ static void RoadZPosAffectSpeed(Vehicle 
 
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;
src/vehicle_gui.cpp
Show inline comments
 
@@ -485,7 +485,7 @@ uint ShowRefitOptionsList(int x, int y, 
 
	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, 
 
	} 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);
 
		}
0 comments (0 inline, 0 general)