diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/map/battleground.c | 7 | ||||
-rw-r--r-- | src/map/battleground.h | 2 | ||||
-rw-r--r-- | src/map/clif.c | 16 | ||||
-rw-r--r-- | src/map/clif.h | 2 | ||||
-rw-r--r-- | src/map/guild.c | 9 | ||||
-rw-r--r-- | src/map/guild.h | 2 | ||||
-rw-r--r-- | src/map/party.c | 12 | ||||
-rw-r--r-- | src/map/party.h | 2 |
8 files changed, 31 insertions, 21 deletions
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/clif.c b/src/map/clif.c index 1d749b8cf..d6a418a47 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -11978,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))); @@ -13077,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))); @@ -16143,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; @@ -16185,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). diff --git a/src/map/clif.h b/src/map/clif.h index 7c6516871..459d62d7b 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -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/guild.c b/src/map/guild.c index 39d580bb7..a231ebd9b 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); 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/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); |