summaryrefslogtreecommitdiff
path: root/src/map/clif.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2015-05-18 01:09:37 +0200
committerHaru <haru@dotalux.com>2015-05-18 01:14:22 +0200
commit3f06bc2bded05a27e1982d1e71c0983009a2f701 (patch)
tree99ea6f365dc77db7f28f08c13f30059bf67c6d3b /src/map/clif.c
parentab6adbcc802233ced064ae75a5f11695a4140fb8 (diff)
downloadhercules-3f06bc2bded05a27e1982d1e71c0983009a2f701.tar.gz
hercules-3f06bc2bded05a27e1982d1e71c0983009a2f701.tar.bz2
hercules-3f06bc2bded05a27e1982d1e71c0983009a2f701.tar.xz
hercules-3f06bc2bded05a27e1982d1e71c0983009a2f701.zip
Removed duplicates of clif->msgtable
- Removed clif->msgtable, and renamed clif->msg to clif->msgtable. - Removed clif->msgtable_num, and renamed clif->msg_value to clif->msgtable_num - Renamed clif->msg_skill to clif->msgtable_skill - Removed clif_viewequip_fail - Replaced hardcoded message IDs with constants (see enum clif_messages) Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/clif.c')
-rw-r--r--src/map/clif.c100
1 files changed, 50 insertions, 50 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index efad7b5e1..09e3ddc69 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -5267,7 +5267,7 @@ void clif_cooking_list(struct map_session_data *sd, int trigger, uint16 skill_id
if( skill_id != AM_PHARMACY ) { // AM_PHARMACY is used to Cooking.
// It fails.
#if PACKETVER >= 20090922
- clif->msg_skill(sd,skill_id,0x625);
+ clif->msgtable_skill(sd, skill_id, MSG_COOKING_LIST_FAIL);
#else
WFIFOW(fd,2) = 6 + 2 * c;
WFIFOSET(fd,WFIFOW(fd,2));
@@ -8731,9 +8731,15 @@ void clif_viewequip_ack(struct map_session_data* sd, struct map_session_data* ts
}
-/// Display msgstringtable.txt string (ZC_MSG).
-/// 0291 <message>.W
-void clif_msg(struct map_session_data* sd, unsigned short id)
+/**
+ * Displays a string from msgstringtable.txt (ZC_MSG).
+ *
+ * 0291 <msg id>.W
+ *
+ * @param sd The target character.
+ * @param msg_id msgstringtable message index, 0-based (@see enum clif_messages)
+ */
+void clif_msgtable(struct map_session_data* sd, unsigned short msg_id)
{
int fd;
nullpo_retv(sd);
@@ -8741,31 +8747,47 @@ void clif_msg(struct map_session_data* sd, unsigned short id)
WFIFOHEAD(fd, packet_len(0x291));
WFIFOW(fd, 0) = 0x291;
- WFIFOW(fd, 2) = id; // zero-based msgstringtable.txt index
+ WFIFOW(fd, 2) = msg_id; // zero-based msgstringtable.txt index
WFIFOSET(fd, packet_len(0x291));
}
-
-/// Display msgstringtable.txt string and fill in a valid for %d format (ZC_MSG_VALUE).
-/// 0x7e2 <message>.W <value>.L
-void clif_msg_value(struct map_session_data* sd, unsigned short id, int value)
+/**
+ * Displays a format string from msgstringtable.txt with a %d value (ZC_MSG_VALUE).
+ *
+ * 0x7e2 <msg id>.W <value>.L
+ *
+ * @param sd The target character.
+ * @param msg_id msgstringtable message index, 0-based (@see enum clif_messages)
+ * @param value The value to fill %d.
+ */
+void clif_msgtable_num(struct map_session_data *sd, unsigned short msg_id, int value)
{
- int fd = sd->fd;
+#if PACKETVER >= 20090805
+ int fd;
+ nullpo_retv(sd);
+ fd = sd->fd;
WFIFOHEAD(fd, packet_len(0x7e2));
- WFIFOW(fd,0) = 0x7e2;
- WFIFOW(fd,2) = id;
- WFIFOL(fd,4) = value;
+ WFIFOW(fd, 0) = 0x7e2;
+ WFIFOW(fd, 2) = msg_id;
+ WFIFOL(fd, 4) = value;
WFIFOSET(fd, packet_len(0x7e2));
+#endif
}
-
-/// Displays msgstringtable.txt string, prefixed with a skill name. (ZC_MSG_SKILL).
-/// 07e6 <skill id>.W <msg id>.L
-///
-/// NOTE: Message has following format and is printed in color 0xCDCDFF (purple):
-/// "[SkillName] Message"
-void clif_msg_skill(struct map_session_data* sd, uint16 skill_id, int msg_id)
+/**
+ * Displays a string from msgstringtable.txt, prefixed with a skill name (ZC_MSG_SKILL).
+ *
+ * 07e6 <skill id>.W <msg id>.L
+ *
+ * NOTE: Message has following format and is printed in color 0xCDCDFF (purple):
+ * "[SkillName] Message"
+ *
+ * @param sd The target character.
+ * @param skill_id ID of the skill to display.
+ * @param msg_id msgstringtable message index, 0-based (@see enum clif_messages)
+ */
+void clif_msgtable_skill(struct map_session_data* sd, uint16 skill_id, int msg_id)
{
int fd = sd->fd;
@@ -10337,7 +10359,7 @@ void clif_parse_NpcClicked(int fd,struct map_session_data *sd)
}
if( sd->npc_id || sd->state.workinprogress&2 ){
#ifdef RENEWAL
- clif->msg(sd, 0x783); // TODO look for the client date that has this message.
+ clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); // TODO look for the client date that has this message.
#endif
return;
}
@@ -10352,7 +10374,7 @@ void clif_parse_NpcClicked(int fd,struct map_session_data *sd)
case BL_NPC:
if( sd->ud.skill_id < RK_ENCHANTBLADE && sd->ud.skilltimer != INVALID_TIMER ) {// TODO: should only work with none 3rd job skills
#ifdef RENEWAL
- clif->msg(sd, 0x783);
+ clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS);
#endif
break;
}
@@ -10704,7 +10726,7 @@ void clif_parse_ChangeCart(int fd,struct map_session_data *sd)
#ifdef RENEWAL
if( sd->npc_id || sd->state.workinprogress&1 ){
- clif->msg(sd, 0x783);
+ clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS);
return;
}
#endif
@@ -10894,7 +10916,7 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd)
if( sd->npc_id || sd->state.workinprogress&1 ){
#ifdef RENEWAL
- clif->msg(sd, 0x783); // TODO look for the client date that has this message.
+ clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); // TODO look for the client date that has this message.
#endif
return;
}
@@ -10990,7 +11012,7 @@ void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, uint16 ski
#ifdef RENEWAL
if( sd->state.workinprogress&1 ){
- clif->msg(sd, 0x783); // TODO look for the client date that has this message.
+ clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); // TODO look for the client date that has this message.
return;
}
#endif
@@ -15291,7 +15313,7 @@ void clif_parse_ViewPlayerEquip(int fd, struct map_session_data* sd) {
if( tsd->status.show_equip || pc_has_permission(sd, PC_PERM_VIEW_EQUIPMENT) )
clif->viewequip_ack(sd, tsd);
else
- clif_viewequip_fail(sd);
+ clif->msgtable(sd, MSG_EQUIP_NOT_PUBLIC);
}
@@ -15689,7 +15711,7 @@ void clif_parse_mercenary_action(int fd, struct map_session_data* sd)
/// 3 = Your mercenary soldier has ran away.
void clif_mercenary_message(struct map_session_data* sd, int message)
{
- clif->msg(sd, 1266 + message);
+ clif->msgtable(sd, MSG_MERCENARY_EXPIRED + message);
}
@@ -16925,26 +16947,6 @@ int clif_skill_itemlistwindow( struct map_session_data *sd, uint16 skill_id, uin
return 1;
}
-// msgstringtable.txt
-// 0x291 <line>.W
-void clif_msgtable(int fd, int line) {
- WFIFOHEAD(fd, packet_len(0x291));
- WFIFOW(fd, 0) = 0x291;
- WFIFOW(fd, 2) = line;
- WFIFOSET(fd, packet_len(0x291));
-}
-
-// msgstringtable.txt
-// 0x7e2 <line>.W <value>.L
-void clif_msgtable_num(int fd, int line, int num) {
-#if PACKETVER >= 20090805
- WFIFOHEAD(fd, packet_len(0x7e2));
- WFIFOW(fd, 0) = 0x7e2;
- WFIFOW(fd, 2) = line;
- WFIFOL(fd, 4) = num;
- WFIFOSET(fd, packet_len(0x7e2));
-#endif
-}
/*==========================================
* used by SC_AUTOSHADOWSPELL
* RFIFOL(fd,2) - flag (currently not used)
@@ -18677,9 +18679,7 @@ void clif_defaults(void) {
clif->broadcast2 = clif_broadcast2;
clif->messagecolor = clif_messagecolor;
clif->disp_overhead = clif_disp_overhead;
- clif->msg = clif_msg;
- clif->msg_value = clif_msg_value;
- clif->msg_skill = clif_msg_skill;
+ clif->msgtable_skill = clif_msgtable_skill;
clif->msgtable = clif_msgtable;
clif->msgtable_num = clif_msgtable_num;
clif->message = clif_displaymessage;