Browse Source

- Fixed clif_send not sending packets to SELF when specifying AREA if the source is not on the map yet.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@7180 54d463be-8e91-2dee-dedb-b68131a5f0ec
skotlex 19 years ago
parent
commit
553c87f39e
4 changed files with 9 additions and 16 deletions
  1. 2 0
      Changelog-Trunk.txt
  2. 5 3
      src/map/clif.c
  3. 1 2
      src/map/map.c
  4. 1 11
      src/map/status.c

+ 2 - 0
Changelog-Trunk.txt

@@ -4,6 +4,8 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
 2006/06/15
+	* Fixed clif_send not sending packets to SELF when specifying AREA if the
+	  source is not on the map yet. [Skotlex]
 	* Fixed and cleaned up script command 'equip' [Skotlex]
 	* Fixed 'autoequip' items. [Skotlex]
 	* Fixed Aspd not being updated in your status window after Agi/Dex

+ 5 - 3
src/map/clif.c

@@ -276,7 +276,7 @@ int clif_send_sub(struct block_list *bl, va_list ap)
 	case AREA_WOSC:
 		{
 			struct map_session_data *ssd = (struct map_session_data *)src_bl;
-			if ((ssd != 0) && (src_bl->type == BL_PC) && (sd->chatID != 0) && (sd->chatID == ssd->chatID))
+			if (ssd && (src_bl->type == BL_PC) && sd->chatID && (sd->chatID == ssd->chatID))
 				return 0;
 		}
 		break;
@@ -385,9 +385,11 @@ int clif_send (unsigned char *buf, int len, struct block_list *bl, int type) {
 		}
 		break;
 	case AREA:
-	case AREA_WOS:
-	case AREA_WOC:
 	case AREA_WOSC:
+		if (sd && bl->prev == NULL) //Otherwise source misses the packet.[Skotlex]
+			clif_send (buf, len, bl, SELF);
+	case AREA_WOC:
+	case AREA_WOS:
 		map_foreachinarea(clif_send_sub, bl->m, bl->x-AREA_SIZE, bl->y-AREA_SIZE, bl->x+AREA_SIZE, bl->y+AREA_SIZE,
 			BL_PC, buf, len, bl, type);
 		break;

+ 1 - 2
src/map/map.c

@@ -1744,8 +1744,7 @@ struct map_session_data * map_charid2sd(int id) {
  *------------------------------------------
  */
 struct map_session_data * map_nick2sd(char *nick) {
-	int i, quantity=0, users;
-	struct map_session_data *sd = NULL;
+	int i, users;
 	struct map_session_data *pl_sd = NULL, **pl_allsd;
 
 	if (nick == NULL)

+ 1 - 11
src/map/status.c

@@ -5162,13 +5162,8 @@ int status_change_start(struct block_list *bl,int type,int rate,int val1,int val
 		break;
 	}
 
-	if (sd)
-	{ //Why must it be ONLY for players? [Skotlex]
-	if (bl->prev)
+	if (sd) //Only for players, client crashes if they receive this for a mob o.O [Skotlex]
 		clif_status_change(bl,StatusIconChangeTable[type],1);
-	else
-		clif_status_load(bl,StatusIconChangeTable[type],1);
-	}
 
 	// Set option as needed.
 	opt_flag = 1;
@@ -5627,12 +5622,7 @@ int status_change_end( struct block_list* bl , int type,int tid )
 		}
 
 	if (sd) 
-	{	//Why must it be ONLY for players? [Skotlex]
-	if (bl->prev)
 		clif_status_change(bl,StatusIconChangeTable[type],0);
-	else
-		clif_status_load(bl,StatusIconChangeTable[type],0);
-	}
 
 	opt_flag = 1;
 	switch(type){