TBTR: Remove partial implementation of all-group replacement.

This commit is contained in:
Jonathan G Rennison
2017-01-21 01:17:36 +00:00
parent e79541b166
commit 4800e47270

View File

@@ -213,22 +213,13 @@ Train* DeleteVirtualTrain(Train *chain, Train *to_del) {
// retrieve template vehicle from templatereplacement that belongs to the given group // retrieve template vehicle from templatereplacement that belongs to the given group
TemplateVehicle* GetTemplateVehicleByGroupID(GroupID gid) { TemplateVehicle* GetTemplateVehicleByGroupID(GroupID gid) {
if (gid >= NEW_GROUP) return NULL;
TemplateReplacement *tr; TemplateReplacement *tr;
// first try to find a templatereplacement issued for the given groupid
FOR_ALL_TEMPLATE_REPLACEMENTS(tr) { FOR_ALL_TEMPLATE_REPLACEMENTS(tr) {
if (tr->Group() == gid) { if (tr->Group() == gid) {
return TemplateVehicle::GetIfValid(tr->Template()); // there can be only one return TemplateVehicle::GetIfValid(tr->Template()); // there can be only one
} }
} }
// if that didn't work, try to find a templatereplacement for ALL_GROUP
if (gid != ALL_GROUP) {
FOR_ALL_TEMPLATE_REPLACEMENTS(tr) {
if (tr->Group() == ALL_GROUP) {
return TemplateVehicle::GetIfValid(tr->Template());
}
}
}
// if all failed, just return null
return NULL; return NULL;
} }