summaryrefslogtreecommitdiff
path: root/src/map/chat.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2015-12-28 15:41:36 +0100
committerHaru <haru@dotalux.com>2016-01-06 15:18:39 +0100
commite3eac134b1607cfe78331e298aaa20b260662571 (patch)
tree135f15dadc1c7964b3078fd8223771f94d1ed0e6 /src/map/chat.c
parent0e05c1ed742707e0eb5923b562b2f6b8c6c5a3be (diff)
downloadhercules-e3eac134b1607cfe78331e298aaa20b260662571.tar.gz
hercules-e3eac134b1607cfe78331e298aaa20b260662571.tar.bz2
hercules-e3eac134b1607cfe78331e298aaa20b260662571.tar.xz
hercules-e3eac134b1607cfe78331e298aaa20b260662571.zip
Replaced the remaining explicit casts with BL_CAST/BL_UCAST
Signed-off-by: Haru <haru@dotalux.com>
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 );