diff options
author | shennetsind <ind@henn.et> | 2013-06-09 00:55:03 -0300 |
---|---|---|
committer | shennetsind <ind@henn.et> | 2013-06-09 00:55:03 -0300 |
commit | 2db09c2e6442aa3abe573d35a3a5a1c6fa3db5fa (patch) | |
tree | c7f5dbb515a926c04e2cd4f38872730e0e7c3429 /src/map | |
parent | 89a571a3c5d4c9366843a462c40efdebb24d17fe (diff) | |
download | hercules-2db09c2e6442aa3abe573d35a3a5a1c6fa3db5fa.tar.gz hercules-2db09c2e6442aa3abe573d35a3a5a1c6fa3db5fa.tar.bz2 hercules-2db09c2e6442aa3abe573d35a3a5a1c6fa3db5fa.tar.xz hercules-2db09c2e6442aa3abe573d35a3a5a1c6fa3db5fa.zip |
Fixed Bug #7319
Special Thanks to KeiKun~!
http://hercules.ws/board/tracker/issue-7319-db-name/
Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/itemdb.c | 7 | ||||
-rw-r--r-- | src/map/map.c | 117 | ||||
-rw-r--r-- | src/map/map.h | 1 |
3 files changed, 57 insertions, 68 deletions
diff --git a/src/map/itemdb.c b/src/map/itemdb.c index 4b6275047..cb845111d 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -1293,14 +1293,13 @@ uint64 itemdb_unique_id(int8 flag, int64 value) { return ++item_uid; } -int itemdb_uid_load(){ +int itemdb_uid_load() { char * uid; - if (SQL_ERROR == SQL->Query(mmysql_handle, "SELECT `value` FROM `interreg` WHERE `varname`='unique_id'")) + if (SQL_ERROR == SQL->Query(mmysql_handle, "SELECT `value` FROM `%s` WHERE `varname`='unique_id'",iMap->interreg_db)) Sql_ShowDebug(mmysql_handle); - if( SQL_SUCCESS != SQL->NextRow(mmysql_handle) ) - { + if( SQL_SUCCESS != SQL->NextRow(mmysql_handle) ) { ShowError("itemdb_uid_load: Unable to fetch unique_id data\n"); SQL->FreeResult(mmysql_handle); return -1; diff --git a/src/map/map.c b/src/map/map.c index f0db40c39..70aa777e3 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -3526,82 +3526,71 @@ void map_reloadnpc(bool clear) #endif } -int inter_config_read(char *cfgName) -{ +int inter_config_read(char *cfgName) { char line[1024],w1[1024],w2[1024]; FILE *fp; - fp=fopen(cfgName,"r"); - if(fp==NULL){ + if( !( fp = fopen(cfgName,"r") ) ){ ShowError("File not found: %s\n",cfgName); return 1; } - while(fgets(line, sizeof(line), fp)) - { + while(fgets(line, sizeof(line), fp)) { if(line[0] == '/' && line[1] == '/') continue; + if( sscanf(line,"%[^:]: %[^\r\n]",w1,w2) < 2 ) continue; - + /* table names */ if(strcmpi(w1,"item_db_db")==0) strcpy(iMap->item_db_db,w2); - else - if(strcmpi(w1,"mob_db_db")==0) - strcpy(iMap->mob_db_db,w2); - else - if(strcmpi(w1,"item_db2_db")==0) - strcpy(iMap->item_db2_db,w2); - else - if(strcmpi(w1,"item_db_re_db")==0) - strcpy(iMap->item_db_re_db,w2); - else - if(strcmpi(w1,"mob_db2_db")==0) - strcpy(iMap->mob_db2_db,w2); - else - //Map Server SQL DB - if(strcmpi(w1,"map_server_ip")==0) - strcpy(map_server_ip, w2); - else - if(strcmpi(w1,"map_server_port")==0) - map_server_port=atoi(w2); - else - if(strcmpi(w1,"map_server_id")==0) - strcpy(map_server_id, w2); - else - if(strcmpi(w1,"map_server_pw")==0) - strcpy(map_server_pw, w2); - else - if(strcmpi(w1,"map_server_db")==0) - strcpy(map_server_db, w2); - else - if(strcmpi(w1,"default_codepage")==0) - strcpy(default_codepage, w2); - else - if(strcmpi(w1,"use_sql_db")==0) { - iMap->db_use_sqldbs = config_switch(w2); - ShowStatus ("Using SQL dbs: %s\n",w2); - } else - if(strcmpi(w1,"log_db_ip")==0) - strcpy(log_db_ip, w2); - else - if(strcmpi(w1,"log_db_id")==0) - strcpy(log_db_id, w2); - else - if(strcmpi(w1,"log_db_pw")==0) - strcpy(log_db_pw, w2); - else - if(strcmpi(w1,"log_db_port")==0) - log_db_port = atoi(w2); - else - if(strcmpi(w1,"log_db_db")==0) - strcpy(log_db_db, w2); - else - if( mapreg_config_read(w1,w2) ) - continue; - //support the import command, just like any other config - else - if(strcmpi(w1,"import")==0) - inter_config_read(w2); + else if(strcmpi(w1,"mob_db_db")==0) + strcpy(iMap->mob_db_db,w2); + else if(strcmpi(w1,"item_db2_db")==0) + strcpy(iMap->item_db2_db,w2); + else if(strcmpi(w1,"item_db_re_db")==0) + strcpy(iMap->item_db_re_db,w2); + else if(strcmpi(w1,"mob_db2_db")==0) + strcpy(iMap->mob_db2_db,w2); + else if(strcmpi(w1,"mob_skill_db_db")==0) + strcpy(iMap->mob_skill_db_db,w2); + else if(strcmpi(w1,"mob_skill_db2_db")==0) + strcpy(iMap->mob_skill_db2_db,w2); + else if(strcmpi(w1,"interreg_db")==0) + strcpy(iMap->interreg_db,w2); + /* map sql stuff */ + else if(strcmpi(w1,"map_server_ip")==0) + strcpy(map_server_ip, w2); + else if(strcmpi(w1,"map_server_port")==0) + map_server_port=atoi(w2); + else if(strcmpi(w1,"map_server_id")==0) + strcpy(map_server_id, w2); + else if(strcmpi(w1,"map_server_pw")==0) + strcpy(map_server_pw, w2); + else if(strcmpi(w1,"map_server_db")==0) + strcpy(map_server_db, w2); + else if(strcmpi(w1,"default_codepage")==0) + strcpy(default_codepage, w2); + else if(strcmpi(w1,"use_sql_db")==0) { + iMap->db_use_sqldbs = config_switch(w2); + ShowStatus ("Using SQL dbs: %s\n",w2); + } + /* sql log db */ + else if(strcmpi(w1,"log_db_ip")==0) + strcpy(log_db_ip, w2); + else if(strcmpi(w1,"log_db_id")==0) + strcpy(log_db_id, w2); + else if(strcmpi(w1,"log_db_pw")==0) + strcpy(log_db_pw, w2); + else if(strcmpi(w1,"log_db_port")==0) + log_db_port = atoi(w2); + else if(strcmpi(w1,"log_db_db")==0) + strcpy(log_db_db, w2); + /* mapreg */ + else if( mapreg_config_read(w1,w2) ) + continue; + /* import */ + else if(strcmpi(w1,"import")==0) + inter_config_read(w2); } fclose(fp); diff --git a/src/map/map.h b/src/map/map.h index 9126f39a7..3e7c45bc3 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -796,6 +796,7 @@ struct map_interface { char mob_db2_db[32]; char mob_skill_db_db[32]; char mob_skill_db2_db[32]; + char interreg_db[32]; /* funcs */ void (*zone_init) (void); |