Codechange: Replace FOR_ALL_DEPOTS with range-based for loops

This commit is contained in:
glx
2019-12-15 17:54:05 +01:00
committed by Niels Martin Hansen
parent 5fce5fa300
commit fa9769f81a
8 changed files with 11 additions and 27 deletions

View File

@@ -144,7 +144,6 @@ void Ship::GetImage(Direction direction, EngineImageType image_type, VehicleSpri
static const Depot *FindClosestShipDepot(const Vehicle *v, uint max_distance)
{
/* Find the closest depot */
const Depot *depot;
const Depot *best_depot = nullptr;
/* If we don't have a maximum distance, i.e. distance = 0,
* we want to find any depot so the best distance of no
@@ -153,7 +152,7 @@ static const Depot *FindClosestShipDepot(const Vehicle *v, uint max_distance)
* further away than max_distance can safely be ignored. */
uint best_dist = max_distance == 0 ? UINT_MAX : max_distance + 1;
FOR_ALL_DEPOTS(depot) {
for (const Depot *depot : Depot::Iterate()) {
TileIndex tile = depot->xy;
if (IsShipDepotTile(tile) && IsTileOwner(tile, v->owner)) {
uint dist = DistanceManhattan(tile, v->tile);