Sfoglia il codice sorgente

> Solved bugreport:7228, where you couldn't set the server to accept no users at all.
* 0 (zero) is used now when you wan't 0 users online;
* -1 is used now for unlimited users.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@17111 54d463be-8e91-2dee-dedb-b68131a5f0ec

momacabu 12 anni fa
parent
commit
3ed8a17eaf
2 ha cambiato i file con 8 aggiunte e 6 eliminazioni
  1. 3 2
      conf/char_athena.conf
  2. 5 4
      src/char/char.c

+ 3 - 2
conf/char_athena.conf

@@ -79,13 +79,14 @@ char_new: 1
 // Display (New) in the server list.
 char_new_display: 0
 
-// Maximum users able to connect to the server. Set to 0 for unlimited.
+// Maximum users able to connect to the server.
+// Set to 0 to disable users to log-in. (-1 means unlimited)
 max_connect_user: 0
 
 // Group ID that is allowed to bypass the server limit of users.
 // Default: -1 = nobody (there are no groups with ID < 0)
 // See: conf/groups.conf
-gm_allow_group: -1
+gm_allow_group: 99
 
 // How often should the server save all files? (In seconds)
 // Note: Applies to all data files on TXT servers.

+ 5 - 4
src/char/char.c

@@ -133,7 +133,7 @@ struct char_session_data {
 	char birthdate[10+1];  // YYYY-MM-DD
 };
 
-int max_connect_user = 0;
+int max_connect_user = -1;
 int gm_allow_group = -1;
 int autosave_interval = DEFAULT_AUTOSAVE_INTERVAL;
 int start_zeny = 0;
@@ -2154,7 +2154,8 @@ int parse_fromlogin(int fd) {
 				ARR_FIND( 0, ARRAYLENGTH(server), server_id, server[server_id].fd > 0 && server[server_id].map[0] );
 				// continued from char_auth_ok...
 				if( server_id == ARRAYLENGTH(server) || //server not online, bugreport:2359
-					( max_connect_user && count_users() >= max_connect_user && sd->group_id != gm_allow_group ) ) {
+					(max_connect_user == 0 && sd->group_id != gm_allow_group) ||
+					( max_connect_user > 0 && count_users() >= max_connect_user && sd->group_id != gm_allow_group ) ) {
 					// refuse connection (over populated)
 					WFIFOHEAD(i,3);
 					WFIFOW(i,0) = 0x6c;
@@ -4559,8 +4560,8 @@ int char_config_read(const char* cfgName)
 			char_new_display = atoi(w2);
 		} else if (strcmpi(w1, "max_connect_user") == 0) {
 			max_connect_user = atoi(w2);
-			if (max_connect_user < 0)
-				max_connect_user = 0; // unlimited online players
+			if (max_connect_user < -1)
+				max_connect_user = -1;
 		} else if(strcmpi(w1, "gm_allow_group") == 0) {
 			gm_allow_group = atoi(w2);
 		} else if (strcmpi(w1, "autosave_time") == 0) {