MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / GetCar

Method GetCar

src/openrct2/ride/Vehicle.cpp:1473–1486  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1471}
1472
1473Vehicle* Vehicle::GetCar(size_t carIndex) const
1474{
1475 auto car = const_cast<Vehicle*>(this);
1476 for (; carIndex != 0; carIndex--)
1477 {
1478 car = getGameState().entities.GetEntity<Vehicle>(car->next_vehicle_on_train);
1479 if (car == nullptr)
1480 {
1481 LOG_ERROR("Tried to get non-existent car from index!");
1482 return nullptr;
1483 }
1484 }
1485 return car;
1486}
1487
1488void Vehicle::SetState(Status vehicleStatus, uint8_t subState)
1489{

Callers 9

RidePrepareBreakdownFunction · 0.45
RideGetBrokenVehicleFunction · 0.45
GetEntryMethod · 0.45
PeepChooseCarFromRideFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected