| 1064 | } |
| 1065 | |
| 1066 | void ResearchDetermineFirstOfType() |
| 1067 | { |
| 1068 | auto& gameState = getGameState(); |
| 1069 | _seenRideType.reset(); |
| 1070 | |
| 1071 | for (const auto& researchItem : gameState.researchItemsInvented) |
| 1072 | { |
| 1073 | if (researchItem.type != Research::EntryType::ride) |
| 1074 | continue; |
| 1075 | |
| 1076 | auto rideType = researchItem.baseRideType; |
| 1077 | if (rideType >= RIDE_TYPE_COUNT) |
| 1078 | continue; |
| 1079 | |
| 1080 | const auto& rtd = GetRideTypeDescriptor(rideType); |
| 1081 | if (rtd.flags.has(RtdFlag::listVehiclesSeparately)) |
| 1082 | continue; |
| 1083 | |
| 1084 | // The last research item will also be present in gameState.researchItemsInvented. |
| 1085 | // Avoid marking its ride type as "invented" prematurely. |
| 1086 | if (gameState.researchLastItem.has_value() && !gameState.researchLastItem->isNull() |
| 1087 | && researchItem == gameState.researchLastItem.value()) |
| 1088 | continue; |
| 1089 | |
| 1090 | // The next research item is (sometimes?) also present in gameState.researchItemsInvented, even though it isn't invented |
| 1091 | // yet(!) |
| 1092 | if (gameState.researchNextItem.has_value() && !gameState.researchNextItem->isNull() |
| 1093 | && researchItem == gameState.researchNextItem.value()) |
| 1094 | continue; |
| 1095 | |
| 1096 | ResearchMarkRideTypeAsSeen(researchItem); |
| 1097 | } |
| 1098 | |
| 1099 | if (gameState.researchLastItem.has_value()) |
| 1100 | { |
| 1101 | ResearchUpdateFirstOfType(&gameState.researchLastItem.value()); |
| 1102 | ResearchMarkRideTypeAsSeen(gameState.researchLastItem.value()); |
| 1103 | } |
| 1104 | if (gameState.researchNextItem.has_value()) |
| 1105 | { |
| 1106 | ResearchUpdateFirstOfType(&gameState.researchNextItem.value()); |
| 1107 | ResearchMarkRideTypeAsSeen(gameState.researchNextItem.value()); |
| 1108 | } |
| 1109 | |
| 1110 | for (auto& researchItem : gameState.researchItemsUninvented) |
| 1111 | { |
| 1112 | // The next research item is (sometimes?) also present in gameState.researchItemsUninvented |
| 1113 | if (gameState.researchNextItem.has_value() && !gameState.researchNextItem->isNull() |
| 1114 | && researchItem.baseRideType == gameState.researchNextItem.value().baseRideType) |
| 1115 | { |
| 1116 | // Copy the "first of type" flag. |
| 1117 | researchItem.flags = gameState.researchNextItem->flags; |
| 1118 | continue; |
| 1119 | } |
| 1120 | |
| 1121 | ResearchUpdateFirstOfType(&researchItem); |
| 1122 | ResearchMarkRideTypeAsSeen(researchItem); |
| 1123 | } |
no test coverage detected