From 43462caf9441a041755806a889cb6d5104dcf438 Mon Sep 17 00:00:00 2001 From: Haru Date: Wed, 4 Dec 2013 20:11:10 +0100 Subject: 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 --- src/map/itemdb.c | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'src/map/itemdb.c') 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; -- cgit v1.2.3-60-g2f50