(svn r19019) -Codechange: use HasExactlyOneBit() and HasAtMostOneBit() instead of CountBits() where possible

This commit is contained in:
smatz
2010-02-05 17:05:58 +00:00
parent a80eb0a1c0
commit d62d0ac489
8 changed files with 35 additions and 11 deletions

View File

@@ -35,7 +35,7 @@
if (::GetRoadTypes(tile) != ROADTYPES_ROAD) return false;
/* Depots and crossings aren't considered buildable */
if (::GetRoadTileType(tile) != ROAD_TILE_NORMAL) return false;
if (CountBits(::GetRoadBits(tile, ROADTYPE_ROAD)) != 1) return false;
if (!HasExactlyOneBit(::GetRoadBits(tile, ROADTYPE_ROAD))) return false;
if (::IsRoadOwner(tile, ROADTYPE_ROAD, OWNER_TOWN)) return true;
if (::IsRoadOwner(tile, ROADTYPE_ROAD, _current_company)) return true;
return false;