Переглянути джерело

Minor improvement in char_per_account setting, which could be greater than MAX_CHARS.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@16937 54d463be-8e91-2dee-dedb-b68131a5f0ec
momacabu 12 роки тому
батько
коміт
b4a0578039
2 змінених файлів з 11 додано та 5 видалено
  1. 2 0
      conf/char_athena.conf
  2. 9 5
      src/char/char.c

+ 2 - 0
conf/char_athena.conf

@@ -139,6 +139,8 @@ char_name_option: 1
 char_name_letters: abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890
 
 // How many Characters are allowed per Account ? (0 = disabled)
+// You can not exceed the limit of MAX_CHARS slots, defined in mmo.h
+// Doing that, chars_per_account will be default to MAX_CHARS.
 chars_per_account: 0
 
 // Restrict character deletion by BaseLevel

+ 9 - 5
src/char/char.c

@@ -105,7 +105,7 @@ char unknown_char_name[NAME_LENGTH] = "Unknown"; // Name to use when the request
 #define TRIM_CHARS "\255\xA0\032\t\x0A\x0D " //The following characters are trimmed regardless because they cause confusion and problems on the servers. [Skotlex]
 char char_name_letters[1024] = ""; // list of letters/symbols allowed (or not) in a character name. by [Yor]
 
-int char_per_account = 0; //Maximum charas per account (default unlimited) [Sirius]
+int char_per_account = 0; //Maximum chars per account (default unlimited) [Sirius]
 int char_del_level = 0; //From which level u can delete character [Lupus]
 int char_del_delay = 86400;
 
@@ -1338,10 +1338,10 @@ int mmo_char_sql_init(void)
 {
 	char_db_= idb_alloc(DB_OPT_RELEASE_DATA);
 
-	if(char_per_account == 0){
-		ShowStatus("Chars per Account: 'Unlimited'.......\n");
-	}else{
-		ShowStatus("Chars per Account: '%d'.......\n", char_per_account);
+	if (char_per_account == 0) {
+		ShowStatus("Characters per Account: 'Unlimited'.\n");
+	} else {
+		ShowStatus("Characters per Account: '%d'.\n", char_per_account);
 	}
 
 	//the 'set offline' part is now in check_login_conn ...
@@ -4592,6 +4592,10 @@ int char_config_read(const char* cfgName)
 			safestrncpy(char_name_letters, w2, sizeof(char_name_letters));
 		} else if (strcmpi(w1, "chars_per_account") == 0) { //maxchars per account [Sirius]
 			char_per_account = atoi(w2);
+			if( char_per_account > MAX_CHARS ) {
+				ShowWarning("Max chars per account '%d' exceeded limit. Defaulting to '%d'.\n", char_per_account, MAX_CHARS);
+				char_per_account = MAX_CHARS;
+			}
 		} else if (strcmpi(w1, "char_del_level") == 0) { //disable/enable char deletion by its level condition [Lupus]
 			char_del_level = atoi(w2);
 		} else if (strcmpi(w1, "char_del_delay") == 0) {