Changeset - r17395:d05b2e25814b
[Not reviewed]
master
0 1 0
terkhen - 14 years ago 2011-02-27 11:38:28
terkhen@openttd.org
(svn r22154) -Fix [FS#4529]: _current_company was modified when moving a client to spectators, causing issues in bankruptcy (Rubidium)
1 file changed with 4 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/network/network_client.cpp
Show inline comments
 
@@ -27,12 +27,13 @@
 
#include "../date_func.h"
 
#include "../gui.h"
 
#include "../rev.h"
 
#include "network.h"
 
#include "network_base.h"
 
#include "network_client.h"
 
#include "../core/backup_type.hpp"
 

	
 
#include "table/strings.h"
 

	
 
/* This file handles all the client-commands */
 

	
 

	
 
@@ -1152,21 +1153,24 @@ void NetworkClientRequestMove(CompanyID 
 
{
 
	MyClient::SendMove(company_id, pass);
 
}
 

	
 
void NetworkClientsToSpectators(CompanyID cid)
 
{
 
	Backup<CompanyByte> cur_company(_current_company, FILE_LINE);
 
	/* If our company is changing owner, go to spectators */
 
	if (cid == _local_company) SetLocalCompany(COMPANY_SPECTATOR);
 

	
 
	NetworkClientInfo *ci;
 
	FOR_ALL_CLIENT_INFOS(ci) {
 
		if (ci->client_playas != cid) continue;
 
		NetworkTextMessage(NETWORK_ACTION_COMPANY_SPECTATOR, CC_DEFAULT, false, ci->client_name);
 
		ci->client_playas = COMPANY_SPECTATOR;
 
	}
 

	
 
	cur_company.Restore();
 
}
 

	
 
void NetworkUpdateClientName()
 
{
 
	NetworkClientInfo *ci = NetworkFindClientInfoFromClientID(_network_own_client_id);
 

	
0 comments (0 inline, 0 general)