From f1adeec83d5b250f91001064aad6d9c650414ac9 Mon Sep 17 00:00:00 2001 From: zephyrus Date: Fri, 28 Mar 2008 02:22:25 +0000 Subject: - 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 --- src/map/map.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'src/map/map.c') 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; } -- cgit v1.2.3-60-g2f50