From 6ce5dacb5b15f16ff4c672596c091a41a190d687 Mon Sep 17 00:00:00 2001 From: ultramage Date: Sun, 18 Mar 2007 22:43:41 +0000 Subject: - Removed the old 'mapserver charsave' mechanism - Fixed some wrong sql login logic - Fixed some compiler warnings, cleaned up mapserver sql-related vars git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10027 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/map.c | 110 +++++++++++----------------------------------------------- 1 file changed, 21 insertions(+), 89 deletions(-) (limited to 'src/map/map.c') diff --git a/src/map/map.c b/src/map/map.c index dfdda95b7..a438731de 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -46,65 +46,53 @@ #include "log.h" -#include "charsave.h" - #include "irc.h" #ifndef TXT_ONLY -#include "mail.h" // mail system [Valaris] +#include "mail.h" -MYSQL mmysql_handle; -MYSQL_RES* sql_res ; -MYSQL_ROW sql_row ; char tmp_sql[65535]=""; - -MYSQL logmysql_handle; //For the log database - fix by [Maeki] -MYSQL_RES* logsql_res ; -MYSQL_ROW logsql_row ; - -MYSQL mail_handle; // mail system [Valaris] -MYSQL_RES* mail_res ; -MYSQL_ROW mail_row ; +char default_codepage[32] = ""; int map_server_port = 3306; char map_server_ip[16] = "127.0.0.1"; char map_server_id[32] = "ragnarok"; char map_server_pw[32] = "ragnarok"; char map_server_db[32] = "ragnarok"; -char default_codepage[32] = ""; //Feature by irmin. -int db_use_sqldbs = 0; +MYSQL mmysql_handle; +MYSQL_RES* sql_res; +MYSQL_ROW sql_row; +int db_use_sqldbs = 0; char item_db_db[32] = "item_db"; char item_db2_db[32] = "item_db2"; char mob_db_db[32] = "mob_db"; char mob_db2_db[32] = "mob_db2"; -int log_db_port = 3306; +char char_db[32] = "char"; + +// log database char log_db_ip[16] = "127.0.0.1"; +int log_db_port = 3306; char log_db_id[32] = "ragnarok"; char log_db_pw[32] = "ragnarok"; char log_db[32] = "log"; +MYSQL logmysql_handle; +MYSQL_RES* logsql_res; +MYSQL_ROW logsql_row; -int mail_server_port = 3306; +// mail system +int mail_server_enable = 0; char mail_server_ip[16] = "127.0.0.1"; +int mail_server_port = 3306; char mail_server_id[32] = "ragnarok"; char mail_server_pw[32] = "ragnarok"; char mail_server_db[32] = "ragnarok"; -int mail_server_enable = 0; - -char char_db[32] = "char"; - char mail_db[32] = "mail"; - -char charsql_host[40] = "localhost"; -int charsql_port = 3306; -char charsql_user[32] = "ragnarok"; -char charsql_pass[32] = "eAthena"; -char charsql_db[40] = "ragnarok"; -MYSQL charsql_handle; -MYSQL_RES* charsql_res; -MYSQL_ROW charsql_row; +MYSQL mail_handle; +MYSQL_RES* mail_res; +MYSQL_ROW mail_row; #endif /* not TXT_ONLY */ @@ -150,7 +138,6 @@ int map_port=0; int autosave_interval = DEFAULT_AUTOSAVE_INTERVAL; int minsave_interval = 100; int save_settings = 0xFFFF; -int charsave_method = 0; //Default 'OLD' Save method (SQL ONLY!) [Sirius] int agit_flag = 0; int night_flag = 0; // 0=day, 1=night [Yor] @@ -182,7 +169,7 @@ void map_setusers(int fd) WFIFOHEAD(fd, 2); map_users = RFIFOL(fd,2); - // send some anser + // send some answer WFIFOW(fd,0) = 0x2718; WFIFOSET(fd,2); } @@ -1721,15 +1708,6 @@ int map_quit(struct map_session_data *sd) { sd->st = NULL; sd->npc_id = 0; } -#ifndef TXT_ONLY - if(charsave_method) - { //Let player be free'd on closing the connection. - idb_remove(pc_db,sd->status.account_id); - if (!(sd->fd && session[sd->fd]->session_data == sd)) - aFree(sd); //In case player was not attached to session. - return 0; - } -#endif if(sd->fd) { //Player will be free'd on save-ack. [Skotlex] if (session[sd->fd]) @@ -2754,9 +2732,8 @@ int map_config_read(char *cfgName) { } else if(strcmpi(w1,"stdout_with_ansisequence")==0){ stdout_with_ansisequence = config_switch(w2); } else if(strcmpi(w1,"console_silent")==0){ - msg_silent = 0; //To always allow the next line to show up. - ShowInfo("Console Silent Setting: %d\n", atoi(w2)); msg_silent = atoi(w2); + ShowInfo("Console Silent Setting: %d\n", msg_silent); } else if (strcmpi(w1, "userid")==0){ chrif_setuserid(w2); } else if (strcmpi(w1, "passwd") == 0) { @@ -2854,8 +2831,6 @@ int inter_config_read(char *cfgName) strcpy(main_chat_nick, w2); #ifndef TXT_ONLY - } else if(strcmpi(w1,"charsave_method")==0){ - charsave_method = atoi(w2); //New char saving method. } else if(strcmpi(w1,"item_db_db")==0){ strcpy(item_db_db,w2); } else if(strcmpi(w1,"mob_db_db")==0){ @@ -2882,16 +2857,6 @@ int inter_config_read(char *cfgName) } else if(strcmpi(w1,"use_sql_db")==0){ db_use_sqldbs = battle_config_switch(w2); ShowStatus ("Using SQL dbs: %s\n",w2); - }else if(strcmpi(w1, "char_server_ip") == 0){ - strcpy(charsql_host, w2); - }else if(strcmpi(w1, "char_server_port") == 0){ - charsql_port = atoi(w2); - }else if(strcmpi(w1, "char_server_id") == 0){ - strcpy(charsql_user, w2); - }else if(strcmpi(w1, "char_server_pw") == 0){ - strcpy(charsql_pass, w2); - }else if(strcmpi(w1, "char_server_db") == 0){ - strcpy(charsql_db, w2); } else if(strcmpi(w1,"log_db")==0) { strcpy(log_db, w2); } else if(strcmpi(w1,"log_db_ip")==0) { @@ -3184,8 +3149,6 @@ void do_final(void) { #ifndef TXT_ONLY map_sql_close(); - if(charsave_method) - charsql_db_init(0); //Connecting to chardb #endif /* not TXT_ONLY */ ShowStatus("Successfully terminated.\n"); } @@ -3331,8 +3294,6 @@ int do_init(int argc, char *argv[]) { charid_db = db_alloc(__FILE__,__LINE__,DB_INT,DB_OPT_RELEASE_DATA,sizeof(int)); #ifndef TXT_ONLY map_sql_init(); - if(charsave_method) - charsql_db_init(1); //Connecting to chardb #endif /* not TXT_ONLY */ map_readallmaps(); @@ -3399,32 +3360,3 @@ int compare_item(struct item *a, struct item *b) { } return 0; } - -#ifndef TXT_ONLY -int charsql_db_init(int method){ - - if(method == 1){ //'INIT / START' - ShowInfo("Connecting to 'character' Database... "); - mysql_init(&charsql_handle); - - if(!mysql_real_connect(&charsql_handle, charsql_host, charsql_user, charsql_pass, charsql_db, charsql_port, (char *)NULL, 0)){ - ShowSQL("DB error - %s\n",mysql_error(&charsql_handle)); - exit(1); - }else{ - printf("success.\n"); - if( strlen(default_codepage) > 0 ) { - sprintf( tmp_sql, "SET NAMES %s", default_codepage ); - if (mysql_query(&charsql_handle, tmp_sql)) { - ShowSQL("DB error - %s\n",mysql_error(&charsql_handle)); - ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql); - } - } - } - }else if(method == 0){ //'FINAL' / Shutdown - ShowInfo("Closing 'character' Database connection ... "); - mysql_close(&charsql_handle); - printf("done.\n"); - } - return 0; -} -#endif -- cgit v1.2.3-60-g2f50