TBTR: Fix incorrect deletion of template vehicles when deleting company

(cherry picked from commit fff3018b42)
pull/104/head
Jonathan G Rennison 5 years ago
parent e0578a6e0c
commit 2e929a88a9

@ -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) {

Loading…
Cancel
Save