diff options
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/mapreg.h | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/src/map/mapreg.h b/src/map/mapreg.h index 495d75102..4318eaea8 100644 --- a/src/map/mapreg.h +++ b/src/map/mapreg.h @@ -21,44 +21,42 @@ #ifndef MAP_MAPREG_H #define MAP_MAPREG_H -#include "map/script.h" // struct reg_db -#include "common/hercules.h" +#include "map/script.h" #include "common/db.h" +#include "common/hercules.h" -/* Forward Declarations */ -struct config_setting_t; // common/conf.h +/** Forward Declarations **/ +struct config_setting_t; struct eri; -#define MAPREG_AUTOSAVE_INTERVAL (300 * 1000) +#ifndef MAPREG_AUTOSAVE_INTERVAL +#define MAPREG_AUTOSAVE_INTERVAL (300 * 1000) //!< Interval for auto-saving permanent global variables to the database in milliseconds. +#endif /** MAPREG_AUTOSAVE_INTERVAL **/ -/** Container for a mapreg value */ +/** Global variable structure. **/ struct mapreg_save { - int64 uid; ///< Unique ID - union { - int i; ///< Numeric value - char *str; ///< String value + int64 uid; //!< The variable's unique ID. + union value { //!< The variable's value container. + int i; //!< The variable's integer value. + char *str; //!< The variable's string value. } u; - bool is_string; ///< true if it's a string, false if it's a number - bool save; ///< Whether a save operation is pending + bool is_string; //!< Whether the variable's value is a string. + bool save; //!< Whether the variable's save operation is pending. }; +/** The mapreg interface structure. **/ struct mapreg_interface { - struct reg_db regs; - /* */ - bool skip_insert; - /* */ - struct eri *ers; //[Ind/Hercules] - /* */ - char num_db[32]; //!< Name of SQL table which holds permanent global integer variables. - char str_db[32]; //!< Name of SQL table which holds permanent global string variables. - /* */ - bool dirty; ///< Whether there are modified regs to be saved - /* */ - void (*init) (void); - void (*final) (void); - /* */ + /** Interface variables. **/ + struct eri *ers; //!< Entry manager for global variables. + struct reg_db regs; //!< Generic database for global variables. + bool dirty; //!< Whether there are modified global variables to be saved. + bool skip_insert; //!< Whether to skip inserting the variable into the SQL database in mapreg_set_*_db(). + char num_db[32]; //!< Name of SQL table which holds permanent global integer variables. + char str_db[32]; //!< Name of SQL table which holds permanent global string variables. + + /** Interface functions. **/ int (*readreg) (int64 uid); - char* (*readregstr) (int64 uid); + char *(*readregstr) (int64 uid); bool (*set_num_db) (int64 uid, const char *name, unsigned int index, int value); bool (*delete_num_db) (int64 uid, const char *name, unsigned int index); bool (*setreg) (int64 uid, int val); @@ -75,12 +73,14 @@ struct mapreg_interface { int (*destroyreg) (union DBKey key, struct DBData *data, va_list ap); void (*reload) (void); bool (*config_read_registry) (const char *filename, const struct config_setting_t *config, bool imported); + void (*final) (void); + void (*init) (void); }; #ifdef HERCULES_CORE void mapreg_defaults(void); -#endif // HERCULES_CORE +#endif /** HERCULES_CORE **/ HPShared struct mapreg_interface *mapreg; -#endif /* MAP_MAPREG_H */ +#endif /** MAP_MAPREG_H **/ |