فهرست منبع

Converted CZ_LESSEFFECT to struct (#8820)

Lemongrass3110 6 ماه پیش
والد
کامیت
d1befc1b6e
3فایلهای تغییر یافته به همراه14 افزوده شده و 5 حذف شده
  1. 7 4
      src/map/clif.cpp
  2. 1 1
      src/map/clif_packetdb.hpp
  3. 6 0
      src/map/packets.hpp

+ 7 - 4
src/map/clif.cpp

@@ -18816,8 +18816,8 @@ void clif_showdigit(map_session_data* sd, unsigned char type, int32 value)
 }
 
 
-/// Notification of the state of client command /effect (CZ_LESSEFFECT).
-/// 021d <state>.L
+/// Notification of the state of client command /effect.
+/// 021d <state>.L (CZ_LESSEFFECT)
 /// state:
 ///     0 = Full effects
 ///     1 = Reduced effects
@@ -18829,8 +18829,11 @@ void clif_showdigit(map_session_data* sd, unsigned char type, int32 value)
 ///         as the only skill unit, that is sent with 0x1c9 is
 ///         Graffiti.
 void clif_parse_LessEffect(int32 fd, map_session_data* sd){
-	int32 isLess = RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]);
-	sd->state.lesseffect = ( isLess != 0 );
+#if PACKETVER >= 20041115
+	const PACKET_CZ_LESSEFFECT* p = reinterpret_cast<PACKET_CZ_LESSEFFECT*>( RFIFOP( fd, 0 ) );
+
+	sd->state.lesseffect = p->state != 0;
+#endif
 }
 
 /// 07e4 <length>.w <option>.l <val>.l {<index>.w <amount>.w).4b* (CZ_ITEMLISTWIN_RES)

+ 1 - 1
src/map/clif_packetdb.hpp

@@ -483,7 +483,7 @@
 
 // 2004-11-15aSakexe
 #if PACKETVER >= 20041115
-	parseable_packet(0x021d,6,clif_parse_LessEffect,2);
+	parseable_packet( HEADER_CZ_LESSEFFECT, sizeof( PACKET_CZ_LESSEFFECT ), clif_parse_LessEffect, 0 );
 #endif
 
 // 2004-11-29aSakexe

+ 6 - 0
src/map/packets.hpp

@@ -1571,6 +1571,12 @@ struct PACKET_ZC_ACK_RANKING2{
 } __attribute__((packed));
 DEFINE_PACKET_HEADER(ZC_ACK_RANKING2, 0xaf6);
 
+struct PACKET_CZ_LESSEFFECT{
+	int16 packetType;
+	int32 state;
+} __attribute__((packed));
+DEFINE_PACKET_HEADER(CZ_LESSEFFECT, 0x21d);
+
 // NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute
 #if !defined( sun ) && ( !defined( __NETBSD__ ) || __NetBSD_Version__ >= 600000000 )
 	#pragma pack( pop )