- Cleaned up a bit the format of skill_db.txt (that comma next to the skill name looks ugly if you ask me)
- Corrected skill_db reading to properly trim the skill name/descs. - Added a mobid_db in map.c to handle mob lookups faster. git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@11943 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
ace81763bc
commit
ece12b6e42
@ -3,6 +3,9 @@ Date Added
|
|||||||
AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
|
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.
|
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
|
||||||
|
|
||||||
|
2007/12/18
|
||||||
|
* Corrected skill_db reading to properly trim the skill name/descs.
|
||||||
|
* Added a mobid_db in map.c to handle mob lookups faster. [Skotlex]
|
||||||
2007/12/17
|
2007/12/17
|
||||||
* Added flag.server to indicate interserver sockets
|
* Added flag.server to indicate interserver sockets
|
||||||
- replaces the previous way (setting 'client_addr' to 0)
|
- replaces the previous way (setting 'client_addr' to 0)
|
||||||
|
@ -38,6 +38,9 @@
|
|||||||
|
|
||||||
=======================
|
=======================
|
||||||
|
|
||||||
|
12/18
|
||||||
|
* Cleaned up a bit the format of skill_db.txt (that comma next to the skill
|
||||||
|
name looks ugly if you ask me)
|
||||||
12/14
|
12/14
|
||||||
* corrected Option_Xmas value in const.txt [Skotlex]
|
* corrected Option_Xmas value in const.txt [Skotlex]
|
||||||
12/13
|
12/13
|
||||||
|
@ -96,6 +96,7 @@ char *MSG_CONF_NAME;
|
|||||||
// 極力 staticでロ?カルに?める
|
// 極力 staticでロ?カルに?める
|
||||||
static DBMap* id_db=NULL; // int id -> struct block_list*
|
static DBMap* id_db=NULL; // int id -> struct block_list*
|
||||||
static DBMap* pc_db=NULL; // int id -> struct map_session_data*
|
static DBMap* pc_db=NULL; // int id -> struct map_session_data*
|
||||||
|
static DBMap* mobid_db=NULL; // int id -> struct mob_data*
|
||||||
static DBMap* map_db=NULL; // unsigned int mapindex -> struct map_data*
|
static DBMap* map_db=NULL; // unsigned int mapindex -> struct map_data*
|
||||||
static DBMap* nick_db=NULL; // int char_id -> struct charid2nick* (requested names of offline characters)
|
static DBMap* nick_db=NULL; // int char_id -> struct charid2nick* (requested names of offline characters)
|
||||||
static DBMap* charid_db=NULL; // int char_id -> struct map_session_data*
|
static DBMap* charid_db=NULL; // int char_id -> struct map_session_data*
|
||||||
@ -1643,7 +1644,9 @@ void map_addiddb(struct block_list *bl)
|
|||||||
TBL_PC* sd = (TBL_PC*)bl;
|
TBL_PC* sd = (TBL_PC*)bl;
|
||||||
idb_put(pc_db,sd->bl.id,sd);
|
idb_put(pc_db,sd->bl.id,sd);
|
||||||
idb_put(charid_db,sd->status.char_id,sd);
|
idb_put(charid_db,sd->status.char_id,sd);
|
||||||
}
|
} else if (bl->type == BL_MOB)
|
||||||
|
idb_put(mobid_db,bl->id,bl);
|
||||||
|
|
||||||
idb_put(id_db,bl->id,bl);
|
idb_put(id_db,bl->id,bl);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1659,7 +1662,8 @@ void map_deliddb(struct block_list *bl)
|
|||||||
TBL_PC* sd = (TBL_PC*)bl;
|
TBL_PC* sd = (TBL_PC*)bl;
|
||||||
idb_remove(pc_db,sd->bl.id);
|
idb_remove(pc_db,sd->bl.id);
|
||||||
idb_remove(charid_db,sd->status.char_id);
|
idb_remove(charid_db,sd->status.char_id);
|
||||||
}
|
} else if (bl->type == BL_MOB)
|
||||||
|
idb_remove(mobid_db,bl->id);
|
||||||
idb_remove(id_db,bl->id);
|
idb_remove(id_db,bl->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1764,9 +1768,9 @@ struct map_session_data * map_id2sd(int id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct mob_data * map_id2md(int id)
|
struct mob_data * map_id2md(int id)
|
||||||
{// just a id2bl lookup because there's no mob_db
|
{
|
||||||
if (id <= 0) return NULL;
|
if (id <= 0) return NULL;
|
||||||
return (struct mob_data*)map_id2bl(id);
|
return (struct mob_data*)idb_get(mobid_db,id);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct npc_data * map_id2nd(int id)
|
struct npc_data * map_id2nd(int id)
|
||||||
@ -1909,6 +1913,14 @@ void map_foreachpc(int (*func)(DBKey,void*,va_list),...)
|
|||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void map_foreachmob(int (*func)(DBKey,void*,va_list),...)
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
va_start(ap,func);
|
||||||
|
mobid_db->vforeach(mobid_db,func,ap);
|
||||||
|
va_end(ap);
|
||||||
|
}
|
||||||
|
|
||||||
/*==========================================
|
/*==========================================
|
||||||
* id_db?の全てにfuncを?行
|
* id_db?の全てにfuncを?行
|
||||||
*------------------------------------------*/
|
*------------------------------------------*/
|
||||||
@ -3113,6 +3125,7 @@ void do_final(void)
|
|||||||
|
|
||||||
id_db->destroy(id_db, NULL);
|
id_db->destroy(id_db, NULL);
|
||||||
pc_db->destroy(pc_db, NULL);
|
pc_db->destroy(pc_db, NULL);
|
||||||
|
mobid_db->destroy(mobid_db, NULL);
|
||||||
nick_db->destroy(nick_db, nick_db_final);
|
nick_db->destroy(nick_db, nick_db_final);
|
||||||
charid_db->destroy(charid_db, NULL);
|
charid_db->destroy(charid_db, NULL);
|
||||||
|
|
||||||
@ -3291,6 +3304,7 @@ int do_init(int argc, char *argv[])
|
|||||||
|
|
||||||
id_db = idb_alloc(DB_OPT_BASE);
|
id_db = idb_alloc(DB_OPT_BASE);
|
||||||
pc_db = idb_alloc(DB_OPT_BASE); //Added for reliable map_id2sd() use. [Skotlex]
|
pc_db = idb_alloc(DB_OPT_BASE); //Added for reliable map_id2sd() use. [Skotlex]
|
||||||
|
mobid_db = idb_alloc(DB_OPT_BASE); //Added to lower the load of the lazy mob ai. [Skotlex]
|
||||||
map_db = uidb_alloc(DB_OPT_BASE);
|
map_db = uidb_alloc(DB_OPT_BASE);
|
||||||
nick_db = idb_alloc(DB_OPT_BASE);
|
nick_db = idb_alloc(DB_OPT_BASE);
|
||||||
charid_db = idb_alloc(DB_OPT_BASE);
|
charid_db = idb_alloc(DB_OPT_BASE);
|
||||||
|
@ -1335,6 +1335,7 @@ void map_addiddb(struct block_list *);
|
|||||||
void map_deliddb(struct block_list *bl);
|
void map_deliddb(struct block_list *bl);
|
||||||
struct map_session_data** map_getallusers(int *users);
|
struct map_session_data** map_getallusers(int *users);
|
||||||
void map_foreachpc(int (*func)(DBKey,void*,va_list),...);
|
void map_foreachpc(int (*func)(DBKey,void*,va_list),...);
|
||||||
|
void map_foreachmob(int (*func)(DBKey,void*,va_list),...);
|
||||||
int map_foreachiddb(int (*)(DBKey,void*,va_list),...);
|
int map_foreachiddb(int (*)(DBKey,void*,va_list),...);
|
||||||
struct map_session_data * map_nick2sd(const char*);
|
struct map_session_data * map_nick2sd(const char*);
|
||||||
|
|
||||||
|
@ -1383,7 +1383,7 @@ static int mob_ai_sub_lazy(DBKey key,void * data,va_list ap)
|
|||||||
|
|
||||||
nullpo_retr(0, md);
|
nullpo_retr(0, md);
|
||||||
|
|
||||||
if(md->bl.type!=BL_MOB || md->bl.prev == NULL)
|
if(md->bl.prev == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (md->nd || (battle_config.mob_ai&0x20 && map[md->bl.m].users>0))
|
if (md->nd || (battle_config.mob_ai&0x20 && map[md->bl.m].users>0))
|
||||||
@ -1443,7 +1443,7 @@ static int mob_ai_sub_lazy(DBKey key,void * data,va_list ap)
|
|||||||
*------------------------------------------*/
|
*------------------------------------------*/
|
||||||
static int mob_ai_lazy(int tid,unsigned int tick,int id,int data)
|
static int mob_ai_lazy(int tid,unsigned int tick,int id,int data)
|
||||||
{
|
{
|
||||||
map_foreachiddb(mob_ai_sub_lazy,tick);
|
map_foreachmob(mob_ai_sub_lazy,tick);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10821,8 +10821,8 @@ static bool skill_parse_row_skilldb(char* split[], int columns, int current)
|
|||||||
else
|
else
|
||||||
skill_db[i].skill_type = 0;
|
skill_db[i].skill_type = 0;
|
||||||
skill_split_atoi(split[14],skill_db[i].blewcount);
|
skill_split_atoi(split[14],skill_db[i].blewcount);
|
||||||
safestrncpy(skill_db[i].name, split[15], sizeof(skill_db[i].name));
|
safestrncpy(skill_db[i].name, trim(split[15]), sizeof(skill_db[i].name));
|
||||||
safestrncpy(skill_db[i].desc, split[16], sizeof(skill_db[i].desc));
|
safestrncpy(skill_db[i].desc, trim(split[16]), sizeof(skill_db[i].desc));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user