Codechange: refactor FindClosestDepot to not use pointers, but return a struct

This commit is contained in:
Rubidium
2023-01-03 22:33:09 +01:00
committed by rubidium42
parent b3907b1359
commit 375a5b8e3f
12 changed files with 69 additions and 82 deletions

View File

@@ -913,14 +913,10 @@ CommandCost CmdBuildShip(DoCommandFlag flags, TileIndex tile, const Engine *e, V
return CommandCost();
}
bool Ship::FindClosestDepot(TileIndex *location, DestinationID *destination, bool *reverse)
ClosestDepot Ship::FindClosestDepot()
{
const Depot *depot = FindClosestShipDepot(this, 0);
if (depot == nullptr) return ClosestDepot();
if (depot == nullptr) return false;
if (location != nullptr) *location = depot->xy;
if (destination != nullptr) *destination = depot->index;
return true;
return ClosestDepot(depot->xy, depot->index);
}