summaryrefslogtreecommitdiff
path: root/src/map/clif.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2016-04-21 20:38:18 +0200
committerHaru <haru@dotalux.com>2016-04-23 19:11:52 +0200
commit4788c813c654c522d336dd9fb1229c1cbdd2d7de (patch)
treeb96507116fb1863680c6101c4add29b041e536bb /src/map/clif.c
parentd7ffa6adbcf4800821fe3f961513952450d06f98 (diff)
downloadhercules-4788c813c654c522d336dd9fb1229c1cbdd2d7de.tar.gz
hercules-4788c813c654c522d336dd9fb1229c1cbdd2d7de.tar.bz2
hercules-4788c813c654c522d336dd9fb1229c1cbdd2d7de.tar.xz
hercules-4788c813c654c522d336dd9fb1229c1cbdd2d7de.zip
Removed the 'len' argument from various message-related functions
- The argument was redundant, since the passed value is always the same as the passed string's length (it doesn't make sense otherwise). The argument is implicit now. Less typing and less errors. - Affected functions: `clif->bg_message()`, `bg->send_message()`, `party->send_message()`, `guild->send_message()`. Signed-off-by: Haru <haru@dotalux.com> Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/clif.c')
-rw-r--r--src/map/clif.c16
1 files changed, 10 insertions, 6 deletions
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).