diff options
author | Matheus Macabu <mkbu95@gmail.com> | 2013-07-04 17:36:16 -0300 |
---|---|---|
committer | Matheus Macabu <mkbu95@gmail.com> | 2013-07-04 17:36:16 -0300 |
commit | 0f2899cf48bd4a324e92dc33dc2bc28d1edcdae3 (patch) | |
tree | 28a722e533422e2d05b662f533d311a88b4edb6a | |
parent | 5b1d3c5ebcbeab9730f8f4603c769c090ca4c8d1 (diff) | |
download | hercules-0f2899cf48bd4a324e92dc33dc2bc28d1edcdae3.tar.gz hercules-0f2899cf48bd4a324e92dc33dc2bc28d1edcdae3.tar.bz2 hercules-0f2899cf48bd4a324e92dc33dc2bc28d1edcdae3.tar.xz hercules-0f2899cf48bd4a324e92dc33dc2bc28d1edcdae3.zip |
Split use_sql_db into the three available: item_db, mob_db, mob_skill_db.
Signed-off-by: Matheus Macabu <mkbu95@gmail.com>
-rw-r--r-- | conf/inter-server.conf | 10 | ||||
-rw-r--r-- | src/char/char.c | 4 | ||||
-rw-r--r-- | src/char/char.h | 4 | ||||
-rw-r--r-- | src/map/battle.c | 4 | ||||
-rw-r--r-- | src/map/itemdb.c | 6 | ||||
-rw-r--r-- | src/map/map.c | 18 | ||||
-rw-r--r-- | src/map/map.h | 4 | ||||
-rw-r--r-- | src/map/mob.c | 2 | ||||
-rw-r--r-- | src/plugins/db2sql.c | 8 |
9 files changed, 41 insertions, 19 deletions
diff --git a/conf/inter-server.conf b/conf/inter-server.conf index 3cf5211df..468cf5a26 100644 --- a/conf/inter-server.conf +++ b/conf/inter-server.conf @@ -119,7 +119,13 @@ mob_skill_db_db: mob_skill_db mob_skill_db2_db: mob_skill_db2 mapreg_db: mapreg -//Use SQL item_db, mob_db and mob_skill_db for the map server -use_sql_db: no +// Use SQL for item_db? +use_sql_item_db: no + +// Use SQL for mob_db? +use_sql_mob_db: no + +// Use SQL for mob_skill_db? +use_sql_mob_skill_db: no import: conf/import/inter_conf.txt diff --git a/src/char/char.c b/src/char/char.c index edc73223a..a941dac14 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -75,7 +75,9 @@ static DBMap* char_db_; // int char_id -> struct mmo_charstatus* char db_path[1024] = "db"; -int db_use_sqldbs; +int db_use_sql_item_db; +int db_use_sql_mob_db; +int db_use_sql_mob_skill_db; struct mmo_map_server { int fd; diff --git a/src/char/char.h b/src/char/char.h index 1a9441868..d98ce9004 100644 --- a/src/char/char.h +++ b/src/char/char.h @@ -105,7 +105,9 @@ extern char mercenary_owner_db[256]; extern char ragsrvinfo_db[256]; extern char interreg_db[32]; -extern int db_use_sqldbs; // added for sql item_db read for char server [Valaris] +extern int db_use_sql_item_db; +extern int db_use_sql_mob_db; +extern int db_use_sql_mob_skill_db; extern int guild_exp_rate; extern int log_inter; diff --git a/src/map/battle.c b/src/map/battle.c index b9669c319..18c95c76d 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -6554,8 +6554,8 @@ void Hercules_report(char* date, char *time_c) { #endif /* non-define part */ - if( iMap->db_use_sqldbs ) - config |= C_SQL_DBS; + if( iMap->db_use_sql_item_db || iMap->db_use_sql_mob_db || iMap->db_use_sql_mob_skill_db ) + config |= C_SQL_DBS; //TODO: split this config into three. if( logs->config.sql_logs ) config |= C_SQL_LOGS; diff --git a/src/map/itemdb.c b/src/map/itemdb.c index 4e0477b75..7b6fd0ed7 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -1346,7 +1346,7 @@ int itemdb_parse_dbrow(char** str, const char* source, int line, int scriptopt) id->weight = atoi(str[6]); #ifdef RENEWAL - if( iMap->db_use_sqldbs ) { + if( iMap->db_use_sql_item_db ) { id->atk = atoi(str[7]); id->matk = atoi(str[8]); offset += 1; @@ -1376,7 +1376,7 @@ int itemdb_parse_dbrow(char** str, const char* source, int line, int scriptopt) id->wlv = cap_value(atoi(str[15+offset]), REFINE_TYPE_ARMOR, REFINE_TYPE_MAX); #ifdef RENEWAL - if( iMap->db_use_sqldbs ) { + if( iMap->db_use_sql_item_db ) { id->elv = atoi(str[16+offset]); id->elvmax = atoi(str[17+offset]); offset += 1; @@ -1639,7 +1639,7 @@ int itemdb_uid_load() { * read all item-related databases *------------------------------------*/ static void itemdb_read(void) { - if (iMap->db_use_sqldbs) + if (iMap->db_use_sql_item_db) itemdb_read_sqldb(); else itemdb_readdb(); diff --git a/src/map/map.c b/src/map/map.c index 2770a8af7..3a2ca6c57 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -3548,9 +3548,17 @@ int inter_config_read(char *cfgName) { 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,"use_sql_item_db")==0) { + iMap->db_use_sql_item_db = config_switch(w2); + ShowStatus ("Using item database as SQL: '%s'\n", w2); + } + else if(strcmpi(w1,"use_sql_mob_db")==0) { + iMap->db_use_sql_mob_db = config_switch(w2); + ShowStatus ("Using monster database as SQL: '%s'\n", w2); + } + else if(strcmpi(w1,"use_sql_mob_skill_db")==0) { + iMap->db_use_sql_mob_skill_db = config_switch(w2); + ShowStatus ("Using monster skill database as SQL: '%s'\n", w2); } /* sql log db */ else if(strcmpi(w1,"log_db_ip")==0) @@ -5319,7 +5327,9 @@ int do_init(int argc, char *argv[]) iMap->night_flag = 0; // 0=day, 1=night [Yor] iMap->enable_spy = 0; //To enable/disable @spy commands, which consume too much cpu time when sending packets. [Skotlex] - iMap->db_use_sqldbs = 0; + iMap->db_use_sql_item_db = 0; + iMap->db_use_sql_mob_db = 0; + iMap->db_use_sql_mob_skill_db = 0; sprintf(iMap->item_db_db, "item_db"); sprintf(iMap->item_db2_db, "item_db2"); diff --git a/src/map/map.h b/src/map/map.h index 6002e56da..ec5921509 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -788,7 +788,9 @@ struct map_interface { char *MSG_CONF_NAME; char *GRF_PATH_FILENAME; - int db_use_sqldbs; + int db_use_sql_item_db; + int db_use_sql_mob_db; + int db_use_sql_mob_skill_db; char item_db_db[32]; char item_db2_db[32]; diff --git a/src/map/mob.c b/src/map/mob.c index 1e79d6b93..ad3dd50c3 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -4588,7 +4588,7 @@ static void mob_load(void) { sv->readdb(iMap->db_path, "mob_item_ratio.txt", ',', 2, 2+MAX_ITEMRATIO_MOBS, -1, &mob_readdb_itemratio); // must be read before mobdb mob_readchatdb(); - if (iMap->db_use_sqldbs) + if (iMap->db_use_sql_mob_db) { mob_read_sqldb(); mob_read_sqlskilldb(); diff --git a/src/plugins/db2sql.c b/src/plugins/db2sql.c index 8db4a006f..5cb8d52a2 100644 --- a/src/plugins/db2sql.c +++ b/src/plugins/db2sql.c @@ -49,7 +49,7 @@ int db2sql(char** str, const char* source, int line, int scriptopt) { struct item_data *it = NULL; unsigned char offset = 0; #ifdef RENEWAL - if( iMap->db_use_sqldbs ) offset = 1; + if( iMap->db_use_sql_item_db ) offset = 1; #endif if( (it = itemdb->exists(parse_dbrow(str,source,line,scriptopt))) ) { /* renewal has the 'matk' and 'equip_level' is now 'equip_level_min', and there is a new 'equip_level_max' field */ @@ -69,7 +69,7 @@ int db2sql(char** str, const char* source, int line, int scriptopt) { SqlStmt_ShowDebug(stmt); else { #ifdef RENEWAL - if( iMap->db_use_sqldbs ) offset += 1; + if( iMap->db_use_sql_item_db ) offset += 1; #endif if( it->script ) trimbraces(str[19+offset]); if ( SQL_SUCCESS != SQL->StmtBindParam(stmt, 2, SQLDT_STRING, it->script?str[19+offset]:"", it->script?strlen(str[19+offset]):0) ) @@ -98,8 +98,8 @@ int db2sql(char** str, const char* source, int line, int scriptopt) { CPCMD(db2sql) { - if( iMap->db_use_sqldbs ) { - ShowInfo("db2sql: this should not be used with 'db_use_sqldbs' enabled, skipping...\n"); + if( iMap->db_use_sql_item_db ) { + ShowInfo("db2sql: this should not be used with 'db_use_sql_item_db' enabled, skipping...\n"); return; } |