From c8db14a97b3d3ba0d8a255e57d941968e265ef1c Mon Sep 17 00:00:00 2001 From: skotlex Date: Wed, 30 Aug 2006 13:56:27 +0000 Subject: - Fixed char-sql compilation - Added support for reading the item_db_db inter config settings (char-sql) - Fixed some compile warnings (functions with no arguments should have a (void) instead of ()). git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@8546 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog-Trunk.txt | 1 + src/char_sql/char.c | 4 ++++ src/char_sql/itemdb.c | 22 ++++++---------------- src/char_sql/itemdb.h | 2 ++ src/map/mercenary.c | 14 +++++++------- src/map/mercenary.h | 5 ++--- 6 files changed, 22 insertions(+), 26 deletions(-) diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 2cc77a1c5..e4c091c32 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -4,6 +4,7 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. 2006/08/30 + * Fixed up char-sql compilation. [Skotlex] * Added a message to @clearweather stating when climate changes will dispel. [Skotlex] * Corrected @hidenpc saying that it's command name was "@npcoff" [Skotlex] diff --git a/src/char_sql/char.c b/src/char_sql/char.c index d5d1395a7..3a21f2ebb 100644 --- a/src/char_sql/char.c +++ b/src/char_sql/char.c @@ -4016,6 +4016,10 @@ void sql_config_read(const char *cfgName){ /* Kalaspuff, to get login_db */ }else if(strcmpi(w1,"use_sql_db")==0){ // added for sql item_db read for char server [Valaris] db_use_sqldbs = config_switch(w2); ShowStatus("Using SQL dbs: %s\n",w2); + }else if(strcmpi(w1,"item_db_db")==0){ + strcpy(item_db_db,w2); + }else if(strcmpi(w1,"item_db2_db")==0){ + strcpy(item_db2_db,w2); } else if(strcmpi(w1,"connection_ping_interval")==0) { connection_ping_interval = config_switch(w2); //custom columns for login database diff --git a/src/char_sql/itemdb.c b/src/char_sql/itemdb.c index f2f38efb5..a8148f866 100644 --- a/src/char_sql/itemdb.c +++ b/src/char_sql/itemdb.c @@ -19,6 +19,7 @@ //#define ITEMDB_OVERRIDE_NAME_VERBOSE 1 char item_db_db[256]="item_db"; // added to specify item_db sql table [Valaris] +char item_db2_db[256]="item_db2"; static struct dbt* item_db; @@ -168,8 +169,8 @@ static int itemdb_read_sqldb(void) // sql item_db read, shortened version of map sprintf(tmp_sql, "SELECT * FROM `%s`", item_db_name[i]); // Execute the query; if the query execution succeeded... - if (mysql_query(&mmysql_handle, tmp_sql) == 0) { - sql_res = mysql_store_result(&mmysql_handle); + if (mysql_query(&mysql_handle, tmp_sql) == 0) { + sql_res = mysql_store_result(&mysql_handle); // If the storage of the query result succeeded... if (sql_res) { @@ -203,14 +204,14 @@ static int itemdb_read_sqldb(void) // sql item_db read, shortened version of map ShowStatus("Done reading '"CL_WHITE"%lu"CL_RESET"' entries in '"CL_WHITE"%s"CL_RESET"'.\n", ln, item_db_name[i]); ln = 0; } else { - ShowSQL("DB error (%s) - %s\n",item_db_name[i], mysql_error(&mmysql_handle)); + ShowSQL("DB error (%s) - %s\n",item_db_name[i], mysql_error(&mysql_handle)); ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql); } // Free the query result mysql_free_result(sql_res); } else { - ShowSQL("DB error (%s) - %s\n",item_db_name[i], mysql_error(&mmysql_handle)); + ShowSQL("DB error (%s) - %s\n",item_db_name[i], mysql_error(&mysql_handle)); ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql); } } @@ -218,17 +219,6 @@ static int itemdb_read_sqldb(void) // sql item_db read, shortened version of map return 0; } -static int itemdb_final(DBKey key,void *data,va_list ap) -{ - struct item_data *id = (struct item_data*)data; - if(id->use_script) - aFree(id->use_script); - if(id->equip_script) - aFree(id->equip_script); - return 0; -} - - /*========================================== * *------------------------------------------ @@ -236,7 +226,7 @@ static int itemdb_final(DBKey key,void *data,va_list ap) void do_final_itemdb(void) { if(item_db){ - item_db->destroy(item_db,itemdb_final); + item_db->destroy(item_db,NULL); item_db=NULL; } } diff --git a/src/char_sql/itemdb.h b/src/char_sql/itemdb.h index 972df5385..d19dd498c 100644 --- a/src/char_sql/itemdb.h +++ b/src/char_sql/itemdb.h @@ -29,6 +29,8 @@ struct item_data { int type; }; +extern char item_db_db[256]; +extern char item_db2_db[256]; struct item_data* itemdb_search(int nameid); #define itemdb_type(n) itemdb_search(n)->type diff --git a/src/map/mercenary.c b/src/map/mercenary.c index 472f402c6..2c3cbdf52 100644 --- a/src/map/mercenary.c +++ b/src/map/mercenary.c @@ -793,7 +793,7 @@ void merc_hom_revive(struct homun_data *hd, unsigned int hp, unsigned int sp) clif_homskillinfoblock(sd); } -int read_homunculusdb() +int read_homunculusdb(void) { FILE *fp; char line[1024], *p; @@ -881,7 +881,7 @@ int read_homunculusdb() return 0; } -int read_homunculus_skilldb() +int read_homunculus_skilldb(void) { FILE *fp; char line[1024], *p; @@ -949,7 +949,7 @@ int read_homunculus_skilldb() return 0; } -void read_homunculus_expdb() +void read_homunculus_expdb(void) { FILE *fp; char line[1024]; @@ -985,18 +985,18 @@ void read_homunculus_expdb() } } -void merc_reload() +void merc_reload(void) { read_homunculusdb(); read_homunculus_expdb(); } -void merc_skill_reload() +void merc_skill_reload(void) { read_homunculus_skilldb(); } -int do_init_merc() +int do_init_merc(void) { read_homunculusdb(); read_homunculus_expdb(); @@ -1006,4 +1006,4 @@ int do_init_merc() return 0; } -int do_final_merc(); +int do_final_merc(void); diff --git a/src/map/mercenary.h b/src/map/mercenary.h index bf30d7fe0..d116db77e 100644 --- a/src/map/mercenary.h +++ b/src/map/mercenary.h @@ -75,6 +75,5 @@ int merc_hom_increase_intimacy(struct homun_data * hd, unsigned int value); int merc_hom_decrease_intimacy(struct homun_data * hd, unsigned int value); int merc_skill_tree_get_max(int id, int b_class); void merc_hom_init_timers(struct homun_data * hd); -void merc_skill_reload(); -void merc_reload(); - +void merc_skill_reload(void); +void merc_reload(void); -- cgit v1.2.3-70-g09d2