TBTR: Fix incorrect deletion of template vehicles when deleting company

This commit is contained in:
Jonathan G Rennison
2019-05-16 20:01:56 +01:00
parent 6bf4b67486
commit fff3018b42

View File

@@ -505,7 +505,7 @@ void ChangeOwnershipOfCompanyItems(Owner old_owner, Owner new_owner)
if (new_owner == INVALID_OWNER) {
TemplateVehicle *tv;
FOR_ALL_TEMPLATES(tv) {
if (tv->owner == old_owner) {
if (tv->owner == old_owner && tv->Prev() == nullptr) {
TemplateReplacement *tr;
FOR_ALL_TEMPLATE_REPLACEMENTS(tr) {
if (tr->Template() == tv->index) {