Przeglądaj źródła

- Fixed script command warpparty looking for an attached player even when it is not needed.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@5592 54d463be-8e91-2dee-dedb-b68131a5f0ec
skotlex 19 lat temu
rodzic
commit
d842b9f68d
2 zmienionych plików z 25 dodań i 29 usunięć
  1. 2 0
      Changelog-Trunk.txt
  2. 23 29
      src/map/script.c

+ 2 - 0
Changelog-Trunk.txt

@@ -5,6 +5,8 @@ IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.  EV
 GOES INTO TRUNK AND WILL BE MERGED INTO STABLE BY VALARIS AND WIZPUTER. -- VALARIS
 
 2006/03/13
+	* Fixed script command warpparty looking for an attached player even when
+	  it is not needed. [Skotlex]
 	* Shield Reflect is now passed through Devotion as well. [Skotlex]
 	- Devoted characters lose the devotion effect when the Crusader is at less
 	  than 25% Hp. [Skotlex]

+ 23 - 29
src/map/script.c

@@ -2930,31 +2930,25 @@ int buildin_warpparty(struct script_state *st)
 {
 	int x,y;
 	char *str;
-	int p;
+	int p_id;
 	int i;
 	unsigned short mapindex;
-	struct map_session_data *pl_sd, **pl_allsd;
-	struct map_session_data *sd;
-	int users;
+	struct map_session_data *pl_sd;
+	struct party *p=NULL;
 	str=conv_str(st,& (st->stack->stack_data[st->start+2]));
 	x=conv_num(st,& (st->stack->stack_data[st->start+3]));
 	y=conv_num(st,& (st->stack->stack_data[st->start+4]));
-	p=conv_num(st,& (st->stack->stack_data[st->start+5]));
-	sd=script_rid2sd(st);
-	if(map[sd->bl.m].flag.noreturn || map[sd->bl.m].flag.nowarpto)
+	p_id=conv_num(st,& (st->stack->stack_data[st->start+5]));
+	if(p_id < 1)
 		return 0;
-
-	if(p < 1)
+	p = party_search(p_id);
+	if (!p)
 		return 0;
-
-	pl_allsd = map_getallusers(&users);
-
 	if(strcmp(str,"Random")==0)
 	{
-		
-		for (i = 0; i < users; i++)
+		for (i = 0; i < MAX_PARTY; i++)
 		{
-			if ((pl_sd = pl_allsd[i]) && pl_sd->status.party_id == p)
+			if ((pl_sd = p->member[i].sd))
 			{
 				if(map[pl_sd->bl.m].flag.nowarp)
 					continue;
@@ -2964,12 +2958,9 @@ int buildin_warpparty(struct script_state *st)
 	}
 	else if(strcmp(str,"SavePointAll")==0)
 	{
-		if(map[sd->bl.m].flag.noreturn)
-			return 0;
-		
-		for (i = 0; i < users; i++)
+		for (i = 0; i < MAX_PARTY; i++)
 		{
-			if ((pl_sd = pl_allsd[i]) && pl_sd->status.party_id == p)
+			if ((pl_sd = p->member[i].sd))
 			{
 				if(map[pl_sd->bl.m].flag.noreturn)
 					continue;
@@ -2979,15 +2970,16 @@ int buildin_warpparty(struct script_state *st)
 	}
 	else if(strcmp(str,"SavePoint")==0)
 	{
-		if(map[sd->bl.m].flag.noreturn)
-			return 0;
+		pl_sd=script_rid2sd(st);
+		if (!pl_sd) return 0;
 	
-		mapindex=sd->status.save_point.map;
-		x=sd->status.save_point.x;
-		y=sd->status.save_point.y;
-		for (i = 0; i < users; i++)
+		mapindex=pl_sd->status.save_point.map;
+		x=pl_sd->status.save_point.x;
+		y=pl_sd->status.save_point.y;
+		
+		for (i = 0; i < MAX_PARTY; i++)
 		{
-			if ((pl_sd = pl_allsd[i]) && pl_sd->status.party_id == p)
+			if ((pl_sd = p->member[i].sd))
 			{
 				if(map[pl_sd->bl.m].flag.noreturn)
 					continue;			
@@ -2998,9 +2990,11 @@ int buildin_warpparty(struct script_state *st)
 	else
 	{
 		mapindex = mapindex_name2id(str);
-		for (i = 0; i < users; i++)
+		if (!mapindex) //Show source of npc error.
+			return 1;
+		for (i = 0; i < MAX_PARTY; i++)
 		{
-			if ((pl_sd = pl_allsd[i]) && pl_sd->status.party_id == p)
+			if ((pl_sd = p->member[i].sd))
 			{
 				if(map[pl_sd->bl.m].flag.noreturn || map[pl_sd->bl.m].flag.nowarp)
 					continue;