TBTR: Remove duplicated function: SetupTemplateVehicleFromVirtual

(cherry picked from commit c6fa43d767)
This commit is contained in:
Jonathan G Rennison
2019-03-08 19:20:36 +00:00
parent c4f5c8e789
commit 21faae910b
3 changed files with 2 additions and 30 deletions

View File

@@ -141,7 +141,7 @@ void DrawTemplate(const TemplateVehicle *tv, int left, int right, int y)
} }
// copy important stuff from the virtual vehicle to the template // copy important stuff from the virtual vehicle to the template
inline void SetupTemplateVehicleFromVirtual(TemplateVehicle *tmp, TemplateVehicle *prev, Train *virt) void SetupTemplateVehicleFromVirtual(TemplateVehicle *tmp, TemplateVehicle *prev, Train *virt)
{ {
if (prev) { if (prev) {
prev->SetNext(tmp); prev->SetNext(tmp);

View File

@@ -26,8 +26,8 @@ Money CalculateOverallTemplateCost(const TemplateVehicle*);
void DrawTemplate(const TemplateVehicle*, int, int, int); void DrawTemplate(const TemplateVehicle*, int, int, int);
TemplateVehicle* TemplateVehicleFromVirtualTrain(Train *virt); TemplateVehicle* TemplateVehicleFromVirtualTrain(Train *virt);
Train* DeleteVirtualTrain(Train*, Train *); Train* DeleteVirtualTrain(Train*, Train *);
void SetupTemplateVehicleFromVirtual(TemplateVehicle *tmp, TemplateVehicle *prev, Train *virt);
CommandCost CmdTemplateReplaceVehicle(Train*, bool, DoCommandFlag); CommandCost CmdTemplateReplaceVehicle(Train*, bool, DoCommandFlag);

View File

@@ -784,34 +784,6 @@ static void CloneVehicleName(const Vehicle *src, Vehicle *dst)
/* All done. If we didn't find a name, it'll just use its default. */ /* All done. If we didn't find a name, it'll just use its default. */
} }
inline void SetupTemplateVehicleFromVirtual(TemplateVehicle *tmp, TemplateVehicle *prev, Train *virt)
{
if (prev) {
prev->SetNext(tmp);
tmp->SetPrev(prev);
tmp->SetFirst(prev->First());
}
tmp->railtype = virt->railtype;
tmp->owner = virt->owner;
tmp->value = virt->value;
// set the subtype but also clear the virtual flag while doing it
tmp->subtype = virt->subtype & ~(1 << GVSF_VIRTUAL);
// set the cargo type and capacity
tmp->cargo_type = virt->cargo_type;
tmp->cargo_subtype = virt->cargo_subtype;
tmp->cargo_cap = virt->cargo_cap;
const GroundVehicleCache *gcache = virt->GetGroundVehicleCache();
tmp->max_speed = virt->GetDisplayMaxSpeed();
tmp->power = gcache->cached_power;
tmp->weight = gcache->cached_weight;
tmp->max_te = gcache->cached_max_te / 1000;
virt->GetImage(DIR_W, EIT_IN_DEPOT, &tmp->sprite_seq);
tmp->image_dimensions.SetFromTrain(virt);
}
/** /**
* Toggles 'reuse depot vehicles' on a template vehicle. * Toggles 'reuse depot vehicles' on a template vehicle.
* @param tile unused * @param tile unused