TBTR: Add option to replace only old vehicles

This commit is contained in:
Jonathan G Rennison
2018-10-18 18:34:22 +01:00
parent 45d2726379
commit c4f5c8e789
9 changed files with 62 additions and 4 deletions

View File

@@ -4306,6 +4306,10 @@ CommandCost CmdTemplateReplaceVehicle(TileIndex tile, DoCommandFlag flags, uint3
/* first some tests on necessity and sanity */
if (tv == NULL) return buy;
if (tv->IsReplaceOldOnly() && !vehicle->NeedsAutorenewing(Company::Get(vehicle->owner), false)) {
if (!stayInDepot) incoming->vehstatus &= ~VS_STOPPED;
return buy;
}
bool need_replacement = !TrainMatchesTemplate(incoming, tv);
bool need_refit = !TrainMatchesTemplateRefit(incoming, tv);
bool use_refit = tv->refit_as_template;