diff --git a/speed-dreams-data b/speed-dreams-data index 9749171ce..53904d8e2 160000 --- a/speed-dreams-data +++ b/speed-dreams-data @@ -1 +1 @@ -Subproject commit 9749171cef65b4bc93094df17fcf2ec79e8d187a +Subproject commit 53904d8e2c9c34e78d2c7be1bdb89becbe4cc6a7 diff --git a/src/libs/tgfdata/racemanagers.cpp b/src/libs/tgfdata/racemanagers.cpp index b484ac094..55f4aa13e 100644 --- a/src/libs/tgfdata/racemanagers.cpp +++ b/src/libs/tgfdata/racemanagers.cpp @@ -124,13 +124,31 @@ GfRaceManagers::GfRaceManagers() continue; } + bool insert = false; // Create the race manager and load it from the params file. //GfLogDebug("GfRaceManagers::GfRaceManagers: creating '%s'\n", strRaceManId.c_str()); GfRaceManager* pRaceMan = new GfRaceManager(strRaceManId, hparmRaceMan); + const std::vector& catIds = + pRaceMan->getAcceptedCarCategoryIds(); - // Update the GfRaceManagers singleton. - _pPrivate->vecRaceMans.push_back(pRaceMan); - _pPrivate->mapRaceMansById[strRaceManId] = pRaceMan; + for (const std::string &category : catIds) + { + std::vector cars = + GfCars::self()->getCarsInCategory(category); + + if (!cars.empty()) + { + insert = true; + break; + } + } + + if (insert) + { + // Update the GfRaceManagers singleton. + _pPrivate->vecRaceMans.push_back(pRaceMan); + _pPrivate->mapRaceMansById[strRaceManId] = pRaceMan; + } } while ((pFile = pFile->next) != lstFiles);