Codechange: Replace HasVehicleOnPos and callbacks with HasVehicleOnTile and lambda-predicates.

This commit is contained in:
frosch
2025-04-22 14:23:43 +02:00
committed by frosch
parent dacd77b2bd
commit 06c399b79e
7 changed files with 61 additions and 90 deletions

View File

@@ -544,21 +544,6 @@ void FindVehicleOnPos(TileIndex tile, void *data, VehicleFromPosProc *proc)
VehicleFromPos(tile, data, proc, false);
}
/**
* Checks whether a vehicle is on a specific location. It will call \a proc for
* vehicles until it returns non-nullptr.
* @note Use #FindVehicleOnPos when you have the intention that all vehicles
* should be iterated over.
* @param tile The location on the map
* @param data Arbitrary data passed to \a proc.
* @param proc The \a proc that determines whether a vehicle will be "found".
* @return True if proc returned non-nullptr.
*/
bool HasVehicleOnPos(TileIndex tile, void *data, VehicleFromPosProc *proc)
{
return VehicleFromPos(tile, data, proc, true) != nullptr;
}
/**
* Callback that returns 'real' vehicles lower or at height \c *(int*)data .
* @param v Vehicle to examine.