فهرست منبع

* Confirmed packet 0x291 (ZC_MSG) to be general-purpose msgstringtable.txt packet and updated all functions using it (related r12245 and r13126).

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@14538 54d463be-8e91-2dee-dedb-b68131a5f0ec
ai4rei 14 سال پیش
والد
کامیت
ca36918486
4فایلهای تغییر یافته به همراه17 افزوده شده و 14 حذف شده
  1. 1 0
      Changelog-Trunk.txt
  2. 12 12
      src/map/clif.c
  3. 3 1
      src/map/clif.h
  4. 1 1
      src/map/mercenary.c

+ 1 - 0
Changelog-Trunk.txt

@@ -1,6 +1,7 @@
 Date	Added
 
 2010/12/01
+	* Confirmed packet 0x291 (ZC_MSG) to be general-purpose msgstringtable.txt packet and updated all functions using it (related r12245 and r13126). [Ai4rei]
 	* Fixed using main chat nick longer than 15 characters would cause a buffer overflow (bugreport:2671, since r5013). [Ai4rei]
 	* Fixed bAutoSpellOnSkill bonuses could not be chained (bugreport:4421, since r13596). [Ai4rei]
 	* Fixed NPC_TALK message being displayed with EOL character attached (bugreport:4596, since r14270). [Ai4rei]

+ 12 - 12
src/map/clif.c

@@ -8175,12 +8175,9 @@ void clif_viewequip_ack(struct map_session_data* sd, struct map_session_data* ts
 	WFIFOSET(fd, WFIFOW(fd, 2));
 }
 
-/*==========================================
- * View player equip request denied
- * R 0291 <message>.W
- * TODO: this looks like a general-purpose packet to print msgstringtable entries.
- *------------------------------------------*/
-void clif_viewequip_fail(struct map_session_data* sd)
+/// Display msgstringtable.txt string (ZC_MSG)
+/// R 0291 <message>.W
+void clif_msg(struct map_session_data* sd, unsigned short id)
 {
 	int fd;
 	nullpo_retv(sd);
@@ -8188,10 +8185,16 @@ void clif_viewequip_fail(struct map_session_data* sd)
 
 	WFIFOHEAD(fd, packet_len(0x291));
 	WFIFOW(fd, 0) = 0x291;
-	WFIFOW(fd, 2) = 0x54d;	// This controls which message is displayed. 0x54d is the correct one. Maybe it's used for something else too?
+	WFIFOW(fd, 2) = id;  // zero-based msgstringtable.txt index
 	WFIFOSET(fd, packet_len(0x291));
 }
 
+/// View player equip request denied
+void clif_viewequip_fail(struct map_session_data* sd)
+{
+	clif_msg(sd, 0x54d);
+}
+
 /// Validates one global/guild/party/whisper message packet and tries to recognize its components.
 /// Returns true if the packet was parsed successfully.
 /// Formats: 0 - <packet id>.w <packet len>.w (<name> : <message>).?B 00
@@ -13593,12 +13596,9 @@ void clif_parse_mercenary_action(int fd, struct map_session_data* sd)
  * 2 = Your mercenary soldier has been fired.
  * 3 = Your mercenary soldier has ran away.
  *------------------------------------------*/
-void clif_mercenary_message(int fd, int message)
+void clif_mercenary_message(struct map_session_data* sd, int message)
 {
-	WFIFOHEAD(fd,4);
-	WFIFOW(fd,0) = 0x0291;
-	WFIFOW(fd,2) = 1266 + message;
-	WFIFOSET(fd,4);
+	clif_msg(sd, 1266 + message);
 }
 
 /*------------------------------------------

+ 3 - 1
src/map/clif.h

@@ -504,6 +504,8 @@ void clif_viewequip_ack(struct map_session_data* sd, struct map_session_data* ts
 void clif_viewequip_fail(struct map_session_data* sd);
 void clif_equipcheckbox(struct map_session_data* sd);
 
+void clif_msg(struct map_session_data* sd, unsigned short id);
+
 //quest system [Kevin] [Inkfish]
 void clif_quest_send_list(struct map_session_data * sd);  
 void clif_quest_send_mission(struct map_session_data * sd);  
@@ -545,7 +547,7 @@ void clif_Adopt_reply(struct map_session_data *sd, int type);
 // MERCENARIES
 void clif_mercenary_info(struct map_session_data *sd);
 void clif_mercenary_skillblock(struct map_session_data *sd);
-void clif_mercenary_message(int fd, int message);
+void clif_mercenary_message(struct map_session_data* sd, int message);
 void clif_mercenary_updatestatus(struct map_session_data *sd, int type);
 
 // RENTAL SYSTEM

+ 1 - 1
src/map/mercenary.c

@@ -258,7 +258,7 @@ int merc_delete(struct mercenary_data *md, int reply)
 		case 1: mercenary_set_faith(md, -1); break; // -1 Loyalty on Mercenary killed
 	}
 
-	clif_mercenary_message(sd->fd, reply);
+	clif_mercenary_message(sd, reply);
 	return unit_remove_map(&md->bl, CLR_OUTSIGHT);
 }