From 1c256a4be79ac393185944dc0e4461da02be450e Mon Sep 17 00:00:00 2001 From: Rubidium Date: Wed, 2 Feb 2022 22:37:38 +0100 Subject: [PATCH] Fix: do not let shares in the company taking over another company disappear --- src/economy.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/economy.cpp b/src/economy.cpp index bc3692e3a4..c6fd2ed398 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -324,13 +324,13 @@ void ChangeOwnershipOfCompanyItems(Owner old_owner, Owner new_owner) /* Sell all the shares that people have on this company */ Backup cur_company2(_current_company, FILE_LINE); - const Company *c = Company::Get(old_owner); + Company *c = Company::Get(old_owner); for (i = 0; i < 4; i++) { if (c->share_owners[i] == INVALID_OWNER) continue; if (c->bankrupt_value == 0 && c->share_owners[i] == new_owner) { /* You are the one buying the company; so don't sell the shares back to you. */ - Company::Get(new_owner)->share_owners[i] = INVALID_OWNER; + c->share_owners[i] = INVALID_OWNER; } else { cur_company2.Change(c->share_owners[i]); /* Sell the shares */