From 058375e6a0ff8783c1f23111049f5d4b9c2d8834 Mon Sep 17 00:00:00 2001 From: celest Date: Fri, 7 Jan 2005 09:01:22 +0000 Subject: Stall_time changes git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@930 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog.txt | 4 + conf-tmpl/inter_athena.conf | 16 ++-- conf-tmpl/login_athena.conf | 2 - src/map/map.c | 183 +++++++++++++++++++++----------------------- 4 files changed, 99 insertions(+), 106 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index a41ee747d..d19f93fca 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,5 +1,9 @@ Date Added 01/07 + * Stall_time wasn't being read in login_athena at all (not by the login server, + because the code didn't read it, nor by TXT map server, since its in the SQL + inter_athena.conf reading)... so moved it to inter_athena.conf, and + change sql_config_read in map.c to inter_config_read [celest] * Some tidying up of battle_get_def and _def2 [celest] * Added 'bDelayrate' and changed Phen card, Marduk Card and Berzebub Card's effects to use this instead of bCastrate (which was reducing casting time, diff --git a/conf-tmpl/inter_athena.conf b/conf-tmpl/inter_athena.conf index 9d6040107..b73865f8f 100644 --- a/conf-tmpl/inter_athena.conf +++ b/conf-tmpl/inter_athena.conf @@ -23,12 +23,21 @@ castle_txt: save/castle.txt // Options for both versions +// Log Inter Connections, etc.? +log_inter: 1 + // Inter Log Filename inter_log_filename: log/inter.log // Level range for sharing within a party party_share_level: 10 +// How long can a socket stall before closing the connection +stall_time: 60 + + + +// SQL version options only // The lowest GM level on your server lowest_gm_level: 1 @@ -36,10 +45,6 @@ lowest_gm_level: 1 // How often the GM accounts will be reloaded by the map-server in minutes read_gm_interval: 10 - - -// SQL version options only - // Ideally under linux, you want to use localhost instead of 127.0.0.1. // // Under windows, you want to use 127.0.0.1. If you see a message like @@ -130,7 +135,4 @@ mob_db_db: mob_db //Use SQL item_db and mob_db for the map server use_sql_db: no -// Log Inter Connections, etc.? -log_inter: 1 - import: conf/import/inter_conf.txt diff --git a/conf-tmpl/login_athena.conf b/conf-tmpl/login_athena.conf index 4758f7dc0..5b4395b28 100644 --- a/conf-tmpl/login_athena.conf +++ b/conf-tmpl/login_athena.conf @@ -151,7 +151,5 @@ flush_on: 0 // How often to flush the buffer in Mugendai's GUI flush_time: 60 -// How long can a socket stall before closing the connection -stall_time: 60 import: conf/import/login_conf.txt diff --git a/src/map/map.c b/src/map/map.c index b3edeb2a8..a591c97a2 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -2298,82 +2298,7 @@ int map_config_read(char *cfgName) { return 0; } -#ifndef TXT_ONLY -/*======================================= - * MySQL Init - *--------------------------------------- - */ - -int map_sql_init(void){ - - mysql_init(&mmysql_handle); - - //DB connection start - printf("Connect Map DB Server....\n"); - if(!mysql_real_connect(&mmysql_handle, map_server_ip, map_server_id, map_server_pw, - map_server_db ,map_server_port, (char *)NULL, 0)) { - //pointer check - printf("%s\n",mysql_error(&mmysql_handle)); - exit(1); - } - else { - printf ("connect success! (Map Server Connection)\n"); - } - - mysql_init(&lmysql_handle); - - //DB connection start - printf("Connect Login DB Server....\n"); - if(!mysql_real_connect(&lmysql_handle, login_server_ip, login_server_id, login_server_pw, - login_server_db ,login_server_port, (char *)NULL, 0)) { - //pointer check - printf("%s\n",mysql_error(&lmysql_handle)); - exit(1); - } - else { - printf ("connect success! (Login Server Connection)\n"); - } - - if(battle_config.mail_system) { // mail system [Valaris] - mysql_init(&mail_handle); - if(!mysql_real_connect(&mail_handle, map_server_ip, map_server_id, map_server_pw, - map_server_db ,map_server_port, (char *)NULL, 0)) { - printf("%s\n",mysql_error(&mail_handle)); - exit(1); - } - } - - return 0; -} - -int map_sql_close(void){ - mysql_close(&mmysql_handle); - printf("Close Map DB Connection....\n"); - - mysql_close(&lmysql_handle); - printf("Close Login DB Connection....\n"); - return 0; -} - -int log_sql_init(void){ - - mysql_init(&mmysql_handle); - - //DB connection start - printf(""CL_WHITE"[SQL]"CL_RESET": Connecting to Log Database "CL_WHITE"%s"CL_RESET" At "CL_WHITE"%s"CL_RESET"...\n",log_db,log_db_ip); - if(!mysql_real_connect(&mmysql_handle, log_db_ip, log_db_id, log_db_pw, - log_db ,log_db_port, (char *)NULL, 0)) { - //pointer check - printf(""CL_WHITE"[SQL Error]"CL_RESET": %s\n",mysql_error(&mmysql_handle)); - exit(1); - } else { - printf(""CL_WHITE"[SQL]"CL_RESET": Successfully '"CL_GREEN"connected"CL_RESET"' to Database '"CL_WHITE"%s"CL_RESET"'.\n", log_db); - } - - return 0; -} - -int sql_config_read(char *cfgName) +int inter_config_read(char *cfgName) { int i; char line[1024],w1[1024],w2[1024]; @@ -2391,7 +2316,10 @@ int sql_config_read(char *cfgName) i=sscanf(line,"%[^:]: %[^\r\n]",w1,w2); if(i!=2) continue; - if(strcmpi(w1,"item_db_db")==0){ + if(strcmpi(w1,"stall_time")==0){ + stall_time_ = atoi(w2); + #ifndef TXT_ONLY + } else if(strcmpi(w1,"item_db_db")==0){ strcpy(item_db_db,w2); } else if(strcmpi(w1,"mob_db_db")==0){ strcpy(mob_db_db,w2); @@ -2434,8 +2362,6 @@ int sql_config_read(char *cfgName) strcpy(login_server_pw, w2); } else if(strcmpi(w1,"login_server_db")==0){ strcpy(login_server_db, w2); - } else if(strcmpi(w1,"stall_time")==0){ - stall_time_ = atoi(w2); } else if(strcmpi(w1,"lowest_gm_level")==0){ lowest_gm_level = atoi(w2); } else if(strcmpi(w1,"read_gm_interval")==0){ @@ -2452,18 +2378,10 @@ int sql_config_read(char *cfgName) strcpy(log_db_pw, w2); } else if(strcmpi(w1,"log_db_port")==0) { log_db_port = atoi(w2); - }else if(strcmpi(w1,"read_map_from_bitmap")==0){ - if (atoi(w2) == 2) - map_read_flag = READ_FROM_BITMAP_COMPRESSED; - else if (atoi(w2) == 1) - map_read_flag = READ_FROM_BITMAP; - else - map_read_flag = READ_FROM_GAT; - }else if(strcmpi(w1,"map_bitmap_path")==0){ - strncpy(map_bitmap_filename,w2,255); + #endif //support the import command, just like any other config } else if(strcmpi(w1,"import")==0){ - sql_config_read(w2); + inter_config_read(w2); } } fclose(fp); @@ -2471,6 +2389,81 @@ int sql_config_read(char *cfgName) return 0; } +#ifndef TXT_ONLY +/*======================================= + * MySQL Init + *--------------------------------------- + */ + +int map_sql_init(void){ + + mysql_init(&mmysql_handle); + + //DB connection start + printf("Connect Map DB Server....\n"); + if(!mysql_real_connect(&mmysql_handle, map_server_ip, map_server_id, map_server_pw, + map_server_db ,map_server_port, (char *)NULL, 0)) { + //pointer check + printf("%s\n",mysql_error(&mmysql_handle)); + exit(1); + } + else { + printf ("connect success! (Map Server Connection)\n"); + } + + mysql_init(&lmysql_handle); + + //DB connection start + printf("Connect Login DB Server....\n"); + if(!mysql_real_connect(&lmysql_handle, login_server_ip, login_server_id, login_server_pw, + login_server_db ,login_server_port, (char *)NULL, 0)) { + //pointer check + printf("%s\n",mysql_error(&lmysql_handle)); + exit(1); + } + else { + printf ("connect success! (Login Server Connection)\n"); + } + + if(battle_config.mail_system) { // mail system [Valaris] + mysql_init(&mail_handle); + if(!mysql_real_connect(&mail_handle, map_server_ip, map_server_id, map_server_pw, + map_server_db ,map_server_port, (char *)NULL, 0)) { + printf("%s\n",mysql_error(&mail_handle)); + exit(1); + } + } + + return 0; +} + +int map_sql_close(void){ + mysql_close(&mmysql_handle); + printf("Close Map DB Connection....\n"); + + mysql_close(&lmysql_handle); + printf("Close Login DB Connection....\n"); + return 0; +} + +int log_sql_init(void){ + + mysql_init(&mmysql_handle); + + //DB connection start + printf(""CL_WHITE"[SQL]"CL_RESET": Connecting to Log Database "CL_WHITE"%s"CL_RESET" At "CL_WHITE"%s"CL_RESET"...\n",log_db,log_db_ip); + if(!mysql_real_connect(&mmysql_handle, log_db_ip, log_db_id, log_db_pw, + log_db ,log_db_port, (char *)NULL, 0)) { + //pointer check + printf(""CL_WHITE"[SQL Error]"CL_RESET": %s\n",mysql_error(&mmysql_handle)); + exit(1); + } else { + printf(""CL_WHITE"[SQL]"CL_RESET": Successfully '"CL_GREEN"connected"CL_RESET"' to Database '"CL_WHITE"%s"CL_RESET"'.\n", log_db); + } + + return 0; +} + int online_timer(int tid,unsigned int tick,int id,int data) { if(check_online_timer != tid) @@ -2683,9 +2676,7 @@ int do_init(int argc, char *argv[]) { FILE *data_conf; char line[1024], w1[1024], w2[1024]; -#ifndef TXT_ONLY - unsigned char *SQL_CONF_NAME="conf/inter_athena.conf"; -#endif + unsigned char *INTER_CONF_NAME="conf/inter_athena.conf"; unsigned char *LOG_CONF_NAME="conf/log_athena.conf"; unsigned char *MAP_CONF_NAME = "conf/map_athena.conf"; unsigned char *BATTLE_CONF_FILENAME = "conf/battle_athena.conf"; @@ -2719,8 +2710,8 @@ int do_init(int argc, char *argv[]) { else if (strcmp(argv[i],"--grf_path_file") == 0 || strcmp(argv[i],"--grf-path-file") == 0) GRF_PATH_FILENAME = argv[i+1]; #ifndef TXT_ONLY - else if (strcmp(argv[i],"--sql_config") == 0 || strcmp(argv[i],"--sql-config") == 0) - SQL_CONF_NAME = argv[i+1]; + else if (strcmp(argv[i],"--inter_config") == 0 || strcmp(argv[i],"--inter-config") == 0) + INTER_CONF_NAME = argv[i+1]; #endif /* not TXT_ONLY */ else if (strcmp(argv[i],"--log_config") == 0 || strcmp(argv[i],"--log-config") == 0) LOG_CONF_NAME = argv[i+1]; @@ -2761,9 +2752,7 @@ int do_init(int argc, char *argv[]) { atcommand_config_read(ATCOMMAND_CONF_FILENAME); charcommand_config_read(CHARCOMMAND_CONF_FILENAME); script_config_read(SCRIPT_CONF_NAME); -#ifndef TXT_ONLY - sql_config_read(SQL_CONF_NAME); -#endif /* not TXT_ONLY */ + inter_config_read(INTER_CONF_NAME); log_config_read(LOG_CONF_NAME); atexit(do_final); -- cgit v1.2.3-60-g2f50