Changeset - r11411:5838126139f5
[Not reviewed]
master
0 4 0
rubidium - 16 years ago 2009-03-19 23:32:39
rubidium@openttd.org
(svn r15773) -Fix [FS#2475]: number of active clients wasn't always properly
4 files changed with 3 insertions and 16 deletions:
0 comments (0 inline, 0 general)
src/network/network.cpp
Show inline comments
 
@@ -346,7 +346,7 @@ static uint NetworkCountActiveClients()
 
static bool _min_active_clients_paused = false;
 

	
 
/* Check if the minimum number of active clients has been reached and pause or unpause the game as appropriate */
 
void CheckMinActiveClients()
 
static void CheckMinActiveClients()
 
{
 
	if (!_network_dedicated) return;
 

	
 
@@ -466,8 +466,6 @@ void NetworkCloseClient(NetworkClientSoc
 

	
 
	delete cs->GetInfo();
 
	delete cs;
 

	
 
	CheckMinActiveClients();
 
}
 

	
 
/* For the server, to accept new clients */
 
@@ -820,7 +818,6 @@ bool NetworkServerStart()
 
	if (_network_dedicated) IConsoleCmdExec("exec scripts/on_dedicated.scr 0");
 

	
 
	_min_active_clients_paused = false;
 
	CheckMinActiveClients();
 

	
 
	/* Try to register us to the master server */
 
	_network_last_advertise_frame = 0;
 
@@ -1028,6 +1025,7 @@ void NetworkGameLoop()
 
			cp->company = (CompanyID)company;
 
		}
 
#endif /* DEBUG_DUMP_COMMANDS */
 
		CheckMinActiveClients();
 

	
 
		bool send_frame = false;
 

	
src/network/network_func.h
Show inline comments
 
@@ -24,7 +24,6 @@ extern char *_network_host_list[10];
 
extern char *_network_ban_list[25];
 

	
 
byte NetworkSpectatorCount();
 
void CheckMinActiveClients();
 
void NetworkUpdateClientName();
 
bool NetworkCompanyHasClients(CompanyID company);
 
bool NetworkChangeCompanyPassword(byte argc, char *argv[]);
src/network/network_server.cpp
Show inline comments
 
@@ -1018,8 +1018,6 @@ DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT
 
			NetworkServerSendChat(NETWORK_ACTION_SERVER_MESSAGE, DESTTYPE_BROADCAST, 0, "", CLIENT_ID_SERVER, NETWORK_SERVER_MESSAGE_GAME_UNPAUSED_CONNECT);
 
		}
 

	
 
		CheckMinActiveClients();
 

	
 
		/* Execute script for, e.g. MOTD */
 
		IConsoleCmdExec("exec scripts/on_server_connect.scr 0");
 
	}
 
@@ -1752,8 +1750,6 @@ void NetworkServerDoMove(ClientID client
 

	
 
	NetworkAction action = (company_id == COMPANY_SPECTATOR) ? NETWORK_ACTION_COMPANY_SPECTATOR : NETWORK_ACTION_COMPANY_JOIN;
 
	NetworkServerSendChat(action, DESTTYPE_BROADCAST, 0, "", client_id, company_id + 1);
 

	
 
	CheckMinActiveClients();
 
}
 

	
 
void NetworkServerSendRcon(ClientID client_id, ConsoleColour colour_code, const char *string)
src/settings.cpp
Show inline comments
 
@@ -1164,12 +1164,6 @@ static bool ChangeDynamicEngines(int32 p
 

	
 
#ifdef ENABLE_NETWORK
 

	
 
static bool UpdateMinActiveClients(int32 p1)
 
{
 
	CheckMinActiveClients();
 
	return true;
 
}
 

	
 
static bool UpdateClientName(int32 p1)
 
{
 
	NetworkUpdateClientName();
 
@@ -1578,7 +1572,7 @@ const SettingDesc _settings[] = {
 
	  SDTC_VAR(network.max_clients,           SLE_UINT8, S, NO,    16,     2, MAX_CLIENTS, 0, STR_NULL,                                       NULL),
 
	  SDTC_VAR(network.max_spectators,        SLE_UINT8, S, NO,     8,     0, MAX_CLIENTS, 0, STR_NULL,                                       UpdateClientConfigValues),
 
	  SDTC_VAR(network.restart_game_year,     SLE_INT32, S,D0|NO|NC,0, MIN_YEAR, MAX_YEAR, 1, STR_NULL,                                       NULL),
 
	  SDTC_VAR(network.min_active_clients,    SLE_UINT8, S, NO,     0,     0, MAX_CLIENTS, 0, STR_NULL,                                       UpdateMinActiveClients),
 
	  SDTC_VAR(network.min_active_clients,    SLE_UINT8, S, NO,     0,     0, MAX_CLIENTS, 0, STR_NULL,                                       NULL),
 
	SDTC_OMANY(network.server_lang,           SLE_UINT8, S, NO,     0,    35, "ANY|ENGLISH|GERMAN|FRENCH|BRAZILIAN|BULGARIAN|CHINESE|CZECH|DANISH|DUTCH|ESPERANTO|FINNISH|HUNGARIAN|ICELANDIC|ITALIAN|JAPANESE|KOREAN|LITHUANIAN|NORWEGIAN|POLISH|PORTUGUESE|ROMANIAN|RUSSIAN|SLOVAK|SLOVENIAN|SPANISH|SWEDISH|TURKISH|UKRAINIAN|AFRIKAANS|CROATIAN|CATALAN|ESTONIAN|GALICIAN|GREEK|LATVIAN", STR_NULL, NULL),
 
	 SDTC_BOOL(network.reload_cfg,                       S, NO, false,                        STR_NULL,                                       NULL),
 
	  SDTC_STR(network.last_host,              SLE_STRB, S,  0, "0.0.0.0",                    STR_NULL,                                       NULL),
0 comments (0 inline, 0 general)