MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / checkAndSetNearestVehicle

Function checkAndSetNearestVehicle

src/OpenLoco/src/Ui/ViewportInteraction.cpp:347–361  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

345 }
346
347 static void checkAndSetNearestVehicle(uint32_t& nearestDistance, Vehicles::VehicleBase*& nearestVehicle, Vehicles::VehicleBase& checkVehicle, const viewport_pos& targetPosition)
348 {
349 if (checkVehicle.spriteLeft != Location::null)
350 {
351 auto distanceRes = vehicleDistanceFromLocation(checkVehicle, targetPosition);
352 if (distanceRes)
353 {
354 if (*distanceRes < nearestDistance)
355 {
356 nearestDistance = *distanceRes;
357 nearestVehicle = &checkVehicle;
358 }
359 }
360 }
361 }
362
363 // 0x004CD658
364 InteractionArg getItemLeft(int16_t tempX, int16_t tempY)

Callers 1

getItemLeftFunction · 0.85

Calls 1

Tested by

no test coverage detected