diff options
author | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2009-01-31 15:48:04 +0000 |
---|---|---|
committer | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2009-01-31 15:48:04 +0000 |
commit | 64b6e20b84aa3dca07228df923e73c0703b3d5af (patch) | |
tree | 013b60c9e17b9bf6819a0da06feda229adc78b3d /src/map/chat.c | |
parent | 4dbc7922cdb25fcedc9ca39fc72ddca926e61efe (diff) | |
download | hercules-64b6e20b84aa3dca07228df923e73c0703b3d5af.tar.gz hercules-64b6e20b84aa3dca07228df923e73c0703b3d5af.tar.bz2 hercules-64b6e20b84aa3dca07228df923e73c0703b3d5af.tar.xz hercules-64b6e20b84aa3dca07228df923e73c0703b3d5af.zip |
objects[] array removal (bugreport:2559)
- Removed the 2 MB wide static array in favor of a general-purpose DBMap (id_db for now).
- Inlined functions map_addobject, map_delobject and map_delobjectnofree into their callers' code.
- Replaced the free id lookup algorithm from ancient jathena with something more efficient.
- Moved the algorithm to map_get_new_object_id() (similar idea as r13481).
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13503 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/chat.c')
-rw-r--r-- | src/map/chat.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/map/chat.c b/src/map/chat.c index 8446596e6..a761d528a 100644 --- a/src/map/chat.c +++ b/src/map/chat.c @@ -40,12 +40,12 @@ static struct chat_data* chat_createchat(struct block_list* bl, const char* titl cd->owner = bl; safestrncpy(cd->npc_event, ev, sizeof(cd->npc_event)); + cd->bl.id = map_get_new_object_id(); cd->bl.m = bl->m; cd->bl.x = bl->x; cd->bl.y = bl->y; cd->bl.type = BL_CHAT; cd->bl.next = cd->bl.prev = NULL; - cd->bl.id = map_addobject(&cd->bl); if( cd->bl.id == 0 ) { @@ -53,6 +53,8 @@ static struct chat_data* chat_createchat(struct block_list* bl, const char* titl cd = NULL; } + map_addiddb(&cd->bl); + return cd; } @@ -172,7 +174,8 @@ int chat_leavechat(struct map_session_data* sd, bool kicked) if( cd->users == 0 && cd->owner->type == BL_PC ) { // Delete empty chatroom clif_clearchat(cd, 0); - map_delobject(cd->bl.id); + map_delblock(&cd->bl); + map_freeblock(&cd->bl); return 1; } @@ -323,7 +326,8 @@ int chat_deletenpcchat(struct npc_data* nd) chat_npckickall(cd); clif_clearchat(cd, 0); - map_delobject(cd->bl.id); // freeまでしてくれる + map_delblock(&cd->bl); + map_freeblock(&cd->bl); nd->chat_id = 0; return 0; |