It can be done in FOCs ... almost ....
Code: Select all
/** @brief Checks content tags for a custom defined pedia category.
*
* @param[in,out] tags content tags to check for a matching pedia prefix tag
*
* @return The first matched pedia category for this set of tags,
* or empty string if there are no matches.
*/
std::string_view DetermineCustomCategory(const std::set<std::string>& tags) {
// for each tag, check if it starts with the prefix TAG_PEDIA_PREFIX
// when a match is found, return the match (without the prefix portion)
for (auto& tag : tags) {
if (boost::starts_with(tag, TAG_PEDIA_PREFIX)) {
//return boost::replace_first_copy(tag, TAG_PEDIA_PREFIX, "");
std::string_view retval{tag};
retval.remove_prefix(TAG_PEDIA_PREFIX.length());
return retval;
}
}
returns the
first matched pedia category:
So laenfa can either be phototrophic species or ... fuel parts
Its probably pure luck that sly are gaseous species and not ... fuel parts
Probably doesn't need many changes in EncyclopediaDetailPanel.cpp to get it to work automatically. At least I hope.
Edit: Other relevant bit:
Code: Select all
// species
for (auto& [species_name, species] : GetSpeciesManager())
if (dir_name == "ALL_SPECIES" ||
(dir_name == "NATIVE_SPECIES" && species->Native()) ||
(dir_name == "PLAYABLE_SPECIES" && species->Playable()) ||
DetermineCustomCategory(species->Tags()) == dir_name)
{
dir_entries.emplace(
UserString(species_name),
std::pair{VarText::SPECIES_TAG, species_name});
}