TBTR: Fix incorrect deletion of template vehicles when deleting company

(cherry picked from commit fff3018b42)
This commit is contained in:
Jonathan G Rennison
2019-05-16 20:01:56 +01:00
parent e0578a6e0c
commit 2e929a88a9

View File

@@ -490,7 +490,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) {