diff options
-rw-r--r-- | src/char/char.c | 2 | ||||
-rw-r--r-- | src/char/char.h | 4 | ||||
-rw-r--r-- | src/char/int_auction.h | 6 | ||||
-rw-r--r-- | src/char/int_guild.h | 4 | ||||
-rw-r--r-- | src/char/int_party.h | 6 | ||||
-rw-r--r-- | src/char/inter.c | 2 | ||||
-rw-r--r-- | src/common/HPM.c | 2 | ||||
-rw-r--r-- | src/common/db.c | 198 | ||||
-rw-r--r-- | src/common/db.h | 107 | ||||
-rw-r--r-- | src/common/mapindex.h | 6 | ||||
-rw-r--r-- | src/common/socket.c | 2 | ||||
-rw-r--r-- | src/login/login.h | 4 | ||||
-rw-r--r-- | src/map/atcommand.h | 4 | ||||
-rw-r--r-- | src/map/battleground.h | 2 | ||||
-rw-r--r-- | src/map/channel.h | 8 | ||||
-rw-r--r-- | src/map/chat.h | 5 | ||||
-rw-r--r-- | src/map/chrif.h | 2 | ||||
-rw-r--r-- | src/map/guild.h | 8 | ||||
-rw-r--r-- | src/map/itemdb.h | 4 | ||||
-rw-r--r-- | src/map/map.h | 20 | ||||
-rw-r--r-- | src/map/npc.c | 2 | ||||
-rw-r--r-- | src/map/npc.h | 8 | ||||
-rw-r--r-- | src/map/party.h | 4 | ||||
-rw-r--r-- | src/map/pc.h | 4 | ||||
-rw-r--r-- | src/map/pc_groups.h | 6 | ||||
-rw-r--r-- | src/map/script.c | 10 | ||||
-rw-r--r-- | src/map/script.h | 12 | ||||
-rw-r--r-- | src/map/skill.h | 12 | ||||
-rw-r--r-- | src/map/storage.h | 2 | ||||
-rw-r--r-- | src/map/vending.h | 5 | ||||
-rw-r--r-- | src/plugins/HPMHooking.c | 2 |
31 files changed, 239 insertions, 224 deletions
diff --git a/src/char/char.c b/src/char/char.c index 01262fdcb..929473e33 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -162,7 +162,7 @@ unsigned short skillid2idx[MAX_SKILL_ID]; //----------------------------------------------------- #define AUTH_TIMEOUT 30000 -static DBMap* auth_db; // int account_id -> struct char_auth_node* +static struct DBMap *auth_db; // int account_id -> struct char_auth_node* //----------------------------------------------------- // Online User Database diff --git a/src/char/char.h b/src/char/char.h index 4fe602c45..9cde18e96 100644 --- a/src/char/char.h +++ b/src/char/char.h @@ -98,8 +98,8 @@ struct char_interface { struct mmo_map_server server[MAX_MAP_SERVERS]; int login_fd; int char_fd; - DBMap* online_char_db; // int account_id -> struct online_char_data* - DBMap* char_db_; + struct DBMap *online_char_db; // int account_id -> struct online_char_data* + struct DBMap *char_db_; char userid[NAME_LENGTH]; char passwd[NAME_LENGTH]; char server_name[20]; diff --git a/src/char/int_auction.h b/src/char/int_auction.h index 29b068dfd..ccd5bfbf5 100644 --- a/src/char/int_auction.h +++ b/src/char/int_auction.h @@ -22,14 +22,16 @@ #define CHAR_INT_AUCTION_H #include "common/hercules.h" -#include "common/db.h" #include "common/mmo.h" +/* Forward Declarations */ +struct DBMap; // common/db.h + /** * inter_auction_interface interface **/ struct inter_auction_interface { - DBMap* db; // int auction_id -> struct auction_data* + struct DBMap *db; // int auction_id -> struct auction_data* int (*count) (int char_id, bool buy); void (*save) (struct auction_data *auction); unsigned int (*create) (struct auction_data *auction); diff --git a/src/char/int_guild.h b/src/char/int_guild.h index 31c334cbf..252c2dc47 100644 --- a/src/char/int_guild.h +++ b/src/char/int_guild.h @@ -44,8 +44,8 @@ enum { * inter_guild interface **/ struct inter_guild_interface { - DBMap* guild_db; // int guild_id -> struct guild* - DBMap* castle_db; + struct DBMap *guild_db; // int guild_id -> struct guild* + struct DBMap *castle_db; unsigned int exp[MAX_GUILDLEVEL]; int (*save_timer) (int tid, int64 tick, int id, intptr_t data); diff --git a/src/char/int_party.h b/src/char/int_party.h index e6ad75bb8..62fef4192 100644 --- a/src/char/int_party.h +++ b/src/char/int_party.h @@ -22,9 +22,11 @@ #define CHAR_INT_PARTY_H #include "common/hercules.h" -#include "common/db.h" #include "common/mmo.h" +/* Forward Declarations */ +struct DBMap; // common/db.h + //Party Flags on what to save/delete. enum { PS_CREATE = 0x01, //Create a new party entry (index holds leader's info) @@ -47,7 +49,7 @@ struct party_data { **/ struct inter_party_interface { struct party_data *pt; - DBMap* db; // int party_id -> struct party_data* + struct DBMap *db; // int party_id -> struct party_data* int (*check_lv) (struct party_data *p); void (*calc_state) (struct party_data *p); int (*tosql) (struct party *p, int flag, int index); diff --git a/src/char/inter.c b/src/char/inter.c index cf648c238..9fea2885c 100644 --- a/src/char/inter.c +++ b/src/char/inter.c @@ -83,7 +83,7 @@ struct WisData { int64 tick; unsigned char src[24], dst[24], msg[512]; }; -static DBMap* wis_db = NULL; // int wis_id -> struct WisData* +static struct DBMap *wis_db = NULL; // int wis_id -> struct WisData* static int wis_dellist[WISDELLIST_MAX], wis_delnum; #define MAX_JOB_NAMES 150 diff --git a/src/common/HPM.c b/src/common/HPM.c index fa4025fb8..d3d050d27 100644 --- a/src/common/HPM.c +++ b/src/common/HPM.c @@ -55,7 +55,7 @@ struct HPM_interface *HPM; /** * (char*) data name -> (unsigned int) HPMDataCheck[] index **/ -DBMap *datacheck_db; +struct DBMap *datacheck_db; int datacheck_version; const struct s_HPMDataCheck *datacheck_data; diff --git a/src/common/db.c b/src/common/db.c index fa1a6d65c..7abe4513a 100644 --- a/src/common/db.c +++ b/src/common/db.c @@ -110,8 +110,8 @@ struct db_interface *DB; * enum DBNodeColor - Enumeration of colors of the nodes. * * DBNode - Structure of a node in RED-BLACK trees. * * struct db_free - Structure that holds a deleted node to be freed. * - * DBMap_impl - Structure of the database. * - * stats - Statistics about the database system. * + * struct DBMap_impl - Structure of the database. * + * stats - Statistics about the database system. * *****************************************************************************/ /** @@ -129,7 +129,7 @@ struct db_interface *DB; /** * Size of the hashtable in the database. * @private - * @see DBMap_impl#ht + * @see struct DBMap_impl#ht */ #define HASH_SIZE (256+27) @@ -153,7 +153,7 @@ enum DBNodeColor { * @param deleted If the node is deleted * @param color Color of the node * @private - * @see DBMap_impl#ht + * @see struct DBMap_impl#ht */ typedef struct dbn { // Tree structure @@ -173,7 +173,7 @@ typedef struct dbn { * @param node Deleted node * @param root Address to the root of the tree * @private - * @see DBMap_impl#free_list + * @see struct DBMap_impl#free_list */ struct db_free { DBNode *node; @@ -202,7 +202,7 @@ struct db_free { * @private * @see #db_alloc() */ -typedef struct DBMap_impl { +struct DBMap_impl { // Database interface struct DBMap vtable; // File and line of allocation @@ -225,7 +225,7 @@ typedef struct DBMap_impl { uint32 item_count; unsigned short maxlen; unsigned global_lock : 1; -} DBMap_impl; +}; /** * Complete iterator structure. @@ -235,13 +235,13 @@ typedef struct DBMap_impl { * @param node Current node * @private * @see struct DBIterator - * @see #DBMap_impl + * @see struct DBMap_impl * @see #DBNode */ struct DBIterator_impl { // Iterator interface struct DBIterator vtable; - DBMap_impl* db; + struct DBMap_impl *db; int ht_index; DBNode *node; }; @@ -509,7 +509,7 @@ static void db_rebalance(DBNode *node, DBNode **root) * @private * @see #db_rotate_left(DBNode *,DBNode **) * @see #db_rotate_right(DBNode *,DBNode **) - * @see #db_free_unlock(DBMap_impl*) + * @see #db_free_unlock() */ static void db_rebalance_erase(DBNode *node, DBNode **root) { @@ -671,12 +671,12 @@ static int db_is_key_null(enum DBType type, union DBKey key) * @param key Key to be duplicated * @param Duplicated key * @private - * @see #db_free_add(DBMap_impl*,DBNode *,DBNode **) - * @see #db_free_remove(DBMap_impl*,DBNode *) + * @see #db_free_add() + * @see #db_free_remove() * @see #db_obj_put() * @see #db_dup_key_free() */ -static union DBKey db_dup_key(DBMap_impl* db, union DBKey key) +static union DBKey db_dup_key(struct DBMap_impl *db, union DBKey key) { char *str; size_t len; @@ -704,7 +704,7 @@ static union DBKey db_dup_key(DBMap_impl* db, union DBKey key) * @private * @see #db_dup_key() */ -static void db_dup_key_free(DBMap_impl* db, union DBKey key) +static void db_dup_key_free(struct DBMap_impl *db, union DBKey key) { DB_COUNTSTAT(db_dup_key_free); switch (db->type) { @@ -727,13 +727,13 @@ static void db_dup_key_free(DBMap_impl* db, union DBKey key) * @param node Target node * @private * @see #struct db_free - * @see DBMap_impl#free_list - * @see DBMap_impl#free_count - * @see DBMap_impl#free_max + * @see struct DBMap_impl#free_list + * @see struct DBMap_impl#free_count + * @see struct DBMap_impl#free_max * @see #db_obj_remove() - * @see #db_free_remove(DBMap_impl*,DBNode *) + * @see #db_free_remove() */ -static void db_free_add(DBMap_impl* db, DBNode *node, DBNode **root) +static void db_free_add(struct DBMap_impl *db, DBNode *node, DBNode **root) { union DBKey old_key; @@ -777,12 +777,12 @@ static void db_free_add(DBMap_impl* db, DBNode *node, DBNode **root) * @param node Node being removed from free_list * @private * @see #struct db_free - * @see DBMap_impl#free_list - * @see DBMap_impl#free_count + * @see struct DBMap_impl#free_list + * @see struct DBMap_impl#free_count * @see #db_obj_put() - * @see #db_free_add(DBMap_impl*,DBNode**,DBNode*) + * @see #db_free_add() */ -static void db_free_remove(DBMap_impl* db, DBNode *node) +static void db_free_remove(struct DBMap_impl *db, DBNode *node) { unsigned int i; @@ -808,10 +808,10 @@ static void db_free_remove(DBMap_impl* db, DBNode *node) * Increment the free_lock of the database. * @param db Target database * @private - * @see DBMap_impl#free_lock - * @see #db_unlock(DBMap_impl*) + * @see struct DBMap_impl#free_lock + * @see #db_unlock() */ -static void db_free_lock(DBMap_impl* db) +static void db_free_lock(struct DBMap_impl *db) { DB_COUNTSTAT(db_free_lock); if (db->free_lock == (unsigned int)~0) { @@ -830,11 +830,11 @@ static void db_free_lock(DBMap_impl* db) * NOTE: Frees the duplicated keys of the nodes * @param db Target database * @private - * @see DBMap_impl#free_lock + * @see struct DBMap_impl#free_lock * @see #db_free_dbn(DBNode*) - * @see #db_lock(DBMap_impl*) + * @see #db_lock() */ -static void db_free_unlock(DBMap_impl* db) +static void db_free_unlock(struct DBMap_impl *db) { unsigned int i; @@ -1461,7 +1461,7 @@ bool dbit_obj_exists(struct DBIterator *self) * @param out_data Data of the removed entry. * @return 1 if entry was removed, 0 otherwise * @protected - * @see DBMap#remove + * @see struct DBMap#remove() * @see struct DBIterator#remove() */ int dbit_obj_remove(struct DBIterator *self, struct DBData *out_data) @@ -1474,7 +1474,7 @@ int dbit_obj_remove(struct DBIterator *self, struct DBData *out_data) node = it->node; if( node && !node->deleted ) { - DBMap_impl* db = it->db; + struct DBMap_impl *db = it->db; if( db->cache == node ) db->cache = NULL; db->release(node->key, node->data, DB_RELEASE_DATA); @@ -1511,9 +1511,9 @@ void dbit_obj_destroy(struct DBIterator *self) * @return New iterator * @protected */ -static struct DBIterator *db_obj_iterator(DBMap* self) +static struct DBIterator *db_obj_iterator(struct DBMap *self) { - DBMap_impl* db = (DBMap_impl*)self; + struct DBMap_impl *db = (struct DBMap_impl *)self; struct DBIterator_impl *it; DB_COUNTSTAT(db_iterator); @@ -1541,11 +1541,11 @@ static struct DBIterator *db_obj_iterator(DBMap* self) * @param key Key that identifies the entry * @return true is the entry exists * @protected - * @see DBMap#exists + * @see struct DBMap#exists() */ -static bool db_obj_exists(DBMap* self, union DBKey key) +static bool db_obj_exists(struct DBMap *self, union DBKey key) { - DBMap_impl* db = (DBMap_impl*)self; + struct DBMap_impl *db = (struct DBMap_impl *)self; DBNode *node; bool found = false; @@ -1591,11 +1591,11 @@ static bool db_obj_exists(DBMap* self, union DBKey key) * @param key Key that identifies the entry * @return Data of the entry or NULL if not found * @protected - * @see DBMap#get + * @see struct DBMap#get() */ -static struct DBData *db_obj_get(DBMap* self, union DBKey key) +static struct DBData *db_obj_get(struct DBMap *self, union DBKey key) { - DBMap_impl* db = (DBMap_impl*)self; + struct DBMap_impl *db = (struct DBMap_impl *)self; DBNode *node; struct DBData *data = NULL; @@ -1650,11 +1650,11 @@ static struct DBData *db_obj_get(DBMap* self, union DBKey key) * @param ... Extra arguments for match * @return The number of entries that matched * @protected - * @see DBMap#vgetall + * @see struct DBMap#vgetall() */ -static unsigned int db_obj_vgetall(DBMap* self, struct DBData **buf, unsigned int max, DBMatcher match, va_list args) +static unsigned int db_obj_vgetall(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, va_list args) { - DBMap_impl* db = (DBMap_impl*)self; + struct DBMap_impl *db = (struct DBMap_impl *)self; unsigned int i; DBNode *node; DBNode *parent; @@ -1707,7 +1707,8 @@ static unsigned int db_obj_vgetall(DBMap* self, struct DBData **buf, unsigned in } /** - * Just calls {@link DBMap#vgetall}. + * Just calls struct DBMap#vgetall(). + * * Get the data of the entries matched by <code>match</code>. * It puts a maximum of <code>max</code> entries into <code>buf</code>. * If <code>buf</code> is NULL, it only counts the matches. @@ -1721,10 +1722,10 @@ static unsigned int db_obj_vgetall(DBMap* self, struct DBData **buf, unsigned in * @param ... Extra arguments for match * @return The number of entries that matched * @protected - * @see DBMap#vgetall - * @see DBMap#getall + * @see struct DBMap#vgetall() + * @see struct DBMap#getall() */ -static unsigned int db_obj_getall(DBMap* self, struct DBData **buf, unsigned int max, DBMatcher match, ...) +static unsigned int db_obj_getall(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, ...) { va_list args; unsigned int ret; @@ -1748,11 +1749,11 @@ static unsigned int db_obj_getall(DBMap* self, struct DBData **buf, unsigned int * @param args Extra arguments for create * @return Data of the entry * @protected - * @see DBMap#vensure + * @see struct DBMap#vensure() */ -static struct DBData *db_obj_vensure(DBMap* self, union DBKey key, DBCreateData create, va_list args) +static struct DBData *db_obj_vensure(struct DBMap *self, union DBKey key, DBCreateData create, va_list args) { - DBMap_impl* db = (DBMap_impl*)self; + struct DBMap_impl *db = (struct DBMap_impl *)self; DBNode *node; DBNode *parent = NULL; unsigned int hash; @@ -1837,7 +1838,8 @@ static struct DBData *db_obj_vensure(DBMap* self, union DBKey key, DBCreateData } /** - * Just calls {@link DBMap#vensure}. + * Just calls struct DBMap#vensure(). + * * Get the data of the entry identified by the key. * If the entry does not exist, an entry is added with the data returned by * <code>create</code>. @@ -1847,10 +1849,10 @@ static struct DBData *db_obj_vensure(DBMap* self, union DBKey key, DBCreateData * @param ... Extra arguments for create * @return Data of the entry * @protected - * @see DBMap#vensure - * @see DBMap#ensure + * @see struct DBMap#vensure() + * @see struct DBMap#ensure() */ -static struct DBData *db_obj_ensure(DBMap* self, union DBKey key, DBCreateData create, ...) +static struct DBData *db_obj_ensure(struct DBMap *self, union DBKey key, DBCreateData create, ...) { va_list args; struct DBData *ret = NULL; @@ -1875,13 +1877,13 @@ static struct DBData *db_obj_ensure(DBMap* self, union DBKey key, DBCreateData c * @return 1 if if the entry already exists, 0 otherwise * @protected * @see #db_malloc_dbn(void) - * @see DBMap#put + * @see struct DBMap#put() * FIXME: If this method fails shouldn't it return another value? * Other functions rely on this to know if they were able to put something [Panikon] */ -static int db_obj_put(DBMap* self, union DBKey key, struct DBData data, struct DBData *out_data) +static int db_obj_put(struct DBMap *self, union DBKey key, struct DBData data, struct DBData *out_data) { - DBMap_impl* db = (DBMap_impl*)self; + struct DBMap_impl *db = (struct DBMap_impl *)self; DBNode *node; DBNode *parent = NULL; int c = 0, retval = 0; @@ -1975,18 +1977,18 @@ static int db_obj_put(DBMap* self, union DBKey key, struct DBData data, struct D /** * Remove an entry from the database. * Puts the previous data in out_data, if out_data is not NULL. (unless data has been released) - * NOTE: The key (of the database) is released in {@link #db_free_add(DBMap_impl*,DBNode*,DBNode **)}. + * NOTE: The key (of the database) is released in #db_free_add(). * @param self Interface of the database * @param key Key that identifies the entry * @param out_data Previous data if the entry exists * @return 1 if if the entry already exists, 0 otherwise * @protected - * @see #db_free_add(DBMap_impl*,DBNode*,DBNode **) - * @see DBMap#remove + * @see #db_free_add() + * @see struct DBMap#remove() */ -static int db_obj_remove(DBMap* self, union DBKey key, struct DBData *out_data) +static int db_obj_remove(struct DBMap *self, union DBKey key, struct DBData *out_data) { - DBMap_impl* db = (DBMap_impl*)self; + struct DBMap_impl *db = (struct DBMap_impl *)self; DBNode *node; unsigned int hash; int retval = 0; @@ -2037,11 +2039,11 @@ static int db_obj_remove(DBMap* self, union DBKey key, struct DBData *out_data) * @param args Extra arguments for func * @return Sum of the values returned by func * @protected - * @see DBMap#vforeach + * @see struct DBMap#vforeach() */ -static int db_obj_vforeach(DBMap* self, DBApply func, va_list args) +static int db_obj_vforeach(struct DBMap *self, DBApply func, va_list args) { - DBMap_impl* db = (DBMap_impl*)self; + struct DBMap_impl *db = (struct DBMap_impl *)self; unsigned int i; int sum = 0; DBNode *node; @@ -2088,7 +2090,8 @@ static int db_obj_vforeach(DBMap* self, DBApply func, va_list args) } /** - * Just calls {@link DBMap#vforeach}. + * Just calls struct DBMap#vforeach(). + * * Apply <code>func</code> to every entry in the database. * Returns the sum of values returned by func. * @param self Interface of the database @@ -2096,10 +2099,10 @@ static int db_obj_vforeach(DBMap* self, DBApply func, va_list args) * @param ... Extra arguments for func * @return Sum of the values returned by func * @protected - * @see DBMap#vforeach - * @see DBMap#foreach + * @see struct DBMap#vforeach() + * @see struct DBMap#foreach() */ -static int db_obj_foreach(DBMap* self, DBApply func, ...) +static int db_obj_foreach(struct DBMap *self, DBApply func, ...) { va_list args; int ret; @@ -2123,11 +2126,11 @@ static int db_obj_foreach(DBMap* self, DBApply func, ...) * @param args Extra arguments for func * @return Sum of values returned by func * @protected - * @see DBMap#vclear + * @see struct DBMap#vclear() */ -static int db_obj_vclear(DBMap* self, DBApply func, va_list args) +static int db_obj_vclear(struct DBMap *self, DBApply func, va_list args) { - DBMap_impl* db = (DBMap_impl*)self; + struct DBMap_impl *db = (struct DBMap_impl *)self; int sum = 0; unsigned int i; DBNode *node; @@ -2184,7 +2187,8 @@ static int db_obj_vclear(DBMap* self, DBApply func, va_list args) } /** - * Just calls {@link DBMap#vclear}. + * Just calls struct DBMap#vclear(). + * * Removes all entries from the database. * Before deleting an entry, func is applied to it. * Releases the key and the data. @@ -2196,10 +2200,10 @@ static int db_obj_vclear(DBMap* self, DBApply func, va_list args) * @param ... Extra arguments for func * @return Sum of values returned by func * @protected - * @see DBMap#vclear - * @see DBMap#clear + * @see struct DBMap#vclear() + * @see struct DBMap#clear() */ -static int db_obj_clear(DBMap* self, DBApply func, ...) +static int db_obj_clear(struct DBMap *self, DBApply func, ...) { va_list args; int ret; @@ -2224,11 +2228,11 @@ static int db_obj_clear(DBMap* self, DBApply func, ...) * @param args Extra arguments for func * @return Sum of values returned by func * @protected - * @see DBMap#vdestroy + * @see struct DBMap#vdestroy() */ -static int db_obj_vdestroy(DBMap* self, DBApply func, va_list args) +static int db_obj_vdestroy(struct DBMap *self, DBApply func, va_list args) { - DBMap_impl* db = (DBMap_impl*)self; + struct DBMap_impl *db = (struct DBMap_impl *)self; int sum; DB_COUNTSTAT(db_vdestroy); @@ -2267,7 +2271,7 @@ static int db_obj_vdestroy(DBMap* self, DBApply func, va_list args) } /** - * Just calls {@link DBMap#db_vdestroy}. + * Just calls struct DBMap#db_vdestroy(). * Finalize the database, feeing all the memory it uses. * Before deleting an entry, func is applied to it. * Releases the key and the data. @@ -2279,10 +2283,10 @@ static int db_obj_vdestroy(DBMap* self, DBApply func, va_list args) * @param ... Extra arguments for func * @return Sum of values returned by func * @protected - * @see DBMap#vdestroy - * @see DBMap#destroy + * @see struct DBMap#vdestroy() + * @see struct DBMap#destroy() */ -static int db_obj_destroy(DBMap* self, DBApply func, ...) +static int db_obj_destroy(struct DBMap *self, DBApply func, ...) { va_list args; int ret; @@ -2301,12 +2305,12 @@ static int db_obj_destroy(DBMap* self, DBApply func, ...) * @param self Interface of the database * @return Size of the database * @protected - * @see DBMap_impl#item_count - * @see DBMap#size + * @see struct DBMap_impl#item_count + * @see struct DBMap#size() */ -static unsigned int db_obj_size(DBMap* self) +static unsigned int db_obj_size(struct DBMap *self) { - DBMap_impl* db = (DBMap_impl*)self; + struct DBMap_impl *db = (struct DBMap_impl *)self; unsigned int item_count; DB_COUNTSTAT(db_size); @@ -2324,12 +2328,12 @@ static unsigned int db_obj_size(DBMap* self) * @param self Interface of the database * @return Type of the database * @protected - * @see DBMap_impl#type - * @see DBMap#type + * @see struct DBMap_impl#type + * @see struct DBMap#type() */ -static enum DBType db_obj_type(DBMap* self) +static enum DBType db_obj_type(struct DBMap *self) { - DBMap_impl* db = (DBMap_impl*)self; + struct DBMap_impl *db = (struct DBMap_impl *)self; enum DBType type; DB_COUNTSTAT(db_type); @@ -2348,12 +2352,12 @@ static enum DBType db_obj_type(DBMap* self) * @param self Interface of the database * @return Options of the database * @protected - * @see DBMap_impl#options - * @see DBMap#options + * @see struct DBMap_impl#options + * @see struct DBMap#options() */ -static enum DBOptions db_obj_options(DBMap* self) +static enum DBOptions db_obj_options(struct DBMap *self) { - DBMap_impl* db = (DBMap_impl*)self; + struct DBMap_impl* db = (struct DBMap_impl *)self; enum DBOptions options; DB_COUNTSTAT(db_options); @@ -2544,12 +2548,12 @@ DBReleaser db_custom_release(enum DBReleaseOption which) * databases. If 0, the maximum number of maxlen is used (64K). * @return The interface of the database * @public - * @see #DBMap_impl + * @see struct DBMap_impl * @see #db_fix_options() */ -DBMap* db_alloc(const char *file, const char *func, int line, enum DBType type, enum DBOptions options, unsigned short maxlen) +struct DBMap *db_alloc(const char *file, const char *func, int line, enum DBType type, enum DBOptions options, unsigned short maxlen) { - DBMap_impl* db; + struct DBMap_impl *db; unsigned int i; char ers_name[50]; diff --git a/src/common/db.h b/src/common/db.h index a867b011f..60b5b32ac 100644 --- a/src/common/db.h +++ b/src/common/db.h @@ -43,7 +43,7 @@ * 2007/11/09 - Added an iterator to the database. * * 2.1 (Athena build #???#) - Portability fix * * - Fixed the portability of casting to union and added the functions * - * DBMap#ensure() and {@link DBMap#clear(DBMap,DBApply,...)}. * + * struct DBMap#ensure() and struct DBMap#clear(). * * 2.0 (Athena build 4859) - Transition version * * - Almost everything recoded with a strategy similar to objects, * * database structure is maintained. * @@ -72,12 +72,12 @@ * enum DBDataType - Enumeration of data types. * * struct DBData - Struct for used data types. * * DBApply - Format of functions applied to the databases. * - * DBMatcher - Format of matchers used in DBMap::getall. * + * DBMatcher - Format of matchers used in struct DBMap#getall(). * * DBComparator - Format of the comparators used by the databases. * * DBHasher - Format of the hashers used by the databases. * * DBReleaser - Format of the releasers used by the databases. * * struct DBIterator - Database iterator. * - * DBMap - Database interface. * + * struct DBMap - Database interface. * *****************************************************************************/ /** @@ -135,7 +135,7 @@ enum DBType { * @param DB_OPT_RELEASE_KEY Releases the key. * @param DB_OPT_RELEASE_DATA Releases the data whenever an entry is removed * from the database. - * WARNING: for functions that return the data (like DBMap::remove), + * WARNING: for functions that return the data (like struct DBMap#remove()), * a dangling pointer will be returned. * @param DB_OPT_RELEASE_BOTH Releases both key and data. * @param DB_OPT_ALLOW_NULL_KEY Allow NULL keys in the database. @@ -162,9 +162,9 @@ enum DBOptions { * @param str Type of key for DB_STRING and DB_ISTRING databases * @public * @see enum DBType - * @see DBMap#get - * @see DBMap#put - * @see DBMap#remove + * @see struct DBMap#get() + * @see struct DBMap#put() + * @see struct DBMap#remove() */ union DBKey { int i; @@ -213,8 +213,8 @@ struct DBData { * @param args Extra arguments of the function * @return Data identified by the key to be put in the database * @public - * @see DBMap#vensure - * @see DBMap#ensure + * @see struct DBMap#vensure() + * @see struct DBMap#ensure() */ typedef struct DBData (*DBCreateData)(union DBKey key, va_list args); @@ -228,10 +228,10 @@ typedef struct DBData (*DBCreateData)(union DBKey key, va_list args); * @param args Extra arguments of the function * @return Value to be added up by the function that is applying this * @public - * @see DBMap#vforeach - * @see DBMap#foreach - * @see DBMap#vdestroy - * @see DBMap#destroy + * @see struct DBMap#vforeach() + * @see struct DBMap#foreach() + * @see struct DBMap#vdestroy() + * @see struct DBMap#destroy() */ typedef int (*DBApply)(union DBKey key, struct DBData *data, va_list args); @@ -244,7 +244,7 @@ typedef int (*DBApply)(union DBKey key, struct DBData *data, va_list args); * @param args Extra arguments of the function * @return 0 if a match, another number otherwise * @public - * @see DBMap#getall + * @see struct DBMap#getall() */ typedef int (*DBMatcher)(union DBKey key, struct DBData data, va_list args); @@ -288,8 +288,6 @@ typedef uint64 (*DBHasher)(union DBKey key, unsigned short maxlen); */ typedef void (*DBReleaser)(union DBKey key, struct DBData data, enum DBReleaseOption which); -typedef struct DBMap DBMap; - /** * Database iterator. * @@ -300,7 +298,7 @@ typedef struct DBMap DBMap; * struct DBIterator#destroy() as soon as possible. * * @public - * @see #DBMap + * @see struct DBMap */ struct DBIterator { /** @@ -368,7 +366,7 @@ struct DBIterator { * @param out_data Data of the removed entry. * @return 1 if entry was removed, 0 otherwise * @protected - * @see DBMap#remove + * @see struct DBMap#remove() */ int (*remove)(struct DBIterator *self, struct DBData *out_data); @@ -398,7 +396,7 @@ struct DBMap { * @return New iterator * @protected */ - struct DBIterator *(*iterator)(DBMap* self); + struct DBIterator *(*iterator)(struct DBMap *self); /** * Returns true if the entry exists. @@ -407,7 +405,7 @@ struct DBMap { * @return true is the entry exists * @protected */ - bool (*exists)(DBMap* self, union DBKey key); + bool (*exists)(struct DBMap *self, union DBKey key); /** * Get the data of the entry identified by the key. @@ -416,10 +414,11 @@ struct DBMap { * @return Data of the entry or NULL if not found * @protected */ - struct DBData *(*get)(DBMap* self, union DBKey key); + struct DBData *(*get)(struct DBMap *self, union DBKey key); /** - * Just calls {@link DBMap#vgetall}. + * Just calls struct DBMap#vgetall(). + * * Get the data of the entries matched by <code>match</code>. * It puts a maximum of <code>max</code> entries into <code>buf</code>. * If <code>buf</code> is NULL, it only counts the matches. @@ -433,9 +432,9 @@ struct DBMap { * @param ... Extra arguments for match * @return The number of entries that matched * @protected - * @see DBMap#vgetall(DBMap*,void **,unsigned int,DBMatcher,va_list) + * @see struct DBMap#vgetall() */ - unsigned int (*getall)(DBMap* self, struct DBData **buf, unsigned int max, DBMatcher match, ...); + unsigned int (*getall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, ...); /** * Get the data of the entries matched by <code>match</code>. @@ -451,12 +450,12 @@ struct DBMap { * @param ... Extra arguments for match * @return The number of entries that matched * @protected - * @see DBMap#getall(DBMap*,void **,unsigned int,DBMatcher,...) + * @see struct DBMap#getall() */ - unsigned int (*vgetall)(DBMap* self, struct DBData **buf, unsigned int max, DBMatcher match, va_list args); + unsigned int (*vgetall)(struct DBMap *self, struct DBData **buf, unsigned int max, DBMatcher match, va_list args); /** - * Just calls DBMap#vensure. + * Just calls struct DBMap#vensure(). * * Get the data of the entry identified by the key. If the entry does * not exist, an entry is added with the data returned by `create`. @@ -467,9 +466,9 @@ struct DBMap { * @param ... Extra arguments for create * @return Data of the entry * @protected - * @see DBMap#vensure() + * @see struct DBMap#vensure() */ - struct DBData *(*ensure)(DBMap* self, union DBKey key, DBCreateData create, ...); + struct DBData *(*ensure)(struct DBMap *self, union DBKey key, DBCreateData create, ...); /** * Get the data of the entry identified by the key. @@ -481,9 +480,9 @@ struct DBMap { * @param args Extra arguments for create * @return Data of the entry * @protected - * @see DBMap#ensure() + * @see struct DBMap#ensure() */ - struct DBData *(*vensure)(DBMap* self, union DBKey key, DBCreateData create, va_list args); + struct DBData *(*vensure)(struct DBMap *self, union DBKey key, DBCreateData create, va_list args); /** * Put the data identified by the key in the database. @@ -496,7 +495,7 @@ struct DBMap { * @return 1 if if the entry already exists, 0 otherwise * @protected */ - int (*put)(DBMap* self, union DBKey key, struct DBData data, struct DBData *out_data); + int (*put)(struct DBMap *self, union DBKey key, struct DBData data, struct DBData *out_data); /** * Remove an entry from the database. @@ -508,10 +507,11 @@ struct DBMap { * @return 1 if if the entry already exists, 0 otherwise * @protected */ - int (*remove)(DBMap* self, union DBKey key, struct DBData *out_data); + int (*remove)(struct DBMap *self, union DBKey key, struct DBData *out_data); /** - * Just calls {@link DBMap#vforeach}. + * Just calls struct DBMap#vforeach(). + * * Apply <code>func</code> to every entry in the database. * Returns the sum of values returned by func. * @param self Database @@ -519,9 +519,9 @@ struct DBMap { * @param ... Extra arguments for func * @return Sum of the values returned by func * @protected - * @see DBMap#vforeach(DBMap*,DBApply,va_list) + * @see struct DBMap#vforeach() */ - int (*foreach)(DBMap* self, DBApply func, ...); + int (*foreach)(struct DBMap *self, DBApply func, ...); /** * Apply <code>func</code> to every entry in the database. @@ -531,12 +531,13 @@ struct DBMap { * @param args Extra arguments for func * @return Sum of the values returned by func * @protected - * @see DBMap#foreach(DBMap*,DBApply,...) + * @see struct DBMap#foreach() */ - int (*vforeach)(DBMap* self, DBApply func, va_list args); + int (*vforeach)(struct DBMap *self, DBApply func, va_list args); /** - * Just calls {@link DBMap#vclear}. + * Just calls struct DBMap#vclear(). + * * Removes all entries from the database. * Before deleting an entry, func is applied to it. * Releases the key and the data. @@ -546,9 +547,9 @@ struct DBMap { * @param ... Extra arguments for func * @return Sum of values returned by func * @protected - * @see DBMap#vclear(DBMap*,DBApply,va_list) + * @see struct DBMap#vclear() */ - int (*clear)(DBMap* self, DBApply func, ...); + int (*clear)(struct DBMap *self, DBApply func, ...); /** * Removes all entries from the database. @@ -560,12 +561,12 @@ struct DBMap { * @param args Extra arguments for func * @return Sum of values returned by func * @protected - * @see DBMap#clear(DBMap*,DBApply,...) + * @see struct DBMap#clear() */ - int (*vclear)(DBMap* self, DBApply func, va_list args); + int (*vclear)(struct DBMap *self, DBApply func, va_list args); /** - * Just calls {@link DBMap#vdestroy}. + * Just calls DBMap#vdestroy(). * Finalize the database, feeing all the memory it uses. * Before deleting an entry, func is applied to it. * Releases the key and the data. @@ -577,9 +578,9 @@ struct DBMap { * @param ... Extra arguments for func * @return Sum of values returned by func * @protected - * @see DBMap#vdestroy(DBMap*,DBApply,va_list) + * @see struct DBMap#vdestroy() */ - int (*destroy)(DBMap* self, DBApply func, ...); + int (*destroy)(struct DBMap *self, DBApply func, ...); /** * Finalize the database, feeing all the memory it uses. @@ -592,9 +593,9 @@ struct DBMap { * @param args Extra arguments for func * @return Sum of values returned by func * @protected - * @see DBMap#destroy(DBMap*,DBApply,...) + * @see struct DBMap#destroy() */ - int (*vdestroy)(DBMap* self, DBApply func, va_list args); + int (*vdestroy)(struct DBMap *self, DBApply func, va_list args); /** * Return the size of the database (number of items in the database). @@ -602,7 +603,7 @@ struct DBMap { * @return Size of the database * @protected */ - unsigned int (*size)(DBMap* self); + unsigned int (*size)(struct DBMap *self); /** * Return the type of the database. @@ -610,7 +611,7 @@ struct DBMap { * @return Type of the database * @protected */ - enum DBType (*type)(DBMap* self); + enum DBType (*type)(struct DBMap *self); /** * Return the options of the database. @@ -618,7 +619,7 @@ struct DBMap { * @return Options of the database * @protected */ - enum DBOptions (*options)(DBMap* self); + enum DBOptions (*options)(struct DBMap *self); }; @@ -823,13 +824,13 @@ DBReleaser (*custom_release) (enum DBReleaseOption which); * @return The interface of the database * @public * @see enum DBType - * @see #DBMap + * @see struct DBMap * @see #db_default_cmp() * @see #db_default_hash() * @see #db_default_release() * @see #db_fix_options() */ -DBMap* (*alloc) (const char *file, const char *func, int line, enum DBType type, enum DBOptions options, unsigned short maxlen); +struct DBMap *(*alloc) (const char *file, const char *func, int line, enum DBType type, enum DBOptions options, unsigned short maxlen); /** * Manual cast from 'int' to the union DBKey. diff --git a/src/common/mapindex.h b/src/common/mapindex.h index 3fb170c1f..0ebbeb04b 100644 --- a/src/common/mapindex.h +++ b/src/common/mapindex.h @@ -22,9 +22,11 @@ #define COMMON_MAPINDEX_H #include "common/hercules.h" -#include "common/db.h" #include "common/mmo.h" +/* Forward Declarations */ +struct DBMap; // common/db.h + #define MAX_MAPINDEX 2000 /* wohoo, someone look at all those |: map_default could (or *should*) be a char-server.conf */ @@ -82,7 +84,7 @@ struct mapindex_interface { char config_file[80]; /* mapname (str) -> index (int) */ - DBMap *db; + struct DBMap *db; /* number of entries in the index table */ int num; /* default map name */ diff --git a/src/common/socket.c b/src/common/socket.c index 05ac4ca01..5d4ea06a0 100644 --- a/src/common/socket.c +++ b/src/common/socket.c @@ -975,7 +975,7 @@ static int access_debug = 0; static int ddos_count = 10; static int ddos_interval = 3*1000; static int ddos_autoreset = 10*60*1000; -DBMap *connect_history = NULL; +struct DBMap *connect_history = NULL; static int connect_check_(uint32 ip); diff --git a/src/login/login.h b/src/login/login.h index 81d91eab3..1aca47c85 100644 --- a/src/login/login.h +++ b/src/login/login.h @@ -149,8 +149,8 @@ struct online_login_data { * Login.c Interface **/ struct login_interface { - DBMap* auth_db; - DBMap* online_db; + struct DBMap *auth_db; + struct DBMap *online_db; int fd; struct Login_Config *config; struct AccountDB* accounts; diff --git a/src/map/atcommand.h b/src/map/atcommand.h index 40db16bbf..0e7895825 100644 --- a/src/map/atcommand.h +++ b/src/map/atcommand.h @@ -94,8 +94,8 @@ struct atcommand_interface { struct atcmd_binding_data** binding; int binding_count; /* other vars */ - DBMap* db; //name -> AtCommandInfo - DBMap* alias_db; //alias -> AtCommandInfo + struct DBMap *db; //name -> AtCommandInfo + struct DBMap *alias_db; //alias -> AtCommandInfo /** * msg_table[lang_id][msg_id] * Server messages (0-499 reserved for GM commands, 500-999 reserved for others) diff --git a/src/map/battleground.h b/src/map/battleground.h index 05458a9b1..8657beaf8 100644 --- a/src/map/battleground.h +++ b/src/map/battleground.h @@ -102,7 +102,7 @@ struct battleground_interface { struct bg_arena **arena; unsigned char arenas; /* */ - DBMap *team_db; // int bg_id -> struct battleground_data* + struct DBMap *team_db; // int bg_id -> struct battleground_data* unsigned int team_counter; // Next bg_id /* */ void (*init) (bool minimal); diff --git a/src/map/channel.h b/src/map/channel.h index ac1c8f0cb..e8696fd90 100644 --- a/src/map/channel.h +++ b/src/map/channel.h @@ -21,12 +21,12 @@ #define MAP_CHANNEL_H #include "common/hercules.h" -#include "common/db.h" #include "common/mmo.h" /** * Declarations **/ +struct DBMap; // common/db.h struct map_session_data; struct guild; @@ -83,8 +83,8 @@ struct channel_data { char name[HCS_NAME_LENGTH]; char password[HCS_NAME_LENGTH]; unsigned char color; - DBMap *users; - DBMap *banned; + struct DBMap *users; + struct DBMap *banned; unsigned int options; unsigned int owner; enum channel_types type; @@ -94,7 +94,7 @@ struct channel_data { struct channel_interface { /* vars */ - DBMap *db; + struct DBMap *db; struct Channel_Config *config; int (*init) (bool minimal); diff --git a/src/map/chat.h b/src/map/chat.h index 603d8441f..59d61a46e 100644 --- a/src/map/chat.h +++ b/src/map/chat.h @@ -23,8 +23,9 @@ #include "map/map.h" // struct block_list, CHATROOM_TITLE_SIZE #include "common/hercules.h" -#include "common/db.h" +/* Forward Declarations */ +struct DBMap; // common/db.h struct chat_data; struct map_session_data; struct npc_data; @@ -46,7 +47,7 @@ struct chat_data { struct block_list* owner; char npc_event[EVENT_NAME_LENGTH]; /* isn't this a waste? there is a enormous overhead, wouldn't something like skill_blockpc_start be better here? [Ind] */ - DBMap* kick_list; ///< DBMap of users who were kicked from this chat + struct DBMap *kick_list; ///< DBMap of users who were kicked from this chat }; /*===================================== diff --git a/src/map/chrif.h b/src/map/chrif.h index dc946b1c1..4a1e1da47 100644 --- a/src/map/chrif.h +++ b/src/map/chrif.h @@ -72,7 +72,7 @@ struct chrif_interface { /* */ struct eri *auth_db_ers; //For re-utilizing player login structures. - DBMap* auth_db; // int id -> struct auth_node* + struct DBMap *auth_db; // int id -> struct auth_node* /* */ int packet_len_table[CHRIF_PACKET_LEN_TABLE_SIZE]; int fd; diff --git a/src/map/guild.h b/src/map/guild.h index c0191469b..1f3b74543 100644 --- a/src/map/guild.h +++ b/src/map/guild.h @@ -71,10 +71,10 @@ struct guild_interface { void (*init) (bool minimal); void (*final) (void); /* */ - DBMap* db; // int guild_id -> struct guild* - DBMap* castle_db; // int castle_id -> struct guild_castle* - DBMap* expcache_db; // int char_id -> struct guild_expcache* - DBMap* infoevent_db; // int guild_id -> struct eventlist* + struct DBMap *db; // int guild_id -> struct guild* + struct DBMap *castle_db; // int castle_id -> struct guild_castle* + struct DBMap *expcache_db; // int char_id -> struct guild_expcache* + struct DBMap *infoevent_db; // int guild_id -> struct eventlist* /* */ struct eri *expcache_ers; //For handling of guild exp payment. /* */ diff --git a/src/map/itemdb.h b/src/map/itemdb.h index 58d19db05..d33805174 100644 --- a/src/map/itemdb.h +++ b/src/map/itemdb.h @@ -589,10 +589,10 @@ struct itemdb_interface { struct item_combo **combos; unsigned short combo_count; /* */ - DBMap *names; + struct DBMap *names; /* */ struct item_data *array[MAX_ITEMDB]; - DBMap *other;// int nameid -> struct item_data* + struct DBMap *other;// int nameid -> struct item_data* struct item_data dummy; //This is the default dummy item used for non-existant items. [Skotlex] /* */ void (*read_groups) (void); diff --git a/src/map/map.h b/src/map/map.h index 9df2dd586..dbd30febf 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -1004,16 +1004,16 @@ struct map_interface { int16 index2mapid[MAX_MAPINDEX]; /* */ - DBMap* id_db; // int id -> struct block_list* - DBMap* pc_db; // int id -> struct map_session_data* - DBMap* mobid_db; // int id -> struct mob_data* - DBMap* bossid_db; // int id -> struct mob_data* (MVP db) - DBMap* map_db; // unsigned int mapindex -> struct map_data_other_server* - DBMap* nick_db; // int char_id -> struct charid2nick* (requested names of offline characters) - DBMap* charid_db; // int char_id -> struct map_session_data* - DBMap* regen_db; // int id -> struct block_list* (status_natural_heal processing) - DBMap* zone_db; // string => struct map_zone_data - DBMap* iwall_db; + struct DBMap *id_db; // int id -> struct block_list* + struct DBMap *pc_db; // int id -> struct map_session_data* + struct DBMap *mobid_db; // int id -> struct mob_data* + struct DBMap *bossid_db; // int id -> struct mob_data* (MVP db) + struct DBMap *map_db; // unsigned int mapindex -> struct map_data_other_server* + struct DBMap *nick_db; // int char_id -> struct charid2nick* (requested names of offline characters) + struct DBMap *charid_db; // int char_id -> struct map_session_data* + struct DBMap *regen_db; // int id -> struct block_list* (status_natural_heal processing) + struct DBMap *zone_db; // string => struct map_zone_data + struct DBMap *iwall_db; struct block_list **block_free; int block_free_count, block_free_lock, block_free_list_size; struct block_list **bl_list; diff --git a/src/map/npc.c b/src/map/npc.c index 291f3c172..4db5ce625 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -3625,7 +3625,7 @@ int npc_do_atcmd_event(struct map_session_data* sd, const char* command, const c */ const char *npc_parse_function(const char *w1, const char *w2, const char *w3, const char *w4, const char *start, const char *buffer, const char *filepath, int *retval) { - DBMap* func_db; + struct DBMap *func_db; struct DBData old_data; struct script_code *scriptroot; const char* end; diff --git a/src/map/npc.h b/src/map/npc.h index 5b4707d00..8ee59e410 100644 --- a/src/map/npc.h +++ b/src/map/npc.h @@ -177,10 +177,10 @@ struct npc_path_data { struct npc_interface { /* */ struct npc_data *motd; - DBMap *ev_db; // const char* event_name -> struct event_data* - DBMap *ev_label_db; // const char* label_name (without leading "::") -> struct linkdb_node** (key: struct npc_data*; data: struct event_data*) - DBMap *name_db; // const char* npc_name -> struct npc_data* - DBMap *path_db; + struct DBMap *ev_db; // const char* event_name -> struct event_data* + struct DBMap *ev_label_db; // const char* label_name (without leading "::") -> struct linkdb_node** (key: struct npc_data*; data: struct event_data*) + struct DBMap *name_db; // const char* npc_name -> struct npc_data* + struct DBMap *path_db; struct eri *timer_event_ers; //For the npc timer data. [Skotlex] struct npc_data *fake_nd; struct npc_src_list *src_files; diff --git a/src/map/party.h b/src/map/party.h index 750f7d07f..253f074bb 100644 --- a/src/map/party.h +++ b/src/map/party.h @@ -85,8 +85,8 @@ struct party_booking_ad_info { * created by Susu *-------------------------------------*/ struct party_interface { - DBMap* db; // int party_id -> struct party_data* (releases data) - DBMap* booking_db; // int char_id -> struct party_booking_ad_info* (releases data) // Party Booking [Spiria] + struct DBMap *db; // int party_id -> struct party_data* (releases data) + struct DBMap *booking_db; // int char_id -> struct party_booking_ad_info* (releases data) // Party Booking [Spiria] unsigned int booking_nextid; /* funcs */ void (*init) (bool minimal); diff --git a/src/map/pc.h b/src/map/pc.h index 728d02734..a702b44bc 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -785,9 +785,9 @@ struct autotrade_vending { struct pc_interface { /* */ - DBMap *at_db;/* char id -> struct autotrade_vending */ + struct DBMap *at_db;/* char id -> struct autotrade_vending */ /* */ - DBMap* itemcd_db; + struct DBMap *itemcd_db; /* */ int day_timer_tid; int night_timer_tid; diff --git a/src/map/pc_groups.h b/src/map/pc_groups.h index 3f95237b7..27eac7284 100644 --- a/src/map/pc_groups.h +++ b/src/map/pc_groups.h @@ -22,9 +22,9 @@ #define MAP_PC_GROUPS_H #include "common/hercules.h" -#include "common/db.h" /* Forward Declarations */ +struct DBMap; // common/db.h struct config_setting_t; /// PC permissions @@ -91,8 +91,8 @@ struct pc_groups_new_permission { struct pc_groups_interface { /* */ - DBMap* db; // id -> GroupSettings - DBMap* name_db; // name -> GroupSettings + struct DBMap *db; // id -> GroupSettings + struct DBMap *name_db; // name -> GroupSettings /* */ struct pc_groups_permission_table *permissions; unsigned char permission_count; diff --git a/src/map/script.c b/src/map/script.c index 5d7698f75..0fc4a5a65 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -56,6 +56,7 @@ #include "map/unit.h" #include "common/cbasetypes.h" #include "common/conf.h" +#include "common/db.h" #include "common/memmgr.h" #include "common/md5calc.h" #include "common/mmo.h" // NEW_CARTS @@ -3606,7 +3607,8 @@ void pop_stack(struct script_state* st, int start, int end) { /*========================================== * Release script dependent variable, dependent variable of function *------------------------------------------*/ -void script_free_vars(struct DBMap* var_storage) { +void script_free_vars(struct DBMap *var_storage) +{ if( var_storage ) { // destroy the storage construct containing the variables db_destroy(var_storage); @@ -4919,7 +4921,7 @@ void script_load_translations(void) { if( total ) { struct DBIterator *main_iter, *sub_iter; - DBMap *string_db; + struct DBMap *string_db; struct string_translation *st = NULL; uint32 j = 0; @@ -4982,7 +4984,7 @@ void script_load_translation(const char *file, uint8 lang_id, uint32 *total) { uint32 translations = 0; char line[1024]; char msgctxt[NAME_LENGTH*2+1] = { 0 }; - DBMap *string_db; + struct DBMap *string_db; size_t i; FILE *fp; struct script_string_buf msgid = { 0 }, msgstr = { 0 }; @@ -5135,7 +5137,7 @@ void script_clear_translations(bool reload) { **/ int script_translation_db_destroyer(union DBKey key, struct DBData *data, va_list ap) { - DBMap *string_db = DB->data2ptr(data); + struct DBMap *string_db = DB->data2ptr(data); if( db_size(string_db) ) { struct string_translation *st = NULL; diff --git a/src/map/script.h b/src/map/script.h index 368247c63..a1fbe31f0 100644 --- a/src/map/script.h +++ b/src/map/script.h @@ -494,8 +494,8 @@ struct script_syntax_data { int last_func; // buildin index of the last parsed function unsigned int nested_call; //Dont really know what to call this bool lang_macro_active; - DBMap *strings; // string map parsed (used when exporting strings only) - DBMap *translation_db; //non-null if this npc has any translated strings to be linked + struct DBMap *strings; // string map parsed (used when exporting strings only) + struct DBMap *translation_db; //non-null if this npc has any translated strings to be linked }; struct casecheck_data { @@ -534,7 +534,7 @@ struct string_translation { **/ struct script_interface { /* */ - DBMap *st_db; + struct DBMap *st_db; unsigned int active_scripts; unsigned int next_id; struct eri *st_ers; @@ -602,8 +602,8 @@ struct script_interface { /* */ /* Caches compiled autoscript item code. */ /* Note: This is not cleared when reloading itemdb. */ - DBMap* autobonus_db; // char* script -> char* bytecode - DBMap* userfunc_db; // const char* func_name -> struct script_code* + struct DBMap *autobonus_db; // char* script -> char* bytecode + struct DBMap *userfunc_db; // const char* func_name -> struct script_code* /* */ int potion_flag; //For use on Alchemist improved potions/Potion Pitcher. [Skotlex] int potion_hp, potion_per_hp, potion_sp, potion_per_sp; @@ -621,7 +621,7 @@ struct script_interface { int buildin_select_offset; int buildin_lang_macro_offset; /* */ - DBMap *translation_db;/* npc_name => DBMap (strings) */ + struct DBMap *translation_db;/* npc_name => DBMap (strings) */ char **translation_buf;/* */ uint32 translation_buf_size; /* */ diff --git a/src/map/skill.h b/src/map/skill.h index 2f8525654..35fddafa4 100644 --- a/src/map/skill.h +++ b/src/map/skill.h @@ -1856,12 +1856,12 @@ struct skill_interface { void (*reload) (void); void (*read_db) (bool minimal); /* */ - DBMap* cd_db; // char_id -> struct skill_cd - DBMap* name2id_db; - DBMap* unit_db; // int id -> struct skill_unit* - DBMap* usave_db; // char_id -> struct skill_unit_save - DBMap* group_db;// int group_id -> struct skill_unit_group* - DBMap* bowling_db;// int mob_id -> struct mob_data*s + struct DBMap *cd_db; // char_id -> struct skill_cd + struct DBMap *name2id_db; + struct DBMap *unit_db; // int id -> struct skill_unit* + struct DBMap *usave_db; // char_id -> struct skill_unit_save + struct DBMap *group_db;// int group_id -> struct skill_unit_group* + struct DBMap *bowling_db;// int mob_id -> struct mob_data*s /* */ struct eri *unit_ers; //For handling skill_unit's [Skotlex] struct eri *timer_ers; //For handling skill_timerskills [Skotlex] diff --git a/src/map/storage.h b/src/map/storage.h index 2c7ee4ffe..94512c456 100644 --- a/src/map/storage.h +++ b/src/map/storage.h @@ -56,7 +56,7 @@ struct storage_interface { }; struct guild_storage_interface { - struct DBMap* db; // int guild_id -> struct guild_storage* + struct DBMap *db; // int guild_id -> struct guild_storage* /* */ struct guild_storage *(*ensure) (int guild_id); /* */ diff --git a/src/map/vending.h b/src/map/vending.h index 6684ed256..1d2135076 100644 --- a/src/map/vending.h +++ b/src/map/vending.h @@ -22,8 +22,9 @@ #define MAP_VENDING_H #include "common/hercules.h" -#include "common/db.h" +/* Forward Declarations */ +struct DBMap; // common/db.h struct map_session_data; struct s_search_store_search; @@ -35,7 +36,7 @@ struct s_vending { struct vending_interface { unsigned int next_id;/* next vender id */ - DBMap *db; + struct DBMap *db; /* */ void (*init) (bool minimal); void (*final) (void); diff --git a/src/plugins/HPMHooking.c b/src/plugins/HPMHooking.c index 18bfaf220..7a26c8f98 100644 --- a/src/plugins/HPMHooking.c +++ b/src/plugins/HPMHooking.c @@ -128,7 +128,7 @@ HPExport struct hplugin_info pinfo = { }; #define HP_POP(x,y) #x , (void**)(&x) , (void*)y , 0 -DBMap *hp_db;/* hooking points db -- for quick lookup */ +struct DBMap *hp_db;/* hooking points db -- for quick lookup */ struct HookingPointData { char* name; |