TBTR: Refactor template replacement code

Adjust conditions for re-using existing engines in depot
Reduce cost of searching for existing engines in depot
Reduce cost of vehicle chain membership tests
Improve replacement command error handling
Tidy up code in general
This commit is contained in:
Jonathan G Rennison
2023-03-22 00:15:25 +00:00
parent 5d5e005c5d
commit 1707f74d60
9 changed files with 218 additions and 234 deletions

View File

@@ -68,9 +68,9 @@ void TemplateVehicleImageDimensions::SetFromTrain(const Train *t)
}
}
TemplateVehicle::TemplateVehicle(VehicleType ty, EngineID eid, byte subtypeflag, Owner current_owner)
TemplateVehicle::TemplateVehicle(VehicleType type, EngineID eid, Owner current_owner)
{
this->type = ty;
this->type = type;
this->engine_type = eid;
this->reuse_depot_vehicles = false;