summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcelest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-01-07 09:01:22 +0000
committercelest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-01-07 09:01:22 +0000
commit058375e6a0ff8783c1f23111049f5d4b9c2d8834 (patch)
treeaa6df1015f29abfd0319a02e05a77f7ef6080583 /src
parent14e01888d06cfc94df20568d8e3c697fd3355117 (diff)
downloadhercules-058375e6a0ff8783c1f23111049f5d4b9c2d8834.tar.gz
hercules-058375e6a0ff8783c1f23111049f5d4b9c2d8834.tar.bz2
hercules-058375e6a0ff8783c1f23111049f5d4b9c2d8834.tar.xz
hercules-058375e6a0ff8783c1f23111049f5d4b9c2d8834.zip
Stall_time changes
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@930 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/map/map.c183
1 files changed, 86 insertions, 97 deletions
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);