summaryrefslogtreecommitdiff
path: root/src/map/mapreg.h
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2014-02-24 09:17:02 +0100
committerHaru <haru@dotalux.com>2014-03-05 22:35:02 +0100
commit78bf8d26567a2054bd9ff5268f9f73cb07d82b98 (patch)
tree68e5deedd9525d05151840c6446460add55d799e /src/map/mapreg.h
parentd554d61417a6e7f48de96efcc69872e0b7b65da3 (diff)
downloadhercules-78bf8d26567a2054bd9ff5268f9f73cb07d82b98.tar.gz
hercules-78bf8d26567a2054bd9ff5268f9f73cb07d82b98.tar.bz2
hercules-78bf8d26567a2054bd9ff5268f9f73cb07d82b98.tar.xz
hercules-78bf8d26567a2054bd9ff5268f9f73cb07d82b98.zip
Ref redesign, part 1
- Moved string and numeric mapregs into the same DBMap (for consistency with the other reg types.) Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/mapreg.h')
-rw-r--r--src/map/mapreg.h18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/map/mapreg.h b/src/map/mapreg.h
index c92b6f602..246f5b744 100644
--- a/src/map/mapreg.h
+++ b/src/map/mapreg.h
@@ -8,19 +8,19 @@
#include "../common/cbasetypes.h"
#include "../common/db.h"
+/** Container for a mapreg value */
struct mapreg_save {
- int64 uid;
+ int64 uid; ///< Unique ID
union {
- int i;
- char *str;
+ int i; ///< Numeric value
+ char *str; ///< String value
} u;
- bool save;
+ bool is_string; ///< true if it's a string, false if it's a number
+ bool save; ///< Whether a save operation is pending
};
struct mapreg_interface {
- DBMap *db; // int var_id -> int value
- /* TODO duck str_db, use same */
- DBMap *str_db; // int var_id -> char* value
+ DBMap *db; // int var_id -> struct mapreg_save
/* */
DBMap *array_db;
/* */
@@ -30,8 +30,7 @@ struct mapreg_interface {
/* */
char table[32];
/* */
- bool i_dirty;
- bool str_dirty;
+ bool dirty; ///< Whether there are modified regs to be saved
/* */
void (*init) (void);
void (*final) (void);
@@ -43,6 +42,7 @@ struct mapreg_interface {
void (*load) (void);
void (*save) (void);
int (*save_timer) (int tid, int64 tick, int id, intptr_t data);
+ int (*destroyreg) (DBKey key, DBData *data, va_list ap);
void (*reload) (void);
bool (*config_read) (const char *w1, const char *w2);
};