TBTR: Template replacements now also apply to child groups

This commit is contained in:
Jonathan G Rennison
2020-01-16 21:47:29 +00:00
parent ff6288139e
commit ee6d808578
8 changed files with 29 additions and 5 deletions

View File

@@ -159,6 +159,18 @@ TemplateID GetTemplateIDByGroupID(GroupID gid)
return iter->second;
}
TemplateID GetTemplateIDByGroupIDRecursive(GroupID gid)
{
while (gid != INVALID_GROUP) {
auto iter = _template_replacement_index.find(gid);
if (iter != _template_replacement_index.end()) return iter->second;
const Group *g = Group::GetIfValid(gid);
if (g == nullptr) break;
gid = Group::Get(gid)->parent;
}
return INVALID_TEMPLATE;
}
bool IssueTemplateReplacement(GroupID gid, TemplateID tid)
{
TemplateReplacement *tr = GetTemplateReplacementByGroupID(gid);