diff options
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; |