21 lines
1.1 KiB
Diff
21 lines
1.1 KiB
Diff
# UNDF: UNDF-2026-000001035
|
|
--- a/src/modules/userinterface/legacymenu/racescreens/driverselect.cpp
|
|
+++ b/src/modules/userinterface/legacymenu/racescreens/driverselect.cpp
|
|
@@ -1164,13 +1164,17 @@
|
|
|
|
// d) Keep only drivers accepted by the race and not already among competitors
|
|
// (but don't reject humans with the wrong car category : they must be able to change it).
|
|
+ // Build a set for O(1) competitor lookup instead of O(N) linear scan.
|
|
+ std::set<GfDriver*> setCompetitors(vecCompetitors.begin(), vecCompetitors.end());
|
|
+
|
|
std::vector<GfDriver*>::const_iterator itCandidate;
|
|
for (itCandidate = vecCandidates.begin(); itCandidate != vecCandidates.end(); ++itCandidate)
|
|
{
|
|
- if (std::find(vecCompetitors.begin(), vecCompetitors.end(), *itCandidate)
|
|
- == vecCompetitors.end()
|
|
+ if (setCompetitors.find(*itCandidate) == setCompetitors.end()
|
|
&& MenuData->pRace->acceptsDriverType((*itCandidate)->getType())
|
|
&& (strCarModel == AnyCarModel
|
|
|| (*itCandidate)->getCar()->getId() == strCarModel)
|
|
&& ((*itCandidate)->isHuman()
|
|
|| MenuData->pRace->acceptsCarCategory((*itCandidate)->getCar()->getCategoryId())))
|