Work around eFindMap_FuzzyMatch never actually being returned in TF2.

This commit is contained in:
Nicholas Hastings 2015-06-28 09:48:01 -04:00
parent 60ac7e23d0
commit 80838af4a2

View File

@ -1252,7 +1252,16 @@ SMFindMapResult CHalfLife2::FindMap(char *pMapName, int nMapNameMax)
return SMFindMapResult::FuzzyMatch;
}
#elif SOURCE_ENGINE == SE_TF2
return static_cast<SMFindMapResult>(engine->FindMap(pMapName, nMapNameMax));
// Save off name passed in so that we can compare to output.
// There is a bug where eFindMap_FuzzyMap is never returned, even for fuzzy matches.
char *pOriginal = sm_strdup(pMapName);
SMFindMapResult res = static_cast<SMFindMapResult>(engine->FindMap(pMapName, nMapNameMax));
bool bExactMatch = strcmp(pOriginal, pMapName) == 0;
delete [] pOriginal;
if (res == SMFindMapResult::Found && !bExactMatch)
return SMFindMapResult::FuzzyMatch;
else
return res;
#else
return engine->IsMapValid(pMapName) == 0 ? SMFindMapResult::NotFound : SMFindMapResult::Found;
#endif