summaryrefslogtreecommitdiff
path: root/src/map/mapreg_sql.c
diff options
context:
space:
mode:
authorParadox924X <Paradox924X@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-11-21 04:07:53 +0000
committerParadox924X <Paradox924X@54d463be-8e91-2dee-dedb-b68131a5f0ec>2009-11-21 04:07:53 +0000
commit170800247a6ea58419a3cadabf19913dc8d5aaa6 (patch)
treec4e50337e81e28620ea23040eb2cb20a1e51167a /src/map/mapreg_sql.c
parent4e882d9466a4d5cd37f9dec68eeda3fde61a4966 (diff)
downloadhercules-170800247a6ea58419a3cadabf19913dc8d5aaa6.tar.gz
hercules-170800247a6ea58419a3cadabf19913dc8d5aaa6.tar.bz2
hercules-170800247a6ea58419a3cadabf19913dc8d5aaa6.tar.xz
hercules-170800247a6ea58419a3cadabf19913dc8d5aaa6.zip
Cleaned up mapreg dirty-marking code to only mark the mapreg as dirty when it actually is. (bugreport:3735)
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14158 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/mapreg_sql.c')
-rw-r--r--src/map/mapreg_sql.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/map/mapreg_sql.c b/src/map/mapreg_sql.c
index 89951fb76..e32ab30f9 100644
--- a/src/map/mapreg_sql.c
+++ b/src/map/mapreg_sql.c
@@ -43,11 +43,8 @@ bool mapreg_setreg(int uid, int val)
if( val != 0 )
{
if( idb_put(mapreg_db,uid,(void*)val) )
- ; // already exists, delay write
- else
- if( name[1] == '@' )
- ; // nothing more to do
- else
+ mapreg_dirty = true; // already exists, delay write
+ else if(name[1] != '@') {
{// write new wariable to database
char tmp_str[32*2+1];
Sql_EscapeStringLen(mmysql_handle, tmp_str, name, strnlen(name, 32));
@@ -59,16 +56,13 @@ bool mapreg_setreg(int uid, int val)
{
idb_remove(mapreg_db,uid);
- if( name[1] == '@' )
- ; // nothing more to do
- else
+ if( name[1] != '@' )
{// Remove from database because it is unused.
if( SQL_ERROR == Sql_Query(mmysql_handle, "DELETE FROM `%s` WHERE `varname`='%s' AND `index`='%d'", mapreg_table, name, i) )
Sql_ShowDebug(mmysql_handle);
}
}
- mapreg_dirty = true;
return true;
}
@@ -90,7 +84,7 @@ bool mapreg_setregstr(int uid, const char* str)
else
{
if (idb_put(mapregstr_db,uid, aStrdup(str)))
- ;
+ mapreg_dirty = true;
else if(name[1] != '@') { //put returned null, so we must insert.
// Someone is causing a database size infinite increase here without name[1] != '@' [Lance]
char tmp_str[32*2+1];
@@ -102,7 +96,6 @@ bool mapreg_setregstr(int uid, const char* str)
}
}
- mapreg_dirty = true;
return true;
}