Changeset - r17823:2afeae3a6621
[Not reviewed]
master
0 1 0
frosch - 13 years ago 2011-07-02 19:31:01
frosch@openttd.org
(svn r22624) -Fix [FS#4654]: When closing an AI company the local player cheated to, we need to cheat him to another company.
1 file changed with 15 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/economy.cpp
Show inline comments
 
@@ -296,6 +296,21 @@ void ChangeOwnershipOfCompanyItems(Owner
 
	/* In all cases, make spectators of clients connected to that company */
 
	if (_networking) NetworkClientsToSpectators(old_owner);
 
#endif /* ENABLE_NETWORK */
 
	if (old_owner == _local_company) {
 
		/* Single player cheated to AI company.
 
		 * There are no specatators in single player, so we must pick some other company. */
 
		assert(!_networking);
 
		Backup<CompanyByte> cur_company(_current_company, FILE_LINE);
 
		Company *c;
 
		FOR_ALL_COMPANIES(c) {
 
			if (c->index != old_owner) {
 
				SetLocalCompany(c->index);
 
				break;
 
			}
 
		}
 
		cur_company.Restore();
 
		assert(old_owner != _local_company);
 
	}
 

	
 
	Town *t;
 

	
0 comments (0 inline, 0 general)