mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2026-07-26 00:45:35 +00:00
Codechange: make RoadBits an EnumBitSet (#15476)
This commit is contained in:
+4
-4
@@ -58,7 +58,7 @@ static bool IsPossibleCrossing(const TileIndex tile, Axis ax)
|
||||
*/
|
||||
RoadBits CleanUpRoadBits(const TileIndex tile, RoadBits org_rb)
|
||||
{
|
||||
if (!IsValidTile(tile)) return ROAD_NONE;
|
||||
if (!IsValidTile(tile)) return {};
|
||||
for (DiagDirection dir = DIAGDIR_BEGIN; dir < DIAGDIR_END; dir++) {
|
||||
const TileIndex neighbour_tile = TileAddByDiagDir(tile, dir);
|
||||
|
||||
@@ -66,7 +66,7 @@ RoadBits CleanUpRoadBits(const TileIndex tile, RoadBits org_rb)
|
||||
const RoadBits target_rb = DiagDirToRoadBits(dir);
|
||||
|
||||
/* If the roadbit is in the current plan */
|
||||
if (org_rb & target_rb) {
|
||||
if (org_rb.Any(target_rb)) {
|
||||
bool connective = false;
|
||||
const RoadBits mirrored_rb = MirrorRoadBits(target_rb);
|
||||
|
||||
@@ -88,7 +88,7 @@ RoadBits CleanUpRoadBits(const TileIndex tile, RoadBits org_rb)
|
||||
const RoadBits neighbour_rb = GetAnyRoadBits(neighbour_tile, RoadTramType::Road) | GetAnyRoadBits(neighbour_tile, RoadTramType::Tram);
|
||||
|
||||
/* Accept only connective tiles */
|
||||
connective = (neighbour_rb & mirrored_rb) != ROAD_NONE;
|
||||
connective = neighbour_rb.Any(mirrored_rb);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -107,7 +107,7 @@ RoadBits CleanUpRoadBits(const TileIndex tile, RoadBits org_rb)
|
||||
}
|
||||
|
||||
/* If the neighbour tile is inconnective, remove the planned road connection to it */
|
||||
if (!connective) org_rb ^= target_rb;
|
||||
if (!connective) org_rb.Flip(target_rb);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user