72 lines
3.1 KiB
Diff
72 lines
3.1 KiB
Diff
# UNDF: UNDF-2026-000001036
|
|
--- a/src/libs/tgfdata/racemanagers.cpp
|
|
+++ b/src/libs/tgfdata/racemanagers.cpp
|
|
@@ -245,6 +245,8 @@
|
|
GfRaceManager::GfRaceManager(const std::string& strId, void* hparmHandle)
|
|
{
|
|
_strId = strId;
|
|
+ std::set<std::string> seenDriverTypes;
|
|
+ std::set<std::string> seenCarCategories;
|
|
|
|
// Load constant properties (never changed afterwards).
|
|
// 1) Name, type, sub-type and priority (ordering the buttons in the race select menu).
|
|
@@ -261,9 +263,9 @@
|
|
std::string strDrvType;
|
|
while(std::getline(ssAcceptDrvTypes, strDrvType, cFilterSeparator))
|
|
{
|
|
- std::vector<std::string>::iterator itDrvType =
|
|
- std::find(_vecAcceptedDriverTypes.begin(), _vecAcceptedDriverTypes.end(), strDrvType);
|
|
- if (itDrvType == _vecAcceptedDriverTypes.end()) // Not already there => store it.
|
|
+ if (seenDriverTypes.find(strDrvType) == seenDriverTypes.end()) // Not already there => store it.
|
|
+ {
|
|
+ seenDriverTypes.insert(strDrvType);
|
|
_vecAcceptedDriverTypes.push_back(strDrvType);
|
|
+ }
|
|
}
|
|
|
|
@@ -278,9 +280,10 @@
|
|
std::stringstream ssRejectDrvTypes(pszRejectDrvTypes);
|
|
while(std::getline(ssRejectDrvTypes, strDrvType, cFilterSeparator))
|
|
{
|
|
- std::vector<std::string>::iterator itDrvType =
|
|
- std::find(_vecAcceptedDriverTypes.begin(), _vecAcceptedDriverTypes.end(), strDrvType);
|
|
- if (itDrvType != _vecAcceptedDriverTypes.end()) // Accepted til now => now rejected.
|
|
+ auto itDrvType = std::find(_vecAcceptedDriverTypes.begin(),
|
|
+ _vecAcceptedDriverTypes.end(), strDrvType);
|
|
+ if (itDrvType != _vecAcceptedDriverTypes.end())
|
|
+ {
|
|
+ seenDriverTypes.erase(strDrvType);
|
|
_vecAcceptedDriverTypes.erase(itDrvType);
|
|
+ }
|
|
}
|
|
|
|
@@ -293,9 +296,9 @@
|
|
std::string strCarCat;
|
|
while(std::getline(ssAcceptCarCats, strCarCat, cFilterSeparator))
|
|
{
|
|
- std::vector<std::string>::iterator itCarCat =
|
|
- std::find(_vecAcceptedCarCategoryIds.begin(), _vecAcceptedCarCategoryIds.end(), strCarCat);
|
|
- if (itCarCat == _vecAcceptedCarCategoryIds.end()) // Not already there => store it.
|
|
+ if (seenCarCategories.find(strCarCat) == seenCarCategories.end())
|
|
+ {
|
|
+ seenCarCategories.insert(strCarCat);
|
|
_vecAcceptedCarCategoryIds.push_back(strCarCat);
|
|
+ }
|
|
}
|
|
|
|
@@ -310,9 +313,10 @@
|
|
std::stringstream ssRejectCarCats(pszRejectCarCats);
|
|
while(std::getline(ssRejectCarCats, strCarCat, cFilterSeparator))
|
|
{
|
|
- std::vector<std::string>::iterator itCarCat =
|
|
- std::find(_vecAcceptedCarCategoryIds.begin(), _vecAcceptedCarCategoryIds.end(), strCarCat);
|
|
- if (itCarCat != _vecAcceptedCarCategoryIds.end()) // Accepted til now => now rejected.
|
|
+ auto itCarCat = std::find(_vecAcceptedCarCategoryIds.begin(),
|
|
+ _vecAcceptedCarCategoryIds.end(), strCarCat);
|
|
+ if (itCarCat != _vecAcceptedCarCategoryIds.end())
|
|
+ {
|
|
+ seenCarCategories.erase(strCarCat);
|
|
_vecAcceptedCarCategoryIds.erase(itCarCat);
|
|
+ }
|
|
}
|
|
|