(svn r6170) -Feature: save max_companies/clients/spectators in the config file.
authorDarkvater
Sun, 27 Aug 2006 10:49:43 +0000
changeset 4417 629dddc17a65
parent 4416 e0e9a72882d0
child 4418 47ab418a2b57
(svn r6170) -Feature: save max_companies/clients/spectators in the config file.
network.c
settings.c
--- a/network.c	Sun Aug 27 10:04:33 2006 +0000
+++ b/network.c	Sun Aug 27 10:49:43 2006 +0000
@@ -1392,10 +1392,16 @@
 	/* Generate an unique id when there is none yet */
 	if (_network_unique_id[0] == '\0') NetworkGenerateUniqueId();
 
-	memset(&_network_game_info, 0, sizeof(_network_game_info));
-	_network_game_info.clients_max = 10; // XXX - hardcoded, string limiation -- TrueLight
-	_network_game_info.companies_max = MAX_PLAYERS; // 8
-	_network_game_info.spectators_max = _network_game_info.clients_max;
+	{
+		byte cl_max = _network_game_info.clients_max;
+		byte cp_max = _network_game_info.companies_max;
+		byte sp_max = _network_game_info.spectators_max;
+
+		memset(&_network_game_info, 0, sizeof(_network_game_info));
+		_network_game_info.clients_max = cl_max;
+		_network_game_info.companies_max = cp_max;
+		_network_game_info.spectators_max = sp_max;
+	}
 
 	// Let's load the network in windows
 	#if defined(WIN32)
--- a/settings.c	Sun Aug 27 10:04:33 2006 +0000
+++ b/settings.c	Sun Aug 27 10:49:43 2006 +0000
@@ -1206,6 +1206,9 @@
 	SDTG_BOOL("autoclean_companies",             S, 0, _network_autoclean_companies,  false,       STR_NULL, NULL),
 	 SDTG_VAR("autoclean_unprotected",SLE_UINT8, S, 0, _network_autoclean_unprotected,12, 0,  60,  STR_NULL, NULL),
 	 SDTG_VAR("autoclean_protected",  SLE_UINT8, S, 0, _network_autoclean_protected,  36, 0, 180,  STR_NULL, NULL),
+	 SDTG_VAR("max_companies",        SLE_UINT8, S, 0, _network_game_info.companies_max,  8,0, 8,  STR_NULL, NULL),
+	 SDTG_VAR("max_clients",          SLE_UINT8, S, 0, _network_game_info.clients_max,   10,0,10,  STR_NULL, NULL),
+	 SDTG_VAR("max_spectators",       SLE_UINT8, S, 0, _network_game_info.spectators_max,10,0,10,  STR_NULL, NULL),
 	 SDTG_VAR("restart_game_year",    SLE_INT32, S,D0, _network_restart_game_year,    0, MIN_YEAR, MAX_YEAR, STR_NULL, NULL),
 	 SDTG_END()
 };