summaryrefslogtreecommitdiff
path: root/src/map/mapreg.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/mapreg.h')
-rw-r--r--src/map/mapreg.h56
1 files changed, 41 insertions, 15 deletions
diff --git a/src/map/mapreg.h b/src/map/mapreg.h
index e83f9e053..59d226cda 100644
--- a/src/map/mapreg.h
+++ b/src/map/mapreg.h
@@ -2,26 +2,52 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#ifndef _MAPREG_H_
-#define _MAPREG_H_
+#ifndef MAP_MAPREG_H
+#define MAP_MAPREG_H
+#include "script.h" // struct reg_db
+#include "../common/cbasetypes.h"
+#include "../common/db.h"
+
+/** Container for a mapreg value */
struct mapreg_save {
- int 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 {
+ struct reg_db regs;
+ /* */
+ bool skip_insert;
+ /* */
+ struct eri *ers; //[Ind/Hercules]
+ /* */
+ char table[32];
+ /* */
+ bool dirty; ///< Whether there are modified regs to be saved
+ /* */
+ void (*init) (void);
+ void (*final) (void);
+ /* */
+ int (*readreg) (int64 uid);
+ char* (*readregstr) (int64 uid);
+ bool (*setreg) (int64 uid, int val);
+ bool (*setregstr) (int64 uid, const char *str);
+ 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);
};
-void mapreg_reload(void);
-void mapreg_final(void);
-void mapreg_init(void);
-bool mapreg_config_read(const char* w1, const char* w2);
+struct mapreg_interface *mapreg;
-int mapreg_readreg(int uid);
-char* mapreg_readregstr(int uid);
-bool mapreg_setreg(int uid, int val);
-bool mapreg_setregstr(int uid, const char* str);
+void mapreg_defaults(void);
-#endif /* _MAPREG_H_ */
+#endif /* MAP_MAPREG_H */