mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-29 01:35:06 +01:00
Add Authors to the list of things you can search for in the Object Selection menu (#17575)
* Add Authors to Search option Joint effort from Spacek and karst * Update changelog.txt * Apply code review comment Co-authored-by: duncanspumpkin <duncans_pumpkin@hotmail.co.uk>
This commit is contained in:
@@ -1319,6 +1319,19 @@ private:
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool IsFilterInAuthor(const std::vector<std::string>& authors, const std::string& filterUpper)
|
||||
{
|
||||
for (auto& author : authors)
|
||||
{
|
||||
bool inAuthor = String::ToUpper(author).find(filterUpper) != std::string::npos;
|
||||
if (inAuthor)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool FilterString(const ObjectRepositoryItem* item)
|
||||
{
|
||||
// Nothing to search for
|
||||
@@ -1338,12 +1351,13 @@ private:
|
||||
const auto pathUpper = String::ToUpper(item->Path);
|
||||
const auto filterUpper = String::ToUpper(_filter_string);
|
||||
|
||||
// Check if the searched string exists in the name, ride type, or filename
|
||||
// Check if the searched string exists in the name, ride type, filename, or authors field
|
||||
bool inName = nameUpper.find(filterUpper) != std::string::npos;
|
||||
bool inRideType = (item->Type == ObjectType::Ride) && typeUpper.find(filterUpper) != std::string::npos;
|
||||
bool inPath = pathUpper.find(filterUpper) != std::string::npos;
|
||||
bool inAuthor = IsFilterInAuthor(item->Authors, filterUpper);
|
||||
|
||||
return inName || inRideType || inPath;
|
||||
return inName || inRideType || inPath || inAuthor;
|
||||
}
|
||||
|
||||
bool SourcesMatch(ObjectSourceGame source)
|
||||
|
||||
Reference in New Issue
Block a user