Explorar el Código

Converted CZ_CONTACTNPC to struct (#8795)

Lemongrass3110 hace 6 meses
padre
commit
05e4ee9cbe
Se han modificado 2 ficheros con 12 adiciones y 11 borrados
  1. 11 10
      src/map/clif.cpp
  2. 1 1
      src/map/clif_packetdb.hpp

+ 11 - 10
src/map/clif.cpp

@@ -12144,19 +12144,17 @@ void clif_parse_UnequipItem(int fd,map_session_data *sd)
 }
 
 
-/// Request to start a conversation with an NPC (CZ_CONTACTNPC).
-/// 0090 <id>.L <type>.B
+/// Request to start a conversation with an NPC.
+/// 0090 <id>.L <type>.B (CZ_CONTACTNPC)
 /// type:
 ///     1 = click
-void clif_parse_NpcClicked(int fd,map_session_data *sd)
-{
+void clif_parse_NpcClicked( int fd, map_session_data* sd ){
+	const PACKET_CZ_CONTACTNPC* p = reinterpret_cast<PACKET_CZ_CONTACTNPC*>( RFIFOP( fd, 0 ) );
+
 	if( sd == nullptr ){
 		return;
 	}
 
-	struct block_list *bl;
-	struct s_packet_db* info = &packet_db[RFIFOW(fd,0)];
-
 	if(pc_isdead(sd)) {
 		clif_clearunit_area( sd->bl, CLR_DEAD );
 		return;
@@ -12172,9 +12170,12 @@ void clif_parse_NpcClicked(int fd,map_session_data *sd)
 	if( sd->state.mail_writing )
 		return;
 
-	bl = map_id2bl(RFIFOL(fd,info->pos[0]));
-	//type = RFIFOB(fd,info->pos[1]);
-	if (!bl) return;
+	block_list* bl = map_id2bl( p->AID );
+
+	if( bl == nullptr ){
+		return;
+	}
+
 	switch (bl->type) {
 		case BL_MOB:
 		case BL_PC:

+ 1 - 1
src/map/clif_packetdb.hpp

@@ -41,7 +41,7 @@
 	parseable_packet(0x008c,-1,clif_parse_GlobalMessage,2,4);
 	packet(0x008d,-1);
 	packet(0x008e,-1);
-	parseable_packet(0x0090,7,clif_parse_NpcClicked,2,6);
+	parseable_packet( HEADER_CZ_CONTACTNPC, sizeof( PACKET_CZ_CONTACTNPC ), clif_parse_NpcClicked, 0 );
 	packet(0x0093,2);
 	parseable_packet(0x0094,6,clif_parse_GetCharNameRequest,2);
 	parseable_packet(0x0096,-1,clif_parse_WisMessage,2,4,28);