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

Function RideGetEntryIndex

src/openrct2/ride/Ride.cpp:5265–5300  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5263}
5264
5265ObjectEntryIndex RideGetEntryIndex(ride_type_t rideType, ObjectEntryIndex rideSubType)
5266{
5267 auto subType = rideSubType;
5268
5269 if (subType == kObjectEntryIndexNull)
5270 {
5271 auto& objManager = GetContext()->GetObjectManager();
5272 auto& rideEntries = objManager.GetAllRideEntries(rideType);
5273 if (!rideEntries.empty())
5274 {
5275 subType = rideEntries[0];
5276 for (auto rideEntryIndex : rideEntries)
5277 {
5278 const auto* rideEntry = GetRideEntryByIndex(rideEntryIndex);
5279 if (rideEntry == nullptr)
5280 {
5281 return kObjectEntryIndexNull;
5282 }
5283
5284 // Can happen in select-by-track-type mode
5285 if (!RideEntryIsInvented(rideEntryIndex) && !getGameState().cheats.ignoreResearchStatus)
5286 {
5287 continue;
5288 }
5289
5290 if (!GetRideTypeDescriptor(rideType).flags.has(RtdFlag::listVehiclesSeparately))
5291 {
5292 subType = rideEntryIndex;
5293 break;
5294 }
5295 }
5296 }
5297 }
5298
5299 return subType;
5300}
5301
5302const StationObject* Ride::getStationObject() const
5303{

Callers 3

QueryMethod · 0.85
ExecuteMethod · 0.85
RideConstructNewFunction · 0.85

Calls 5

GetContextFunction · 0.85
GetRideEntryByIndexFunction · 0.85
RideEntryIsInventedFunction · 0.85
hasMethod · 0.65
emptyMethod · 0.45

Tested by

no test coverage detected