diff options
author | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-04-07 04:21:29 +0000 |
---|---|---|
committer | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-04-07 04:21:29 +0000 |
commit | fe1cc2f25ac9ddaad8213e6f34268f1329c3d865 (patch) | |
tree | 31e23dd04d1db2632626ebf960061c9c3885527c /src/map | |
parent | 6729808a6dd1e3760c3f8b5453d07f27f35dca45 (diff) | |
download | hercules-fe1cc2f25ac9ddaad8213e6f34268f1329c3d865.tar.gz hercules-fe1cc2f25ac9ddaad8213e6f34268f1329c3d865.tar.bz2 hercules-fe1cc2f25ac9ddaad8213e6f34268f1329c3d865.tar.xz hercules-fe1cc2f25ac9ddaad8213e6f34268f1329c3d865.zip |
- Moved e_mail_check() and config_switch() to strlib.h
- Synchronized the login servers a bit
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10174 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/atcommand.c | 42 | ||||
-rw-r--r-- | src/map/atcommand.h | 1 | ||||
-rw-r--r-- | src/map/battle.c | 24 | ||||
-rw-r--r-- | src/map/battle.h | 2 | ||||
-rw-r--r-- | src/map/map.c | 18 | ||||
-rw-r--r-- | src/map/script.c | 12 |
6 files changed, 12 insertions, 87 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 916bf2387..f947c0b3b 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -721,46 +721,6 @@ char * player_title_txt(int level) { return atcmd_temp; } -//------------------------------------------------------------ -// E-mail check: return 0 (not correct) or 1 (valid). by [Yor] -//------------------------------------------------------------ -int e_mail_check(char *email) -{ - char ch; - char* last_arobas; - - // athena limits - if (strlen(email) < 3 || strlen(email) > 39) - return 0; - - // part of RFC limits (official reference of e-mail description) - if (strchr(email, '@') == NULL || email[strlen(email)-1] == '@') - return 0; - - if (email[strlen(email)-1] == '.') - return 0; - - last_arobas = strrchr(email, '@'); - - if (strstr(last_arobas, "@.") != NULL || - strstr(last_arobas, "..") != NULL) - return 0; - - for(ch = 1; ch < 32; ch++) { - if (strchr(last_arobas, ch) != NULL) { - return 0; - break; - } - } - - if (strchr(last_arobas, ' ') != NULL || - strchr(last_arobas, ';') != NULL) - return 0; - - // all correct - return 1; -} - /*========================================== * Retrieve the atcommand's required gm level *------------------------------------------ @@ -7675,7 +7635,7 @@ int atcommand_partyoption(const int fd, struct map_session_data* sd, const char* return -1; } w1[14] = w2[14] = '\0'; //Assure a proper string terminator. - option = (battle_config_switch(w1)?1:0)|(battle_config_switch(w2)?2:0); + option = (config_switch(w1)?1:0)|(config_switch(w2)?2:0); //Change item share type. if (option != p->party.item) diff --git a/src/map/atcommand.h b/src/map/atcommand.h index d18e8e923..19b0e27f4 100644 --- a/src/map/atcommand.h +++ b/src/map/atcommand.h @@ -325,7 +325,6 @@ void do_final_msg(void); char* estr_lower(char* str); -int e_mail_check(char* email); extern char atcommand_symbol; #define MAX_MSG 1000 extern char* msg_table[MAX_MSG]; diff --git a/src/map/battle.c b/src/map/battle.c index f758c3914..6eda8fa78 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -3339,26 +3339,6 @@ int battle_check_range(struct block_list *src,struct block_list *bl,int range) return path_search_long(NULL,src->m,src->x,src->y,bl->x,bl->y); } -/*========================================== - * Return numerical value of a switch configuration (modified by [Yor]) - * on/off, english, français, deutsch, español - *------------------------------------------ - */ -int battle_config_switch(const char *str) { - if(strncmpi(str, "on",2) == 0 || - strncmpi(str, "yes",3) == 0 || - strncmpi(str, "oui",3) == 0 || - strncmpi(str, "ja",2) == 0 || - strncmpi(str, "si",2) == 0) - return 1; - if(strncmpi(str, "off",3) == 0 || - strncmpi(str, "no",2) == 0 || - strncmpi(str, "non",3) == 0 || - strncmpi(str, "nein",4) == 0) - return 0; - return (int)strtol(str,NULL,0); -} - static const struct battle_data_short { const char *str; unsigned short *val; @@ -3730,12 +3710,12 @@ int battle_set_value(const char* w1, const char* w2) { int i; for(i = 0; i < sizeof(battle_data_short) / (sizeof(battle_data_short[0])); i++) if (strcmpi(w1, battle_data_short[i].str) == 0) { - * battle_data_short[i].val = battle_config_switch(w2); + * battle_data_short[i].val = config_switch(w2); return 1; } for(i = 0; i < sizeof(battle_data_int) / (sizeof(battle_data_int[0])); i++) if (strcmpi(w1, battle_data_int[i].str) == 0) { - *battle_data_int[i].val = battle_config_switch(w2); + *battle_data_int[i].val = config_switch(w2); return 1; } return 0; diff --git a/src/map/battle.h b/src/map/battle.h index 90b42444c..e33b811ad 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -87,8 +87,6 @@ int battle_check_range(struct block_list *src,struct block_list *bl,int range); void battle_consume_ammo(struct map_session_data* sd, int skill, int lv); // İ’è -int battle_config_switch(const char *str); // [Valaris] - extern struct Battle_Config { unsigned short warp_point_debug; unsigned short enable_critical; diff --git a/src/map/map.c b/src/map/map.c index b69bd4367..43140677e 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -2678,18 +2678,6 @@ int parse_console(char* buf) return 0; } -//------------------------------------------------- -// Return numerical value of a switch configuration -// on/off, english, français, deutsch, español -//------------------------------------------------- -int config_switch(const char *str) { - if (strcmpi(str, "on") == 0 || strcmpi(str, "yes") == 0 || strcmpi(str, "oui") == 0 || strcmpi(str, "ja") == 0 || strcmpi(str, "si") == 0) - return 1; - if (strcmpi(str, "off") == 0 || strcmpi(str, "no") == 0 || strcmpi(str, "non") == 0 || strcmpi(str, "nein") == 0) - return 0; - return atoi(str); -} - /*========================================== * İ’èƒtƒ@ƒCƒ‹‚ğ?‚İ?‚Ş *------------------------------------------ @@ -2812,7 +2800,7 @@ int inter_config_read(char *cfgName) if(i!=2) continue; if(strcmpi(w1,"party_share_level")==0){ - party_share_level = battle_config_switch(w2); + party_share_level = config_switch(w2); } else if(strcmpi(w1,"lowest_gm_level")==0){ lowest_gm_level = atoi(w2); @@ -2845,7 +2833,7 @@ int inter_config_read(char *cfgName) } else if(strcmpi(w1,"default_codepage")==0){ strcpy(default_codepage, w2); } else if(strcmpi(w1,"use_sql_db")==0){ - db_use_sqldbs = battle_config_switch(w2); + db_use_sqldbs = config_switch(w2); ShowStatus ("Using SQL dbs: %s\n",w2); } else if(strcmpi(w1,"log_db")==0) { strcpy(log_db, w2); @@ -2861,7 +2849,7 @@ int inter_config_read(char *cfgName) log_db_port = atoi(w2); // Mail Server SQL } else if(strcmpi(w1,"mail_server_enable")==0){ - mail_server_enable = battle_config_switch(w2); + mail_server_enable = config_switch(w2); ShowStatus ("Using Mail Server: %s\n",w2); } else if(strcmpi(w1,"mail_server_ip")==0){ strcpy(mail_server_ip, w2); diff --git a/src/map/script.c b/src/map/script.c index 602020cf2..c305bf6ec 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -3312,22 +3312,22 @@ int script_config_read_sub(char *cfgName) set_posword(w2); } else if(strcmpi(w1,"verbose_mode")==0) { - script_config.verbose_mode = battle_config_switch(w2); + script_config.verbose_mode = config_switch(w2); } else if(strcmpi(w1,"warn_func_mismatch_paramnum")==0) { - script_config.warn_func_mismatch_paramnum = battle_config_switch(w2); + script_config.warn_func_mismatch_paramnum = config_switch(w2); } else if(strcmpi(w1,"check_cmdcount")==0) { - script_config.check_cmdcount = battle_config_switch(w2); + script_config.check_cmdcount = config_switch(w2); } else if(strcmpi(w1,"check_gotocount")==0) { - script_config.check_gotocount = battle_config_switch(w2); + script_config.check_gotocount = config_switch(w2); } else if(strcmpi(w1,"event_script_type")==0) { - script_config.event_script_type = battle_config_switch(w2); + script_config.event_script_type = config_switch(w2); } else if(strcmpi(w1,"event_requires_trigger")==0) { - script_config.event_requires_trigger = battle_config_switch(w2); + script_config.event_requires_trigger = config_switch(w2); } else if(strcmpi(w1,"die_event_name")==0) { strncpy(script_config.die_event_name, w2, NAME_LENGTH-1); |