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

Function ResearchUpdateFirstOfType

src/openrct2/management/Research.cpp:1030–1055  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1028static BitSet<RIDE_TYPE_COUNT> _seenRideType = {};
1029
1030static void ResearchUpdateFirstOfType(ResearchItem* researchItem)
1031{
1032 if (researchItem->isNull())
1033 return;
1034
1035 if (researchItem->type != Research::EntryType::ride)
1036 return;
1037
1038 auto rideType = researchItem->baseRideType;
1039 if (rideType >= RIDE_TYPE_COUNT)
1040 {
1041 LOG_ERROR("Research item has non-existent ride type index %d", rideType);
1042 return;
1043 }
1044
1045 researchItem->flags &= ~RESEARCH_ENTRY_FLAG_FIRST_OF_TYPE;
1046 const auto& rtd = GetRideTypeDescriptor(rideType);
1047 if (rtd.flags.has(RtdFlag::listVehiclesSeparately))
1048 {
1049 researchItem->flags |= RESEARCH_ENTRY_FLAG_FIRST_OF_TYPE;
1050 return;
1051 }
1052
1053 if (!_seenRideType[rideType])
1054 researchItem->flags |= RESEARCH_ENTRY_FLAG_FIRST_OF_TYPE;
1055}
1056
1057static void ResearchMarkRideTypeAsSeen(const ResearchItem& researchItem)
1058{

Callers 1

Calls 2

hasMethod · 0.65
isNullMethod · 0.45

Tested by

no test coverage detected