Changeset - r26182:b7bab7bedac9
[Not reviewed]
master
0 1 0
Rubidium - 2 years ago 2022-02-02 21:37:38
rubidium@openttd.org
Fix: do not let shares in the company taking over another company disappear
1 file changed with 2 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/economy.cpp
Show inline comments
 
@@ -324,13 +324,13 @@ void ChangeOwnershipOfCompanyItems(Owner
 

	
 
		/* Sell all the shares that people have on this company */
 
		Backup<CompanyID> 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 */
0 comments (0 inline, 0 general)