mirror of
https://github.com/OpenTTD/OpenTTD
synced 2026-01-28 14:44:28 +01:00
Codechange: replace INVALID_X with XID::Invalid() for PoolIDs
This commit is contained in:
@@ -116,15 +116,15 @@ enum HelicopterRotorStates : uint8_t {
|
||||
|
||||
/**
|
||||
* Find the nearest hangar to v
|
||||
* INVALID_STATION is returned, if the company does not have any suitable
|
||||
* StationID::Invalid() is returned, if the company does not have any suitable
|
||||
* airports (like helipads only)
|
||||
* @param v vehicle looking for a hangar
|
||||
* @return the StationID if one is found, otherwise, INVALID_STATION
|
||||
* @return the StationID if one is found, otherwise, StationID::Invalid()
|
||||
*/
|
||||
static StationID FindNearestHangar(const Aircraft *v)
|
||||
{
|
||||
uint best = 0;
|
||||
StationID index = INVALID_STATION;
|
||||
StationID index = StationID::Invalid();
|
||||
TileIndex vtile = TileVirtXY(v->x_pos, v->y_pos);
|
||||
const AircraftVehicleInfo *avi = AircraftVehInfo(v->engine_type);
|
||||
uint max_range = v->acache.cached_max_range_sqr;
|
||||
@@ -163,7 +163,7 @@ static StationID FindNearestHangar(const Aircraft *v)
|
||||
|
||||
/* v->tile can't be used here, when aircraft is flying v->tile is set to 0 */
|
||||
uint distance = DistanceSquare(vtile, st->airport.tile);
|
||||
if (distance < best || index == INVALID_STATION) {
|
||||
if (distance < best || index == StationID::Invalid()) {
|
||||
best = distance;
|
||||
index = st->index;
|
||||
}
|
||||
@@ -318,8 +318,8 @@ CommandCost CmdBuildAircraft(DoCommandFlags flags, TileIndex tile, const Engine
|
||||
}
|
||||
|
||||
v->name.clear();
|
||||
v->last_station_visited = INVALID_STATION;
|
||||
v->last_loading_station = INVALID_STATION;
|
||||
v->last_station_visited = StationID::Invalid();
|
||||
v->last_loading_station = StationID::Invalid();
|
||||
|
||||
v->acceleration = avi->acceleration;
|
||||
v->engine_type = e->index;
|
||||
@@ -404,7 +404,7 @@ ClosestDepot Aircraft::FindClosestDepot()
|
||||
/* the aircraft has to search for a hangar on its own */
|
||||
StationID station = FindNearestHangar(this);
|
||||
|
||||
if (station == INVALID_STATION) return ClosestDepot();
|
||||
if (station == StationID::Invalid()) return ClosestDepot();
|
||||
|
||||
st = Station::Get(station);
|
||||
}
|
||||
@@ -1357,7 +1357,7 @@ static void CrashAirplane(Aircraft *v)
|
||||
newstype = NewsType::AccidentOther;
|
||||
}
|
||||
|
||||
AddTileNewsItem(newsitem, newstype, vt, st != nullptr ? st->index : INVALID_STATION);
|
||||
AddTileNewsItem(newsitem, newstype, vt, st != nullptr ? st->index : StationID::Invalid());
|
||||
|
||||
ModifyStationRatingAround(vt, v->owner, -160, 30);
|
||||
if (_settings_client.sound.disaster) SndPlayVehicleFx(SND_12_EXPLOSION, v);
|
||||
|
||||
Reference in New Issue
Block a user