diff options
author | Haru <haru@dotalux.com> | 2013-12-04 20:11:10 +0100 |
---|---|---|
committer | Haru <haru@dotalux.com> | 2013-12-04 21:00:48 +0100 |
commit | 43462caf9441a041755806a889cb6d5104dcf438 (patch) | |
tree | cf1e86d12b4c788238a7c3290a50cea76642f21c /src/map/itemdb.c | |
parent | 48fdd76b45f6c37cc02a5f981d3591c951ddfb94 (diff) | |
download | hercules-43462caf9441a041755806a889cb6d5104dcf438.tar.gz hercules-43462caf9441a041755806a889cb6d5104dcf438.tar.bz2 hercules-43462caf9441a041755806a889cb6d5104dcf438.tar.xz hercules-43462caf9441a041755806a889cb6d5104dcf438.zip |
Follow-up to 6e9c385b8fa2fbca97ca23e35f0b8e5dabd13526
- Case-sensitive AegisName and Sprite ID lookups are now optional,
controlled by the case_sensitive_aegisnames battle config flag (you
can set it to "no" to restore the case insensitive behavior.)
- Special thanks to Ind.
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/itemdb.c')
-rw-r--r-- | src/map/itemdb.c | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/src/map/itemdb.c b/src/map/itemdb.c index 1f9e2c889..30f81c354 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -33,11 +33,13 @@ int itemdb_searchname_sub(DBKey key, DBData *data, va_list ap) str=va_arg(ap,char *); dst=va_arg(ap,struct item_data **); dst2=va_arg(ap,struct item_data **); - if(item == &itemdb->dummy) return 0; + if (item == &itemdb->dummy) return 0; //Absolute priority to Aegis code name. if (*dst != NULL) return 0; - if( strcmp(item->name,str)==0 ) // Case sensitive + if ( battle_config.case_sensitive_aegisnames && strcmp(item->name,str) == 0 ) + *dst=item; + else if ( !battle_config.case_sensitive_aegisnames && strcasecmp(item->name,str) == 0 ) *dst=item; //Second priority to Client displayed name. @@ -61,7 +63,9 @@ struct item_data* itemdb_searchname(const char *str) { continue; // Absolute priority to Aegis code name. - if( strcmp(item->name,str) == 0 ) // Case sensitive + if ( battle_config.case_sensitive_aegisnames && strcmp(item->name,str) == 0 ) + return item; + else if ( !battle_config.case_sensitive_aegisnames && strcasecmp(item->name,str) == 0 ) return item; //Second priority to Client displayed name. @@ -90,7 +94,9 @@ int itemdb_searchname_array_sub(DBKey key, DBData data, va_list ap) return 1; //Invalid item. if(stristr(item->jname,str)) return 0; - if(stristr(item->name,str)) + if(battle_config.case_sensitive_aegisnames && strstr(item->name,str)) + return 0; + if(!battle_config.case_sensitive_aegisnames && stristr(item->name,str)) return 0; return strcmpi(item->jname,str); } @@ -113,9 +119,18 @@ int itemdb_searchname_array(struct item_data** data, int size, const char *str, if( item == NULL ) continue; - if( (!flag && (stristr(item->jname,str) || stristr(item->name,str))) || - (flag && (strcmp(item->jname,str) == 0 || strcmp(item->name,str) == 0)) ) - { + if( + (!flag + && (stristr(item->jname,str) + || (battle_config.case_sensitive_aegisnames && strstr(item->name,str)) + || (!battle_config.case_sensitive_aegisnames && stristr(item->name,str)) + )) + || (flag + && (strcmp(item->jname,str) == 0 + || (battle_config.case_sensitive_aegisnames && strcmp(item->name,str) == 0) + || (!battle_config.case_sensitive_aegisnames && strcasecmp(item->name,str) == 0) + )) + ) { if( count < size ) data[count] = item; ++count; |