forked from mirror/OpenTTD
Codechange: refactor FindClosestDepot to not use pointers, but return a struct
This commit is contained in:
@@ -388,7 +388,7 @@ CommandCost CmdBuildAircraft(DoCommandFlag flags, TileIndex tile, const Engine *
|
||||
}
|
||||
|
||||
|
||||
bool Aircraft::FindClosestDepot(TileIndex *location, DestinationID *destination, bool *reverse)
|
||||
ClosestDepot Aircraft::FindClosestDepot()
|
||||
{
|
||||
const Station *st = GetTargetAirportIfValid(this);
|
||||
/* If the station is not a valid airport or if it has no hangars */
|
||||
@@ -396,15 +396,12 @@ bool Aircraft::FindClosestDepot(TileIndex *location, DestinationID *destination,
|
||||
/* the aircraft has to search for a hangar on its own */
|
||||
StationID station = FindNearestHangar(this);
|
||||
|
||||
if (station == INVALID_STATION) return false;
|
||||
if (station == INVALID_STATION) return ClosestDepot();
|
||||
|
||||
st = Station::Get(station);
|
||||
}
|
||||
|
||||
if (location != nullptr) *location = st->xy;
|
||||
if (destination != nullptr) *destination = st->index;
|
||||
|
||||
return true;
|
||||
return ClosestDepot(st->xy, st->index);
|
||||
}
|
||||
|
||||
static void CheckIfAircraftNeedsService(Aircraft *v)
|
||||
|
Reference in New Issue
Block a user