summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenpachi Developer <Kenpachi.Developer@gmx.de>2020-05-12 03:44:00 +0200
committerKenpachi Developer <Kenpachi.Developer@gmx.de>2020-05-12 06:46:02 +0200
commitfeaae9bc9244ee3c3f8968980b17c69d0ccd710f (patch)
treed7751482539cc3303e0c3dd5351a81f40899dc0e
parent30b7c9dee6c19568820b1e6042212bbda21e02e6 (diff)
downloadhercules-feaae9bc9244ee3c3f8968980b17c69d0ccd710f.tar.gz
hercules-feaae9bc9244ee3c3f8968980b17c69d0ccd710f.tar.bz2
hercules-feaae9bc9244ee3c3f8968980b17c69d0ccd710f.tar.xz
hercules-feaae9bc9244ee3c3f8968980b17c69d0ccd710f.zip
Apply code style to mapreg.h
-rw-r--r--src/map/mapreg.h58
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 **/