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

@@ -208,6 +208,12 @@ TemplateVehicle* GetTemplateVehicleByGroupID(GroupID gid) {
return tid != INVALID_TEMPLATE ? TemplateVehicle::GetIfValid(tid) : nullptr;
}
TemplateVehicle* GetTemplateVehicleByGroupIDRecursive(GroupID gid) {
if (gid >= NEW_GROUP) return nullptr;
const TemplateID tid = GetTemplateIDByGroupIDRecursive(gid);
return tid != INVALID_TEMPLATE ? TemplateVehicle::GetIfValid(tid) : nullptr;
}
/**
* Check a template consist whether it contains any engine of the given railtype
*/