Codechange: replace INVALID_X with XID::Invalid() for PoolIDs

This commit is contained in:
Rubidium
2025-02-16 19:29:53 +01:00
committed by rubidium42
parent d13b0e0813
commit fd4adc55e3
157 changed files with 744 additions and 772 deletions

View File

@@ -146,14 +146,14 @@ extern CommandCost ClearTile_Station(TileIndex tile, DoCommandFlags flags);
static CommandCost IsValidTileForWaypoint(TileIndex tile, Axis axis, StationID *waypoint)
{
/* if waypoint is set, then we have special handling to allow building on top of already existing waypoints.
* so waypoint points to INVALID_STATION if we can build on any waypoint.
* so waypoint points to StationID::Invalid() if we can build on any waypoint.
* Or it points to a waypoint if we're only allowed to build on exactly that waypoint. */
if (waypoint != nullptr && IsTileType(tile, MP_STATION)) {
if (!IsRailWaypoint(tile)) {
return ClearTile_Station(tile, DoCommandFlag::Auto); // get error message
} else {
StationID wp = GetStationIndex(tile);
if (*waypoint == INVALID_STATION) {
if (*waypoint == StationID::Invalid()) {
*waypoint = wp;
} else if (*waypoint != wp) {
return CommandCost(STR_ERROR_WAYPOINT_ADJOINS_MORE_THAN_ONE_EXISTING);
@@ -215,8 +215,8 @@ CommandCost CmdBuildRailWaypoint(DoCommandFlags flags, TileIndex start_tile, Axi
if (count == 0 || count > _settings_game.station.station_spread) return CMD_ERROR;
bool reuse = (station_to_join != NEW_STATION);
if (!reuse) station_to_join = INVALID_STATION;
bool distant_join = (station_to_join != INVALID_STATION);
if (!reuse) station_to_join = StationID::Invalid();
bool distant_join = (station_to_join != StationID::Invalid());
if (distant_join && (!_settings_game.station.distant_join_stations || !Waypoint::IsValidID(station_to_join))) return CMD_ERROR;
@@ -229,7 +229,7 @@ CommandCost CmdBuildRailWaypoint(DoCommandFlags flags, TileIndex start_tile, Axi
}
/* Make sure the area below consists of clear tiles. (OR tiles belonging to a certain rail station) */
StationID est = INVALID_STATION;
StationID est = StationID::Invalid();
/* Check whether the tiles we're building on are valid rail or not. */
TileIndexDiff offset = TileOffsByAxis(OtherAxis(axis));
@@ -349,8 +349,8 @@ CommandCost CmdBuildRoadWaypoint(DoCommandFlags flags, TileIndex start_tile, Axi
if (count == 0 || count > _settings_game.station.station_spread) return CMD_ERROR;
bool reuse = (station_to_join != NEW_STATION);
if (!reuse) station_to_join = INVALID_STATION;
bool distant_join = (station_to_join != INVALID_STATION);
if (!reuse) station_to_join = StationID::Invalid();
bool distant_join = (station_to_join != StationID::Invalid());
if (distant_join && (!_settings_game.station.distant_join_stations || !Waypoint::IsValidID(station_to_join))) return CMD_ERROR;
@@ -363,7 +363,7 @@ CommandCost CmdBuildRoadWaypoint(DoCommandFlags flags, TileIndex start_tile, Axi
} else {
unit_cost = _price[PR_BUILD_STATION_TRUCK];
}
StationID est = INVALID_STATION;
StationID est = StationID::Invalid();
CommandCost cost = CalculateRoadStopCost(roadstop_area, flags, true, StationType::RoadWaypoint, axis, AxisToDiagDir(axis), &est, INVALID_ROADTYPE, unit_cost);
if (cost.Failed()) return cost;