diff options
author | gepard1984 <gepard1984@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2012-03-13 15:20:58 +0000 |
---|---|---|
committer | gepard1984 <gepard1984@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2012-03-13 15:20:58 +0000 |
commit | d09a65227657845550ba2ea310c5cf669646d433 (patch) | |
tree | ccadc7a28c93df704d269717cd29aa68098b9fa4 /src/map | |
parent | dc5babf8c3fb943a22c440f5afd6957b121926c5 (diff) | |
download | hercules-d09a65227657845550ba2ea310c5cf669646d433.tar.gz hercules-d09a65227657845550ba2ea310c5cf669646d433.tar.bz2 hercules-d09a65227657845550ba2ea310c5cf669646d433.tar.xz hercules-d09a65227657845550ba2ea310c5cf669646d433.zip |
- Added missing parameter to `db_iput` and `db_uiput` macros (follow-up to r15682).
- Numeric global variables (mapreg) now utilize `DBMap`'s ability to store integer-type data (follow-up to r15682).
- Minor code cleanup: replaced some `DBMap` function calls with macros.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@15683 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/mapreg_sql.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/map/mapreg_sql.c b/src/map/mapreg_sql.c index c8b177c7e..7782f7f02 100644 --- a/src/map/mapreg_sql.c +++ b/src/map/mapreg_sql.c @@ -24,13 +24,13 @@ static bool mapreg_dirty = false; /// Looks up the value of an integer variable using its uid. int mapreg_readreg(int uid) { - return (int)idb_get(mapreg_db, uid); + return idb_iget(mapreg_db, uid); } /// Looks up the value of a string variable using its uid. char* mapreg_readregstr(int uid) { - return (char*)idb_get(mapregstr_db, uid); + return idb_get(mapregstr_db, uid); } /// Modifies the value of an integer variable. @@ -42,10 +42,10 @@ bool mapreg_setreg(int uid, int val) if( val != 0 ) { - if( idb_put(mapreg_db,uid,(void*)val) ) + if( idb_iput(mapreg_db,uid,val) ) mapreg_dirty = true; // already exists, delay write else if(name[1] != '@') - {// write new wariable to database + {// write new variable to database char tmp_str[32*2+1]; Sql_EscapeStringLen(mmysql_handle, tmp_str, name, strnlen(name, 32)); if( SQL_ERROR == Sql_Query(mmysql_handle, "INSERT INTO `%s`(`varname`,`index`,`value`) VALUES ('%s','%d','%d')", mapreg_table, tmp_str, i, val) ) @@ -134,7 +134,7 @@ static void script_load_mapreg(void) if( varname[length-1] == '$' ) idb_put(mapregstr_db, (i<<24)|s, aStrdup(value)); else - idb_put(mapreg_db, (i<<24)|s, (void *)atoi(value)); + idb_iput(mapreg_db, (i<<24)|s, atoi(value)); } SqlStmt_Free(stmt); @@ -159,7 +159,7 @@ static void script_save_mapreg(void) if( name[1] == '@' ) continue; - if( SQL_ERROR == Sql_Query(mmysql_handle, "UPDATE `%s` SET `value`='%d' WHERE `varname`='%s' AND `index`='%d'", mapreg_table, (int)db_data2ptr(data), name, i) ) + if( SQL_ERROR == Sql_Query(mmysql_handle, "UPDATE `%s` SET `value`='%d' WHERE `varname`='%s' AND `index`='%d'", mapreg_table, db_data2i(data), name, i) ) Sql_ShowDebug(mmysql_handle); } dbi_destroy(iter); @@ -198,8 +198,8 @@ void mapreg_reload(void) if( mapreg_dirty ) script_save_mapreg(); - mapreg_db->clear(mapreg_db, NULL); - mapregstr_db->clear(mapregstr_db, NULL); + db_clear(mapreg_db); + db_clear(mapregstr_db); script_load_mapreg(); } @@ -209,8 +209,8 @@ void mapreg_final(void) if( mapreg_dirty ) script_save_mapreg(); - mapreg_db->destroy(mapreg_db,NULL); - mapregstr_db->destroy(mapregstr_db,NULL); + db_destroy(mapreg_db); + db_destroy(mapregstr_db); } void mapreg_init(void) |