From 19c2bd856eeb2ca240cbf4dc3c577d9363b2576e Mon Sep 17 00:00:00 2001
From: skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>
Date: Thu, 15 Jun 2006 14:48:35 +0000
Subject: - Fixed clif_send not sending packets to SELF when specifying AREA if
 the source is not on the map yet.

git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7180 54d463be-8e91-2dee-dedb-b68131a5f0ec
---
 Changelog-Trunk.txt |  2 ++
 src/map/clif.c      |  8 +++++---
 src/map/map.c       |  3 +--
 src/map/status.c    | 12 +-----------
 4 files changed, 9 insertions(+), 16 deletions(-)

diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index f0d7fe97c..57662642a 100644
--- a/Changelog-Trunk.txt
+++ b/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
diff --git a/src/map/clif.c b/src/map/clif.c
index aad0a5ddc..f895a7579 100644
--- a/src/map/clif.c
+++ b/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;
diff --git a/src/map/map.c b/src/map/map.c
index b639e8f85..70b9d290e 100644
--- a/src/map/map.c
+++ b/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)
diff --git a/src/map/status.c b/src/map/status.c
index a26986316..7fc090dd1 100644
--- a/src/map/status.c
+++ b/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){
-- 
cgit v1.2.3-70-g09d2