summaryrefslogblamecommitdiff
path: root/src/map/mapreg.h
blob: 9c9a1acee7a6a3b681f653135449d4ccf9d1b832 (plain) (tree)
1
2
3
4
5
6
7
8


                                                           
 

                    
 
                                    


                                 
                                   
                    
                                         
               

                                             
            

                                                                             

  
                         
                           


                         
                                         
             
                       
             
                                                                    



                             



                                                       

                            
                                                                       
                                                                




                                                             
 
                    
                           
                       
 
                         
// Copyright (c) Hercules Dev Team, licensed under GNU GPL.
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams

#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 {
	int64 uid;         ///< Unique ID
	union {
		int i;     ///< Numeric value
		char *str; ///< 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
};

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);
};

struct mapreg_interface *mapreg;

#ifdef HERCULES_CORE
void mapreg_defaults(void);
#endif // HERCULES_CORE

#endif /* MAP_MAPREG_H */