summaryrefslogtreecommitdiff
path: root/src/map/chat.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/chat.c')
-rw-r--r--src/map/chat.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/map/chat.c b/src/map/chat.c
index 7b4894deb..d60b9bece 100644
--- a/src/map/chat.c
+++ b/src/map/chat.c
@@ -53,7 +53,7 @@ struct chat_data* chat_createchat(struct block_list* bl, const char* title, cons
nullpo_retr(NULL, ev);
/* Given the overhead and the numerous instances (npc allocated or otherwise) wouldn't it be beneficial to have it use ERS? [Ind] */
- cd = (struct chat_data *) aMalloc(sizeof(struct chat_data));
+ CREATE(cd, struct chat_data, 1);
safestrncpy(cd->title, title, sizeof(cd->title));
safestrncpy(cd->pass, pass, sizeof(cd->pass));
@@ -247,14 +247,14 @@ int chat_leavechat(struct map_session_data* sd, bool kicked) {
if( leavechar == 0 && cd->owner->type == BL_PC ) {
// Set and announce new owner
- cd->owner = (struct block_list*) cd->usersd[0];
+ cd->owner = &cd->usersd[0]->bl;
clif->changechatowner(cd, cd->usersd[0]);
clif->clearchat(cd, 0);
//Adjust Chat location after owner has been changed.
map->delblock( &cd->bl );
- cd->bl.x=cd->usersd[0]->bl.x;
- cd->bl.y=cd->usersd[0]->bl.y;
+ cd->bl.x = cd->owner->x;
+ cd->bl.y = cd->owner->y;
map->addblock( &cd->bl );
clif->dispchat(cd,0);
@@ -280,7 +280,7 @@ bool chat_changechatowner(struct map_session_data* sd, const char* nextownername
nullpo_ret(nextownername);
cd = map->id2cd(sd->chatID);
- if( cd == NULL || (struct block_list*) sd != cd->owner )
+ if (cd == NULL || &sd->bl != cd->owner)
return false;
ARR_FIND( 1, cd->users, i, strncmp(cd->usersd[i]->status.name, nextownername, NAME_LENGTH) == 0 );
@@ -291,7 +291,7 @@ bool chat_changechatowner(struct map_session_data* sd, const char* nextownername
clif->clearchat(cd,0);
// set new owner
- cd->owner = (struct block_list*) cd->usersd[i];
+ cd->owner = &cd->usersd[i]->bl;
clif->changechatowner(cd,cd->usersd[i]);
// swap the old and new owners' positions
@@ -325,7 +325,7 @@ bool chat_changechatstatus(struct map_session_data* sd, const char* title, const
nullpo_ret(pass);
cd = map->id2cd(sd->chatID);
- if( cd==NULL || (struct block_list *)sd != cd->owner )
+ if (cd == NULL || &sd->bl != cd->owner)
return false;
safestrncpy(cd->title, title, CHATROOM_TITLE_SIZE);
@@ -354,7 +354,7 @@ bool chat_kickchat(struct map_session_data* sd, const char* kickusername) {
cd = map->id2cd(sd->chatID);
- if( cd==NULL || (struct block_list *)sd != cd->owner )
+ if (cd == NULL || &sd->bl != cd->owner)
return false;
ARR_FIND( 0, cd->users, i, strncmp(cd->usersd[i]->status.name, kickusername, NAME_LENGTH) == 0 );