diff options
author | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-10-12 23:15:27 +0000 |
---|---|---|
committer | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-10-12 23:15:27 +0000 |
commit | 7fed7ca773550e124e256a6c976ea2762cf9498b (patch) | |
tree | 48d5d5ebd6d50b46fb58c5231acf95544c35c2cc /src/char/char.c | |
parent | 96dd8cdf7ac9778cbb84b7c67f65296b8f723eb5 (diff) | |
download | hercules-7fed7ca773550e124e256a6c976ea2762cf9498b.tar.gz hercules-7fed7ca773550e124e256a6c976ea2762cf9498b.tar.bz2 hercules-7fed7ca773550e124e256a6c976ea2762cf9498b.tar.xz hercules-7fed7ca773550e124e256a6c976ea2762cf9498b.zip |
* Fixed wrong index calculation in TXT char creation code (ref: r11410)
* Fixed SQL itemdb loading crash on NULL columns (ref: 11398)
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11434 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/char/char.c')
-rw-r--r-- | src/char/char.c | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/src/char/char.c b/src/char/char.c index 37b779f79..5ecbc4f98 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -1179,6 +1179,19 @@ int make_new_char(struct char_session_data* sd, char* name_, int str, int agi, i return -1; } + // Check Authorised letters/symbols in the name of the character + if( char_name_option == 1 ) { // only letters/symbols in char_name_letters are authorised + for( i = 0; i < NAME_LENGTH && name[i]; i++ ) + if (strchr(char_name_letters, name[i]) == NULL) + return -2; + } else + if( char_name_option == 2 ) { // letters/symbols in char_name_letters are forbidden + for( i = 0; i < NAME_LENGTH && name[i]; i++ ) + if( strchr(char_name_letters, name[i]) != NULL ) + return -2; + } // else, all letters/symbols are authorised (except control char removed before) + + //FIXME: the code way below actually depends on the value of 'i' that's used here! [ultramage] for( i = 0; i < char_num; i++ ) { // check if name doesn't already exist if ((name_ignoring_case != 0 && strncmp(char_dat[i].status.name, name, NAME_LENGTH) == 0) || @@ -1195,18 +1208,6 @@ int make_new_char(struct char_session_data* sd, char* name_, int str, int agi, i } } - // Check Authorised letters/symbols in the name of the character - if( char_name_option == 1 ) { // only letters/symbols in char_name_letters are authorised - for( i = 0; i < NAME_LENGTH && name[i]; i++ ) - if (strchr(char_name_letters, name[i]) == NULL) - return -2; - } else - if( char_name_option == 2 ) { // letters/symbols in char_name_letters are forbidden - for( i = 0; i < NAME_LENGTH && name[i]; i++ ) - if( strchr(char_name_letters, name[i]) != NULL ) - return -2; - } // else, all letters/symbols are authorised (except control char removed before) - //check other inputs if((char_num >= MAX_CHARS) // slots || (hair_style >= 24) // hair style @@ -3587,7 +3588,7 @@ int parse_char(int fd) // add new entry to the chars list ARR_FIND( 0, MAX_CHARS, ch, sd->found_char[ch] == -1 ); if( ch < MAX_CHARS ) - sd->found_char[ch] = i; + sd->found_char[ch] = i; // position of the new char in the char_dat[] array } RFIFOSKIP(fd,37); |