summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIbrahem Hossam <hemagx2@gmail.com>2016-04-24 13:13:19 +0200
committerIbrahem Hossam <hemagx2@gmail.com>2016-04-24 13:13:19 +0200
commit31e27a130676e3e416b583bb947f9dd87efdce81 (patch)
treef91422fa8b0ecd93ccb15720bc15a9b9b839cfd2 /src
parent3ccc681a4bebd5b91b96c1c7059fdec91f2b5d16 (diff)
parent9fdb4567ab8af97004d7c6dcd35f27f788b0bb15 (diff)
downloadhercules-31e27a130676e3e416b583bb947f9dd87efdce81.tar.gz
hercules-31e27a130676e3e416b583bb947f9dd87efdce81.tar.bz2
hercules-31e27a130676e3e416b583bb947f9dd87efdce81.tar.xz
hercules-31e27a130676e3e416b583bb947f9dd87efdce81.zip
Merge pull request #1264 from HerculesWS/vs2015
Diffstat (limited to 'src')
-rw-r--r--src/map/atcommand.c24
-rw-r--r--src/map/battleground.c7
-rw-r--r--src/map/battleground.h2
-rw-r--r--src/map/channel.c51
-rw-r--r--src/map/chat.c18
-rw-r--r--src/map/clif.c252
-rw-r--r--src/map/clif.h12
-rw-r--r--src/map/duel.c16
-rw-r--r--src/map/guild.c11
-rw-r--r--src/map/guild.h2
-rw-r--r--src/map/homunculus.c2
-rw-r--r--src/map/intif.c18
-rw-r--r--src/map/intif.h8
-rw-r--r--src/map/mob.c8
-rw-r--r--src/map/party.c12
-rw-r--r--src/map/party.h2
-rw-r--r--src/map/pc.c24
-rw-r--r--src/map/pc.h8
-rw-r--r--src/map/script.c43
-rw-r--r--src/map/skill.c7
-rw-r--r--src/map/unit.c2
-rw-r--r--src/map/vending.c2
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.Hooks.inc102
23 files changed, 339 insertions, 294 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 3da5c203f..d08367340 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -1091,9 +1091,9 @@ ACMD(kami)
sscanf(message, "%199[^\n]", atcmd_output);
if (stristr(info->command, "l") != NULL)
- clif->broadcast(&sd->bl, atcmd_output, strlen(atcmd_output) + 1, BC_DEFAULT, ALL_SAMEMAP);
+ clif->broadcast(&sd->bl, atcmd_output, (int)strlen(atcmd_output) + 1, BC_DEFAULT, ALL_SAMEMAP);
else
- intif->broadcast(atcmd_output, strlen(atcmd_output) + 1, (*(info->command + 4) == 'b' || *(info->command + 4) == 'B') ? BC_BLUE : BC_YELLOW);
+ intif->broadcast(atcmd_output, (int)strlen(atcmd_output) + 1, (*(info->command + 4) == 'b' || *(info->command + 4) == 'B') ? BC_BLUE : BC_YELLOW);
} else {
if(!*message || (sscanf(message, "%10u %199[^\n]", &color, atcmd_output) < 2)) {
clif->message(fd, msg_fd(fd,981)); // Please enter color and message (usage: @kamic <color> <message>).
@@ -1104,7 +1104,7 @@ ACMD(kami)
clif->message(fd, msg_fd(fd,982)); // Invalid color.
return false;
}
- intif->broadcast2(atcmd_output, strlen(atcmd_output) + 1, color, 0x190, 12, 0, 0);
+ intif->broadcast2(atcmd_output, (int)strlen(atcmd_output) + 1, color, 0x190, 12, 0, 0);
}
return true;
}
@@ -3793,7 +3793,7 @@ ACMD(mapinfo)
if( pl_sd->mapindex == m_index ) {
if( pl_sd->state.vending )
vend_num++;
- else if ((cd = map->id2cd(pl_sd->chatID)) != NULL && cd->usersd[0] == pl_sd)
+ else if ((cd = map->id2cd(pl_sd->chat_id)) != NULL && cd->usersd[0] == pl_sd)
chat_num++;
}
}
@@ -3972,7 +3972,7 @@ ACMD(mapinfo)
clif->message(fd, msg_fd(fd,1113)); // ----- Chats in Map -----
iter = mapit_getallusers();
for (pl_sd = BL_UCCAST(BL_PC, mapit->first(iter)); mapit->exists(iter); pl_sd = BL_UCCAST(BL_PC, mapit->next(iter))) {
- if ((cd = map->id2cd(pl_sd->chatID)) != NULL && pl_sd->mapindex == m_index && cd->usersd[0] == pl_sd) {
+ if ((cd = map->id2cd(pl_sd->chat_id)) != NULL && pl_sd->mapindex == m_index && cd->usersd[0] == pl_sd) {
safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd,1114), // Chat: %s | Player: %s | Location: %d %d
cd->title, pl_sd->status.name, cd->bl.x, cd->bl.y);
clif->message(fd, atcmd_output);
@@ -4911,7 +4911,7 @@ ACMD(broadcast)
}
safesnprintf(atcmd_output, sizeof(atcmd_output), "%s: %s", sd->status.name, message);
- intif->broadcast(atcmd_output, strlen(atcmd_output) + 1, BC_DEFAULT);
+ intif->broadcast(atcmd_output, (int)strlen(atcmd_output) + 1, BC_DEFAULT);
return true;
}
@@ -4930,7 +4930,7 @@ ACMD(localbroadcast)
safesnprintf(atcmd_output, sizeof(atcmd_output), "%s: %s", sd->status.name, message);
- clif->broadcast(&sd->bl, atcmd_output, strlen(atcmd_output) + 1, BC_DEFAULT, ALL_SAMEMAP);
+ clif->broadcast(&sd->bl, atcmd_output, (int)strlen(atcmd_output) + 1, BC_DEFAULT, ALL_SAMEMAP);
return true;
}
@@ -7836,7 +7836,7 @@ ACMD(cash)
// If this option is set, the message is already sent by pc function
if( !battle_config.cashshop_show_points ){
sprintf(output, msg_fd(fd,505), ret, sd->cashPoints);
- clif_disp_onlyself(sd, output, strlen(output));
+ clif_disp_onlyself(sd, output);
clif->message(fd, output);
}
} else
@@ -7844,7 +7844,7 @@ ACMD(cash)
} else {
if( (ret=pc->paycash(sd, -value, 0)) >= 0){
sprintf(output, msg_fd(fd,410), ret, sd->cashPoints);
- clif_disp_onlyself(sd, output, strlen(output));
+ clif_disp_onlyself(sd, output);
clif->message(fd, output);
} else
clif->message(fd, msg_fd(fd,41)); // Unable to decrease the number/value.
@@ -7855,7 +7855,7 @@ ACMD(cash)
// If this option is set, the message is already sent by pc function
if( !battle_config.cashshop_show_points ){
sprintf(output, msg_fd(fd,506), ret, sd->kafraPoints);
- clif_disp_onlyself(sd, output, strlen(output));
+ clif_disp_onlyself(sd, output);
clif->message(fd, output);
}
} else
@@ -7863,7 +7863,7 @@ ACMD(cash)
} else {
if( (ret=pc->paycash(sd, -value, -value)) >= 0){
sprintf(output, msg_fd(fd,411), ret, sd->kafraPoints);
- clif_disp_onlyself(sd, output, strlen(output));
+ clif_disp_onlyself(sd, output);
clif->message(fd, output);
} else
clif->message(fd, msg_fd(fd,41)); // Unable to decrease the number/value.
@@ -7958,7 +7958,7 @@ ACMD(request)
safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd,278), message); // (@request): %s
intif->wis_message_to_gm(sd->status.name, PC_PERM_RECEIVE_REQUESTS, atcmd_output);
- clif_disp_onlyself(sd, atcmd_output, strlen(atcmd_output));
+ clif_disp_onlyself(sd, atcmd_output);
clif->message(sd->fd,msg_fd(fd,279)); // @request sent.
return true;
}
diff --git a/src/map/battleground.c b/src/map/battleground.c
index 629122c87..5231ce3d2 100644
--- a/src/map/battleground.c
+++ b/src/map/battleground.c
@@ -171,7 +171,7 @@ int bg_team_leave(struct map_session_data *sd, enum bg_team_leave_type flag) {
sprintf(output, "Server : %s has been afk-kicked from the battlefield...", sd->status.name);
break;
}
- clif->bg_message(bgd, 0, "Server", output, strlen(output) + 1);
+ clif->bg_message(bgd, 0, "Server", output);
}
if( bgd->logout_event[0] && flag )
@@ -265,14 +265,15 @@ int bg_team_get_id(struct block_list *bl) {
return 0;
}
-bool bg_send_message(struct map_session_data *sd, const char *mes, int len) {
+bool bg_send_message(struct map_session_data *sd, const char *mes)
+{
struct battleground_data *bgd;
nullpo_ret(sd);
nullpo_ret(mes);
if( sd->bg_id == 0 || (bgd = bg->team_search(sd->bg_id)) == NULL )
return false; // Couldn't send message
- clif->bg_message(bgd, sd->bl.id, sd->status.name, mes, len);
+ clif->bg_message(bgd, sd->bl.id, sd->status.name, mes);
return true;
}
diff --git a/src/map/battleground.h b/src/map/battleground.h
index 8657beaf8..4c3d4878f 100644
--- a/src/map/battleground.h
+++ b/src/map/battleground.h
@@ -130,7 +130,7 @@ struct battleground_interface {
bool (*member_respawn) (struct map_session_data *sd);
int (*create) (unsigned short map_index, short rx, short ry, const char *ev, const char *dev);
int (*team_get_id) (struct block_list *bl);
- bool (*send_message) (struct map_session_data *sd, const char *mes, int len);
+ bool (*send_message) (struct map_session_data *sd, const char *mes);
int (*send_xy_timer_sub) (union DBKey key, struct DBData *data, va_list ap);
int (*send_xy_timer) (int tid, int64 tick, int id, intptr_t data);
int (*afk_timer) (int tid, int64 tick, int id, intptr_t data);
diff --git a/src/map/channel.c b/src/map/channel.c
index 3d1b3f975..e4e3d069d 100644
--- a/src/map/channel.c
+++ b/src/map/channel.c
@@ -640,52 +640,47 @@ void read_channels_config(void)
const char *irc_server, *irc_channel,
*irc_nick, *irc_nick_pw;
int irc_use_ghost = 0;
- if( libconfig->setting_lookup_string(settings, "irc_channel_network", &irc_server) ) {
- if( !strstr(irc_server,":") ) {
+ if (!libconfig->setting_lookup_string(settings, "irc_channel_network", &irc_server)) {
+ channel->config->irc = false;
+ ShowWarning("channels.conf : irc channel enabled but irc_channel_network wasn't found, disabling irc channel...\n");
+ } else {
+ char *server = aStrdup(irc_server);
+ char *port = strchr(server, ':');
+ if (port == NULL) {
channel->config->irc = false;
- ShowWarning("channels.conf : network port wasn't found in 'irc_channel_network', disabling irc channel...\n");
+ ShowWarning("channels.conf: network port wasn't found in 'irc_channel_network', disabling irc channel...\n");
+ } else if ((size_t)(port-server) > sizeof channel->config->irc_server - 1) {
+ channel->config->irc = false;
+ ShowWarning("channels.conf: server name is too long in 'irc_channel_network', disabling irc channel...\n");
} else {
- unsigned char d = 0, dlen = strlen(irc_server);
- char server[40];
- if (dlen > 39)
- dlen = 39;
- memset(server, '\0', sizeof(server));
-
- for(d = 0; d < dlen; d++) {
- if(irc_server[d] == ':') {
- memcpy(server, irc_server, d);
- safestrncpy(channel->config->irc_server, server, 40);
- memcpy(server, &irc_server[d+1], dlen - d - 1);
- channel->config->irc_server_port = atoi(server);
- break;
- }
- }
+ *port = '\0';
+ port++;
+ safestrncpy(channel->config->irc_server, server, sizeof channel->config->irc_server);
+ channel->config->irc_server_port = atoi(port);
}
- } else {
- channel->config->irc = false;
- ShowWarning("channels.conf : irc channel enabled but irc_channel_network wasn't found, disabling irc channel...\n");
+ aFree(server);
}
- if( libconfig->setting_lookup_string(settings, "irc_channel_channel", &irc_channel) )
+ if (libconfig->setting_lookup_string(settings, "irc_channel_channel", &irc_channel)) {
safestrncpy(channel->config->irc_channel, irc_channel, 50);
- else {
+ } else {
channel->config->irc = false;
ShowWarning("channels.conf : irc channel enabled but irc_channel_channel wasn't found, disabling irc channel...\n");
}
- if( libconfig->setting_lookup_string(settings, "irc_channel_nick", &irc_nick) ) {
- if( strcmpi(irc_nick,"Hercules_chSysBot") == 0 ) {
+ if (libconfig->setting_lookup_string(settings, "irc_channel_nick", &irc_nick)) {
+ if (strcmpi(irc_nick,"Hercules_chSysBot") == 0) {
sprintf(channel->config->irc_nick, "Hercules_chSysBot%d",rnd()%777);
- } else
+ } else {
safestrncpy(channel->config->irc_nick, irc_nick, 40);
+ }
} else {
channel->config->irc = false;
ShowWarning("channels.conf : irc channel enabled but irc_channel_nick wasn't found, disabling irc channel...\n");
}
- if( libconfig->setting_lookup_string(settings, "irc_channel_nick_pw", &irc_nick_pw) ) {
+ if (libconfig->setting_lookup_string(settings, "irc_channel_nick_pw", &irc_nick_pw)) {
safestrncpy(channel->config->irc_nick_pw, irc_nick_pw, 30);
config_setting_lookup_bool(settings, "irc_channel_use_ghost", &irc_use_ghost);
channel->config->irc_use_ghost = irc_use_ghost;
}
-
}
libconfig->setting_lookup_bool(settings, "map_local_channel_autojoin", &local_autojoin);
diff --git a/src/map/chat.c b/src/map/chat.c
index d60b9bece..df48e1f2c 100644
--- a/src/map/chat.c
+++ b/src/map/chat.c
@@ -97,7 +97,7 @@ bool chat_createpcchat(struct map_session_data* sd, const char* title, const cha
nullpo_ret(title);
nullpo_ret(pass);
- if( sd->chatID )
+ if (sd->chat_id != 0)
return false; //Prevent people abusing the chat system by creating multiple chats, as pointed out by End of Exam. [Skotlex]
if( sd->state.vending || sd->state.buyingstore )
@@ -142,8 +142,10 @@ bool chat_joinchat(struct map_session_data* sd, int chatid, const char* pass) {
nullpo_ret(pass);
cd = map->id2cd(chatid);
- if( cd == NULL || cd->bl.type != BL_CHAT || cd->bl.m != sd->bl.m || sd->state.vending || sd->state.buyingstore || sd->chatID || ((cd->owner->type == BL_NPC) ? cd->users+1 : cd->users) >= cd->limit )
- {
+ if (cd == NULL || cd->bl.type != BL_CHAT || cd->bl.m != sd->bl.m
+ || sd->state.vending || sd->state.buyingstore || sd->chat_id != 0
+ || ((cd->owner->type == BL_NPC) ? cd->users+1 : cd->users) >= cd->limit
+ ) {
clif->joinchatfail(sd,0); // room full
return false;
}
@@ -204,8 +206,8 @@ int chat_leavechat(struct map_session_data* sd, bool kicked) {
nullpo_retr(0, sd);
- cd = map->id2cd(sd->chatID);
- if( cd == NULL ) {
+ cd = map->id2cd(sd->chat_id);
+ if (cd == NULL) {
pc_setchatid(sd, 0);
return 0;
}
@@ -279,7 +281,7 @@ bool chat_changechatowner(struct map_session_data* sd, const char* nextownername
nullpo_ret(sd);
nullpo_ret(nextownername);
- cd = map->id2cd(sd->chatID);
+ cd = map->id2cd(sd->chat_id);
if (cd == NULL || &sd->bl != cd->owner)
return false;
@@ -324,7 +326,7 @@ bool chat_changechatstatus(struct map_session_data* sd, const char* title, const
nullpo_ret(title);
nullpo_ret(pass);
- cd = map->id2cd(sd->chatID);
+ cd = map->id2cd(sd->chat_id);
if (cd == NULL || &sd->bl != cd->owner)
return false;
@@ -352,7 +354,7 @@ bool chat_kickchat(struct map_session_data* sd, const char* kickusername) {
nullpo_ret(sd);
nullpo_ret(kickusername);
- cd = map->id2cd(sd->chatID);
+ cd = map->id2cd(sd->chat_id);
if (cd == NULL || &sd->bl != cd->owner)
return false;
diff --git a/src/map/clif.c b/src/map/clif.c
index 2dea386be..3dc6ab981 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -319,17 +319,17 @@ int clif_send_sub(struct block_list *bl, va_list ap) {
return 0;
break;
case AREA_WOC:
- if (sd->chatID || bl == src_bl)
+ if (sd->chat_id != 0 || bl == src_bl)
return 0;
break;
case AREA_WOSC: {
if (src_bl->type == BL_PC) {
const struct map_session_data *ssd = BL_UCCAST(BL_PC, src_bl);
- if (ssd != NULL && sd->chatID != 0 && (sd->chatID == ssd->chatID))
+ if (ssd != NULL && sd->chat_id != 0 && (sd->chat_id == ssd->chat_id))
return 0;
} else if (src_bl->type == BL_NPC) {
const struct npc_data *nd = BL_UCCAST(BL_NPC, src_bl);
- if (nd != NULL && sd->chatID != 0 && (sd->chatID == nd->chat_id))
+ if (nd != NULL && sd->chat_id != 0 && (sd->chat_id == nd->chat_id))
return 0;
}
}
@@ -435,7 +435,7 @@ bool clif_send(const void* buf, int len, struct block_list* bl, enum send_target
{
const struct chat_data *cd = NULL;
if (sd != NULL) {
- cd = map->id2cd(sd->chatID);
+ cd = map->id2cd(sd->chat_id);
} else {
cd = BL_CCAST(BL_CHAT, bl);
}
@@ -1957,20 +1957,23 @@ void clif_selllist(struct map_session_data *sd)
/// - set npcid of dialog window (0 by default)
/// - if set to clear on next mes, clear contents
/// - append this text
-void clif_scriptmes(struct map_session_data *sd, int npcid, const char *mes) {
- int fd = sd->fd;
- size_t slen;
+void clif_scriptmes(struct map_session_data *sd, int npcid, const char *mes)
+{
+ int fd, slen;
nullpo_retv(sd);
nullpo_retv(mes);
- slen = strlen(mes) + 9;
+
+ fd = sd->fd;
+ slen = (int)strlen(mes) + 9;
+ Assert_retv(slen <= INT16_MAX);
sd->state.dialog = 1;
WFIFOHEAD(fd, slen);
- WFIFOW(fd,0)=0xb4;
- WFIFOW(fd,2)=slen;
- WFIFOL(fd,4)=npcid;
+ WFIFOW(fd,0) = 0xb4;
+ WFIFOW(fd,2) = slen;
+ WFIFOL(fd,4) = npcid;
memcpy(WFIFOP(fd,8), mes, slen-8);
WFIFOSET(fd,WFIFOW(fd,2));
}
@@ -2072,24 +2075,27 @@ void clif_sendfakenpc(struct map_session_data *sd, int npcid) {
/// WARNING: the 'cancel' button closes other windows besides the dialog window and the menu window.
/// Which suggests their have intertwined behavior. (probably the mouse targeting)
/// TODO investigate behavior of other windows [FlavioJS]
-void clif_scriptmenu(struct map_session_data* sd, int npcid, const char* mes) {
- int fd;
- size_t slen;
+void clif_scriptmenu(struct map_session_data *sd, int npcid, const char *mes)
+{
+ int fd, slen;
struct block_list *bl = NULL;
nullpo_retv(sd);
nullpo_retv(mes);
+
fd = sd->fd;
- slen = strlen(mes) + 9;
+ slen = (int)strlen(mes) + 9;
+ Assert_retv(slen <= INT16_MAX);
+
if (!sd->state.using_fake_npc && (npcid == npc->fake_nd->bl.id || ((bl = map->id2bl(npcid)) != NULL && (bl->m!=sd->bl.m ||
bl->x<sd->bl.x-AREA_SIZE-1 || bl->x>sd->bl.x+AREA_SIZE+1 ||
bl->y<sd->bl.y-AREA_SIZE-1 || bl->y>sd->bl.y+AREA_SIZE+1))))
clif->sendfakenpc(sd, npcid);
WFIFOHEAD(fd, slen);
- WFIFOW(fd,0)=0xb7;
- WFIFOW(fd,2)=slen;
- WFIFOL(fd,4)=npcid;
+ WFIFOW(fd,0) = 0xb7;
+ WFIFOW(fd,2) = slen;
+ WFIFOL(fd,4) = npcid;
memcpy(WFIFOP(fd,8), mes, slen-8);
WFIFOSET(fd,WFIFOW(fd,2));
}
@@ -3610,26 +3616,29 @@ void clif_createchat(struct map_session_data* sd, int flag)
/// 1 = public
/// 2 = arena (npc waiting room)
/// 3 = PK zone (non-clickable)
-void clif_dispchat(struct chat_data* cd, int fd)
+void clif_dispchat(struct chat_data *cd, int fd)
{
unsigned char buf[128];
uint8 type;
+ int len;
- if( cd == NULL || cd->owner == NULL )
+ if (cd == NULL || cd->owner == NULL)
return;
type = (cd->owner->type == BL_PC ) ? (cd->pub) ? 1 : 0
: (cd->owner->type == BL_NPC) ? (cd->limit) ? 2 : 3
: 1;
+ len = (int)strlen(cd->title);
+ Assert_retv(len <= INT16_MAX - 17);
WBUFW(buf, 0) = 0xd7;
- WBUFW(buf, 2) = 17 + strlen(cd->title);
+ WBUFW(buf, 2) = 17 + len;
WBUFL(buf, 4) = cd->owner->id;
WBUFL(buf, 8) = cd->bl.id;
WBUFW(buf,12) = cd->limit;
WBUFW(buf,14) = (cd->owner->type == BL_NPC) ? cd->users+1 : cd->users;
WBUFB(buf,16) = type;
- memcpy(WBUFP(buf,17), cd->title, strlen(cd->title)); // not zero-terminated
+ memcpy(WBUFP(buf,17), cd->title, len); // not zero-terminated
if( fd ) {
WFIFOHEAD(fd,WBUFW(buf,2));
@@ -3647,10 +3656,11 @@ void clif_dispchat(struct chat_data* cd, int fd)
/// 1 = public
/// 2 = arena (npc waiting room)
/// 3 = PK zone (non-clickable)
-void clif_changechatstatus(struct chat_data* cd)
+void clif_changechatstatus(struct chat_data *cd)
{
unsigned char buf[128];
uint8 type;
+ int len;
if( cd == NULL || cd->usersd[0] == NULL )
return;
@@ -3658,15 +3668,17 @@ void clif_changechatstatus(struct chat_data* cd)
type = (cd->owner->type == BL_PC ) ? (cd->pub) ? 1 : 0
: (cd->owner->type == BL_NPC) ? (cd->limit) ? 2 : 3
: 1;
+ len = (int)strlen(cd->title);
+ Assert_retv(len <= INT16_MAX - 17);
WBUFW(buf, 0) = 0xdf;
- WBUFW(buf, 2) = 17 + strlen(cd->title);
+ WBUFW(buf, 2) = 17 + len;
WBUFL(buf, 4) = cd->owner->id;
WBUFL(buf, 8) = cd->bl.id;
WBUFW(buf,12) = cd->limit;
WBUFW(buf,14) = (cd->owner->type == BL_NPC) ? cd->users+1 : cd->users;
WBUFB(buf,16) = type;
- memcpy(WBUFP(buf,17), cd->title, strlen(cd->title)); // not zero-terminated
+ memcpy(WBUFP(buf,17), cd->title, len); // not zero-terminated
clif->send(buf,WBUFW(buf,2),cd->owner,CHAT);
}
@@ -4115,8 +4127,8 @@ void clif_getareachar_pc(struct map_session_data* sd,struct map_session_data* ds
nullpo_retv(sd);
nullpo_retv(dstsd);
- if( dstsd->chatID ) {
- struct chat_data *cd = map->id2cd(dstsd->chatID);
+ if (dstsd->chat_id != 0) {
+ struct chat_data *cd = map->id2cd(dstsd->chat_id);
if (cd != NULL && cd->usersd[0] == dstsd)
clif->dispchat(cd,sd->fd);
} else if( dstsd->state.vending )
@@ -4618,9 +4630,9 @@ int clif_outsight(struct block_list *bl,va_list ap)
case BL_PC:
if (sd->vd.class_ != INVISIBLE_CLASS)
clif->clearunit_single(bl->id,CLR_OUTSIGHT,tsd->fd);
- if (sd->chatID) {
- struct chat_data *cd = map->id2cd(sd->chatID);
- if(cd->usersd[0]==sd)
+ if (sd->chat_id != 0) {
+ struct chat_data *cd = map->id2cd(sd->chat_id);
+ if (cd != NULL && cd->usersd[0] == sd)
clif->dispchat(cd,tsd->fd);
}
if( sd->state.vending )
@@ -5516,7 +5528,7 @@ void clif_displaymessage2(const int fd, const char* mes) {
line = strtok(message, "\n");
while(line != NULL) {
// Limit message to 255+1 characters (otherwise it causes a buffer overflow in the client)
- size_t len = strnlen(line, 255);
+ int len = (int)strnlen(line, 255);
if (len > 0) { // don't send a void message (it's not displaying on the client chat). @help can send void line.
if( map->cpsd_active && fd == 0 ) {
@@ -5570,7 +5582,7 @@ void clif_displaymessage_sprintf(const int fd, const char *mes, ...) {
}
/// Send broadcast message in yellow or blue without font formatting (ZC_BROADCAST).
/// 009a <packet len>.W <message>.?B
-void clif_broadcast(struct block_list *bl, const char *mes, size_t len, int type, enum send_target target)
+void clif_broadcast(struct block_list *bl, const char *mes, int len, int type, enum send_target target)
{
int lp = (type&BC_COLOR_MASK) ? 4 : 0;
unsigned char *buf = NULL;
@@ -5594,38 +5606,38 @@ void clif_broadcast(struct block_list *bl, const char *mes, size_t len, int type
* Displays a message on a 'bl' to all it's nearby clients
* Used by npc_globalmessage
*------------------------------------------*/
-void clif_GlobalMessage(struct block_list* bl, const char* message) {
+void clif_GlobalMessage(struct block_list *bl, const char *message)
+{
char buf[256];
- size_t len;
+ int len;
nullpo_retv(bl);
- if(!message)
+ if (message == NULL)
return;
- len = strlen(message)+1;
+ len = (int)strlen(message)+1;
- if (len > sizeof(buf)-8) {
- ShowWarning("clif_GlobalMessage: Truncating too long message '%s' (len=%"PRIuS").\n", message, len);
- len = sizeof(buf)-8;
+ if (len > (int)sizeof(buf)-8) {
+ ShowWarning("clif_GlobalMessage: Truncating too long message '%s' (len=%d).\n", message, len);
+ len = (int)sizeof(buf)-8;
}
- WBUFW(buf,0)=0x8d;
- WBUFW(buf,2)=len+8;
- WBUFL(buf,4)=bl->id;
+ WBUFW(buf,0) = 0x8d;
+ WBUFW(buf,2) = len+8;
+ WBUFL(buf,4) = bl->id;
safestrncpy(WBUFP(buf,8),message,len);
- clif->send((unsigned char *) buf,WBUFW(buf,2),bl,ALL_CLIENT);
-
+ clif->send(buf,WBUFW(buf,2),bl,ALL_CLIENT);
}
/// Send broadcast message with font formatting (ZC_BROADCAST2).
/// 01c3 <packet len>.W <fontColor>.L <fontType>.W <fontSize>.W <fontAlign>.W <fontY>.W <message>.?B
-void clif_broadcast2(struct block_list* bl, const char* mes, size_t len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY, enum send_target target)
+void clif_broadcast2(struct block_list *bl, const char *mes, int len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY, enum send_target target)
{
unsigned char *buf;
nullpo_retv(mes);
- buf = (unsigned char*)aMalloc((16 + len)*sizeof(unsigned char));
+ buf = aMalloc((16 + len)*sizeof(unsigned char));
WBUFW(buf,0) = 0x1c3;
WBUFW(buf,2) = len + 16;
WBUFL(buf,4) = fontColor;
@@ -5793,7 +5805,7 @@ void clif_upgrademessage(int fd, int result, int item_id)
/// Whisper is transmitted to the destination player (ZC_WHISPER).
/// 0097 <packet len>.W <nick>.24B <message>.?B
/// 0097 <packet len>.W <nick>.24B <isAdmin>.L <message>.?B (PACKETVER >= 20091104)
-void clif_wis_message(int fd, const char *nick, const char *mes, size_t mes_len)
+void clif_wis_message(int fd, const char *nick, const char *mes, int mes_len)
{
#if PACKETVER >= 20091104
struct map_session_data *ssd = NULL;
@@ -7937,19 +7949,21 @@ void clif_marriage_proposal(int fd, struct map_session_data *sd, struct map_sess
/*==========================================
* Displays a message using the guild-chat colors to the specified targets. [Skotlex]
*------------------------------------------*/
-void clif_disp_message(struct block_list* src, const char* mes, size_t len, enum send_target target)
+void clif_disp_message(struct block_list *src, const char *mes, enum send_target target)
{
unsigned char buf[256];
+ int len;
+
+ nullpo_retv(mes);
+ nullpo_retv(src);
+ len = (int)strlen(mes);
if (len == 0)
return;
- nullpo_retv(src);
- nullpo_retv(mes);
-
- if (len > sizeof(buf)-5) {
- ShowWarning("clif_disp_message: Truncated message '%s' (len=%"PRIuS", max=%"PRIuS", aid=%d).\n", mes, len, sizeof(buf)-5, src->id);
- len = sizeof(buf)-5;
+ if (len > (int)sizeof(buf)-5) {
+ ShowWarning("clif_disp_message: Truncated message '%s' (len=%d, max=%"PRIuS", aid=%d).\n", mes, len, sizeof(buf)-5, src->id);
+ len = (int)sizeof(buf)-5;
}
WBUFW(buf, 0) = 0x17f;
@@ -8203,10 +8217,11 @@ void clif_specialeffect_value(struct block_list* bl, int effect_id, int num, sen
*/
void clif_messagecolor_self(int fd, uint32 color, const char *msg)
{
- size_t msg_len;
+ int msg_len;
nullpo_retv(msg);
- msg_len = strlen(msg) + 1;
+ msg_len = (int)strlen(msg) + 1;
+ Assert_retv(msg_len <= INT16_MAX - 12);
WFIFOHEAD(fd,msg_len + 12);
WFIFOW(fd,0) = 0x2C1;
@@ -8226,17 +8241,19 @@ void clif_messagecolor_self(int fd, uint32 color, const char *msg)
* @param color Message color (RGB format: 0xRRGGBB)
* @param msg Message text
*/
-void clif_messagecolor(struct block_list* bl, uint32 color, const char *msg)
+void clif_messagecolor(struct block_list *bl, uint32 color, const char *msg)
{
- size_t msg_len = strlen(msg) + 1;
+ int msg_len;
uint8 buf[256];
nullpo_retv(bl);
nullpo_retv(msg);
- if (msg_len > sizeof(buf)-12) {
- ShowWarning("clif_messagecolor: Truncating too long message '%s' (len=%"PRIuS").\n", msg, msg_len);
- msg_len = sizeof(buf)-12;
+ msg_len = (int)strlen(msg) + 1;
+
+ if (msg_len > (int)sizeof(buf)-12) {
+ ShowWarning("clif_messagecolor: Truncating too long message '%s' (len=%d).\n", msg, msg_len);
+ msg_len = (int)sizeof(buf)-12;
}
WBUFW(buf,0) = 0x2C1;
@@ -8316,7 +8333,7 @@ void clif_refresh(struct map_session_data *sd)
clif->elemental_info(sd);
map->foreachinrange(clif->getareachar,&sd->bl,AREA_SIZE,BL_ALL,sd);
clif->weather_check(sd);
- if( sd->chatID )
+ if (sd->chat_id != 0)
chat->leave(sd, false);
if( sd->state.vending )
clif->openvending(sd, sd->bl.id, sd->vending);
@@ -8556,34 +8573,33 @@ void clif_slide(struct block_list *bl, int x, int y)
/// Public chat message (ZC_NOTIFY_CHAT). lordalfa/Skotlex - used by @me as well
/// 008d <packet len>.W <id>.L <message>.?B
-void clif_disp_overhead(struct block_list *bl, const char* mes)
+void clif_disp_overhead(struct block_list *bl, const char *mes)
{
unsigned char buf[256]; //This should be more than sufficient, the theoretical max is CHAT_SIZE + 8 (pads and extra inserted crap)
- size_t len_mes;
+ int mes_len;
nullpo_retv(bl);
nullpo_retv(mes);
- len_mes = strlen(mes)+1; //Account for \0
+ mes_len = (int)strlen(mes)+1; //Account for \0
- if (len_mes > sizeof(buf)-8) {
- ShowError("clif_disp_overhead: Message too long (length %"PRIuS")\n", len_mes);
- len_mes = sizeof(buf)-8; //Trunk it to avoid problems.
+ if (mes_len > (int)sizeof(buf)-8) {
+ ShowError("clif_disp_overhead: Message too long (length %d)\n", mes_len);
+ mes_len = sizeof(buf)-8; //Trunk it to avoid problems.
}
// send message to others
WBUFW(buf,0) = 0x8d;
- WBUFW(buf,2) = len_mes + 8; // len of message + 8 (command+len+id)
+ WBUFW(buf,2) = mes_len + 8; // len of message + 8 (command+len+id)
WBUFL(buf,4) = bl->id;
- safestrncpy(WBUFP(buf,8), mes, len_mes);
+ safestrncpy(WBUFP(buf,8), mes, mes_len);
clif->send(buf, WBUFW(buf,2), bl, AREA_CHAT_WOC);
// send back message to the speaker
- if( bl->type == BL_PC ) {
+ if (bl->type == BL_PC) {
WBUFW(buf,0) = 0x8e;
- WBUFW(buf, 2) = len_mes + 4;
- safestrncpy(WBUFP(buf,4), mes, len_mes);
+ WBUFW(buf, 2) = mes_len + 4;
+ safestrncpy(WBUFP(buf,4), mes, mes_len);
clif->send(buf, WBUFW(buf,2), bl, SELF);
}
-
}
/*==========================
@@ -9005,14 +9021,15 @@ void clif_channel_msg(struct channel_data *chan, struct map_session_data *sd, ch
{
struct DBIterator *iter;
struct map_session_data *user;
- unsigned short msg_len;
+ int msg_len;
uint32 color;
nullpo_retv(chan);
nullpo_retv(sd);
nullpo_retv(msg);
iter = db_iterator(chan->users);
- msg_len = strlen(msg) + 1;
+ msg_len = (int)strlen(msg) + 1;
+ Assert_retv(msg_len <= INT16_MAX - 12);
color = channel->config->colors[chan->color];
WFIFOHEAD(sd->fd,msg_len + 12);
@@ -9040,13 +9057,14 @@ void clif_channel_msg2(struct channel_data *chan, char *msg)
struct DBIterator *iter;
struct map_session_data *user;
unsigned char buf[210];
- unsigned short msg_len;
+ int msg_len;
uint32 color;
nullpo_retv(chan);
nullpo_retv(msg);
iter = db_iterator(chan->users);
- msg_len = strlen(msg) + 1;
+ msg_len = (int)strlen(msg) + 1;
+ Assert_retv(msg_len <= INT16_MAX - 12);
color = channel->config->colors[chan->color];
WBUFW(buf,0) = 0x2C1;
@@ -9412,7 +9430,7 @@ void clif_parse_LoadEndAck(int fd, struct map_session_data *sd) {
if( map->list[sd->bl.m].flag.allowks && !map_flag_ks(sd->bl.m) ) {
char output[128];
sprintf(output, "[ Kill Steal Protection Disabled. KS is allowed in this map ]");
- clif->broadcast(&sd->bl, output, strlen(output) + 1, BC_BLUE, SELF);
+ clif->broadcast(&sd->bl, output, (int)strlen(output) + 1, BC_BLUE, SELF);
}
map->iwall_get(sd); // Updates Walls Info on this Map to Client
@@ -9786,7 +9804,7 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data *sd)
outlen = (int)strlen(full_message) + 1;
}
- if (sd->fontcolor != 0 && sd->chatID == 0) {
+ if (sd->fontcolor != 0 && sd->chat_id == 0) {
uint32 color = 0;
if (sd->disguise == -1) {
@@ -9829,7 +9847,7 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data *sd)
else
safestrncpy(WBUFP(buf, 8), full_message, outlen);
//FIXME: chat has range of 9 only
- clif->send(buf, WBUFW(buf, 2), &sd->bl, sd->chatID ? CHAT_WOS : AREA_CHAT_WOC);
+ clif->send(buf, WBUFW(buf, 2), &sd->bl, sd->chat_id != 0 ? CHAT_WOS : AREA_CHAT_WOC);
aFree(buf);
}
@@ -10211,7 +10229,7 @@ void clif_parse_WisMessage(int fd, struct map_session_data* sd)
// if there are 'Test' player on an other map-server and 'test' player on this map-server,
// and if we ask for 'Test', we must not contact 'test' player
// so, we send information to inter-server, which is the only one which decide (and copy correct name).
- intif->wis_message(sd, target, message, strlen(message));
+ intif->wis_message(sd, target, message, (int)strlen(message));
return;
}
@@ -10225,10 +10243,10 @@ void clif_parse_WisMessage(int fd, struct map_session_data* sd)
}
// if player is autotrading
- if( dstsd->state.autotrade ) {
+ if (dstsd->state.autotrade) {
char output[256];
sprintf(output, "%s is in autotrade mode and cannot receive whispered messages.", dstsd->status.name);
- clif->wis_message(fd, map->wisp_server_name, output, strlen(output) + 1);
+ clif->wis_message(fd, map->wisp_server_name, output, (int)strlen(output) + 1);
return;
}
@@ -10245,7 +10263,7 @@ void clif_parse_WisMessage(int fd, struct map_session_data* sd)
clif->wis_end(fd, 0); // 0: success to send wisper
// Normal message
- clif->wis_message(dstsd->fd, sd->status.name, message, strlen(message));
+ clif->wis_message(dstsd->fd, sd->status.name, message, (int)strlen(message));
}
void clif_parse_Broadcast(int fd, struct map_session_data *sd) __attribute__((nonnull (2)));
@@ -10362,7 +10380,7 @@ void clif_parse_UseItem(int fd, struct map_session_data *sd)
return;
}
- if ( (!sd->npc_id && pc_istrading(sd)) || sd->chatID )
+ if ((!sd->npc_id && pc_istrading(sd)) || sd->chat_id != 0)
return;
//Whether the item is used or not is irrelevant, the char ain't idle. [Skotlex]
@@ -10722,10 +10740,10 @@ void clif_noask_sub(struct map_session_data *src, struct map_session_data *targe
nullpo_retv(src);
// Your request has been rejected by autoreject option.
msg = msg_sd(src,392);
- clif_disp_onlyself(src, msg, strlen(msg));
+ clif_disp_onlyself(src, msg);
//Notice that a request was rejected.
snprintf(output, 256, msg_sd(target,393+type), src->status.name, 256);
- clif_disp_onlyself(target, output, strlen(output));
+ clif_disp_onlyself(target, output);
}
void clif_parse_TradeRequest(int fd,struct map_session_data *sd) __attribute__((nonnull (2)));
@@ -10736,7 +10754,7 @@ void clif_parse_TradeRequest(int fd,struct map_session_data *sd) {
t_sd = map->id2sd(RFIFOL(fd,2));
- if(!sd->chatID && pc_cant_act(sd))
+ if (sd->chat_id == 0 && pc_cant_act(sd))
return; //You can trade while in a chatroom.
// @noask [LuzZza]
@@ -11960,7 +11978,7 @@ void clif_parse_PartyMessage(int fd, struct map_session_data *sd)
if (clif->process_chat_message(sd, packet, message, sizeof message) == NULL)
return;
- party->send_message(sd, message, (int)strlen(message));
+ party->send_message(sd, message);
}
void clif_parse_PartyChangeLeader(int fd, struct map_session_data* sd) __attribute__((nonnull (2)));
@@ -13059,9 +13077,9 @@ void clif_parse_GuildMessage(int fd, struct map_session_data *sd)
return;
if (sd->bg_id)
- bg->send_message(sd, message, (int)strlen(message));
+ bg->send_message(sd, message);
else
- guild->send_message(sd, message, (int)strlen(message));
+ guild->send_message(sd, message);
}
void clif_parse_GuildRequestAlliance(int fd, struct map_session_data *sd) __attribute__((nonnull (2)));
@@ -14643,7 +14661,7 @@ void clif_Mail_refreshinbox(struct map_session_data *sd)
if( md->full ) {// TODO: is this official?
char output[100];
sprintf(output, "Inbox is full (Max %d). Delete some mails.", MAIL_MAX_INBOX);
- clif_disp_onlyself(sd, output, strlen(output));
+ clif_disp_onlyself(sd, output);
}
}
@@ -14681,11 +14699,16 @@ void clif_Mail_read(struct map_session_data *sd, int mail_id)
struct mail_message *msg = &sd->mail.inbox.msg[i];
struct item *item = &msg->item;
struct item_data *data;
- size_t msg_len = strlen(msg->body), len;
+ int msg_len = (int)strlen(msg->body), len;
- if( msg_len == 0 ) {
+ if (msg_len == 0) {
strcpy(msg->body, "(no message)");
- msg_len = strlen(msg->body);
+ msg_len = (int)strlen(msg->body);
+ }
+
+ if (msg_len > UINT8_MAX) {
+ Assert_report(msg_len > UINT8_MAX);
+ msg_len = UINT8_MAX;
}
len = 101 + msg_len;
@@ -14713,7 +14736,7 @@ void clif_Mail_read(struct map_session_data *sd, int mail_id)
} else // no item, set all to zero
memset(WFIFOP(fd,80), 0x00, 19);
- WFIFOB(fd,99) = (unsigned char)msg_len;
+ WFIFOB(fd,99) = (uint8)msg_len;
safestrncpy(WFIFOP(fd,100), msg->body, msg_len + 1);
WFIFOSET(fd,len);
@@ -16120,17 +16143,21 @@ void clif_bg_xy_remove(struct map_session_data *sd)
/// Notifies clients of a battleground message (ZC_BATTLEFIELD_CHAT).
/// 02dc <packet len>.W <account id>.L <name>.24B <message>.?B
-void clif_bg_message(struct battleground_data *bgd, int src_id, const char *name, const char *mes, size_t len)
+void clif_bg_message(struct battleground_data *bgd, int src_id, const char *name, const char *mes)
{
struct map_session_data *sd;
unsigned char *buf;
+ int len;
nullpo_retv(bgd);
nullpo_retv(name);
nullpo_retv(mes);
- if( !bgd->count || (sd = bg->getavailablesd(bgd)) == NULL )
+
+ if (!bgd->count || (sd = bg->getavailablesd(bgd)) == NULL)
return;
+ len = (int)strlen(mes);
+ Assert_retv(len <= INT16_MAX - NAME_LENGTH - 8);
buf = (unsigned char*)aMalloc((len + NAME_LENGTH + 8)*sizeof(unsigned char));
WBUFW(buf,0) = 0x2dc;
@@ -16162,7 +16189,7 @@ void clif_parse_BattleChat(int fd, struct map_session_data *sd)
if (clif->process_chat_message(sd, packet, message, sizeof message) == NULL)
return;
- bg->send_message(sd, message, (int)strlen(message));
+ bg->send_message(sd, message);
}
/// Notifies client of a battleground score change (ZC_BATTLEFIELD_NOTIFY_POINT).
@@ -17657,26 +17684,27 @@ void clif_partytickack(struct map_session_data* sd, bool flag) {
WFIFOSET(sd->fd, packet_len(0x2c9));
}
-void clif_ShowScript(struct block_list* bl, const char* message) {
+void clif_ShowScript(struct block_list *bl, const char *message)
+{
char buf[256];
- size_t len;
+ int len;
nullpo_retv(bl);
- if(!message)
+ if (message == NULL)
return;
- len = strlen(message)+1;
+ len = (int)strlen(message)+1;
- if (len > sizeof(buf)-8) {
- ShowWarning("clif_ShowScript: Truncating too long message '%s' (len=%"PRIuS").\n", message, len);
- len = sizeof(buf)-8;
+ if (len > (int)sizeof(buf)-8) {
+ ShowWarning("clif_ShowScript: Truncating too long message '%s' (len=%d).\n", message, len);
+ len = (int)sizeof(buf)-8;
}
- WBUFW(buf,0)=0x8b3;
- WBUFW(buf,2)=len+8;
- WBUFL(buf,4)=bl->id;
+ WBUFW(buf,0) = 0x8b3;
+ WBUFW(buf,2) = len+8;
+ WBUFL(buf,4) = bl->id;
safestrncpy(WBUFP(buf,8),message,len);
- clif->send((unsigned char *) buf,WBUFW(buf,2),bl,ALL_CLIENT);
+ clif->send(buf,WBUFW(buf,2),bl,ALL_CLIENT);
}
void clif_status_change_end(struct block_list *bl, int tid, enum send_target target, int type) {
@@ -18022,7 +18050,7 @@ void clif_show_modifiers (struct map_session_data *sd) {
snprintf(output,128,"Base EXP : %d%% | Base Drop: %d%% | Base Death Penalty: %d%%",
sd->status.mod_exp,sd->status.mod_drop,sd->status.mod_death);
- clif->broadcast2(&sd->bl,output, strlen(output) + 1, 0xffbc90, 0x190, 12, 0, 0, SELF);
+ clif->broadcast2(&sd->bl, output, (int)strlen(output) + 1, 0xffbc90, 0x190, 12, 0, 0, SELF);
}
}
diff --git a/src/map/clif.h b/src/map/clif.h
index 6d6c368f2..4d22fd4af 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -60,7 +60,7 @@ struct view_data;
**/
#define packet_len(cmd) packet_db[cmd].len
#define clif_menuskill_clear(sd) ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0)
-#define clif_disp_onlyself(sd,mes,len) clif->disp_message( &(sd)->bl, (mes), (len), SELF )
+#define clif_disp_onlyself(sd, mes) clif->disp_message(&(sd)->bl, (mes), SELF)
#define MAX_ROULETTE_LEVEL 7 /** client-defined value **/
#define MAX_ROULETTE_COLUMNS 9 /** client-defined value **/
#define RGB2BGR(c) (((c) & 0x0000FF) << 16 | ((c) & 0x00FF00) | ((c) & 0xFF0000) >> 16)
@@ -841,11 +841,11 @@ struct clif_interface {
void (*clearchat) (struct chat_data *cd,int fd);
void (*leavechat) (struct chat_data* cd, struct map_session_data* sd, bool flag);
void (*changechatstatus) (struct chat_data* cd);
- void (*wis_message) (int fd, const char* nick, const char* mes, size_t mes_len);
+ void (*wis_message) (int fd, const char *nick, const char *mes, int mes_len);
void (*wis_end) (int fd, int flag);
- void (*disp_message) (struct block_list* src, const char* mes, size_t len, enum send_target target);
- void (*broadcast) (struct block_list* bl, const char* mes, size_t len, int type, enum send_target target);
- void (*broadcast2) (struct block_list* bl, const char* mes, size_t len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY, enum send_target target);
+ void (*disp_message) (struct block_list *src, const char *mes, enum send_target target);
+ void (*broadcast) (struct block_list *bl, const char *mes, int len, int type, enum send_target target);
+ void (*broadcast2) (struct block_list *bl, const char *mes, int len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY, enum send_target target);
void (*messagecolor_self) (int fd, uint32 color, const char *msg);
void (*messagecolor) (struct block_list* bl, uint32 color, const char* msg);
void (*disp_overhead) (struct block_list *bl, const char* mes);
@@ -943,7 +943,7 @@ struct clif_interface {
void (*bg_hp) (struct map_session_data *sd);
void (*bg_xy) (struct map_session_data *sd);
void (*bg_xy_remove) (struct map_session_data *sd);
- void (*bg_message) (struct battleground_data *bgd, int src_id, const char *name, const char *mes, size_t len);
+ void (*bg_message) (struct battleground_data *bgd, int src_id, const char *name, const char *mes);
void (*bg_updatescore) (int16 m);
void (*bg_updatescore_single) (struct map_session_data *sd);
void (*sendbgemblem_area) (struct map_session_data *sd);
diff --git a/src/map/duel.c b/src/map/duel.c
index c658ea3e3..64991d39c 100644
--- a/src/map/duel.c
+++ b/src/map/duel.c
@@ -73,7 +73,7 @@ static int duel_showinfo_sub(struct map_session_data* sd, va_list va)
if (sd->duel_group != ssd->duel_group) return 0;
sprintf(output, " %d. %s", ++(*p), sd->status.name);
- clif_disp_onlyself(ssd, output, strlen(output));
+ clif_disp_onlyself(ssd, output);
return 1;
}
@@ -93,7 +93,7 @@ void duel_showinfo(const unsigned int did, struct map_session_data* sd) {
duel->list[did].members_count,
duel->list[did].members_count + duel->list[did].invites_count);
- clif_disp_onlyself(sd, output, strlen(output));
+ clif_disp_onlyself(sd, output);
map->foreachpc(duel_showinfo_sub, sd, &p);
}
@@ -113,7 +113,7 @@ int duel_create(struct map_session_data* sd, const unsigned int maxpl) {
duel->list[i].max_players_limit = maxpl;
safestrncpy(output, msg_sd(sd,372), sizeof(output)); // " -- Duel has been created (@invite/@leave) --"
- clif_disp_onlyself(sd, output, strlen(output));
+ clif_disp_onlyself(sd, output);
clif->map_property(sd, MAPPROPERTY_FREEPVPZONE);
clif->maptypeproperty2(&sd->bl,SELF);
@@ -127,14 +127,14 @@ void duel_invite(const unsigned int did, struct map_session_data* sd, struct map
nullpo_retv(target_sd);
// " -- Player %s invites %s to duel --"
sprintf(output, msg_sd(sd,373), sd->status.name, target_sd->status.name);
- clif->disp_message(&sd->bl, output, strlen(output), DUEL_WOS);
+ clif->disp_message(&sd->bl, output, DUEL_WOS);
target_sd->duel_invite = did;
duel->list[did].invites_count++;
// "Blue -- Player %s invites you to PVP duel (@accept/@reject) --"
sprintf(output, msg_sd(target_sd,374), sd->status.name);
- clif->broadcast(&target_sd->bl, output, strlen(output)+1, BC_BLUE, SELF);
+ clif->broadcast(&target_sd->bl, output, (int)strlen(output)+1, BC_BLUE, SELF);
}
static int duel_leave_sub(struct map_session_data* sd, va_list va)
@@ -152,7 +152,7 @@ void duel_leave(const unsigned int did, struct map_session_data* sd) {
nullpo_retv(sd);
// " <- Player %s has left duel --"
sprintf(output, msg_sd(sd,375), sd->status.name);
- clif->disp_message(&sd->bl, output, strlen(output), DUEL_WOS);
+ clif->disp_message(&sd->bl, output, DUEL_WOS);
duel->list[did].members_count--;
if(duel->list[did].members_count == 0) {
@@ -177,7 +177,7 @@ void duel_accept(const unsigned int did, struct map_session_data* sd) {
// " -> Player %s has accepted duel --"
sprintf(output, msg_sd(sd,376), sd->status.name);
- clif->disp_message(&sd->bl, output, strlen(output), DUEL_WOS);
+ clif->disp_message(&sd->bl, output, DUEL_WOS);
clif->map_property(sd, MAPPROPERTY_FREEPVPZONE);
clif->maptypeproperty2(&sd->bl,SELF);
@@ -189,7 +189,7 @@ void duel_reject(const unsigned int did, struct map_session_data* sd) {
nullpo_retv(sd);
// " -- Player %s has rejected duel --"
sprintf(output, msg_sd(sd,377), sd->status.name);
- clif->disp_message(&sd->bl, output, strlen(output), DUEL_WOS);
+ clif->disp_message(&sd->bl, output, DUEL_WOS);
duel->list[did].invites_count--;
sd->duel_invite = 0;
diff --git a/src/map/guild.c b/src/map/guild.c
index 39d580bb7..1929808ca 100644
--- a/src/map/guild.c
+++ b/src/map/guild.c
@@ -1060,14 +1060,15 @@ int guild_recv_memberinfoshort(int guild_id,int account_id,int char_id,int onlin
/*====================================================
* Send a message to whole guild
*---------------------------------------------------*/
-int guild_send_message(struct map_session_data *sd,const char *mes,int len)
+int guild_send_message(struct map_session_data *sd, const char *mes)
{
+ int len = (int)strlen(mes);
nullpo_ret(sd);
- if(sd->status.guild_id==0)
+ if (sd->status.guild_id == 0)
return 0;
- intif->guild_message(sd->status.guild_id,sd->status.account_id,mes,len);
- guild->recv_message(sd->status.guild_id,sd->status.account_id,mes,len);
+ intif->guild_message(sd->status.guild_id, sd->status.account_id, mes, len);
+ guild->recv_message(sd->status.guild_id, sd->status.account_id, mes, len);
// Chat logging type 'G' / Guild Chat
logs->chat(LOG_CHAT_GUILD, sd->status.guild_id, sd->status.char_id, sd->status.account_id, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y, NULL, mes);
@@ -1828,7 +1829,7 @@ int guild_gm_change(int guild_id, struct map_session_data *sd)
return 0;
//Notify servers that master has changed.
- intif->guild_change_gm(guild_id, sd->status.name, strlen(sd->status.name)+1);
+ intif->guild_change_gm(guild_id, sd->status.name, (int)strlen(sd->status.name)+1);
return 1;
}
diff --git a/src/map/guild.h b/src/map/guild.h
index 1f3b74543..4fe7106d3 100644
--- a/src/map/guild.h
+++ b/src/map/guild.h
@@ -135,7 +135,7 @@ struct guild_interface {
int (*notice_changed) (int guild_id,const char *mes1,const char *mes2);
int (*change_emblem) (struct map_session_data *sd,int len,const char *data);
int (*emblem_changed) (int len,int guild_id,int emblem_id,const char *data);
- int (*send_message) (struct map_session_data *sd,const char *mes,int len);
+ int (*send_message) (struct map_session_data *sd, const char *mes);
int (*recv_message) (int guild_id,int account_id,const char *mes,int len);
int (*send_dot_remove) (struct map_session_data *sd);
int (*skillupack) (int guild_id,uint16 skill_id,int account_id);
diff --git a/src/map/homunculus.c b/src/map/homunculus.c
index bda8fd9e6..66cce23e6 100644
--- a/src/map/homunculus.c
+++ b/src/map/homunculus.c
@@ -391,7 +391,7 @@ bool homunculus_levelup(struct homun_data *hd) {
growth_max_hp, growth_max_sp,
growth_str/10.0, growth_agi/10.0, growth_vit/10.0,
growth_int/10.0, growth_dex/10.0, growth_luk/10.0);
- clif_disp_onlyself(hd->master,output,strlen(output));
+ clif_disp_onlyself(hd->master, output);
}
return true;
}
diff --git a/src/map/intif.c b/src/map/intif.c
index ec0251dad..05b1d7c29 100644
--- a/src/map/intif.c
+++ b/src/map/intif.c
@@ -150,7 +150,7 @@ int intif_rename(struct map_session_data *sd, int type, const char *name)
}
// GM Send a message
-int intif_broadcast(const char* mes, size_t len, int type)
+int intif_broadcast(const char *mes, int len, int type)
{
int lp = (type&BC_COLOR_MASK) ? 4 : 0;
@@ -182,7 +182,7 @@ int intif_broadcast(const char* mes, size_t len, int type)
return 0;
}
-int intif_broadcast2(const char* mes, size_t len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY)
+int intif_broadcast2(const char *mes, int len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY)
{
nullpo_ret(mes);
Assert_ret(len < 32000);
@@ -222,7 +222,7 @@ int intif_main_message(struct map_session_data* sd, const char* message)
snprintf( output, sizeof(output), msg_txt(386), sd->status.name, message );
// send the message using the inter-server broadcast service
- intif->broadcast2( output, strlen(output) + 1, 0xFE000000, 0, 0, 0, 0 );
+ intif->broadcast2(output, (int)strlen(output) + 1, 0xFE000000, 0, 0, 0, 0);
// log the chat message
logs->chat( LOG_CHAT_MAINCHAT, 0, sd->status.char_id, sd->status.account_id, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y, NULL, message );
@@ -231,7 +231,7 @@ int intif_main_message(struct map_session_data* sd, const char* message)
}
// The transmission of Wisp/Page to inter-server (player not found on this server)
-int intif_wis_message(struct map_session_data *sd, const char *nick, const char *mes, size_t mes_len)
+int intif_wis_message(struct map_session_data *sd, const char *nick, const char *mes, int mes_len)
{
if (intif->CheckForCharServer())
return 0;
@@ -279,12 +279,14 @@ int intif_wis_replay(int id, int flag)
// The transmission of GM only Wisp/Page from server to inter-server
int intif_wis_message_to_gm(char *wisp_name, int permission, char *mes)
{
- size_t mes_len;
+ int mes_len;
if (intif->CheckForCharServer())
return 0;
nullpo_ret(wisp_name);
nullpo_ret(mes);
- mes_len = strlen(mes) + 1; // + null
+ mes_len = (int)strlen(mes) + 1; // + null
+ Assert_ret(mes_len > 0 && mes_len <= INT16_MAX - 32);
+
WFIFOHEAD(inter_fd, mes_len + 32);
WFIFOW(inter_fd,0) = 0x3003;
WFIFOW(inter_fd,2) = mes_len + 32;
@@ -658,7 +660,7 @@ int intif_guild_addmember(int guild_id,struct guild_member *m)
}
// Request a new leader for guild
-int intif_guild_change_gm(int guild_id, const char* name, size_t len)
+int intif_guild_change_gm(int guild_id, const char *name, int len)
{
if (intif->CheckForCharServer())
return 0;
@@ -1654,7 +1656,7 @@ void intif_parse_MailInboxReceived(int fd) {
else if( battle_config.mail_show_status && ( battle_config.mail_show_status == 1 || sd->mail.inbox.unread ) ) {
char output[128];
sprintf(output, msg_sd(sd,510), sd->mail.inbox.unchecked, sd->mail.inbox.unread + sd->mail.inbox.unchecked);
- clif_disp_onlyself(sd, output, strlen(output));
+ clif_disp_onlyself(sd, output);
}
}
/*------------------------------------------
diff --git a/src/map/intif.h b/src/map/intif.h
index dccd31d80..5e7f86fc2 100644
--- a/src/map/intif.h
+++ b/src/map/intif.h
@@ -59,10 +59,10 @@ struct intif_interface {
int (*parse) (int fd);
int (*create_pet)(int account_id, int char_id, short pet_type, short pet_lv, short pet_egg_id,
short pet_equip, short intimate, short hungry, char rename_flag, char incubate, char *pet_name);
- int (*broadcast) (const char* mes, size_t len, int type);
- int (*broadcast2) (const char* mes, size_t len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY);
+ int (*broadcast) (const char *mes, int len, int type);
+ int (*broadcast2) (const char *mes, int len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY);
int (*main_message) (struct map_session_data* sd, const char* message);
- int (*wis_message) (struct map_session_data *sd, const char *nick, const char *mes, size_t mes_len);
+ int (*wis_message) (struct map_session_data *sd, const char *nick, const char *mes, int mes_len);
int (*wis_message_to_gm) (char *Wisp_name, int permission, char *mes);
int (*saveregistry) (struct map_session_data *sd);
int (*request_registry) (struct map_session_data *sd, int flag);
@@ -84,7 +84,7 @@ struct intif_interface {
int (*guild_memberinfoshort) (int guild_id, int account_id, int char_id, int online, int lv, int class_);
int (*guild_break) (int guild_id);
int (*guild_message) (int guild_id, int account_id, const char *mes, int len);
- int (*guild_change_gm) (int guild_id, const char* name, size_t len);
+ int (*guild_change_gm) (int guild_id, const char *name, int len);
int (*guild_change_basicinfo) (int guild_id, int type, const void *data, int len);
int (*guild_change_memberinfo) (int guild_id, int account_id, int char_id, int type, const void *data, int len);
int (*guild_position) (int guild_id, int idx, struct guild_position *p);
diff --git a/src/map/mob.c b/src/map/mob.c
index 6a2fc8304..19fee52a5 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -421,7 +421,7 @@ bool mob_ksprotected(struct block_list *src, struct block_list *target) {
if( DIFF_TICK(sd->ks_floodprotect_tick, tick) <= 0 )
{
sprintf(output, "[KS Warning!! - Owner : %s]", pl_sd->status.name);
- clif_disp_onlyself(sd, output, strlen(output));
+ clif_disp_onlyself(sd, output);
sd->ks_floodprotect_tick = tick + 2000;
}
@@ -430,7 +430,7 @@ bool mob_ksprotected(struct block_list *src, struct block_list *target) {
if( DIFF_TICK(pl_sd->ks_floodprotect_tick, tick) <= 0 )
{
sprintf(output, "[Watch out! %s is trying to KS you!]", sd->status.name);
- clif_disp_onlyself(pl_sd, output, strlen(output));
+ clif_disp_onlyself(pl_sd, output);
pl_sd->ks_floodprotect_tick = tick + 2000;
}
@@ -2447,7 +2447,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) {
char message[128];
sprintf (message, msg_txt(541), mvp_sd->status.name, md->name, it->jname, (float)drop_rate/100);
//MSG: "'%s' won %s's %s (chance: %0.02f%%)"
- intif->broadcast(message, strlen(message)+1, BC_DEFAULT);
+ intif->broadcast(message, (int)strlen(message)+1, BC_DEFAULT);
}
/* heres the thing we got the feature set up however we're still discussing how to best define the ids,
@@ -2600,7 +2600,7 @@ int mob_dead(struct mob_data *md, struct block_list *src, int type) {
char message[128];
sprintf(message, msg_txt(541), mvp_sd->status.name, md->name, data->jname, rate/100.);
//MSG: "'%s' won %s's %s (chance: %0.02f%%)"
- intif->broadcast(message, strlen(message)+1, BC_DEFAULT);
+ intif->broadcast(message, (int)strlen(message)+1, BC_DEFAULT);
}
if((temp = pc->additem(mvp_sd,&item,1,LOG_TYPE_PICKDROP_PLAYER)) != 0) {
diff --git a/src/map/party.c b/src/map/party.c
index 551c4d56f..dbb7b6ae2 100644
--- a/src/map/party.c
+++ b/src/map/party.c
@@ -798,12 +798,16 @@ int party_send_logout(struct map_session_data *sd)
return 1;
}
-int party_send_message(struct map_session_data *sd,const char *mes,int len)
+int party_send_message(struct map_session_data *sd, const char *mes)
{
- if(sd->status.party_id==0)
+ int len = (int)strlen(mes);
+
+ nullpo_ret(sd);
+
+ if (sd->status.party_id == 0)
return 0;
- intif->party_message(sd->status.party_id,sd->status.account_id,mes,len);
- party->recv_message(sd->status.party_id,sd->status.account_id,mes,len);
+ intif->party_message(sd->status.party_id, sd->status.account_id, mes, len);
+ party->recv_message(sd->status.party_id, sd->status.account_id, mes, len);
// Chat logging type 'P' / Party Chat
logs->chat(LOG_CHAT_PARTY, sd->status.party_id, sd->status.char_id, sd->status.account_id, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y, NULL, mes);
diff --git a/src/map/party.h b/src/map/party.h
index 253f074bb..05037eb04 100644
--- a/src/map/party.h
+++ b/src/map/party.h
@@ -117,7 +117,7 @@ struct party_interface {
void (*send_movemap) (struct map_session_data *sd);
void (*send_levelup) (struct map_session_data *sd);
int (*send_logout) (struct map_session_data *sd);
- int (*send_message) (struct map_session_data *sd,const char *mes,int len);
+ int (*send_message) (struct map_session_data *sd, const char *mes);
int (*recv_message) (int party_id,int account_id,const char *mes,int len);
int (*skill_check) (struct map_session_data *sd, int party_id, uint16 skill_id, uint16 skill_lv);
int (*send_xy_clear) (struct party_data *p);
diff --git a/src/map/pc.c b/src/map/pc.c
index 8fe9ddd6e..113638912 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -1864,8 +1864,8 @@ int pc_disguise(struct map_session_data *sd, int class_) {
clif->cartlist(sd);
clif->updatestatus(sd,SP_CARTINFO);
}
- if (sd->chatID) {
- struct chat_data *cd = map->id2cd(sd->chatID);
+ if (sd->chat_id != 0) {
+ struct chat_data *cd = map->id2cd(sd->chat_id);
if (cd != NULL)
clif->dispchat(cd,0);
@@ -4276,7 +4276,7 @@ int pc_payzeny(struct map_session_data *sd,int zeny, enum e_log_pick_type type,
if( zeny > 0 && sd->state.showzeny ) {
char output[255];
sprintf(output, "Removed %dz.", zeny);
- clif_disp_onlyself(sd,output,strlen(output));
+ clif_disp_onlyself(sd, output);
}
return 0;
@@ -4318,7 +4318,7 @@ int pc_paycash(struct map_session_data *sd, int price, int points)
{
char output[128];
sprintf(output, msg_sd(sd,504), points, cash, sd->kafraPoints, sd->cashPoints);
- clif_disp_onlyself(sd, output, strlen(output));
+ clif_disp_onlyself(sd, output);
}
return cash+points;
}
@@ -4343,7 +4343,7 @@ int pc_getcash(struct map_session_data *sd, int cash, int points)
if( battle_config.cashshop_show_points )
{
sprintf(output, msg_sd(sd,505), cash, sd->cashPoints);
- clif_disp_onlyself(sd, output, strlen(output));
+ clif_disp_onlyself(sd, output);
}
return cash;
}
@@ -4366,7 +4366,7 @@ int pc_getcash(struct map_session_data *sd, int cash, int points)
if( battle_config.cashshop_show_points )
{
sprintf(output, msg_sd(sd,506), points, sd->kafraPoints);
- clif_disp_onlyself(sd, output, strlen(output));
+ clif_disp_onlyself(sd, output);
}
return points;
}
@@ -4404,7 +4404,7 @@ int pc_getzeny(struct map_session_data *sd,int zeny, enum e_log_pick_type type,
if( zeny > 0 && sd->state.showzeny ) {
char output[255];
sprintf(output, "Gained %dz.", zeny);
- clif_disp_onlyself(sd,output,strlen(output));
+ clif_disp_onlyself(sd, output);
}
return 0;
@@ -5341,7 +5341,7 @@ int pc_steal_item(struct map_session_data *sd,struct block_list *bl, uint16 skil
char message[128];
sprintf (message, msg_txt(542), sd->status.name, md->db->jname, data->jname, (float)md->db->dropitem[i].p / 100);
//MSG: "'%s' stole %s's %s (chance: %0.02f%%)"
- intif->broadcast(message, strlen(message)+1, BC_DEFAULT);
+ intif->broadcast(message, (int)strlen(message)+1, BC_DEFAULT);
}
return 1;
}
@@ -6726,7 +6726,7 @@ bool pc_gainexp(struct map_session_data *sd, struct block_list *src, unsigned in
char output[256];
sprintf(output,
"Experience Gained Base:%u (%.2f%%) Job:%u (%.2f%%)",base_exp,nextbp*(float)100,job_exp,nextjp*(float)100);
- clif_disp_onlyself(sd,output,strlen(output));
+ clif_disp_onlyself(sd, output);
}
return true;
@@ -10335,7 +10335,7 @@ int map_day_timer(int tid, int64 tick, int id, intptr_t data) {
map->night_flag = 0; // 0=day, 1=night [Yor]
map->foreachpc(pc->daynight_timer_sub);
safestrncpy(tmp_soutput, (data == 0) ? msg_txt(502) : msg_txt(60), sizeof(tmp_soutput)); // The day has arrived!
- intif->broadcast(tmp_soutput, strlen(tmp_soutput) + 1, BC_DEFAULT);
+ intif->broadcast(tmp_soutput, (int)strlen(tmp_soutput) + 1, BC_DEFAULT);
return 0;
}
@@ -10355,7 +10355,7 @@ int map_night_timer(int tid, int64 tick, int id, intptr_t data) {
map->night_flag = 1; // 0=day, 1=night [Yor]
map->foreachpc(pc->daynight_timer_sub);
safestrncpy(tmp_soutput, (data == 0) ? msg_txt(503) : msg_txt(59), sizeof(tmp_soutput)); // The night has fallen...
- intif->broadcast(tmp_soutput, strlen(tmp_soutput) + 1, BC_DEFAULT);
+ intif->broadcast(tmp_soutput, (int)strlen(tmp_soutput) + 1, BC_DEFAULT);
return 0;
}
@@ -11195,7 +11195,7 @@ void pc_scdata_received(struct map_session_data *sd) {
time_t exp_time = sd->expiration_time;
char tmpstr[1024];
strftime(tmpstr, sizeof(tmpstr) - 1, msg_sd(sd,501), localtime(&exp_time)); // "Your account time limit is: %d-%m-%Y %H:%M:%S."
- clif->wis_message(sd->fd, map->wisp_server_name, tmpstr, strlen(tmpstr)+1);
+ clif->wis_message(sd->fd, map->wisp_server_name, tmpstr, (int)strlen(tmpstr)+1);
pc->expire_check(sd);
}
diff --git a/src/map/pc.h b/src/map/pc.h
index 5d35fd1cc..58f7a2266 100644
--- a/src/map/pc.h
+++ b/src/map/pc.h
@@ -258,7 +258,7 @@ struct map_session_data {
struct script_state *st;
char npc_str[CHATBOX_SIZE]; // for passing npc input box text to script engine
int npc_timer_id; //For player attached npc timers. [Skotlex]
- unsigned int chatID;
+ int chat_id;
int64 idletime;
struct {
int npc_id;
@@ -610,15 +610,15 @@ END_ZEROED_BLOCK;
#define pc_setsit(sd) ( (sd)->state.dead_sit = (sd)->vd.dead_sit = 2 )
#define pc_isdead(sd) ( (sd)->state.dead_sit == 1 )
#define pc_issit(sd) ( (sd)->vd.dead_sit == 2 )
-#define pc_isidle(sd) ( (sd)->chatID || (sd)->state.vending || (sd)->state.buyingstore || DIFF_TICK(sockt->last_tick, (sd)->idletime) >= battle->bc->idle_no_share )
+#define pc_isidle(sd) ( (sd)->chat_id != 0 || (sd)->state.vending || (sd)->state.buyingstore || DIFF_TICK(sockt->last_tick, (sd)->idletime) >= battle->bc->idle_no_share )
#define pc_istrading(sd) ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->state.trading )
-#define pc_cant_act(sd) ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chatID || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )
+#define pc_cant_act(sd) ( (sd)->npc_id || (sd)->state.vending || (sd)->state.buyingstore || (sd)->chat_id != 0 || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )
/* equals pc_cant_act except it doesn't check for chat rooms */
#define pc_cant_act2(sd) ( (sd)->npc_id || (sd)->state.buyingstore || ((sd)->sc.opt1 && (sd)->sc.opt1 != OPT1_BURNING) || (sd)->state.trading || (sd)->state.storage_flag || (sd)->state.prevend )
#define pc_setdir(sd,b,h) ( (sd)->ud.dir = (b) ,(sd)->head_dir = (h) )
-#define pc_setchatid(sd,n) ( (sd)->chatID = n )
+#define pc_setchatid(sd,n) ( (sd)->chat_id = (n) )
#define pc_ishiding(sd) ( (sd)->sc.option&(OPTION_HIDE|OPTION_CLOAK|OPTION_CHASEWALK) )
#define pc_iscloaking(sd) ( !((sd)->sc.option&OPTION_CHASEWALK) && ((sd)->sc.option&OPTION_CLOAK) )
#define pc_ischasewalk(sd) ( (sd)->sc.option&OPTION_CHASEWALK )
diff --git a/src/map/script.c b/src/map/script.c
index 007c6e0e1..e869ddb62 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -10507,7 +10507,8 @@ BUILDIN(playerattached) {
/*==========================================
*------------------------------------------*/
-BUILDIN(announce) {
+BUILDIN(announce)
+{
const char *mes = script_getstr(st,2);
int flag = script_getnum(st,3);
const char *fontColor = script_hasdata(st,4) ? script_getstr(st,4) : NULL;
@@ -10515,6 +10516,8 @@ BUILDIN(announce) {
int fontSize = script_hasdata(st,6) ? script_getnum(st,6) : 12; // default fontSize
int fontAlign = script_hasdata(st,7) ? script_getnum(st,7) : 0; // default fontAlign
int fontY = script_hasdata(st,8) ? script_getnum(st,8) : 0; // default fontY
+ size_t len = strlen(mes);
+ Assert_retr(false, len < INT_MAX);
if( flag&(BC_TARGET_MASK|BC_SOURCE_MASK) ) {
// Broadcast source or broadcast region defined
@@ -10539,14 +10542,14 @@ BUILDIN(announce) {
}
if (fontColor)
- clif->broadcast2(bl, mes, (int)strlen(mes)+1, (unsigned int)strtoul(fontColor, (char **)NULL, 0), fontType, fontSize, fontAlign, fontY, target);
+ clif->broadcast2(bl, mes, (int)len+1, (unsigned int)strtoul(fontColor, (char **)NULL, 0), fontType, fontSize, fontAlign, fontY, target);
else
- clif->broadcast(bl, mes, (int)strlen(mes)+1, flag&BC_COLOR_MASK, target);
+ clif->broadcast(bl, mes, (int)len+1, flag&BC_COLOR_MASK, target);
} else {
if (fontColor)
- intif->broadcast2(mes, (int)strlen(mes)+1, (unsigned int)strtoul(fontColor, (char **)NULL, 0), fontType, fontSize, fontAlign, fontY);
+ intif->broadcast2(mes, (int)len+1, (unsigned int)strtoul(fontColor, (char **)NULL, 0), fontType, fontSize, fontAlign, fontY);
else
- intif->broadcast(mes, (int)strlen(mes)+1, flag&BC_COLOR_MASK);
+ intif->broadcast(mes, (int)len+1, flag&BC_COLOR_MASK);
}
return true;
}
@@ -10554,10 +10557,10 @@ BUILDIN(announce) {
*------------------------------------------*/
int buildin_announce_sub(struct block_list *bl, va_list ap)
{
- char *mes = va_arg(ap, char *);
+ const char *mes = va_arg(ap, const char *);
int len = va_arg(ap, int);
int type = va_arg(ap, int);
- char *fontColor = va_arg(ap, char *);
+ const char *fontColor = va_arg(ap, const char *);
short fontType = (short)va_arg(ap, int);
short fontSize = (short)va_arg(ap, int);
short fontAlign = (short)va_arg(ap, int);
@@ -10604,7 +10607,8 @@ BUILDIN(itemeffect)
return true;
}
-BUILDIN(mapannounce) {
+BUILDIN(mapannounce)
+{
const char *mapname = script_getstr(st,2);
const char *mes = script_getstr(st,3);
int flag = script_getnum(st,4);
@@ -10614,17 +10618,20 @@ BUILDIN(mapannounce) {
int fontAlign = script_hasdata(st,8) ? script_getnum(st,8) : 0; // default fontAlign
int fontY = script_hasdata(st,9) ? script_getnum(st,9) : 0; // default fontY
int16 m;
+ size_t len = strlen(mes);
+ Assert_retr(false, len < INT_MAX);
if ((m = map->mapname2mapid(mapname)) < 0)
return true;
map->foreachinmap(script->buildin_announce_sub, m, BL_PC,
- mes, strlen(mes)+1, flag&BC_COLOR_MASK, fontColor, fontType, fontSize, fontAlign, fontY);
+ mes, (int)len+1, flag&BC_COLOR_MASK, fontColor, fontType, fontSize, fontAlign, fontY);
return true;
}
/*==========================================
*------------------------------------------*/
-BUILDIN(areaannounce) {
+BUILDIN(areaannounce)
+{
const char *mapname = script_getstr(st,2);
int x0 = script_getnum(st,3);
int y0 = script_getnum(st,4);
@@ -10638,12 +10645,14 @@ BUILDIN(areaannounce) {
int fontAlign = script_hasdata(st,12) ? script_getnum(st,12) : 0; // default fontAlign
int fontY = script_hasdata(st,13) ? script_getnum(st,13) : 0; // default fontY
int16 m;
+ size_t len = strlen(mes);
+ Assert_retr(false, len < INT_MAX);
if ((m = map->mapname2mapid(mapname)) < 0)
return true;
map->foreachinarea(script->buildin_announce_sub, m, x0, y0, x1, y1, BL_PC,
- mes, strlen(mes)+1, flag&BC_COLOR_MASK, fontColor, fontType, fontSize, fontAlign, fontY);
+ mes, (int)len+1, flag&BC_COLOR_MASK, fontColor, fontType, fontSize, fontAlign, fontY);
return true;
}
@@ -13782,7 +13791,7 @@ BUILDIN(dispbottom)
int color = script_getnum(st,3);
clif->messagecolor_self(sd->fd, color, message);
} else {
- clif_disp_onlyself(sd, message, (int)strlen(message));
+ clif_disp_onlyself(sd, message);
}
return true;
@@ -16479,7 +16488,7 @@ BUILDIN(checkchatting) {
sd = script->rid2sd(st);
if (sd != NULL)
- script_pushint(st,(sd->chatID != 0));
+ script_pushint(st, (sd->chat_id != 0));
else
script_pushint(st,0);
@@ -18017,7 +18026,8 @@ BUILDIN(instance_init) {
return true;
}
-BUILDIN(instance_announce) {
+BUILDIN(instance_announce)
+{
int instance_id = script_getnum(st,2);
const char *mes = script_getstr(st,3);
int flag = script_getnum(st,4);
@@ -18026,8 +18036,9 @@ BUILDIN(instance_announce) {
int fontSize = script_hasdata(st,7) ? script_getnum(st,7) : 12; // default fontSize
int fontAlign = script_hasdata(st,8) ? script_getnum(st,8) : 0; // default fontAlign
int fontY = script_hasdata(st,9) ? script_getnum(st,9) : 0; // default fontY
-
int i;
+ size_t len = strlen(mes);
+ Assert_retr(false, len < INT_MAX);
if( instance_id == -1 ) {
if( st->instance_id >= 0 )
@@ -18041,7 +18052,7 @@ BUILDIN(instance_announce) {
for( i = 0; i < instance->list[instance_id].num_map; i++ )
map->foreachinmap(script->buildin_announce_sub, instance->list[instance_id].map[i], BL_PC,
- mes, strlen(mes)+1, flag&BC_COLOR_MASK, fontColor, fontType, fontSize, fontAlign, fontY);
+ mes, (int)len+1, flag&BC_COLOR_MASK, fontColor, fontType, fontSize, fontAlign, fontY);
return true;
}
diff --git a/src/map/skill.c b/src/map/skill.c
index 31be52ae3..d3cb8d0be 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -11716,7 +11716,7 @@ int skill_unit_onplace(struct skill_unit *src, struct block_list *bl, int64 tick
if (bl->type == BL_PC && !working) {
struct map_session_data *sd = BL_UCAST(BL_PC, bl);
- if ((!sd->chatID || battle_config.chat_warpportal) && sd->ud.to_x == src->bl.x && sd->ud.to_y == src->bl.y) {
+ if ((sd->chat_id == 0 || battle_config.chat_warpportal) && sd->ud.to_x == src->bl.x && sd->ud.to_y == src->bl.y) {
int x = sg->val2>>16;
int y = sg->val2&0xffff;
int count = sg->val1>>16;
@@ -13122,7 +13122,8 @@ int skill_check_condition_castbegin(struct map_session_data* sd, uint16 skill_id
nullpo_ret(sd);
- if (sd->chatID) return 0;
+ if (sd->chat_id != 0)
+ return 0;
if (pc_has_permission(sd, PC_PERM_SKILL_UNCONDITIONAL) && sd->skillitem != skill_id) {
//GMs don't override the skillItem check, otherwise they can use items without them being consumed! [Skotlex]
@@ -14088,7 +14089,7 @@ int skill_check_condition_castend(struct map_session_data* sd, uint16 skill_id,
nullpo_ret(sd);
- if( sd->chatID )
+ if (sd->chat_id != 0)
return 0;
if( pc_has_permission(sd, PC_PERM_SKILL_UNCONDITIONAL) && sd->skillitem != skill_id ) {
diff --git a/src/map/unit.c b/src/map/unit.c
index 9a698b77e..7e4d94e0b 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -2433,7 +2433,7 @@ int unit_remove_map(struct block_list *bl, clr_type clrtype, const char* file, i
status_change_end(d_bl,SC__SHADOWFORM,INVALID_TIMER);
}
//Leave/reject all invitations.
- if(sd->chatID)
+ if (sd->chat_id != 0)
chat->leave(sd, false);
if(sd->trade_partner)
trade->cancel(sd);
diff --git a/src/map/vending.c b/src/map/vending.c
index d9001f6f5..e3a62bea7 100644
--- a/src/map/vending.c
+++ b/src/map/vending.c
@@ -199,7 +199,7 @@ void vending_purchasereq(struct map_session_data* sd, int aid, unsigned int uid,
if( battle_config.buyer_name ) {
char temp[256];
sprintf(temp, msg_sd(vsd,265), sd->status.name);
- clif_disp_onlyself(vsd,temp,strlen(temp));
+ clif_disp_onlyself(vsd, temp);
}
}
diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
index ac94bfc4a..1526dd3f1 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
@@ -3219,15 +3219,15 @@ int HP_bg_team_get_id(struct block_list *bl) {
}
return retVal___;
}
-bool HP_bg_send_message(struct map_session_data *sd, const char *mes, int len) {
+bool HP_bg_send_message(struct map_session_data *sd, const char *mes) {
int hIndex = 0;
bool retVal___ = false;
if( HPMHooks.count.HP_bg_send_message_pre ) {
- bool (*preHookFunc) (struct map_session_data *sd, const char *mes, int *len);
+ bool (*preHookFunc) (struct map_session_data *sd, const char *mes);
*HPMforce_return = false;
for(hIndex = 0; hIndex < HPMHooks.count.HP_bg_send_message_pre; hIndex++ ) {
preHookFunc = HPMHooks.list.HP_bg_send_message_pre[hIndex].func;
- retVal___ = preHookFunc(sd, mes, &len);
+ retVal___ = preHookFunc(sd, mes);
}
if( *HPMforce_return ) {
*HPMforce_return = false;
@@ -3235,13 +3235,13 @@ bool HP_bg_send_message(struct map_session_data *sd, const char *mes, int len) {
}
}
{
- retVal___ = HPMHooks.source.bg.send_message(sd, mes, len);
+ retVal___ = HPMHooks.source.bg.send_message(sd, mes);
}
if( HPMHooks.count.HP_bg_send_message_post ) {
- bool (*postHookFunc) (bool retVal___, struct map_session_data *sd, const char *mes, int *len);
+ bool (*postHookFunc) (bool retVal___, struct map_session_data *sd, const char *mes);
for(hIndex = 0; hIndex < HPMHooks.count.HP_bg_send_message_post; hIndex++ ) {
postHookFunc = HPMHooks.list.HP_bg_send_message_post[hIndex].func;
- retVal___ = postHookFunc(retVal___, sd, mes, &len);
+ retVal___ = postHookFunc(retVal___, sd, mes);
}
}
return retVal___;
@@ -12482,10 +12482,10 @@ void HP_clif_changechatstatus(struct chat_data *cd) {
}
return;
}
-void HP_clif_wis_message(int fd, const char *nick, const char *mes, size_t mes_len) {
+void HP_clif_wis_message(int fd, const char *nick, const char *mes, int mes_len) {
int hIndex = 0;
if( HPMHooks.count.HP_clif_wis_message_pre ) {
- void (*preHookFunc) (int *fd, const char *nick, const char *mes, size_t *mes_len);
+ void (*preHookFunc) (int *fd, const char *nick, const char *mes, int *mes_len);
*HPMforce_return = false;
for(hIndex = 0; hIndex < HPMHooks.count.HP_clif_wis_message_pre; hIndex++ ) {
preHookFunc = HPMHooks.list.HP_clif_wis_message_pre[hIndex].func;
@@ -12500,7 +12500,7 @@ void HP_clif_wis_message(int fd, const char *nick, const char *mes, size_t mes_l
HPMHooks.source.clif.wis_message(fd, nick, mes, mes_len);
}
if( HPMHooks.count.HP_clif_wis_message_post ) {
- void (*postHookFunc) (int *fd, const char *nick, const char *mes, size_t *mes_len);
+ void (*postHookFunc) (int *fd, const char *nick, const char *mes, int *mes_len);
for(hIndex = 0; hIndex < HPMHooks.count.HP_clif_wis_message_post; hIndex++ ) {
postHookFunc = HPMHooks.list.HP_clif_wis_message_post[hIndex].func;
postHookFunc(&fd, nick, mes, &mes_len);
@@ -12534,14 +12534,14 @@ void HP_clif_wis_end(int fd, int flag) {
}
return;
}
-void HP_clif_disp_message(struct block_list *src, const char *mes, size_t len, enum send_target target) {
+void HP_clif_disp_message(struct block_list *src, const char *mes, enum send_target target) {
int hIndex = 0;
if( HPMHooks.count.HP_clif_disp_message_pre ) {
- void (*preHookFunc) (struct block_list *src, const char *mes, size_t *len, enum send_target *target);
+ void (*preHookFunc) (struct block_list *src, const char *mes, enum send_target *target);
*HPMforce_return = false;
for(hIndex = 0; hIndex < HPMHooks.count.HP_clif_disp_message_pre; hIndex++ ) {
preHookFunc = HPMHooks.list.HP_clif_disp_message_pre[hIndex].func;
- preHookFunc(src, mes, &len, &target);
+ preHookFunc(src, mes, &target);
}
if( *HPMforce_return ) {
*HPMforce_return = false;
@@ -12549,21 +12549,21 @@ void HP_clif_disp_message(struct block_list *src, const char *mes, size_t len, e
}
}
{
- HPMHooks.source.clif.disp_message(src, mes, len, target);
+ HPMHooks.source.clif.disp_message(src, mes, target);
}
if( HPMHooks.count.HP_clif_disp_message_post ) {
- void (*postHookFunc) (struct block_list *src, const char *mes, size_t *len, enum send_target *target);
+ void (*postHookFunc) (struct block_list *src, const char *mes, enum send_target *target);
for(hIndex = 0; hIndex < HPMHooks.count.HP_clif_disp_message_post; hIndex++ ) {
postHookFunc = HPMHooks.list.HP_clif_disp_message_post[hIndex].func;
- postHookFunc(src, mes, &len, &target);
+ postHookFunc(src, mes, &target);
}
}
return;
}
-void HP_clif_broadcast(struct block_list *bl, const char *mes, size_t len, int type, enum send_target target) {
+void HP_clif_broadcast(struct block_list *bl, const char *mes, int len, int type, enum send_target target) {
int hIndex = 0;
if( HPMHooks.count.HP_clif_broadcast_pre ) {
- void (*preHookFunc) (struct block_list *bl, const char *mes, size_t *len, int *type, enum send_target *target);
+ void (*preHookFunc) (struct block_list *bl, const char *mes, int *len, int *type, enum send_target *target);
*HPMforce_return = false;
for(hIndex = 0; hIndex < HPMHooks.count.HP_clif_broadcast_pre; hIndex++ ) {
preHookFunc = HPMHooks.list.HP_clif_broadcast_pre[hIndex].func;
@@ -12578,7 +12578,7 @@ void HP_clif_broadcast(struct block_list *bl, const char *mes, size_t len, int t
HPMHooks.source.clif.broadcast(bl, mes, len, type, target);
}
if( HPMHooks.count.HP_clif_broadcast_post ) {
- void (*postHookFunc) (struct block_list *bl, const char *mes, size_t *len, int *type, enum send_target *target);
+ void (*postHookFunc) (struct block_list *bl, const char *mes, int *len, int *type, enum send_target *target);
for(hIndex = 0; hIndex < HPMHooks.count.HP_clif_broadcast_post; hIndex++ ) {
postHookFunc = HPMHooks.list.HP_clif_broadcast_post[hIndex].func;
postHookFunc(bl, mes, &len, &type, &target);
@@ -12586,10 +12586,10 @@ void HP_clif_broadcast(struct block_list *bl, const char *mes, size_t len, int t
}
return;
}
-void HP_clif_broadcast2(struct block_list *bl, const char *mes, size_t len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY, enum send_target target) {
+void HP_clif_broadcast2(struct block_list *bl, const char *mes, int len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY, enum send_target target) {
int hIndex = 0;
if( HPMHooks.count.HP_clif_broadcast2_pre ) {
- void (*preHookFunc) (struct block_list *bl, const char *mes, size_t *len, unsigned int *fontColor, short *fontType, short *fontSize, short *fontAlign, short *fontY, enum send_target *target);
+ void (*preHookFunc) (struct block_list *bl, const char *mes, int *len, unsigned int *fontColor, short *fontType, short *fontSize, short *fontAlign, short *fontY, enum send_target *target);
*HPMforce_return = false;
for(hIndex = 0; hIndex < HPMHooks.count.HP_clif_broadcast2_pre; hIndex++ ) {
preHookFunc = HPMHooks.list.HP_clif_broadcast2_pre[hIndex].func;
@@ -12604,7 +12604,7 @@ void HP_clif_broadcast2(struct block_list *bl, const char *mes, size_t len, unsi
HPMHooks.source.clif.broadcast2(bl, mes, len, fontColor, fontType, fontSize, fontAlign, fontY, target);
}
if( HPMHooks.count.HP_clif_broadcast2_post ) {
- void (*postHookFunc) (struct block_list *bl, const char *mes, size_t *len, unsigned int *fontColor, short *fontType, short *fontSize, short *fontAlign, short *fontY, enum send_target *target);
+ void (*postHookFunc) (struct block_list *bl, const char *mes, int *len, unsigned int *fontColor, short *fontType, short *fontSize, short *fontAlign, short *fontY, enum send_target *target);
for(hIndex = 0; hIndex < HPMHooks.count.HP_clif_broadcast2_post; hIndex++ ) {
postHookFunc = HPMHooks.list.HP_clif_broadcast2_post[hIndex].func;
postHookFunc(bl, mes, &len, &fontColor, &fontType, &fontSize, &fontAlign, &fontY, &target);
@@ -14903,14 +14903,14 @@ void HP_clif_bg_xy_remove(struct map_session_data *sd) {
}
return;
}
-void HP_clif_bg_message(struct battleground_data *bgd, int src_id, const char *name, const char *mes, size_t len) {
+void HP_clif_bg_message(struct battleground_data *bgd, int src_id, const char *name, const char *mes) {
int hIndex = 0;
if( HPMHooks.count.HP_clif_bg_message_pre ) {
- void (*preHookFunc) (struct battleground_data *bgd, int *src_id, const char *name, const char *mes, size_t *len);
+ void (*preHookFunc) (struct battleground_data *bgd, int *src_id, const char *name, const char *mes);
*HPMforce_return = false;
for(hIndex = 0; hIndex < HPMHooks.count.HP_clif_bg_message_pre; hIndex++ ) {
preHookFunc = HPMHooks.list.HP_clif_bg_message_pre[hIndex].func;
- preHookFunc(bgd, &src_id, name, mes, &len);
+ preHookFunc(bgd, &src_id, name, mes);
}
if( *HPMforce_return ) {
*HPMforce_return = false;
@@ -14918,13 +14918,13 @@ void HP_clif_bg_message(struct battleground_data *bgd, int src_id, const char *n
}
}
{
- HPMHooks.source.clif.bg_message(bgd, src_id, name, mes, len);
+ HPMHooks.source.clif.bg_message(bgd, src_id, name, mes);
}
if( HPMHooks.count.HP_clif_bg_message_post ) {
- void (*postHookFunc) (struct battleground_data *bgd, int *src_id, const char *name, const char *mes, size_t *len);
+ void (*postHookFunc) (struct battleground_data *bgd, int *src_id, const char *name, const char *mes);
for(hIndex = 0; hIndex < HPMHooks.count.HP_clif_bg_message_post; hIndex++ ) {
postHookFunc = HPMHooks.list.HP_clif_bg_message_post[hIndex].func;
- postHookFunc(bgd, &src_id, name, mes, &len);
+ postHookFunc(bgd, &src_id, name, mes);
}
}
return;
@@ -27414,15 +27414,15 @@ int HP_guild_emblem_changed(int len, int guild_id, int emblem_id, const char *da
}
return retVal___;
}
-int HP_guild_send_message(struct map_session_data *sd, const char *mes, int len) {
+int HP_guild_send_message(struct map_session_data *sd, const char *mes) {
int hIndex = 0;
int retVal___ = 0;
if( HPMHooks.count.HP_guild_send_message_pre ) {
- int (*preHookFunc) (struct map_session_data *sd, const char *mes, int *len);
+ int (*preHookFunc) (struct map_session_data *sd, const char *mes);
*HPMforce_return = false;
for(hIndex = 0; hIndex < HPMHooks.count.HP_guild_send_message_pre; hIndex++ ) {
preHookFunc = HPMHooks.list.HP_guild_send_message_pre[hIndex].func;
- retVal___ = preHookFunc(sd, mes, &len);
+ retVal___ = preHookFunc(sd, mes);
}
if( *HPMforce_return ) {
*HPMforce_return = false;
@@ -27430,13 +27430,13 @@ int HP_guild_send_message(struct map_session_data *sd, const char *mes, int len)
}
}
{
- retVal___ = HPMHooks.source.guild.send_message(sd, mes, len);
+ retVal___ = HPMHooks.source.guild.send_message(sd, mes);
}
if( HPMHooks.count.HP_guild_send_message_post ) {
- int (*postHookFunc) (int retVal___, struct map_session_data *sd, const char *mes, int *len);
+ int (*postHookFunc) (int retVal___, struct map_session_data *sd, const char *mes);
for(hIndex = 0; hIndex < HPMHooks.count.HP_guild_send_message_post; hIndex++ ) {
postHookFunc = HPMHooks.list.HP_guild_send_message_post[hIndex].func;
- retVal___ = postHookFunc(retVal___, sd, mes, &len);
+ retVal___ = postHookFunc(retVal___, sd, mes);
}
}
return retVal___;
@@ -30718,11 +30718,11 @@ int HP_intif_create_pet(int account_id, int char_id, short pet_type, short pet_l
}
return retVal___;
}
-int HP_intif_broadcast(const char *mes, size_t len, int type) {
+int HP_intif_broadcast(const char *mes, int len, int type) {
int hIndex = 0;
int retVal___ = 0;
if( HPMHooks.count.HP_intif_broadcast_pre ) {
- int (*preHookFunc) (const char *mes, size_t *len, int *type);
+ int (*preHookFunc) (const char *mes, int *len, int *type);
*HPMforce_return = false;
for(hIndex = 0; hIndex < HPMHooks.count.HP_intif_broadcast_pre; hIndex++ ) {
preHookFunc = HPMHooks.list.HP_intif_broadcast_pre[hIndex].func;
@@ -30737,7 +30737,7 @@ int HP_intif_broadcast(const char *mes, size_t len, int type) {
retVal___ = HPMHooks.source.intif.broadcast(mes, len, type);
}
if( HPMHooks.count.HP_intif_broadcast_post ) {
- int (*postHookFunc) (int retVal___, const char *mes, size_t *len, int *type);
+ int (*postHookFunc) (int retVal___, const char *mes, int *len, int *type);
for(hIndex = 0; hIndex < HPMHooks.count.HP_intif_broadcast_post; hIndex++ ) {
postHookFunc = HPMHooks.list.HP_intif_broadcast_post[hIndex].func;
retVal___ = postHookFunc(retVal___, mes, &len, &type);
@@ -30745,11 +30745,11 @@ int HP_intif_broadcast(const char *mes, size_t len, int type) {
}
return retVal___;
}
-int HP_intif_broadcast2(const char *mes, size_t len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY) {
+int HP_intif_broadcast2(const char *mes, int len, unsigned int fontColor, short fontType, short fontSize, short fontAlign, short fontY) {
int hIndex = 0;
int retVal___ = 0;
if( HPMHooks.count.HP_intif_broadcast2_pre ) {
- int (*preHookFunc) (const char *mes, size_t *len, unsigned int *fontColor, short *fontType, short *fontSize, short *fontAlign, short *fontY);
+ int (*preHookFunc) (const char *mes, int *len, unsigned int *fontColor, short *fontType, short *fontSize, short *fontAlign, short *fontY);
*HPMforce_return = false;
for(hIndex = 0; hIndex < HPMHooks.count.HP_intif_broadcast2_pre; hIndex++ ) {
preHookFunc = HPMHooks.list.HP_intif_broadcast2_pre[hIndex].func;
@@ -30764,7 +30764,7 @@ int HP_intif_broadcast2(const char *mes, size_t len, unsigned int fontColor, sho
retVal___ = HPMHooks.source.intif.broadcast2(mes, len, fontColor, fontType, fontSize, fontAlign, fontY);
}
if( HPMHooks.count.HP_intif_broadcast2_post ) {
- int (*postHookFunc) (int retVal___, const char *mes, size_t *len, unsigned int *fontColor, short *fontType, short *fontSize, short *fontAlign, short *fontY);
+ int (*postHookFunc) (int retVal___, const char *mes, int *len, unsigned int *fontColor, short *fontType, short *fontSize, short *fontAlign, short *fontY);
for(hIndex = 0; hIndex < HPMHooks.count.HP_intif_broadcast2_post; hIndex++ ) {
postHookFunc = HPMHooks.list.HP_intif_broadcast2_post[hIndex].func;
retVal___ = postHookFunc(retVal___, mes, &len, &fontColor, &fontType, &fontSize, &fontAlign, &fontY);
@@ -30799,11 +30799,11 @@ int HP_intif_main_message(struct map_session_data *sd, const char *message) {
}
return retVal___;
}
-int HP_intif_wis_message(struct map_session_data *sd, const char *nick, const char *mes, size_t mes_len) {
+int HP_intif_wis_message(struct map_session_data *sd, const char *nick, const char *mes, int mes_len) {
int hIndex = 0;
int retVal___ = 0;
if( HPMHooks.count.HP_intif_wis_message_pre ) {
- int (*preHookFunc) (struct map_session_data *sd, const char *nick, const char *mes, size_t *mes_len);
+ int (*preHookFunc) (struct map_session_data *sd, const char *nick, const char *mes, int *mes_len);
*HPMforce_return = false;
for(hIndex = 0; hIndex < HPMHooks.count.HP_intif_wis_message_pre; hIndex++ ) {
preHookFunc = HPMHooks.list.HP_intif_wis_message_pre[hIndex].func;
@@ -30818,7 +30818,7 @@ int HP_intif_wis_message(struct map_session_data *sd, const char *nick, const ch
retVal___ = HPMHooks.source.intif.wis_message(sd, nick, mes, mes_len);
}
if( HPMHooks.count.HP_intif_wis_message_post ) {
- int (*postHookFunc) (int retVal___, struct map_session_data *sd, const char *nick, const char *mes, size_t *mes_len);
+ int (*postHookFunc) (int retVal___, struct map_session_data *sd, const char *nick, const char *mes, int *mes_len);
for(hIndex = 0; hIndex < HPMHooks.count.HP_intif_wis_message_post; hIndex++ ) {
postHookFunc = HPMHooks.list.HP_intif_wis_message_post[hIndex].func;
retVal___ = postHookFunc(retVal___, sd, nick, mes, &mes_len);
@@ -31393,11 +31393,11 @@ int HP_intif_guild_message(int guild_id, int account_id, const char *mes, int le
}
return retVal___;
}
-int HP_intif_guild_change_gm(int guild_id, const char *name, size_t len) {
+int HP_intif_guild_change_gm(int guild_id, const char *name, int len) {
int hIndex = 0;
int retVal___ = 0;
if( HPMHooks.count.HP_intif_guild_change_gm_pre ) {
- int (*preHookFunc) (int *guild_id, const char *name, size_t *len);
+ int (*preHookFunc) (int *guild_id, const char *name, int *len);
*HPMforce_return = false;
for(hIndex = 0; hIndex < HPMHooks.count.HP_intif_guild_change_gm_pre; hIndex++ ) {
preHookFunc = HPMHooks.list.HP_intif_guild_change_gm_pre[hIndex].func;
@@ -31412,7 +31412,7 @@ int HP_intif_guild_change_gm(int guild_id, const char *name, size_t len) {
retVal___ = HPMHooks.source.intif.guild_change_gm(guild_id, name, len);
}
if( HPMHooks.count.HP_intif_guild_change_gm_post ) {
- int (*postHookFunc) (int retVal___, int *guild_id, const char *name, size_t *len);
+ int (*postHookFunc) (int retVal___, int *guild_id, const char *name, int *len);
for(hIndex = 0; hIndex < HPMHooks.count.HP_intif_guild_change_gm_post; hIndex++ ) {
postHookFunc = HPMHooks.list.HP_intif_guild_change_gm_post[hIndex].func;
retVal___ = postHookFunc(retVal___, &guild_id, name, &len);
@@ -51140,15 +51140,15 @@ int HP_party_send_logout(struct map_session_data *sd) {
}
return retVal___;
}
-int HP_party_send_message(struct map_session_data *sd, const char *mes, int len) {
+int HP_party_send_message(struct map_session_data *sd, const char *mes) {
int hIndex = 0;
int retVal___ = 0;
if( HPMHooks.count.HP_party_send_message_pre ) {
- int (*preHookFunc) (struct map_session_data *sd, const char *mes, int *len);
+ int (*preHookFunc) (struct map_session_data *sd, const char *mes);
*HPMforce_return = false;
for(hIndex = 0; hIndex < HPMHooks.count.HP_party_send_message_pre; hIndex++ ) {
preHookFunc = HPMHooks.list.HP_party_send_message_pre[hIndex].func;
- retVal___ = preHookFunc(sd, mes, &len);
+ retVal___ = preHookFunc(sd, mes);
}
if( *HPMforce_return ) {
*HPMforce_return = false;
@@ -51156,13 +51156,13 @@ int HP_party_send_message(struct map_session_data *sd, const char *mes, int len)
}
}
{
- retVal___ = HPMHooks.source.party.send_message(sd, mes, len);
+ retVal___ = HPMHooks.source.party.send_message(sd, mes);
}
if( HPMHooks.count.HP_party_send_message_post ) {
- int (*postHookFunc) (int retVal___, struct map_session_data *sd, const char *mes, int *len);
+ int (*postHookFunc) (int retVal___, struct map_session_data *sd, const char *mes);
for(hIndex = 0; hIndex < HPMHooks.count.HP_party_send_message_post; hIndex++ ) {
postHookFunc = HPMHooks.list.HP_party_send_message_post[hIndex].func;
- retVal___ = postHookFunc(retVal___, sd, mes, &len);
+ retVal___ = postHookFunc(retVal___, sd, mes);
}
}
return retVal___;