diff options
author | zephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-03-28 02:22:25 +0000 |
---|---|---|
committer | zephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-03-28 02:22:25 +0000 |
commit | f1adeec83d5b250f91001064aad6d9c650414ac9 (patch) | |
tree | 8f5e12d012b5393fa65b2f87e0a1a2aac0795a73 | |
parent | 009c0edd8287387b7926c84dbb664ca78e8d19ee (diff) | |
download | hercules-f1adeec83d5b250f91001064aad6d9c650414ac9.tar.gz hercules-f1adeec83d5b250f91001064aad6d9c650414ac9.tar.bz2 hercules-f1adeec83d5b250f91001064aad6d9c650414ac9.tar.xz hercules-f1adeec83d5b250f91001064aad6d9c650414ac9.zip |
- Fixing a bug in map_nick2sd. Also fixed on Stable.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@12445 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r-- | src/map/map.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/map/map.c b/src/map/map.c index 07d672503..8ca1ac5f1 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -1681,6 +1681,7 @@ struct map_session_data * map_nick2sd(const char *nick) struct map_session_data* found_sd; struct s_mapiterator* iter; size_t nicklen; + int qty = 0; if( nick == NULL ) return NULL; @@ -1693,32 +1694,30 @@ struct map_session_data * map_nick2sd(const char *nick) { if( battle_config.partial_name_scan ) {// partial name search - int qty = 0; - if( strnicmp(sd->status.name, nick, nicklen) == 0 ) { found_sd = sd; if( strcmp(sd->status.name, nick) == 0 ) - break; // Perfect Match + {// Perfect Match + qty = 1; + break; + } qty++; } - - if( qty != 1 ) found_sd = NULL; // Collisions } - else + else if( strcasecmp(sd->status.name, nick) == 0 ) {// exact search only - if( strcasecmp(sd->status.name, nick) == 0 ) - { - found_sd = sd; - break; - } + found_sd = sd; + break; } } - mapit_free(iter); + if( battle_config.partial_name_scan && qty != 1 ) + found_sd = NULL; + return found_sd; } |