summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2019-07-07 05:27:26 +0300
committerAndrei Karas <akaras@inbox.ru>2019-07-24 20:34:46 +0300
commite0d9a2076a8264992a88f1c5d3825e281546179e (patch)
treee47339f91e68ca970d6db811644cb99d8a45279c
parent89db5fc44ec9d9b960a87819aa32fe38cb428237 (diff)
downloadhercules-e0d9a2076a8264992a88f1c5d3825e281546179e.tar.gz
hercules-e0d9a2076a8264992a88f1c5d3825e281546179e.tar.bz2
hercules-e0d9a2076a8264992a88f1c5d3825e281546179e.tar.xz
hercules-e0d9a2076a8264992a88f1c5d3825e281546179e.zip
Convert packet ZC_STATUS_CHANGE_ACK into struct
-rw-r--r--src/map/clif.c17
-rw-r--r--src/map/packets_struct.h8
2 files changed, 16 insertions, 9 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 988f60417..310bbebff 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -3951,17 +3951,16 @@ static void clif_arrow_create_list(struct map_session_data *sd)
/// 1 = success
static void clif_statusupack(struct map_session_data *sd, int type, int ok, int val)
{
- int fd;
-
nullpo_retv(sd);
+ int fd = sd->fd;
- fd=sd->fd;
- WFIFOHEAD(fd,packet_len(0xbc));
- WFIFOW(fd,0)=0xbc;
- WFIFOW(fd,2)=type;
- WFIFOB(fd,4)=ok;
- WFIFOB(fd,5)=cap_value(val,0,UINT8_MAX);
- WFIFOSET(fd,packet_len(0xbc));
+ WFIFOHEAD(fd, sizeof(struct PACKET_ZC_STATUS_CHANGE_ACK));
+ struct PACKET_ZC_STATUS_CHANGE_ACK *p = WFIFOP(fd, 0);
+ p->packetType = HEADER_ZC_STATUS_CHANGE_ACK;
+ p->sp = type;
+ p->ok = ok;
+ p->value = cap_value(val, 0, UINT8_MAX);
+ WFIFOSET(fd, sizeof(struct PACKET_ZC_STATUS_CHANGE_ACK));
}
/// Notifies the client about the result of a request to equip an item (ZC_REQ_WEAR_EQUIP_ACK).
diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h
index 5566b5581..aeb57bdc4 100644
--- a/src/map/packets_struct.h
+++ b/src/map/packets_struct.h
@@ -3514,6 +3514,14 @@ struct PACKET_ZC_ACK_RANKING_sub {
} __attribute__((packed));
#endif
+struct PACKET_ZC_STATUS_CHANGE_ACK {
+ int16 packetType;
+ uint16 sp;
+ uint8 ok;
+ uint8 value;
+} __attribute__((packed));
+DEFINE_PACKET_HEADER(ZC_STATUS_CHANGE_ACK, 0x00bc);
+
#if !defined(sun) && (!defined(__NETBSD__) || __NetBSD_Version__ >= 600000000) // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute
#pragma pack(pop)
#endif // not NetBSD < 6 / Solaris