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

Function ignoreSelfCollision

src/OpenLoco/src/Vehicles/Vehicle.cpp:359–375  ·  view source on GitHub ↗

If candidate within 8 vehicle components of src we ignore a self collision TODO: If we stored the car index this could be simplified

Source from the content-addressed store, hash-verified

357 // If candidate within 8 vehicle components of src we ignore a self collision
358 // TODO: If we stored the car index this could be simplified
359 static bool ignoreSelfCollision(VehicleBase& sourceVehicleId, const VehicleBase& candidateVehicleId)
360 {
361 auto* src = &sourceVehicleId;
362 for (uint32_t i = 0; i < 8; ++i)
363 {
364 src = src->nextVehicleComponent();
365 if (src == nullptr)
366 {
367 return false;
368 }
369 if (src == &candidateVehicleId)
370 {
371 return true;
372 }
373 }
374 return false;
375 }
376
377 // 0x004B1876
378 EntityId checkForCollisions(VehicleBogie& bogie, World::Pos3& loc)

Callers 1

checkForCollisionsFunction · 0.85

Calls 1

nextVehicleComponentMethod · 0.80

Tested by

no test coverage detected