From 620e60eebce2c1f35c5c9a82f6ca365b316587f5 Mon Sep 17 00:00:00 2001 From: Valaris Date: Sun, 29 Jan 2006 16:10:48 +0000 Subject: AS OF SVN REV. 5901, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK. IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. EVERYTHING ELSE GOES INTO TRUNK AND WILL BE MERGED INTO STABLE BY VALARIS AND WIZPUTER. -- VALARIS git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5094 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/common/mapindex.h | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/common/mapindex.h (limited to 'src/common/mapindex.h') diff --git a/src/common/mapindex.h b/src/common/mapindex.h new file mode 100644 index 000000000..7e2bbe289 --- /dev/null +++ b/src/common/mapindex.h @@ -0,0 +1,37 @@ +#ifndef _MAX_INDEX_H +#define _MAX_INDEX_H +//File in charge of assigning a numberic ID to each map in existance for space saving when passing map info between servers. +extern char mapindex_cfgfile[80]; + +//whether to enable auto-adding of maps during run. Not so secure as the map indexes will vary! +#define MAPINDEX_AUTOADD + +//Some definitions for the mayor city maps. +#define MAP_PRONTERA "prontera.gat" +#define MAP_GEFFEN "geffen.gat" +#define MAP_MORROC "morocc.gat" +#define MAP_ALBERTA "alberta.gat" +#define MAP_PAYON "payon.gat" +#define MAP_IZLUDE "izlude.gat" +#define MAP_ALDEBARAN "aldebaran.gat" +#define MAP_LUTIE "xmas.gat" +#define MAP_COMODO "comodo.gat" +#define MAP_YUNO "yuno.gat" +#define MAP_AMATSU "amatsu.gat" +#define MAP_GONRYUN "gonryun.gat" +#define MAP_UMBALA "umbala.gat" +#define MAP_NIFLHEIM "niflheim.gat" +#define MAP_LOUYANG "louyang.gat" +#define MAP_JAWAII "jawaii.gat" +#define MAP_AYOTHAYA "ayothaya.gat" +#define MAP_EINBROCH "einbroch.gat" +#define MAP_LIGHTHALZEN "lighthalzen.gat" +#define MAP_EINBECH "einbech.gat" +#define MAP_HUGEL "hugel.gat" +#define MAP_JAIL "sec_pri.gat" +unsigned short mapindex_name2id(char*); +const char* mapindex_id2name(unsigned short); +void mapindex_init(void); +void mapindex_final(void); + +#endif -- cgit v1.2.3-70-g09d2 From f23b4d59152d46450d80066d514869c34c512abc Mon Sep 17 00:00:00 2001 From: FlavioJS Date: Mon, 18 Dec 2006 15:06:51 +0000 Subject: - Cosmetic changes to db. - Fixed the unused MAPINDEX_AUTOADD section in mapindex.c (mapindex.h wasn't being included) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9515 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog-Trunk.txt | 4 + src/common/db.c | 596 ++++++++++++++++++++++---------------------------- src/common/db.h | 201 +++++++---------- src/common/mapindex.c | 120 +++++----- src/common/mapindex.h | 3 +- 5 files changed, 413 insertions(+), 511 deletions(-) (limited to 'src/common/mapindex.h') diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 4e0f01778..2175133ac 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -3,6 +3,10 @@ Date Added AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK. IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. +2006/12/18 + * Cosmetic changes to db. + * Fixed the unused MAPINDEX_AUTOADD section in mapindex.c (mapindex.h + wasn't being included) [FlavioJS] 2006/12/16 * Moved packet_len_table values to packet_db[SERVER]. * When an invalid packet_ver is found, all it's entries are discarted diff --git a/src/common/db.c b/src/common/db.c index a65e87918..306d713dd 100644 --- a/src/common/db.c +++ b/src/common/db.c @@ -50,8 +50,8 @@ * HISTORY: * * 2.1 (Athena build #???#) - Portability fix * * - Fixed the portability of casting to union and added the functions * - * {@link DBInterface#ensure(DBInterface,DBKey,DBCreateData,...)} and * - * {@link DBInterface#clear(DBInterface,DBApply,...)}. * + * {@link DB#ensure(DB,DBKey,DBCreateData,...)} and * + * {@link DB#clear(DB,DBApply,...)}. * * 2.0 (Athena build 4859) - Transition version * * - Almost everything recoded with a strategy similar to objects, * * database structure is maintained. * @@ -83,7 +83,7 @@ * DBNColor - 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. * - * Database - Struture of the database. * + * DB_impl - Struture of the database. * * stats - Statistics about the database system. * \*****************************************************************************/ @@ -102,7 +102,7 @@ /** * Size of the hashtable in the database. * @private - * @see Database#ht + * @see DB_impl#ht */ #define HASH_SIZE (256+27) @@ -116,7 +116,7 @@ * @param deleted If the node is deleted * @param color Color of the node * @private - * @see Database#ht + * @see DB_impl#ht */ typedef struct dbn { // Tree structure @@ -136,7 +136,7 @@ typedef struct dbn { * @param node Deleted node * @param root Address to the root of the tree * @private - * @see Database#free_list + * @see DB_impl#free_list */ struct db_free { DBNode node; @@ -163,20 +163,11 @@ struct db_free { * @param maxlen Maximum length of strings in DB_STRING and DB_ISTRING databases * @param global_lock Global lock of the database * @private - * @see common\db.h#DBInterface - * @see #HASH_SIZE - * @see #DBNode - * @see #struct db_free - * @see common\db.h#DBComparator(void *,void *) - * @see common\db.h#DBHasher(void *) - * @see common\db.h#DBReleaser(void *,void *,DBRelease) - * @see common\db.h#DBOptions - * @see common\db.h#DBType * @see #db_alloc(const char *,int,DBOptions,DBType,...) */ typedef struct db { // Database interface - struct dbt dbi; + struct dbt vtable; // File and line of allocation const char *alloc_file; int alloc_line; @@ -196,7 +187,7 @@ typedef struct db { unsigned int item_count; unsigned short maxlen; unsigned global_lock : 1; -} *Database; +} *DB_impl; #ifdef DB_ENABLE_STATS /** @@ -205,70 +196,70 @@ typedef struct db { * @see #DB_ENABLE_STATS * @see #stats */ -static struct { +static struct db_stats { // Node alloc/free - unsigned int db_node_alloc; - unsigned int db_node_free; + uint32 db_node_alloc; + uint32 db_node_free; // Database creating/destruction counters - unsigned int db_int_alloc; - unsigned int db_uint_alloc; - unsigned int db_string_alloc; - unsigned int db_istring_alloc; - unsigned int db_int_destroy; - unsigned int db_uint_destroy; - unsigned int db_string_destroy; - unsigned int db_istring_destroy; + uint32 db_int_alloc; + uint32 db_uint_alloc; + uint32 db_string_alloc; + uint32 db_istring_alloc; + uint32 db_int_destroy; + uint32 db_uint_destroy; + uint32 db_string_destroy; + uint32 db_istring_destroy; // Function usage counters - unsigned int db_rotate_left; - unsigned int db_rotate_right; - unsigned int db_rebalance; - unsigned int db_rebalance_erase; - unsigned int db_is_key_null; - unsigned int db_dup_key; - unsigned int db_dup_key_free; - unsigned int db_free_add; - unsigned int db_free_remove; - unsigned int db_free_lock; - unsigned int db_free_unlock; - unsigned int db_int_cmp; - unsigned int db_uint_cmp; - unsigned int db_string_cmp; - unsigned int db_istring_cmp; - unsigned int db_int_hash; - unsigned int db_uint_hash; - unsigned int db_string_hash; - unsigned int db_istring_hash; - unsigned int db_release_nothing; - unsigned int db_release_key; - unsigned int db_release_data; - unsigned int db_release_both; - unsigned int db_get; - unsigned int db_getall; - unsigned int db_vgetall; - unsigned int db_ensure; - unsigned int db_vensure; - unsigned int db_put; - unsigned int db_remove; - unsigned int db_foreach; - unsigned int db_vforeach; - unsigned int db_clear; - unsigned int db_vclear; - unsigned int db_destroy; - unsigned int db_vdestroy; - unsigned int db_size; - unsigned int db_type; - unsigned int db_options; - unsigned int db_fix_options; - unsigned int db_default_cmp; - unsigned int db_default_hash; - unsigned int db_default_release; - unsigned int db_custom_release; - unsigned int db_alloc; - unsigned int db_i2key; - unsigned int db_ui2key; - unsigned int db_str2key; - unsigned int db_init; - unsigned int db_final; + uint32 db_rotate_left; + uint32 db_rotate_right; + uint32 db_rebalance; + uint32 db_rebalance_erase; + uint32 db_is_key_null; + uint32 db_dup_key; + uint32 db_dup_key_free; + uint32 db_free_add; + uint32 db_free_remove; + uint32 db_free_lock; + uint32 db_free_unlock; + uint32 db_int_cmp; + uint32 db_uint_cmp; + uint32 db_string_cmp; + uint32 db_istring_cmp; + uint32 db_int_hash; + uint32 db_uint_hash; + uint32 db_string_hash; + uint32 db_istring_hash; + uint32 db_release_nothing; + uint32 db_release_key; + uint32 db_release_data; + uint32 db_release_both; + uint32 db_get; + uint32 db_getall; + uint32 db_vgetall; + uint32 db_ensure; + uint32 db_vensure; + uint32 db_put; + uint32 db_remove; + uint32 db_foreach; + uint32 db_vforeach; + uint32 db_clear; + uint32 db_vclear; + uint32 db_destroy; + uint32 db_vdestroy; + uint32 db_size; + uint32 db_type; + uint32 db_options; + uint32 db_fix_options; + uint32 db_default_cmp; + uint32 db_default_hash; + uint32 db_default_release; + uint32 db_custom_release; + uint32 db_alloc; + uint32 db_i2key; + uint32 db_ui2key; + uint32 db_str2key; + uint32 db_init; + uint32 db_final; } stats = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -277,6 +268,7 @@ static struct { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; +#define COUNT(func) if (stats. ## func != UINT32_MAX) ++stats. ## func #endif /* DB_ENABLE_STATS */ /*****************************************************************************\ @@ -309,7 +301,7 @@ static void db_rotate_left(DBNode node, DBNode *root) DBNode y = node->right; #ifdef DB_ENABLE_STATS - if (stats.db_rotate_left != (unsigned int)~0) stats.db_rotate_left++; + COUNT(db_rotate_left); #endif /* DB_ENABLE_STATS */ // put the left of y at the right of node node->right = y->left; @@ -342,7 +334,7 @@ static void db_rotate_right(DBNode node, DBNode *root) DBNode y = node->left; #ifdef DB_ENABLE_STATS - if (stats.db_rotate_right != (unsigned int)~0) stats.db_rotate_right++; + COUNT(db_rotate_right); #endif /* DB_ENABLE_STATS */ // put the right of y at the left of node node->left = y->right; @@ -370,14 +362,14 @@ static void db_rotate_right(DBNode node, DBNode *root) * @private * @see #db_rotate_left(DBNode,DBNode *) * @see #db_rotate_right(DBNode,DBNode *) - * @see #db_put(DBInterface,DBKey,void *) + * @see #db_put(DB,DBKey,void *) */ static void db_rebalance(DBNode node, DBNode *root) { DBNode y; #ifdef DB_ENABLE_STATS - if (stats.db_rebalance != (unsigned int)~0) stats.db_rebalance++; + COUNT(db_rebalance); #endif /* DB_ENABLE_STATS */ // Restore the RED-BLACK properties node->color = RED; @@ -434,7 +426,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(Database) + * @see #db_free_unlock(DB_impl) */ static void db_rebalance_erase(DBNode node, DBNode *root) { @@ -444,7 +436,7 @@ static void db_rebalance_erase(DBNode node, DBNode *root) DBNode w; #ifdef DB_ENABLE_STATS - if (stats.db_rebalance_erase != (unsigned int)~0) stats.db_rebalance_erase++; + COUNT(db_rebalance_erase); #endif /* DB_ENABLE_STATS */ // Select where to change the tree if (y->left == NULL) { // no left @@ -575,16 +567,14 @@ static void db_rebalance_erase(DBNode node, DBNode *root) * @param key Key being tested * @return not 0 if considered NULL, 0 otherwise * @private - * @see common\db.h#DBType - * @see common\db.h#DBKey - * @see #db_get(DBInterface,DBKey) - * @see #db_put(DBInterface,DBKey,void *) - * @see #db_remove(DBInterface,DBKey) + * @see #db_get(DB,DBKey) + * @see #db_put(DB,DBKey,void *) + * @see #db_remove(DB,DBKey) */ static int db_is_key_null(DBType type, DBKey key) { #ifdef DB_ENABLE_STATS - if (stats.db_is_key_null != (unsigned int)~0) stats.db_is_key_null++; + COUNT(db_is_key_null); #endif /* DB_ENABLE_STATS */ switch (type) { case DB_STRING: @@ -602,17 +592,17 @@ static int db_is_key_null(DBType type, DBKey key) * @param key Key to be duplicated * @param Duplicated key * @private - * @see #db_free_add(Database,DBNode,DBNode *) - * @see #db_free_remove(Database,DBNode) - * @see #db_put(DBInterface,DBKey,void *) - * @see #db_dup_key_free(Database,DBKey) + * @see #db_free_add(DB_impl,DBNode,DBNode *) + * @see #db_free_remove(DB_impl,DBNode) + * @see #db_put(DB,DBKey,void *) + * @see #db_dup_key_free(DB_impl,DBKey) */ -static DBKey db_dup_key(Database db, DBKey key) +static DBKey db_dup_key(DB_impl db, DBKey key) { unsigned char *str; #ifdef DB_ENABLE_STATS - if (stats.db_dup_key != (unsigned int)~0) stats.db_dup_key++; + COUNT(db_dup_key); #endif /* DB_ENABLE_STATS */ switch (db->type) { case DB_STRING: @@ -637,12 +627,12 @@ static DBKey db_dup_key(Database db, DBKey key) * @param db Database the key is being used in * @param key Key to be freed * @private - * @see #db_dup_key(Database,DBKey) + * @see #db_dup_key(DB_impl,DBKey) */ -static void db_dup_key_free(Database db, DBKey key) +static void db_dup_key_free(DB_impl db, DBKey key) { #ifdef DB_ENABLE_STATS - if (stats.db_dup_key_free != (unsigned int)~0) stats.db_dup_key_free++; + COUNT(db_dup_key_free); #endif /* DB_ENABLE_STATS */ switch (db->type) { case DB_STRING: @@ -664,18 +654,18 @@ static void db_dup_key_free(Database db, DBKey key) * @param node Target node * @private * @see #struct db_free - * @see Database#free_list - * @see Database#free_count - * @see Database#free_max - * @see #db_remove(DBInterface,DBKey) - * @see #db_free_remove(Database,DBNode) + * @see DB_impl#free_list + * @see DB_impl#free_count + * @see DB_impl#free_max + * @see #db_remove(DB,DBKey) + * @see #db_free_remove(DB_impl,DBNode) */ -static void db_free_add(Database db, DBNode node, DBNode *root) +static void db_free_add(DB_impl db, DBNode node, DBNode *root) { DBKey old_key; #ifdef DB_ENABLE_STATS - if (stats.db_free_add != (unsigned int)~0) stats.db_free_add++; + COUNT(db_free_add); #endif /* DB_ENABLE_STATS */ if (db->free_lock == (unsigned int)~0) { ShowFatalError("db_free_add: free_lock overflow\n" @@ -716,17 +706,17 @@ static void db_free_add(Database db, DBNode node, DBNode *root) * @param node Node being removed from free_list * @private * @see #struct db_free - * @see Database#free_list - * @see Database#free_count - * @see #db_put(DBInterface,DBKey,void *) - * @see #db_free_add(Database,DBNode *,DBNode) + * @see DB_impl#free_list + * @see DB_impl#free_count + * @see #db_put(DB,DBKey,void *) + * @see #db_free_add(DB_impl,DBNode *,DBNode) */ -static void db_free_remove(Database db, DBNode node) +static void db_free_remove(DB_impl db, DBNode node) { unsigned int i; #ifdef DB_ENABLE_STATS - if (stats.db_free_remove != (unsigned int)~0) stats.db_free_remove++; + COUNT(db_free_remove); #endif /* DB_ENABLE_STATS */ for (i = 0; i < db->free_count; i++) { if (db->free_list[i].node == node) { @@ -749,13 +739,13 @@ static void db_free_remove(Database db, DBNode node) * Increment the free_lock of the database. * @param db Target database * @private - * @see Database#free_lock - * @see #db_unlock(Database) + * @see DB_impl#free_lock + * @see #db_unlock(DB_impl) */ -static void db_free_lock(Database db) +static void db_free_lock(DB_impl db) { #ifdef DB_ENABLE_STATS - if (stats.db_free_lock != (unsigned int)~0) stats.db_free_lock++; + COUNT(db_free_lock); #endif /* DB_ENABLE_STATS */ if (db->free_lock == (unsigned int)~0) { ShowFatalError("db_free_lock: free_lock overflow\n" @@ -773,16 +763,16 @@ static void db_free_lock(Database db) * NOTE: Frees the duplicated keys of the nodes * @param db Target database * @private - * @see Database#free_lock + * @see DB_impl#free_lock * @see #db_free_dbn(DBNode) - * @see #db_lock(Database) + * @see #db_lock(DB_impl) */ -static void db_free_unlock(Database db) +static void db_free_unlock(DB_impl db) { unsigned int i; #ifdef DB_ENABLE_STATS - if (stats.db_free_unlock != (unsigned int)~0) stats.db_free_unlock++; + COUNT(db_free_unlock); #endif /* DB_ENABLE_STATS */ if (db->free_lock == 0) { ShowWarning("db_free_unlock: free_lock was already 0\n" @@ -832,15 +822,15 @@ static void db_free_unlock(Database db) * @param key2 Key being compared to * @param maxlen Maximum length of the key to hash * @return 0 if equal, negative if lower and positive if higher - * @see common\db.h#DBKey - * @see common\db.h\DBType#DB_INT - * @see common\db.h#DBComparator + * @see DBType#DB_INT + * @see #DBComparator * @see #db_default_cmp(DBType) */ static int db_int_cmp(DBKey key1, DBKey key2, unsigned short maxlen) { + (void)maxlen;//not used #ifdef DB_ENABLE_STATS - if (stats.db_int_cmp != (unsigned int)~0) stats.db_int_cmp++; + COUNT(db_int_cmp); #endif /* DB_ENABLE_STATS */ if (key1.i < key2.i) return -1; if (key1.i > key2.i) return 1; @@ -856,15 +846,15 @@ static int db_int_cmp(DBKey key1, DBKey key2, unsigned short maxlen) * @param key2 Key being compared to * @param maxlen Maximum length of the key to hash * @return 0 if equal, negative if lower and positive if higher - * @see common\db.h#DBKey - * @see common\db.h\DBType#DB_UINT - * @see common\db.h#DBComparator + * @see DBType#DB_UINT + * @see #DBComparator * @see #db_default_cmp(DBType) */ static int db_uint_cmp(DBKey key1, DBKey key2, unsigned short maxlen) { + (void)maxlen;//not used #ifdef DB_ENABLE_STATS - if (stats.db_uint_cmp != (unsigned int)~0) stats.db_uint_cmp++; + COUNT(db_uint_cmp); #endif /* DB_ENABLE_STATS */ if (key1.ui < key2.ui) return -1; if (key1.ui > key2.ui) return 1; @@ -879,17 +869,17 @@ static int db_uint_cmp(DBKey key1, DBKey key2, unsigned short maxlen) * @param key2 Key being compared to * @param maxlen Maximum length of the key to hash * @return 0 if equal, negative if lower and positive if higher - * @see common\db.h#DBKey - * @see common\db.h\DBType#DB_STRING - * @see common\db.h#DBComparator + * @see DBType#DB_STRING + * @see #DBComparator * @see #db_default_cmp(DBType) */ static int db_string_cmp(DBKey key1, DBKey key2, unsigned short maxlen) { #ifdef DB_ENABLE_STATS - if (stats.db_string_cmp != (unsigned int)~0) stats.db_string_cmp++; + COUNT(db_string_cmp); #endif /* DB_ENABLE_STATS */ - if (maxlen == 0) maxlen = (unsigned short)~0; + if (maxlen == 0) + maxlen = UINT16_MAX; return strncmp((const char *)key1.str, (const char *)key2.str, maxlen); } @@ -901,17 +891,17 @@ static int db_string_cmp(DBKey key1, DBKey key2, unsigned short maxlen) * @param key2 Key being compared to * @param maxlen Maximum length of the key to hash * @return 0 if equal, negative if lower and positive if higher - * @see common\db.h#DBKey - * @see common\db.h\DBType#DB_ISTRING - * @see common\db.h#DBComparator + * @see DBType#DB_ISTRING + * @see #DBComparator * @see #db_default_cmp(DBType) */ static int db_istring_cmp(DBKey key1, DBKey key2, unsigned short maxlen) { #ifdef DB_ENABLE_STATS - if (stats.db_istring_cmp != (unsigned int)~0) stats.db_istring_cmp++; + COUNT(db_istring_cmp); #endif /* DB_ENABLE_STATS */ - if (maxlen == 0) maxlen = (unsigned short)~0; + if (maxlen == 0) + maxlen = UINT16_MAX; return strncasecmp((const char *)key1.str, (const char *)key2.str, maxlen); } @@ -922,15 +912,15 @@ static int db_istring_cmp(DBKey key1, DBKey key2, unsigned short maxlen) * @param key Key to be hashed * @param maxlen Maximum length of the key to hash * @return hash of the key - * @see common\db.h#DBKey - * @see common\db.h\DBType#DB_INT - * @see common\db.h#DBHasher + * @see DBType#DB_INT + * @see #DBHasher * @see #db_default_hash(DBType) */ static unsigned int db_int_hash(DBKey key, unsigned short maxlen) { + (void)maxlen;//not used #ifdef DB_ENABLE_STATS - if (stats.db_int_hash != (unsigned int)~0) stats.db_int_hash++; + COUNT(db_int_hash); #endif /* DB_ENABLE_STATS */ return (unsigned int)key.i; } @@ -942,14 +932,15 @@ static unsigned int db_int_hash(DBKey key, unsigned short maxlen) * @param key Key to be hashed * @param maxlen Maximum length of the key to hash * @return hash of the key - * @see common\db.h#DBKey - * @see common\db.h\DBType#DB_UINT + * @see DBType#DB_UINT + * @see #DBHasher * @see #db_default_hash(DBType) */ static unsigned int db_uint_hash(DBKey key, unsigned short maxlen) { + (void)maxlen;//not used #ifdef DB_ENABLE_STATS - if (stats.db_uint_hash != (unsigned int)~0) stats.db_uint_hash++; + COUNT(db_uint_hash); #endif /* DB_ENABLE_STATS */ return key.ui; } @@ -960,8 +951,8 @@ static unsigned int db_uint_hash(DBKey key, unsigned short maxlen) * @param key Key to be hashed * @param maxlen Maximum length of the key to hash * @return hash of the key - * @see common\db.h#DBKey - * @see common\db.h\DBType#DB_STRING + * @see DBType#DB_STRING + * @see #DBHasher * @see #db_default_hash(DBType) */ static unsigned int db_string_hash(DBKey key, unsigned short maxlen) @@ -971,10 +962,10 @@ static unsigned int db_string_hash(DBKey key, unsigned short maxlen) unsigned short i; #ifdef DB_ENABLE_STATS - if (stats.db_string_hash != (unsigned int)~0) stats.db_string_hash++; + COUNT(db_string_hash); #endif /* DB_ENABLE_STATS */ if (maxlen == 0) - maxlen = (unsigned short)~0; // Maximum + maxlen = UINT16_MAX; for (i = 0; *k; i++) { hash = (hash*33 + *k++)^(hash>>24); @@ -991,8 +982,7 @@ static unsigned int db_string_hash(DBKey key, unsigned short maxlen) * @param key Key to be hashed * @param maxlen Maximum length of the key to hash * @return hash of the key - * @see common\db.h#DBKey - * @see common\db.h\DBType#DB_ISTRING + * @see DBType#DB_ISTRING * @see #db_default_hash(DBType) */ static unsigned int db_istring_hash(DBKey key, unsigned short maxlen) @@ -1002,10 +992,10 @@ static unsigned int db_istring_hash(DBKey key, unsigned short maxlen) unsigned short i; #ifdef DB_ENABLE_STATS - if (stats.db_istring_hash != (unsigned int)~0) stats.db_istring_hash++; + COUNT(db_istring_hash); #endif /* DB_ENABLE_STATS */ if (maxlen == 0) - maxlen = (unsigned short)~0; // Maximum + maxlen = UINT16_MAX; for (i = 0; *k; i++) { hash = (hash*33 + LOWER(*k))^(hash>>24); @@ -1023,15 +1013,14 @@ static unsigned int db_istring_hash(DBKey key, unsigned short maxlen) * @param data Data of the database entry * @param which What is being requested to be released * @protected - * @see common\db.h#DBKey - * @see common\db.h#DBRelease - * @see common\db.h#DBReleaser + * @see #DBReleaser * @see #db_default_releaser(DBType,DBOptions) */ static void db_release_nothing(DBKey key, void *data, DBRelease which) { + (void)key;(void)data;(void)which;//not used #ifdef DB_ENABLE_STATS - if (stats.db_release_nothing != (unsigned int)~0) stats.db_release_nothing++; + COUNT(db_release_nothing); #endif /* DB_ENABLE_STATS */ } @@ -1041,15 +1030,14 @@ static void db_release_nothing(DBKey key, void *data, DBRelease which) * @param data Data of the database entry * @param which What is being requested to be released * @protected - * @see common\db.h#DBKey - * @see common\db.h#DBRelease - * @see common\db.h#DBReleaser + * @see #DBReleaser * @see #db_default_release(DBType,DBOptions) */ static void db_release_key(DBKey key, void *data, DBRelease which) { + (void)data;//not used #ifdef DB_ENABLE_STATS - if (stats.db_release_key != (unsigned int)~0) stats.db_release_key++; + COUNT(db_release_key); #endif /* DB_ENABLE_STATS */ if (which&DB_RELEASE_KEY) aFree(key.str); // needs to be a pointer } @@ -1067,8 +1055,9 @@ static void db_release_key(DBKey key, void *data, DBRelease which) */ static void db_release_data(DBKey key, void *data, DBRelease which) { + (void)key;//not used #ifdef DB_ENABLE_STATS - if (stats.db_release_data != (unsigned int)~0) stats.db_release_data++; + COUNT(db_release_data); #endif /* DB_ENABLE_STATS */ if (which&DB_RELEASE_DATA) aFree(data); } @@ -1087,7 +1076,7 @@ static void db_release_data(DBKey key, void *data, DBRelease which) static void db_release_both(DBKey key, void *data, DBRelease which) { #ifdef DB_ENABLE_STATS - if (stats.db_release_both != (unsigned int)~0) stats.db_release_both++; + COUNT(db_release_both); #endif /* DB_ENABLE_STATS */ if (which&DB_RELEASE_KEY) aFree(key.str); // needs to be a pointer if (which&DB_RELEASE_DATA) aFree(data); @@ -1122,19 +1111,17 @@ static void db_release_both(DBKey key, void *data, DBRelease which) * @param key Key that identifies the entry * @return Data of the entry or NULL if not found * @protected - * @see common\db.h#DBKey - * @see common\db.h#DBInterface - * @see common\db.h\DBInterface#get(DBInterface,DBKey) + * @see DB_impl::vtable#get */ -static void *db_obj_get(DBInterface self, DBKey key) +static void *db_obj_get(DB self, DBKey key) { - Database db = (Database)self; + DB_impl db = (DB_impl)self; DBNode node; int c; void *data = NULL; #ifdef DB_ENABLE_STATS - if (stats.db_get != (unsigned int)~0) stats.db_get++; + COUNT(db_get); #endif /* DB_ENABLE_STATS */ if (db == NULL) return NULL; // nullpo candidate if (!(db->options&DB_OPT_ALLOW_NULL_KEY) && db_is_key_null(db->type, key)) { @@ -1173,20 +1160,18 @@ static void *db_obj_get(DBInterface self, DBKey key) * @param ... Extra arguments for match * @return The number of entries that matched * @protected - * @see common\db.h#DBInterface - * @see common\db.h#DBMatcher(DBKey key, void *data, va_list args) - * @see common\db.h\DBInterface#vgetall(DBInterface,void **,unsigned int,DBMatch,va_list) + * @see DB_impl::vtable#vgetall */ -static unsigned int db_obj_vgetall(DBInterface self, void **buf, unsigned int max, DBMatcher match, va_list args) +static unsigned int db_obj_vgetall(DB self, void **buf, unsigned int max, DBMatcher match, va_list args) { - Database db = (Database)self; + DB_impl db = (DB_impl)self; unsigned int i; DBNode node; DBNode parent; unsigned int ret = 0; #ifdef DB_ENABLE_STATS - if (stats.db_vgetall != (unsigned int)~0) stats.db_vgetall++; + COUNT(db_vgetall); #endif /* DB_ENABLE_STATS */ if (db == NULL) return 0; // nullpo candidate if (match == NULL) return 0; // nullpo candidate @@ -1225,7 +1210,7 @@ static unsigned int db_obj_vgetall(DBInterface self, void **buf, unsigned int ma } /** - * Just calls {@link common\db.h\DBInterface#vgetall(DBInterface,void **,unsigned int,DBMatch,va_list)}. + * Just calls {@link DB#vgetall(DB,void **,unsigned int,DBMatch,va_list)}. * Get the data of the entries matched by match. * It puts a maximum of max entries into buf. * If buf is NULL, it only counts the matches. @@ -1239,18 +1224,16 @@ static unsigned int db_obj_vgetall(DBInterface self, void **buf, unsigned int ma * @param ... Extra arguments for match * @return The number of entries that matched * @protected - * @see common\db.h#DBMatcher(DBKey key, void *data, va_list args) - * @see common\db.h#DBInterface - * @see common\db.h\DBInterface#vgetall(DBInterface,void **,unsigned int,DBMatch,va_list) - * @see common\db.h\DBInterface#getall(DBInterface,void **,unsigned int,DBMatch,...) + * @see DB_impl::vtable#vgetall + * @see DB_impl::vtable#getall */ -static unsigned int db_obj_getall(DBInterface self, void **buf, unsigned int max, DBMatcher match, ...) +static unsigned int db_obj_getall(DB self, void **buf, unsigned int max, DBMatcher match, ...) { va_list args; unsigned int ret; #ifdef DB_ENABLE_STATS - if (stats.db_getall != (unsigned int)~0) stats.db_getall++; + COUNT(db_getall); #endif /* DB_ENABLE_STATS */ if (self == NULL) return 0; // nullpo candidate @@ -1270,14 +1253,11 @@ static unsigned int db_obj_getall(DBInterface self, void **buf, unsigned int max * @param args Extra arguments for create * @return Data of the entry * @protected - * @see common\db.h#DBKey - * @see common\db.h#DBCreateData - * @see common\db.h#DBInterface - * @see common\db.h\DBInterface#vensure(DBInterface,DBKey,DBCreateData,va_list) + * @see DB_impl::vtable#vensure */ -static void *db_obj_vensure(DBInterface self, DBKey key, DBCreateData create, va_list args) +static void *db_obj_vensure(DB self, DBKey key, DBCreateData create, va_list args) { - Database db = (Database)self; + DB_impl db = (DB_impl)self; DBNode node; DBNode parent = NULL; unsigned int hash; @@ -1285,7 +1265,7 @@ static void *db_obj_vensure(DBInterface self, DBKey key, DBCreateData create, va void *data = NULL; #ifdef DB_ENABLE_STATS - if (stats.db_vensure != (unsigned int)~0) stats.db_vensure++; + COUNT(db_vensure); #endif /* DB_ENABLE_STATS */ if (db == NULL) return NULL; // nullpo candidate if (create == NULL) { @@ -1320,7 +1300,7 @@ static void *db_obj_vensure(DBInterface self, DBKey key, DBCreateData create, va return NULL; } #ifdef DB_ENABLE_STATS - if (stats.db_node_alloc != (unsigned int)~0) stats.db_node_alloc++; + COUNT(db_node_alloc); #endif /* DB_ENABLE_STATS */ node = ers_alloc(db->nodes, struct dbn); node->left = NULL; @@ -1359,7 +1339,7 @@ static void *db_obj_vensure(DBInterface self, DBKey key, DBCreateData create, va } /** - * Just calls {@link common\db.h\DBInterface#vensure(DBInterface,DBKey,DBCreateData,va_list)}. + * Just calls {@link DB#vensure(DB,DBKey,DBCreateData,va_list)}. * 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. @@ -1369,19 +1349,16 @@ static void *db_obj_vensure(DBInterface self, DBKey key, DBCreateData create, va * @param ... Extra arguments for create * @return Data of the entry * @protected - * @see common\db.h#DBKey - * @see common\db.h#DBCreateData - * @see common\db.h#DBInterface - * @see common\db.h\DBInterface#vensure(DBInterface,DBKey,DBCreateData,va_list) - * @see common\db.h\DBInterface#ensure(DBInterface,DBKey,DBCreateData,...) + * @see DB_impl::vtable#vensure + * @see DB_impl::vtable#ensure */ -static void *db_obj_ensure(DBInterface self, DBKey key, DBCreateData create, ...) +static void *db_obj_ensure(DB self, DBKey key, DBCreateData create, ...) { va_list args; void *ret; #ifdef DB_ENABLE_STATS - if (stats.db_ensure != (unsigned int)~0) stats.db_ensure++; + COUNT(db_ensure); #endif /* DB_ENABLE_STATS */ if (self == NULL) return 0; // nullpo candidate @@ -1400,14 +1377,12 @@ static void *db_obj_ensure(DBInterface self, DBKey key, DBCreateData create, ... * @param data Data to be put in the database * @return The previous data if the entry exists or NULL * @protected - * @see common\db.h#DBKey - * @see common\db.h#DBInterface * @see #db_malloc_dbn(void) - * @see common\db.h\DBInterface#put(DBInterface,DBKey,void *) + * @see DB_impl::vtable#put */ -static void *db_obj_put(DBInterface self, DBKey key, void *data) +static void *db_obj_put(DB self, DBKey key, void *data) { - Database db = (Database)self; + DB_impl db = (DB_impl)self; DBNode node; DBNode parent = NULL; int c = 0; @@ -1415,7 +1390,7 @@ static void *db_obj_put(DBInterface self, DBKey key, void *data) void *old_data = NULL; #ifdef DB_ENABLE_STATS - if (stats.db_put != (unsigned int)~0) stats.db_put++; + COUNT(db_put); #endif /* DB_ENABLE_STATS */ if (db == NULL) return NULL; // nullpo candidate if (db->global_lock) { @@ -1463,7 +1438,7 @@ static void *db_obj_put(DBInterface self, DBKey key, void *data) // allocate a new node if necessary if (node == NULL) { #ifdef DB_ENABLE_STATS - if (stats.db_node_alloc != (unsigned int)~0) stats.db_node_alloc++; + COUNT(db_node_alloc); #endif /* DB_ENABLE_STATS */ node = ers_alloc(db->nodes, struct dbn); node->left = NULL; @@ -1503,26 +1478,24 @@ static void *db_obj_put(DBInterface self, DBKey key, void *data) /** * Remove an entry from the database. * Returns the data of the entry. - * NOTE: The key (of the database) is released in {@link #db_free_add(Database,DBNode,DBNode *)}. + * NOTE: The key (of the database) is released in {@link #db_free_add(DB_impl,DBNode,DBNode *)}. * @param self Interface of the database * @param key Key that identifies the entry * @return The data of the entry or NULL if not found * @protected - * @see common\db.h#DBKey - * @see common\db.h#DBInterface - * @see #db_free_add(Database,DBNode,DBNode *) - * @see common\db.h\DBInterface#remove(DBInterface,DBKey) + * @see #db_free_add(DB_impl,DBNode,DBNode *) + * @see DB_impl::vtable#remove */ -static void *db_obj_remove(DBInterface self, DBKey key) +static void *db_obj_remove(DB self, DBKey key) { - Database db = (Database)self; + DB_impl db = (DB_impl)self; void *data = NULL; DBNode node; unsigned int hash; int c = 0; #ifdef DB_ENABLE_STATS - if (stats.db_remove != (unsigned int)~0) stats.db_remove++; + COUNT(db_remove); #endif /* DB_ENABLE_STATS */ if (db == NULL) return NULL; // nullpo candidate if (db->global_lock) { @@ -1565,20 +1538,18 @@ static void *db_obj_remove(DBInterface self, DBKey key) * @param args Extra arguments for func * @return Sum of the values returned by func * @protected - * @see common\db.h#DBInterface - * @see common\db.h#DBApply(DBKey,void *,va_list) - * @see common\db.h\DBInterface#vforeach(DBInterface,DBApply,va_list) + * @see DB_impl::vtable#vforeach */ -static int db_obj_vforeach(DBInterface self, DBApply func, va_list args) +static int db_obj_vforeach(DB self, DBApply func, va_list args) { - Database db = (Database)self; + DB_impl db = (DB_impl)self; unsigned int i; int sum = 0; DBNode node; DBNode parent; #ifdef DB_ENABLE_STATS - if (stats.db_vforeach != (unsigned int)~0) stats.db_vforeach++; + COUNT(db_vforeach); #endif /* DB_ENABLE_STATS */ if (db == NULL) return 0; // nullpo candidate if (func == NULL) { @@ -1617,7 +1588,7 @@ static int db_obj_vforeach(DBInterface self, DBApply func, va_list args) } /** - * Just calls {@link common\db.h\DBInterface#vforeach(DBInterface,DBApply,va_list)}. + * Just calls {@link common\db.h\DB#vforeach(DB,DBApply,va_list)}. * Apply func to every entry in the database. * Returns the sum of values returned by func. * @param self Interface of the database @@ -1625,18 +1596,16 @@ static int db_obj_vforeach(DBInterface self, DBApply func, va_list args) * @param ... Extra arguments for func * @return Sum of the values returned by func * @protected - * @see common\db.h#DBInterface - * @see common\db.h#DBApply(DBKey,void *,va_list) - * @see common\db.h\DBInterface#vforeach(DBInterface,DBApply,va_list) - * @see common\db.h\DBInterface#foreach(DBInterface,DBApply,...) + * @see DB_impl::vtable#vforeach + * @see DB_impl::vtable#foreach */ -static int db_obj_foreach(DBInterface self, DBApply func, ...) +static int db_obj_foreach(DB self, DBApply func, ...) { va_list args; int ret; #ifdef DB_ENABLE_STATS - if (stats.db_foreach != (unsigned int)~0) stats.db_foreach++; + COUNT(db_foreach); #endif /* DB_ENABLE_STATS */ if (self == NULL) return 0; // nullpo candidate @@ -1656,20 +1625,18 @@ static int db_obj_foreach(DBInterface self, DBApply func, ...) * @param args Extra arguments for func * @return Sum of values returned by func * @protected - * @see common\db.h#DBApply(DBKey,void *,va_list) - * @see common\db.h#DBInterface - * @see common\db.h\DBInterface#vclear(DBInterface,DBApply,va_list) + * @see DB_impl::vtable#vclear */ -static int db_obj_vclear(DBInterface self, DBApply func, va_list args) +static int db_obj_vclear(DB self, DBApply func, va_list args) { - Database db = (Database)self; + DB_impl db = (DB_impl)self; int sum = 0; unsigned int i; DBNode node; DBNode parent; #ifdef DB_ENABLE_STATS - if (stats.db_vclear != (unsigned int)~0) stats.db_vclear++; + COUNT(db_vclear); #endif /* DB_ENABLE_STATS */ if (db == NULL) return 0; // nullpo candidate @@ -1697,7 +1664,7 @@ static int db_obj_vclear(DBInterface self, DBApply func, va_list args) node->deleted = 1; } #ifdef DB_ENABLE_STATS - if (stats.db_node_free != (unsigned int)~0) stats.db_node_free++; + COUNT(db_node_free); #endif /* DB_ENABLE_STATS */ ers_free(db->nodes, node); if (parent) { @@ -1717,7 +1684,7 @@ static int db_obj_vclear(DBInterface self, DBApply func, va_list args) } /** - * Just calls {@link common\db.h\DBInterface#vclear(DBInterface,DBApply,va_list)}. + * Just calls {@link common\db.h\DB#vclear(DB,DBApply,va_list)}. * Removes all entries from the database. * Before deleting an entry, func is applyed to it. * Releases the key and the data. @@ -1729,18 +1696,16 @@ static int db_obj_vclear(DBInterface self, DBApply func, va_list args) * @param ... Extra arguments for func * @return Sum of values returned by func * @protected - * @see common\db.h#DBApply(DBKey,void *,va_list) - * @see common\db.h#DBInterface - * @see common\db.h\DBInterface#vclear(DBInterface,DBApply,va_list) - * @see common\db.h\DBInterface#clear(DBInterface,DBApply,...) + * @see DB_impl::vtable#vclear + * @see DB_impl::vtable#clear */ -static int db_obj_clear(DBInterface self, DBApply func, ...) +static int db_obj_clear(DB self, DBApply func, ...) { va_list args; int ret; #ifdef DB_ENABLE_STATS - if (stats.db_clear != (unsigned int)~0) stats.db_clear++; + COUNT(db_clear); #endif /* DB_ENABLE_STATS */ if (self == NULL) return 0; // nullpo candidate @@ -1761,17 +1726,15 @@ static int db_obj_clear(DBInterface self, DBApply func, ...) * @param args Extra arguments for func * @return Sum of values returned by func * @protected - * @see common\db.h#DBApply(DBKey,void *,va_list) - * @see common\db.h#DBInterface - * @see common\db.h\DBInterface#vdestroy(DBInterface,DBApply,va_list) + * @see DB_impl::vtable#vdestroy */ -static int db_obj_vdestroy(DBInterface self, DBApply func, va_list args) +static int db_obj_vdestroy(DB self, DBApply func, va_list args) { - Database db = (Database)self; + DB_impl db = (DB_impl)self; int sum; #ifdef DB_ENABLE_STATS - if (stats.db_vdestroy != (unsigned int)~0) stats.db_vdestroy++; + COUNT(db_vdestroy); #endif /* DB_ENABLE_STATS */ if (db == NULL) return 0; // nullpo candidate if (db->global_lock) { @@ -1788,16 +1751,16 @@ static int db_obj_vdestroy(DBInterface self, DBApply func, va_list args) #ifdef DB_ENABLE_STATS switch (db->type) { case DB_INT: - stats.db_int_destroy++; + COUNT(db_int_destroy); break; case DB_UINT: - stats.db_uint_destroy++; + COUNT(db_uint_destroy); break; case DB_STRING: - stats.db_string_destroy++; + COUNT(db_string_destroy); break; case DB_ISTRING: - stats.db_istring_destroy++; + COUNT(db_istring_destroy); break; } #endif /* DB_ENABLE_STATS */ @@ -1814,7 +1777,7 @@ static int db_obj_vdestroy(DBInterface self, DBApply func, va_list args) } /** - * Just calls {@link common\db.h\DBInterface#db_vdestroy(DBInterface,DBApply,va_list)}. + * Just calls {@link DB#db_vdestroy(DB,DBApply,va_list)}. * Finalize the database, feeing all the memory it uses. * Before deleting an entry, func is applyed to it. * Releases the key and the data. @@ -1826,18 +1789,16 @@ static int db_obj_vdestroy(DBInterface self, DBApply func, va_list args) * @param ... Extra arguments for func * @return Sum of values returned by func * @protected - * @see common\db.h#DBApply(DBKey,void *,va_list) - * @see common\db.h#DBInterface - * @see common\db.h\DBInterface#vdestroy(DBInterface,DBApply,va_list) - * @see common\db.h\DBInterface#destroy(DBInterface,DBApply,...) + * @see DB_impl::vtable#vdestroy + * @see DB_impl::vtable#destroy */ -static int db_obj_destroy(DBInterface self, DBApply func, ...) +static int db_obj_destroy(DB self, DBApply func, ...) { va_list args; int ret; #ifdef DB_ENABLE_STATS - if (stats.db_destroy != (unsigned int)~0) stats.db_destroy++; + COUNT(db_destroy); #endif /* DB_ENABLE_STATS */ if (self == NULL) return 0; // nullpo candidate @@ -1852,17 +1813,16 @@ static int db_obj_destroy(DBInterface self, DBApply func, ...) * @param self Interface of the database * @return Size of the database * @protected - * @see common\db.h#DBInterface - * @see Database#item_count - * @see common\db.h\DBInterface#size(DBInterface) + * @see DB_impl#item_count + * @see DB_impl::vtable#size */ -static unsigned int db_obj_size(DBInterface self) +static unsigned int db_obj_size(DB self) { - Database db = (Database)self; + DB_impl db = (DB_impl)self; unsigned int item_count; #ifdef DB_ENABLE_STATS - if (stats.db_size != (unsigned int)~0) stats.db_size++; + COUNT(db_size); #endif /* DB_ENABLE_STATS */ if (db == NULL) return 0; // nullpo candidate @@ -1878,18 +1838,16 @@ static unsigned int db_obj_size(DBInterface self) * @param self Interface of the database * @return Type of the database * @protected - * @see common\db.h#DBType - * @see common\db.h#DBInterface - * @see Database#type - * @see common\db.h\DBInterface#type(DBInterface) + * @see DB_impl#type + * @see DB_impl::vtable#type */ -static DBType db_obj_type(DBInterface self) +static DBType db_obj_type(DB self) { - Database db = (Database)self; + DB_impl db = (DB_impl)self; DBType type; #ifdef DB_ENABLE_STATS - if (stats.db_type != (unsigned int)~0) stats.db_type++; + COUNT(db_type); #endif /* DB_ENABLE_STATS */ if (db == NULL) return -1; // nullpo candidate - TODO what should this return? @@ -1905,18 +1863,16 @@ static DBType db_obj_type(DBInterface self) * @param self Interface of the database * @return Options of the database * @protected - * @see common\db.h#DBOptions - * @see common\db.h#DBInterface - * @see Database#options - * @see common\db.h\DBInterface#options(DBInterface) + * @see DB_impl#options + * @see DB_impl::vtable#options */ -static DBOptions db_obj_options(DBInterface self) +static DBOptions db_obj_options(DB self) { - Database db = (Database)self; + DB_impl db = (DB_impl)self; DBOptions options; #ifdef DB_ENABLE_STATS - if (stats.db_options != (unsigned int)~0) stats.db_options++; + COUNT(db_options); #endif /* DB_ENABLE_STATS */ if (db == NULL) return DB_OPT_BASE; // nullpo candidate - TODO what should this return? @@ -1951,16 +1907,13 @@ static DBOptions db_obj_options(DBInterface self) * @param options Original options of the database * @return Fixed options of the database * @private - * @see common\db.h#DBType - * @see common\db.h#DBOptions * @see #db_default_release(DBType,DBOptions) * @see #db_alloc(const char *,int,DBType,DBOptions,unsigned short) - * @see common\db.h#db_fix_options(DBType,DBOptions) */ DBOptions db_fix_options(DBType type, DBOptions options) { #ifdef DB_ENABLE_STATS - if (stats.db_fix_options != (unsigned int)~0) stats.db_fix_options++; + COUNT(db_fix_options); #endif /* DB_ENABLE_STATS */ switch (type) { case DB_INT: @@ -1980,17 +1933,15 @@ DBOptions db_fix_options(DBType type, DBOptions options) * @param type Type of database * @return Comparator for the type of database or NULL if unknown database * @public - * @see common\db.h#DBType * @see #db_int_cmp(DBKey,DBKey,unsigned short) * @see #db_uint_cmp(DBKey,DBKey,unsigned short) * @see #db_string_cmp(DBKey,DBKey,unsigned short) * @see #db_istring_cmp(DBKey,DBKey,unsigned short) - * @see common\db.h#db_default_cmp(DBType) */ DBComparator db_default_cmp(DBType type) { #ifdef DB_ENABLE_STATS - if (stats.db_default_cmp != (unsigned int)~0) stats.db_default_cmp++; + COUNT(db_default_cmp); #endif /* DB_ENABLE_STATS */ switch (type) { case DB_INT: return db_int_cmp; @@ -2008,17 +1959,15 @@ DBComparator db_default_cmp(DBType type) * @param type Type of database * @return Hasher of the type of database or NULL if unknown database * @public - * @see common\db.h#DBType * @see #db_int_hash(DBKey,unsigned short) * @see #db_uint_hash(DBKey,unsigned short) * @see #db_string_hash(DBKey,unsigned short) * @see #db_istring_hash(DBKey,unsigned short) - * @see common\db.h#db_default_hash(DBType) */ DBHasher db_default_hash(DBType type) { #ifdef DB_ENABLE_STATS - if (stats.db_default_hash != (unsigned int)~0) stats.db_default_hash++; + COUNT(db_default_hash); #endif /* DB_ENABLE_STATS */ switch (type) { case DB_INT: return db_int_hash; @@ -2040,20 +1989,16 @@ DBHasher db_default_hash(DBType type) * @param options Options of the database * @return Default releaser for the type of database with the specified options * @public - * @see common\db.h#DBType - * @see common\db.h#DBOptions - * @see common\db.h#DBReleaser * @see #db_release_nothing(DBKey,void *,DBRelease) * @see #db_release_key(DBKey,void *,DBRelease) * @see #db_release_data(DBKey,void *,DBRelease) * @see #db_release_both(DBKey,void *,DBRelease) * @see #db_custom_release(DBRelease) - * @see common\db.h#db_default_release(DBType,DBOptions) */ DBReleaser db_default_release(DBType type, DBOptions options) { #ifdef DB_ENABLE_STATS - if (stats.db_default_release != (unsigned int)~0) stats.db_default_release++; + COUNT(db_default_release); #endif /* DB_ENABLE_STATS */ options = db_fix_options(type, options); if (options&DB_OPT_RELEASE_DATA) { // Release data, what about the key? @@ -2071,19 +2016,16 @@ DBReleaser db_default_release(DBType type, DBOptions options) * @param which Options that specified what the releaser releases * @return Releaser for the specified release options * @public - * @see common\db.h#DBRelease - * @see common\db.h#DBReleaser * @see #db_release_nothing(DBKey,void *,DBRelease) * @see #db_release_key(DBKey,void *,DBRelease) * @see #db_release_data(DBKey,void *,DBRelease) * @see #db_release_both(DBKey,void *,DBRelease) * @see #db_default_release(DBType,DBOptions) - * @see common\db.h#db_custom_release(DBRelease) */ DBReleaser db_custom_release(DBRelease which) { #ifdef DB_ENABLE_STATS - if (stats.db_custom_release != (unsigned int)~0) stats.db_custom_release++; + COUNT(db_custom_release); #endif /* DB_ENABLE_STATS */ switch (which) { case DB_RELEASE_NOTHING: return db_release_nothing; @@ -2108,31 +2050,28 @@ DBReleaser db_custom_release(DBRelease which) * databases * @return The interface of the database * @public - * @see common\db.h#DBType - * @see common\db.h#DBInterface - * @see #Database + * @see #DB_impl * @see #db_fix_options(DBType,DBOptions) - * @see common\db.h#db_alloc(const char *,int,DBType,unsigned short) */ -DBInterface db_alloc(const char *file, int line, DBType type, DBOptions options, unsigned short maxlen) +DB db_alloc(const char *file, int line, DBType type, DBOptions options, unsigned short maxlen) { - Database db; + DB_impl db; unsigned int i; #ifdef DB_ENABLE_STATS if (stats.db_alloc != (unsigned int)~0) stats.db_alloc++; switch (type) { case DB_INT: - stats.db_int_alloc++; + COUNT(db_int_alloc); break; case DB_UINT: - stats.db_uint_alloc++; + COUNT(db_uint_alloc); break; case DB_STRING: - stats.db_string_alloc++; + COUNT(db_string_alloc); break; case DB_ISTRING: - stats.db_istring_alloc++; + COUNT(db_istring_alloc); break; } #endif /* DB_ENABLE_STATS */ @@ -2140,22 +2079,22 @@ DBInterface db_alloc(const char *file, int line, DBType type, DBOptions options, options = db_fix_options(type, options); /* Interface of the database */ - db->dbi.get = db_obj_get; - db->dbi.getall = db_obj_getall; - db->dbi.vgetall = db_obj_vgetall; - db->dbi.ensure = db_obj_ensure; - db->dbi.vensure = db_obj_vensure; - db->dbi.put = db_obj_put; - db->dbi.remove = db_obj_remove; - db->dbi.foreach = db_obj_foreach; - db->dbi.vforeach = db_obj_vforeach; - db->dbi.clear = db_obj_clear; - db->dbi.vclear = db_obj_vclear; - db->dbi.destroy = db_obj_destroy; - db->dbi.vdestroy = db_obj_vdestroy; - db->dbi.size = db_obj_size; - db->dbi.type = db_obj_type; - db->dbi.options = db_obj_options; + db->vtable.get = db_obj_get; + db->vtable.getall = db_obj_getall; + db->vtable.vgetall = db_obj_vgetall; + db->vtable.ensure = db_obj_ensure; + db->vtable.vensure = db_obj_vensure; + db->vtable.put = db_obj_put; + db->vtable.remove = db_obj_remove; + db->vtable.foreach = db_obj_foreach; + db->vtable.vforeach = db_obj_vforeach; + db->vtable.clear = db_obj_clear; + db->vtable.vclear = db_obj_vclear; + db->vtable.destroy = db_obj_destroy; + db->vtable.vdestroy = db_obj_vdestroy; + db->vtable.size = db_obj_size; + db->vtable.type = db_obj_type; + db->vtable.options = db_obj_options; /* File and line of allocation */ db->alloc_file = file; db->alloc_line = line; @@ -2177,7 +2116,7 @@ DBInterface db_alloc(const char *file, int line, DBType type, DBOptions options, db->maxlen = maxlen; db->global_lock = 0; - return &db->dbi; + return &db->vtable; } #ifdef DB_MANUAL_CAST_TO_UNION @@ -2187,17 +2126,16 @@ DBInterface db_alloc(const char *file, int line, DBType type, DBOptions options, * @param key Key to be casted * @return The key as a DBKey union * @public - * @see common\db.h#DB_MANUAL_CAST_TO_UNION + * @see #DB_MANUAL_CAST_TO_UNION * @see #db_ui2key(unsigned int) * @see #db_str2key(unsigned char *) - * @see common\db.h#db_i2key(int) */ DBKey db_i2key(int key) { DBKey ret; #ifdef DB_ENABLE_STATS - if (stats.db_i2key != (unsigned int)~0) stats.db_i2key++; + COUNT(db_i2key); #endif /* DB_ENABLE_STATS */ ret.i = key; return ret; @@ -2219,7 +2157,7 @@ DBKey db_ui2key(unsigned int key) DBKey ret; #ifdef DB_ENABLE_STATS - if (stats.db_ui2key != (unsigned int)~0) stats.db_ui2key++; + COUNT(db_ui2key); #endif /* DB_ENABLE_STATS */ ret.ui = key; return ret; @@ -2241,7 +2179,7 @@ DBKey db_str2key(unsigned char *key) DBKey ret; #ifdef DB_ENABLE_STATS - if (stats.db_str2key != (unsigned int)~0) stats.db_str2key++; + COUNT(db_str2key); #endif /* DB_ENABLE_STATS */ ret.str = key; return ret; @@ -2257,7 +2195,7 @@ DBKey db_str2key(unsigned char *key) void db_init(void) { #ifdef DB_ENABLE_STATS - if (stats.db_init != (unsigned int)~0) stats.db_init++; + COUNT(db_init); #endif /* DB_ENABLE_STATS */ } diff --git a/src/common/db.h b/src/common/db.h index 2f02c1bfa..aa165acd7 100644 --- a/src/common/db.h +++ b/src/common/db.h @@ -23,8 +23,8 @@ * HISTORY: * * 2.1 (Athena build #???#) - Portability fix * * - Fixed the portability of casting to union and added the functions * - * {@link DBInterface#ensure(DBInterface,DBKey,DBCreateData,...)} and * - * {@link DBInterface#clear(DBInterface,DBApply,...)}. * + * {@link DB#ensure(DB,DBKey,DBCreateData,...)} and * + * {@link DB#clear(DB,DBApply,...)}. * * 2.0 (Athena build 4859) - Transition version * * - Almost everything recoded with a strategy similar to objects, * * database structure is maintained. * @@ -51,11 +51,11 @@ * DBOptions - Bitfield enumeration of database options. * * DBKey - Union of used key types. * * DBApply - Format of functions applyed to the databases. * - * DBMatcher - Format of matchers used in DBInterface->getall. * + * DBMatcher - Format of matchers used in DB::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. * - * DBInterface - Structure of the interface of the database. * + * DB - Database interface. * \*****************************************************************************/ /** @@ -120,7 +120,7 @@ typedef enum { * @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 funtions that return the data (like DBInterface->remove), + * WARNING: for funtions that return the data (like DB::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. @@ -147,16 +147,11 @@ typedef enum { * @param str Type of key for DB_STRING and DB_ISTRING databases * @public * @see #DBType - * @see #DBApply(DBKey,void *,va_list) - * @see #DBMatcher(DBKey,void *,va_list) - * @see #DBComparator(DBKey,DBKey,unsigned short) - * @see #DBHasher(DBKey,unsigned short) - * @see #DBReleaser(DBKey,void *,DBRelease) - * @see DBInterface#get(DBInterface,DBKey) - * @see DBInterface#put(DBInterface,DBKey,void *) - * @see DBInterface#remove(DBInterface,DBKey) + * @see DB#get + * @see DB#put + * @see DB#remove */ -typedef union { +typedef union dbkey { int i; unsigned int ui; unsigned char *str;//## TODO change to 'const char *' @@ -169,9 +164,8 @@ typedef union { * @param args Extra arguments of the funtion * @return Data identified by the key to be put in the database * @public - * @see #DBKey - * @see DBInterface#vensure(DBInterface,DBKey,DBCreateData,va_list) - * @see DBInterface#ensure(DBInterface,DBKey,DBCreateData,...) + * @see DB#vensure + * @see DB#ensure */ typedef void *(*DBCreateData)(DBKey key, va_list args); @@ -185,11 +179,10 @@ typedef void *(*DBCreateData)(DBKey key, va_list args); * @param args Extra arguments of the funtion * @return Value to be added up by the funtion that is applying this * @public - * @see #DBKey - * @see DBInterface#vforeach(DBInterface,DBApply,va_list) - * @see DBInterface#foreach(DBInterface,DBApply,...) - * @see DBInterface#vdestroy(DBInterface,DBApply,va_list) - * @see DBInterface#destroy(DBInterface,DBApply,...) + * @see DB#vforeach + * @see DB#foreach + * @see DB#vdestroy + * @see DB#destroy */ typedef int (*DBApply)(DBKey key, void *data, va_list args); @@ -202,8 +195,7 @@ typedef int (*DBApply)(DBKey key, void *data, va_list args); * @param args Extra arguments of the function * @return 0 if a match, another number otherwise * @public - * @see #DBKey - * @see DBInterface#getall(DBInterface,void **,unsigned int,DBMatcher,...) + * @see DB#getall */ typedef int (*DBMatcher)(DBKey key, void *data, va_list args); @@ -219,7 +211,6 @@ typedef int (*DBMatcher)(DBKey key, void *data, va_list args); * databases. * @return 0 if equal, negative if lower and positive if higher * @public - * @see #DBKey * @see #db_default_cmp(DBType) */ typedef int (*DBComparator)(DBKey key1, DBKey key2, unsigned short maxlen); @@ -234,7 +225,6 @@ typedef int (*DBComparator)(DBKey key1, DBKey key2, unsigned short maxlen); * databases. * @return Hash of the key * @public - * @see #DBKey * @see #db_default_hash(DBType) */ typedef unsigned int (*DBHasher)(DBKey key, unsigned short maxlen); @@ -248,7 +238,6 @@ typedef unsigned int (*DBHasher)(DBKey key, unsigned short maxlen); * @param which What is being requested to be released * @public * @see #DBRelease - * @see #DBKey * @see #db_default_releaser(DBType,DBOptions) * @see #db_custom_release(DBRelease) */ @@ -258,21 +247,22 @@ typedef void (*DBReleaser)(DBKey key, void *data, DBRelease which); * Public interface of a database. Only contains funtions. * All the functions take the interface as the first argument. * @public - * @see DBInterface#get(DBInterface,DBKey) - * @see DBInterface#getall(DBInterface,void **,unsigned int,DBMatch,...) - * @see DBInterface#vgetall(DBInterface,void **,unsigned int,DBMatch,va_list) - * @see DBInterface#put(DBInterface,DBKey,void *) - * @see DBInterface#remove(DBInterface,DBKey) - * @see DBInterface#foreach(DBInterface,DBApply,...) - * @see DBInterface#vforeach(DBInterface,DBApply,va_list) - * @see DBInterface#destroy(DBInterface,DBApply,...) - * @see DBInterface#destroy(DBInterface,DBApply,va_list) - * @see DBInterface#size(DBInterface) - * @see DBInterface#type(DBInterface) - * @see DBInterface#options(DBInterface) + * @see DB#get(DB,DBKey) + * @see DB#getall(DB,void **,unsigned int,DBMatch,...) + * @see DB#vgetall(DB,void **,unsigned int,DBMatch,va_list) + * @see DB#put(DB,DBKey,void *) + * @see DB#remove(DB,DBKey) + * @see DB#foreach(DB,DBApply,...) + * @see DB#vforeach(DB,DBApply,va_list) + * @see DB#destroy(DB,DBApply,...) + * @see DB#destroy(DB,DBApply,va_list) + * @see DB#size(DB) + * @see DB#type(DB) + * @see DB#options(DB) * @see #db_alloc(const char *,int,DBType,DBOptions,unsigned short) */ -typedef struct dbt { +typedef struct dbt *DB; +struct dbt { /** * Get the data of the entry identifid by the key. @@ -280,14 +270,12 @@ typedef struct dbt { * @param key Key that identifies the entry * @return Data of the entry or NULL if not found * @protected - * @see #DBKey - * @see #DBInterface - * @see common\db.c#db_get(DBInterface,DBKey) + * @see #db_get(DB,DBKey) */ void *(*get)(struct dbt *dbi, DBKey key); /** - * Just calls {@link DBInterface#vgetall(DBInterface,void **,unsigned int,DBMatch,va_list)}. + * Just calls {@link DB#vgetall(DB,void **,unsigned int,DBMatch,va_list)}. * Get the data of the entries matched by match. * It puts a maximum of max entries into buf. * If buf is NULL, it only counts the matches. @@ -301,12 +289,10 @@ typedef struct dbt { * @param ... Extra arguments for match * @return The number of entries that matched * @protected - * @see #DBMatcher(DBKey key, void *data, va_list args) - * @see #DBInterface - * @see DBInterface#vgetall(DBInterface,void **,unsigned int,DBMatch,va_list) - * @see common\db.c#db_getall(DBInterface,void **,unsigned int,DBMatch,...) + * @see DB#vgetall + * @see #db_getall(DB,void **,unsigned int,DBMatch,...) */ - unsigned int (*getall)(struct dbt *dbi, void **buf, unsigned int max, DBMatcher match, ...); + unsigned int (*getall)(DB self, void **buf, unsigned int max, DBMatcher match, ...); /** * Get the data of the entries matched by match. @@ -322,15 +308,13 @@ typedef struct dbt { * @param ... Extra arguments for match * @return The number of entries that matched * @protected - * @see #DBMatcher(DBKey key, void *data, va_list args) - * @see #DBInterface - * @see DBInterface#getall(DBInterface,void **,unsigned int,DBMatch,...) - * @see common\db.c#db_vgetall(DBInterface,void **,unsigned int,DBMatch,va_list) + * @see DB#getall + * @see #db_vgetall(DB,void **,unsigned int,DBMatch,va_list) */ - unsigned int (*vgetall)(struct dbt *dbi, void **buf, unsigned int max, DBMatcher match, va_list args); + unsigned int (*vgetall)(DB self, void **buf, unsigned int max, DBMatcher match, va_list args); /** - * Just calls {@link common\db.h\DBInterface#vensure(DBInterface,DBKey,DBCreateData,va_list)}. + * Just calls {@link common\db.h\DB#vensure(DB,DBKey,DBCreateData,va_list)}. * 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. @@ -340,13 +324,10 @@ typedef struct dbt { * @param ... Extra arguments for create * @return Data of the entry * @protected - * @see #DBKey - * @see #DBCreateData - * @see #DBInterface - * @see DBInterface#vensure(DBInterface,DBKey,DBCreateData,va_list) - * @see common\db.c#db_ensure(DBInterface,DBKey,DBCreateData,...) + * @see DB#vensure(DB,DBKey,DBCreateData,va_list) + * @see #db_ensure(DB,DBKey,DBCreateData,...) */ - void *(*ensure)(struct dbt *dbi, DBKey key, DBCreateData create, ...); + void *(*ensure)(DB self, DBKey key, DBCreateData create, ...); /** * Get the data of the entry identified by the key. @@ -358,13 +339,10 @@ typedef struct dbt { * @param args Extra arguments for create * @return Data of the entry * @protected - * @see #DBKey - * @see #DBCreateData - * @see #DBInterface - * @see DBInterface#ensure(DBInterface,DBKey,DBCreateData,...) - * @see common\db.c#db_vensure(DBInterface,DBKey,DBCreateData,va_list) + * @see DB#ensure(DB,DBKey,DBCreateData,...) + * @see #db_vensure(DB,DBKey,DBCreateData,va_list) */ - void *(*vensure)(struct dbt *dbi, DBKey key, DBCreateData create, va_list args); + void *(*vensure)(DB self, DBKey key, DBCreateData create, va_list args); /** * Put the data identified by the key in the database. @@ -375,11 +353,9 @@ typedef struct dbt { * @param data Data to be put in the database * @return The previous data if the entry exists or NULL * @protected - * @see #DBKey - * @see #DBInterface - * @see common\db.c#db_put(DBInterface,DBKey,void *) + * @see #db_put(DB,DBKey,void *) */ - void *(*put)(struct dbt *dbi, DBKey key, void *data); + void *(*put)(DB self, DBKey key, void *data); /** * Remove an entry from the database. @@ -389,14 +365,12 @@ typedef struct dbt { * @param key Key that identifies the entry * @return The data of the entry or NULL if not found * @protected - * @see #DBKey - * @see #DBInterface - * @see common\db.c#db_remove(DBInterface,DBKey) + * @see #db_remove(DB,DBKey) */ - void *(*remove)(struct dbt *dbi, DBKey key); + void *(*remove)(DB self, DBKey key); /** - * Just calls {@link DBInterface#vforeach(DBInterface,DBApply,va_list)}. + * Just calls {@link DB#vforeach(DB,DBApply,va_list)}. * Apply func to every entry in the database. * Returns the sum of values returned by func. * @param dbi Interface of the database @@ -404,12 +378,10 @@ typedef struct dbt { * @param ... Extra arguments for func * @return Sum of the values returned by func * @protected - * @see #DBInterface - * @see #DBApply(DBKey,void *,va_list) - * @see DBInterface#vforeach(DBInterface,DBApply,va_list) - * @see common\db.c#db_foreach(DBInterface,DBApply,...) + * @see DB#vforeach + * @see #db_foreach(DB,DBApply,...) */ - int (*foreach)(struct dbt *dbi, DBApply func, ...); + int (*foreach)(DB self, DBApply func, ...); /** * Apply func to every entry in the database. @@ -419,15 +391,13 @@ typedef struct dbt { * @param args Extra arguments for func * @return Sum of the values returned by func * @protected - * @see #DBApply(DBKey,void *,va_list) - * @see #DBInterface - * @see DBInterface#foreach(DBInterface,DBApply,...) - * @see common\db.c#db_vforeach(DBInterface,DBApply,va_list) + * @see DB#foreach + * @see #db_vforeach(DB,DBApply,va_list) */ - int (*vforeach)(struct dbt *dbi, DBApply func, va_list args); + int (*vforeach)(DB self, DBApply func, va_list args); /** - * Just calls {@link DBInterface#vclear(DBInterface,DBApply,va_list)}. + * Just calls {@link DB#vclear(DB,DBApply,va_list)}. * Removes all entries from the database. * Before deleting an entry, func is applyed to it. * Releases the key and the data. @@ -437,12 +407,10 @@ typedef struct dbt { * @param ... Extra arguments for func * @return Sum of values returned by func * @protected - * @see #DBApply(DBKey,void *,va_list) - * @see #DBInterface - * @see DBInterface#vclear(DBInterface,DBApply,va_list) - * @see common\db.c#db_clear(DBInterface,DBApply,...) + * @see DB#vclear + * @see #db_clear(DB,DBApply,...) */ - int (*clear)(struct dbt *dbi, DBApply func, ...); + int (*clear)(DB self, DBApply func, ...); /** * Removes all entries from the database. @@ -454,15 +422,13 @@ typedef struct dbt { * @param args Extra arguments for func * @return Sum of values returned by func * @protected - * @see #DBApply(DBKey,void *,va_list) - * @see #DBInterface - * @see DBInterface#clear(DBInterface,DBApply,...) - * @see common\db.c#vclear(DBInterface,DBApply,va_list) + * @see DB#clear + * @see #vclear(DB,DBApply,va_list) */ - int (*vclear)(struct dbt *dbi, DBApply func, va_list args); + int (*vclear)(DB self, DBApply func, va_list args); /** - * Just calls {@link DBInterface#vdestroy(DBInterface,DBApply,va_list)}. + * Just calls {@link DB#vdestroy(DB,DBApply,va_list)}. * Finalize the database, feeing all the memory it uses. * Before deleting an entry, func is applyed to it. * Releases the key and the data. @@ -474,12 +440,10 @@ typedef struct dbt { * @param ... Extra arguments for func * @return Sum of values returned by func * @protected - * @see #DBApply(DBKey,void *,va_list) - * @see #DBInterface - * @see DBInterface#vdestroy(DBInterface,DBApply,va_list) - * @see common\db.c#db_destroy(DBInterface,DBApply,...) + * @see DB#vdestroy + * @see #db_destroy(DB,DBApply,...) */ - int (*destroy)(struct dbt *dbi, DBApply func, ...); + int (*destroy)(DB self, DBApply func, ...); /** * Finalize the database, feeing all the memory it uses. @@ -492,46 +456,39 @@ typedef struct dbt { * @param args Extra arguments for func * @return Sum of values returned by func * @protected - * @see #DBInterface - * @see #DBApply(DBKey,void *,va_list) - * @see DBInterface#destroy(DBInterface,DBApply,...) - * @see common\db.c#db_vdestroy(DBInterface,DBApply,va_list) + * @see DB#destroy + * @see #db_vdestroy(DB,DBApply,va_list) */ - int (*vdestroy)(struct dbt *dbi, DBApply func, va_list args); + int (*vdestroy)(DB self, DBApply func, va_list args); /** * Return the size of the database (number of items in the database). * @param dbi Interface of the database * @return Size of the database * @protected - * @see #DBInterface - * @see common\db.c#db_size(DBInterface) + * @see #db_size(DB) */ - unsigned int (*size)(struct dbt *dbi); + unsigned int (*size)(DB self); /** * Return the type of the database. * @param dbi Interface of the database * @return Type of the database * @protected - * @see #DBType - * @see #DBInterface - * @see common\db.c#db_type(DBInterface) + * @see #db_type(DB) */ - DBType (*type)(struct dbt *dbi); + DBType (*type)(DB self); /** * Return the options of the database. * @param dbi Interface of the database * @return Options of the database * @protected - * @see #DBOptions - * @see #DBInterface - * @see common\db.c#db_options(DBInterface) + * @see #db_options(DB) */ - DBOptions (*options)(struct dbt *dbi); + DBOptions (*options)(DB self); -} *DBInterface; +}; //For easy access to the common functions. #ifdef DB_MANUAL_CAST_TO_UNION @@ -664,14 +621,14 @@ DBReleaser db_custom_release(DBRelease which); * @return The interface of the database * @public * @see #DBType - * @see #DBInterface + * @see #DB * @see #db_default_cmp(DBType) * @see #db_default_hash(DBType) * @see #db_default_release(DBType,DBOptions) * @see #db_fix_options(DBType,DBOptions) * @see common\db.c#db_alloc(const char *,int,DBType,DBOptions,unsigned short) */ -DBInterface db_alloc(const char *file, int line, DBType type, DBOptions options, unsigned short maxlen); +DB db_alloc(const char *file, int line, DBType type, DBOptions options, unsigned short maxlen); #ifdef DB_MANUAL_CAST_TO_UNION /** diff --git a/src/common/mapindex.c b/src/common/mapindex.c index 0c3faec75..d0843017e 100644 --- a/src/common/mapindex.c +++ b/src/common/mapindex.c @@ -1,14 +1,16 @@ -#include "mmo.h" #include #include #include -#include "showmsg.h" + +#include "mapindex.h" +#include "../common/mmo.h" +#include "../common/showmsg.h" #include "../common/malloc.h" #define MAX_MAPINDEX 2000 //Leave an extra char of space to hold the terminator, in case for the strncpy(mapindex_id2name()) calls. -struct { +struct indexes { char name[MAP_NAME_LENGTH+1]; //Stores map name int length; //Stores string length WITHOUT the extension for quick lookup. } indexes[MAX_MAPINDEX]; @@ -17,6 +19,52 @@ static unsigned short max_index = 0; char mapindex_cfgfile[80] = "db/map_index.txt"; +/// Adds a map to the specified index +/// Returns 1 if successful, 0 oherwise +static int mapindex_addmap(int index, const char *name) +{ + char map_name[1024]; + char *ext; + int length; + + if (index < 0 || index >= MAX_MAPINDEX) { + ShowError("(mapindex_add) Map index (%d) for \"%s\" out of range (max is %d)\n", index, name, MAX_MAPINDEX); + return 0; + } + snprintf(map_name, 1024, "%s", name); + map_name[1023] = 0; + length = strlen(map_name); + if (length > MAP_NAME_LENGTH) { + ShowError("(mapindex_add) Map name %s is too long. Maps are limited to %d characters.\n", map_name, MAP_NAME_LENGTH); + return 0; + } + if ((ext = strstr(map_name, ".gat")) != NULL) { //Gat map + length = ext-map_name; + } else if ((ext = strstr(map_name, ".afm")) != NULL || (ext = strstr(map_name, ".af2")) != NULL) { //afm map + length = ext-map_name; + sprintf(ext, ".gat"); //Change the extension to gat + } else if ((ext = strstr(map_name, ".")) != NULL) { //Generic extension? + length = ext-map_name; + sprintf(ext, ".gat"); + } else { //No extension? + length = strlen(map_name); + strcat(map_name, ".gat"); + } + if (length > MAP_NAME_LENGTH - 4) { + ShowError("(mapindex_add) Adjusted Map name %s is too long. Maps are limited to %d characters.\n", map_name, MAP_NAME_LENGTH); + return 0; + } + + if (indexes[index].length) + ShowWarning("(mapindex_add) Overriding index %d: map \"%s\" -> \"%s\"\n", indexes[index].name, map_name); + + strncpy(indexes[index].name, map_name, MAP_NAME_LENGTH); + indexes[index].length = length; + if (max_index <= index) + max_index = index+1; + return 1; +} + unsigned short mapindex_name2id(char* name) { //TODO: Perhaps use a db to speed this up? [Skotlex] int i; @@ -30,32 +78,20 @@ unsigned short mapindex_name2id(char* name) { return i; } #ifdef MAPINDEX_AUTOADD - if (i < MAX_MAPINDEX) { - char map_name[MAP_NAME_LENGTH+5]; - length = strlen(name); - if (length > MAP_NAME_LENGTH) - return; - memcpy(map_name, name, length+1); - if ((ext = strstr(map_name, ".")) != NULL) { - length = ext-map_name; - sprintf(ext, ".gat"); - } else { //No extension? - length = strlen(map_name); - strcat(map_name, ".gat"); - } - if (length > MAP_NAME_LENGTH - 4) - return 0; //Can't be added. - strncpy(indexes[i].name, map_name, MAP_NAME_LENGTH); - indexes[i].length = strlen(map_name); - ShowDebug("mapindex_name2id: Added map \"%s\" to position %d\n", indexes[i], i); + if( mapindex_addmap(i,name) ) + { + ShowDebug("mapindex_name2id: Auto-added map \"%s\" to position %d\n", indexes[i], i); return i; } -#endif + ShowWarning("mapindex_name2id: Failed to auto-add map \"%s\" to position %d!\n", name, i); + return 0; +#else ShowDebug("mapindex_name2id: Map \"%s\" not found in index list!\n", name); return 0; +#endif } -char* mapindex_id2name(unsigned short id) { +const char* mapindex_id2name(unsigned short id) { if (id > MAX_MAPINDEX || !indexes[id].length) { ShowDebug("mapindex_id2name: Requested name for non-existant map index [%d] in cache.\n", id); return indexes[0].name; //Theorically this should never happen, hence we return this string to prevent null pointer crashes. @@ -66,9 +102,8 @@ char* mapindex_id2name(unsigned short id) { void mapindex_init(void) { FILE *fp; char line[1024]; - char *ext; int last_index = -1; - int index, length; + int index; char map_name[1024]; malloc_tsetdword (&indexes, 0, sizeof (indexes)); @@ -85,39 +120,7 @@ void mapindex_init(void) { case 1: //Map with no ID given, auto-assign index = last_index+1; case 2: //Map with ID given - if (index < 0 || index >= MAX_MAPINDEX) { - ShowError("(mapindex_init) Map index (%d) for \"%s\" out of range (max is %d)\n", index, map_name, MAX_MAPINDEX); - continue; - } - length = strlen(map_name); - if (length > MAP_NAME_LENGTH) { - ShowError("(mapindex_init) Map name %s is too long. Maps are limited to %d characters.\n", map_name, MAP_NAME_LENGTH); - continue; - } - if ((ext = strstr(map_name, ".gat")) != NULL) { //Gat map - length = ext-map_name; - } else if ((ext = strstr(map_name, ".afm")) != NULL || (ext = strstr(map_name, ".af2")) != NULL) { //afm map - length = ext-map_name; - sprintf(ext, ".gat"); //Change the extension to gat - } else if ((ext = strstr(map_name, ".")) != NULL) { //Generic extension? - length = ext-map_name; - sprintf(ext, ".gat"); - } else { //No extension? - length = strlen(map_name); - strcat(map_name, ".gat"); - } - if (length > MAP_NAME_LENGTH - 4) { - ShowError("(mapindex_init) Adjusted Map name %s is too long. Maps are limited to %d characters.\n", map_name, MAP_NAME_LENGTH); - continue; - } - - if (indexes[index].length) - ShowWarning("(mapindex_init) Overriding index %d: map \"%s\" -> \"%s\"\n", indexes[index].name, map_name); - - strncpy(indexes[index].name, map_name, MAP_NAME_LENGTH); - indexes[index].length = length; - if (max_index <= index) - max_index = index+1; + mapindex_addmap(index,map_name); break; default: continue; @@ -129,4 +132,3 @@ void mapindex_init(void) { void mapindex_final(void) { } - diff --git a/src/common/mapindex.h b/src/common/mapindex.h index 7e2bbe289..3f5b5107a 100644 --- a/src/common/mapindex.h +++ b/src/common/mapindex.h @@ -4,7 +4,8 @@ extern char mapindex_cfgfile[80]; //whether to enable auto-adding of maps during run. Not so secure as the map indexes will vary! -#define MAPINDEX_AUTOADD +// disabled - since mapindex.h wasn't included in mapindex.c it never got enabled anyway... [FlavioJS] +//#define MAPINDEX_AUTOADD //Some definitions for the mayor city maps. #define MAP_PRONTERA "prontera.gat" -- cgit v1.2.3-70-g09d2 From 5f00460ddd810828f3248d1a970b49f965771913 Mon Sep 17 00:00:00 2001 From: ultramage Date: Wed, 3 Jan 2007 18:18:50 +0000 Subject: - Now the server will by default perform symmetric adding of friends - > TODO - symmetric deletion (http://www.eathena.ws/board/index.php?showtopic=130749) - Added a first approximation of warps for the new maps (by $ephiroth) - Added Rachel and Veins to the list of @go destinations git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9613 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog-Trunk.txt | 6 +++++- conf-tmpl/Changelog.txt | 1 + conf-tmpl/battle/player.conf | 3 ++- npc/Changelog.txt | 2 ++ npc/scripts_warps.conf | 5 ++++- npc/warps/cities/veins.txt | 18 ++++++++++++++++++ npc/warps/dungeons/ice_dun.txt | 15 ++++++++++++++- npc/warps/dungeons/thor_dun.txt | 20 ++++++++++++++++++++ npc/warps/fields/rachel_fild.txt | 15 ++++++++++++++- npc/warps/fields/veins_fild.txt | 35 +++++++++++++++++++++++++++++++++++ src/common/mapindex.h | 2 ++ src/map/atcommand.c | 2 ++ src/map/battle.c | 2 +- 13 files changed, 120 insertions(+), 6 deletions(-) create mode 100644 npc/warps/cities/veins.txt create mode 100644 npc/warps/dungeons/thor_dun.txt create mode 100644 npc/warps/fields/veins_fild.txt (limited to 'src/common/mapindex.h') diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index f203e785d..ab470b326 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -4,6 +4,10 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. 2007/01/03 + * Added Rachel and Veins to the list of @go destinations. + * Added a first approximation of warps for the new maps (by $ephiroth). + * Now the server will by default perform symmetric adding of friends. [ultramage] + > TODO - symmetric deletion (http://www.eathena.ws/board/index.php?showtopic=130749) * Fixed TURBO FIFO defines. * Moved refusal of a known packet versions to clif_parse_WantToConnection and made it check for non-player object with that id. @@ -16,7 +20,7 @@ IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. * Added support for text/comments at the end of monster spawn lines ( required) * Added the official behavior of monsters regaining full hp when they morph. > info at http://www.eathena.ws/board/index.php?showtopic=130103 - * Fixed pc_calc_skilltree ignoring prerequisites / joblvl requirements. + * Fixed pc_calc_skilltree ignoring prerequisites / joblvl requirements for soullinked skills. > TODOs at http://www.eathena.ws/board/index.php?showtopic=130788 * Re-applied change r9593 that got accidentally reverted by r9595. [ultramage] diff --git a/conf-tmpl/Changelog.txt b/conf-tmpl/Changelog.txt index a35b3283e..8aed77a3c 100644 --- a/conf-tmpl/Changelog.txt +++ b/conf-tmpl/Changelog.txt @@ -1,6 +1,7 @@ Date Added 2007/01/03 + * Changed friend_auto_add to 'yes' (closer to official, except for one detail) * Changed monster_class_change_full_recover to 'yes' (official) [ultramage] 2006/12/20 * Fixed the meaning of stdout_with_ansisequence and changed the default diff --git a/conf-tmpl/battle/player.conf b/conf-tmpl/battle/player.conf index fbec77f15..f0e8b9f1b 100644 --- a/conf-tmpl/battle/player.conf +++ b/conf-tmpl/battle/player.conf @@ -126,7 +126,8 @@ show_hp_sp_gain: yes // If set, when A accepts B as a friend, B will also be added to A's friend // list, otherwise, only A appears in B's friend list. -friend_auto_add: no +// NOTE: this setting only enables friend auto-adding; auto-deletion does not work yet +friend_auto_add: yes // Are other requests accepted during [various things[party,guild]] a request or not? // It does not accept by no accepted by yes. diff --git a/npc/Changelog.txt b/npc/Changelog.txt index cf43acf56..8b2a036e3 100644 --- a/npc/Changelog.txt +++ b/npc/Changelog.txt @@ -34,6 +34,8 @@ KarLaeda Date Added ====== +2007/01/03 + * Added Veins and Thor Dungeon warps, +fixed some headers [ultramage] 2006/12/28 * Fixed typo in the Priest Quest [KarLaeda] 2006/12/25 diff --git a/npc/scripts_warps.conf b/npc/scripts_warps.conf index 266a1bc77..c555bb6df 100644 --- a/npc/scripts_warps.conf +++ b/npc/scripts_warps.conf @@ -36,6 +36,7 @@ npc: npc/warps/cities/payon.txt npc: npc/warps/cities/prontera.txt npc: npc/warps/cities/rachel.txt npc: npc/warps/cities/umbala.txt +npc: npc/warps/cities/veins.txt npc: npc/warps/cities/yggdrasil.txt npc: npc/warps/cities/yuno.txt // -------------------------- Dungeons -------------------------- @@ -53,6 +54,7 @@ npc: npc/warps/dungeons/gon_dun.txt npc: npc/warps/dungeons/ice_dun.txt npc: npc/warps/dungeons/izlude_dun.txt npc: npc/warps/dungeons/juperos.txt +npc: npc/warps/dungeons/kiel_dun.txt npc: npc/warps/dungeons/lhalzen_dun.txt npc: npc/warps/dungeons/louyang_dun.txt npc: npc/warps/dungeons/lutie_dun.txt @@ -64,9 +66,9 @@ npc: npc/warps/dungeons/prt_dun.txt npc: npc/warps/dungeons/rachel_dun.txt npc: npc/warps/dungeons/thana_dun.txt //npc: npc/warps/dungeons/thana_custom.txt +npc: npc/warps/dungeons/thor_dun.txt npc: npc/warps/dungeons/umbala_dun.txt npc: npc/warps/dungeons/yuno_dun.txt -npc: npc/warps/dungeons/kiel_dun.txt // --------------------------- Fields --------------------------- npc: npc/warps/fields/amatsu_fild.txt npc: npc/warps/fields/com_fild.txt @@ -84,6 +86,7 @@ npc: npc/warps/fields/payon_fild.txt npc: npc/warps/fields/prontera_fild.txt npc: npc/warps/fields/rachel_fild.txt npc: npc/warps/fields/umbala_fild.txt +npc: npc/warps/fields/veins_fild.txt npc: npc/warps/fields/yuno_fild.txt npc: npc/warps/fields/abyss_warper.txt // --------------------------- Others --------------------------- diff --git a/npc/warps/cities/veins.txt b/npc/warps/cities/veins.txt new file mode 100644 index 000000000..49f2e7f36 --- /dev/null +++ b/npc/warps/cities/veins.txt @@ -0,0 +1,18 @@ +//===== Athena Script ======================================== +//= Veins City Warp Script +//===== By: ================================================== +//= $ephiroth +//===== Current Version: ===================================== +//= 1.0 +//===== Compatible With: ===================================== +//= Any Athena Version +//===== Description: ========================================= +//= Warp Points for Veins +//===== Additional Comments: ================================= +//= 1.0 Initial version [$ephiroth] +//============================================================ + +//= Veins City ================================================ +veins.gat,218,361,0 warp veinswarp0501 1,1,ve_fild06.gat,152,221 +veins.gat,146,24,0 warp veinswarp0502 1,1,ve_fild07.gat,148,370 +rachel.gat,130,20,0 warp veinswarp0503 1,1,ve_fild02.gat,196,379 \ No newline at end of file diff --git a/npc/warps/dungeons/ice_dun.txt b/npc/warps/dungeons/ice_dun.txt index 570ca4d09..4ac7d4036 100644 --- a/npc/warps/dungeons/ice_dun.txt +++ b/npc/warps/dungeons/ice_dun.txt @@ -1,4 +1,17 @@ -//Ice Dungeon Warps +//===== Athena Script ======================================== +//= Ice Dungeon Warp Script +//===== By: ================================================== +//= Playtester +//===== Current Version: ===================================== +//= 1.0 +//===== Compatible With: ===================================== +//= Any Athena Version +//===== Description: ========================================= +//= Warp Points for Ice Dungeon +//===== Additional Comments: ================================= +//= 1.0 Initial version [Playtester] +//============================================================ + ice_dun01.gat,157,10,0 warp ice001 1,1,ra_fild01.gat,233,330 ice_dun01.gat,145,153,0 warp ice002 1,1,ice_dun02.gat,151,155 ice_dun02.gat,151,160,0 warp ice003 1,1,ice_dun01.gat,146,157 diff --git a/npc/warps/dungeons/thor_dun.txt b/npc/warps/dungeons/thor_dun.txt new file mode 100644 index 000000000..6649f9e0c --- /dev/null +++ b/npc/warps/dungeons/thor_dun.txt @@ -0,0 +1,20 @@ +//===== Athena Script ======================================== +//= Thor's Volcano Dungeon Warp Script +//===== By: ================================================== +//= $ephiroth +//===== Current Version: ===================================== +//= 1.0 +//===== Compatible With: ===================================== +//= Any Athena Version +//===== Description: ========================================= +//= Warp Points for Thor's Volcano Dungeon +//===== Additional Comments: ================================= +//= 1.0 Initial version [$ephiroth] +//============================================================ + +//= Thor's Volcano Dungeon==================================== +thor_v01.gat,21,223,0 warp thor00 1,1,ve_fild03.gat,168,238 +thor_v01.gat,202,34,0 warp thor01 1,1,thor_v02.gat,74,205 +thor_v02.gat,72,206,0 warp thor02 1,1,thor_v01.gat,199,34 +thor_v02.gat,191,55,0 warp thor03 1,1,thor_v03.gat,31,272 +thor_v03.gat,28,272,0 warp thor04 1,1,thor_v02.gat,190,57 \ No newline at end of file diff --git a/npc/warps/fields/rachel_fild.txt b/npc/warps/fields/rachel_fild.txt index 7b9889e8d..92db6f111 100644 --- a/npc/warps/fields/rachel_fild.txt +++ b/npc/warps/fields/rachel_fild.txt @@ -1,4 +1,17 @@ -//Rachel Fields +//===== Athena Script ======================================== +//= Rachel Field Warp Script +//===== By: ================================================== +//= Playtester +//===== Current Version: ===================================== +//= 1.0 +//===== Compatible With: ===================================== +//= Any Athena Version +//===== Description: ========================================= +//= Warp Points for Rachel Field +//===== Additional Comments: ================================= +//= 1.0 Initial version [Playtester] +//============================================================ + ra_fild01.gat,233,334,0 warp ra000 1,1,ice_dun01.gat,157,14 ra_fild01.gat,305,38,0 warp ra001 1,1,ra_fild04.gat,324,375 ra_fild04.gat,324,379,0 warp ra002 1,1,ra_fild01.gat,305,42 diff --git a/npc/warps/fields/veins_fild.txt b/npc/warps/fields/veins_fild.txt new file mode 100644 index 000000000..c7584e29a --- /dev/null +++ b/npc/warps/fields/veins_fild.txt @@ -0,0 +1,35 @@ +//===== Athena Script ======================================== +//= Veins Field Warp Script +//===== By: ================================================== +//= $ephiroth +//===== Current Version: ===================================== +//= 1.0 +//===== Compatible With: ===================================== +//= Any Athena Version +//===== Description: ========================================= +//= Warp Points for Veins Field +//===== Additional Comments: ================================= +//= 1.0 Initial version [$ephiroth] +//============================================================ + +//= Beins Field (ve_fild) ==================================== +ve_fild02.gat,196,382,0 warp veinswarp5001 1,1,rachel.gat,130,23 +ve_fild06.gat,154,219,0 warp veinswarp5002 1,1,veins.gat,218,358 +ve_fild07.gat,147,372,0 warp veinswarp5003 1,1,veins.gat,146,27 +ve_fild03.gat,168,241,0 warp veinswarp5004 1,1,thor_v01.gat,21,226 +ve_fild01.gat,243,369,0 warp veinswarp5005 1,1,ra_fild11.gat,232,29 +ra_fild11.gat,232,26,0 warp veinswarp5006 1,1,ve_fild01.gat,243,366 +ve_fild01.gat,367,263,0 warp veinswarp5007 1,1,ve_fild02.gat,33,259 +ve_fild02.gat,30,259,0 warp veinswarp5008 1,1,ve_fild01.gat,364,263 +ve_fild01.gat,351,95,0 warp veinswarp5009 1,1,ve_fild02.gat,76,133 +ve_fild02.gat,73,133,0 warp veinswarp5010 1,1,ve_fild01.gat,348,95 +ve_fild01.gat,185,19,0 warp veinswarp5011 1,1,ve_fild04.gat,174,337 +ve_fild04.gat,174,340,0 warp veinswarp5012 1,1,ve_fild01.gat,185,22 +ve_fild02.gat,385,309,0 warp veinswarp5013 1,1,ra_fild13.gat,31,311 +ra_fild13.gat,28,311,0 warp veinswarp5014 1,1,ve_fild02.gat,382,309 +ve_fild03.gat,355,222,0 warp veinswarp5015 1,1,ve_fild04.gat,46,249 +ve_fild04.gat,43,249,0 warp veinswarp5016 1,1,ve_fild03.gat,353,221 +ve_fild03.gat,222,42,0 warp veinswarp5017 1,1,ve_fild05.gat,204,330 +ve_fild05.gat,206,331,0 warp veinswarp5018 1,1,ve_fild03.gat,222,45 +ve_fild04.gat,115,49,0 warp veinswarp5019 1,1,ve_fild06.gat,84,179 +ve_fild06.gat,84,176,0 warp veinswarp5020 1,1,ve_fild04.gat,115,52 \ No newline at end of file diff --git a/src/common/mapindex.h b/src/common/mapindex.h index 3f5b5107a..b5ca54180 100644 --- a/src/common/mapindex.h +++ b/src/common/mapindex.h @@ -29,6 +29,8 @@ extern char mapindex_cfgfile[80]; #define MAP_LIGHTHALZEN "lighthalzen.gat" #define MAP_EINBECH "einbech.gat" #define MAP_HUGEL "hugel.gat" +#define MAP_RACHEL "rachel.gat" +#define MAP_VEINS "veins.gat" #define MAP_JAIL "sec_pri.gat" unsigned short mapindex_name2id(char*); const char* mapindex_id2name(unsigned short); diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 0d595bef3..0784dc571 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -3324,6 +3324,8 @@ int atcommand_go( { MAP_LIGHTHALZEN, 158, 92 }, // 20=Lighthalzen { MAP_EINBECH, 70, 95 }, // 21=Einbech { MAP_HUGEL, 96, 145 }, // 22=Hugel + { MAP_RACHEL, 130, 110 }, // 23=Rachel + { MAP_VEINS, 216, 123 }, // 24=Veins }; nullpo_retr(-1, sd); diff --git a/src/map/battle.c b/src/map/battle.c index 9951090e7..6c7a5b07b 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -4244,7 +4244,7 @@ void battle_set_defaults() { battle_config.autospell_stacking = 0; battle_config.override_mob_names = 0; battle_config.min_chat_delay = 0; - battle_config.friend_auto_add = 0; + battle_config.friend_auto_add = 1; battle_config.hvan_explosion_intimate = 45000; //[orn] battle_config.homunculus_show_growth = 0; //[orn] battle_config.homunculus_friendly_rate = 100; -- cgit v1.2.3-70-g09d2 From 9d26e6b5088c10b1f565e31b9a273e6ed48cad38 Mon Sep 17 00:00:00 2001 From: ultramage Date: Thu, 4 Jan 2007 18:33:53 +0000 Subject: - Updated /doc from jAthena - Completed adding of the new cities to @go > that function is ugly and needs a complete rewrite, asap - Updated thor volcano warps git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9615 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog-Trunk.txt | 6 + doc/client_packet.txt | 616 ++++++++++++++++++++++++++++++----- doc/coredump_report.txt | 16 + doc/db_ref.txt | 533 +++++++++++++++++++++++++++++- doc/effect_list.txt | 697 ++++++++++++++++++++-------------------- doc/inter_server_packet.txt | 152 +++++++-- npc/warps/dungeons/thor_dun.txt | 9 +- src/common/mapindex.h | 1 + src/common/socket.c | 2 - src/map/atcommand.c | 9 +- 10 files changed, 1553 insertions(+), 488 deletions(-) (limited to 'src/common/mapindex.h') diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index ab470b326..caaeda2af 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -3,6 +3,12 @@ Date Added AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK. IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. +2007/01/04 + * Completed adding of the new cities to @go. + > that function is ugly and needs a complete rewrite, asap. + * Updated thor volcano warps. + * Updated /doc from jAthena. [ultramage] + 2007/01/03 * Added Rachel and Veins to the list of @go destinations. * Added a first approximation of warps for the new maps (by $ephiroth). diff --git a/doc/client_packet.txt b/doc/client_packet.txt index 61fb10719..9c2b00bc2 100644 --- a/doc/client_packet.txt +++ b/doc/client_packet.txt @@ -1,19 +1,3 @@ -Client Version in date format (Client Version in 4 digit format): -2004 06 28a (0628a) -2004 10 25 (1025) -2004 11 01 (1101) -2004 12 13 (1213) -2005 01 10 (0110) -2005 03 15 (0315) -2005 03 21 (0321) -2005 04 04 (0404) -2005 04 06 (0406)* -2005 04 11a (0411a) -2005 04 25a (0425a) -2005 05 31b (0531b) -2005 06 14 (0614) -2005 06 28a (0628a) -2005 08 08 (0808) 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -54,8 +38,8 @@ Client Version in date format (Client Version in 4 digit format): 8, 14, 10, 35, 6, 8, 4, 11, 54, 53, 60, 2, -1, 47, 33, 6, 30, 8, 34, 14, 2, 6, 26, 2, 28, 81, 6, 10, 26, 2, -1, -1, -1, -1, 20, 10, 32, 9, 34, 14, 2, 6, 48, 56, -1, 4, 5, 10, -#0x200 - 26, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 19, +#0x0200 + 26, -1, 26, 10, 18, 26, 11, 34, 14, 36, 10, 19, 19, -1, 24, 0, S クライアントから見て送信 R クライアントから見て受信 @@ -89,7 +73,7 @@ R 006a .B err No=07 サーバーが混雑しています R 006b .w .106B* キャラセレ鯖接続成功&キャラクタデータ - = .l .l .l .l .l ?.8B