Core/ChatCommands: Honor exact matches during enum arg parsing (PR #25255)
(cherry picked from commit df29f605959aa449a3962199ee1cac3e09e05e38)
This commit is contained in:
committed by
Shauren
parent
ec44c8296d
commit
2d1a1d8ac3
@@ -142,10 +142,13 @@ struct ArgInfo<T, std::enable_if_t<std::is_enum_v<T>>>
|
||||
if (it == SearchMap.end() || !StringStartsWith(it->first, s)) // not a match
|
||||
return nullptr;
|
||||
|
||||
auto it2 = it;
|
||||
++it2;
|
||||
if (it2 != SearchMap.end() && StringStartsWith(it2->first, s)) // not unique
|
||||
return nullptr;
|
||||
if (it->first != s) // we don't have an exact match - check if it is unique
|
||||
{
|
||||
auto it2 = it;
|
||||
++it2;
|
||||
if (it2 != SearchMap.end() && StringStartsWith(it2->first, s)) // not unique
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (it->second)
|
||||
return &*it->second;
|
||||
|
||||
Reference in New Issue
Block a user