Selaa lähdekoodia

* Fixed script command 'bpet' (Pet Incubator) displaying an empty egg list when attempting to hatch a pet while already having one out (bugreport:3313).

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@14702 54d463be-8e91-2dee-dedb-b68131a5f0ec
ai4rei 14 vuotta sitten
vanhempi
commit
9f2620f2fa
3 muutettua tiedostoa jossa 14 lisäystä ja 9 poistoa
  1. 2 0
      Changelog-Trunk.txt
  2. 7 9
      src/map/clif.c
  3. 5 0
      src/map/script.c

+ 2 - 0
Changelog-Trunk.txt

@@ -1,5 +1,7 @@
 Date	Added
 
+2011/02/09
+	* Fixed script command 'bpet' (Pet Incubator) displaying an empty egg list when attempting to hatch a pet while already having one out (bugreport:3313). [Ai4rei]
 2011/02/08
 	* Moved script constant manipulation code into separate functions script_get_constant / script_set_constant. [Ai4rei]
 	- Added protection against overwriting existing names in script constant creation code.

+ 7 - 9
src/map/clif.c

@@ -6194,15 +6194,13 @@ int clif_sendegg(struct map_session_data *sd)
 	}
 	WFIFOHEAD(fd, MAX_INVENTORY * 2 + 4);
 	WFIFOW(fd,0)=0x1a6;
-	if(sd->status.pet_id <= 0) {
-		for(i=0,n=0;i<MAX_INVENTORY;i++){
-			if(sd->status.inventory[i].nameid<=0 || sd->inventory_data[i] == NULL ||
-			   sd->inventory_data[i]->type!=IT_PETEGG ||
-			   sd->status.inventory[i].amount<=0)
-				continue;
-			WFIFOW(fd,n*2+4)=i+2;
-			n++;
-		}
+	for(i=0,n=0;i<MAX_INVENTORY;i++){
+		if(sd->status.inventory[i].nameid<=0 || sd->inventory_data[i] == NULL ||
+		   sd->inventory_data[i]->type!=IT_PETEGG ||
+		   sd->status.inventory[i].amount<=0)
+			continue;
+		WFIFOW(fd,n*2+4)=i+2;
+		n++;
 	}
 	WFIFOW(fd,2)=4+n*2;
 	WFIFOSET(fd,WFIFOW(fd,2));

+ 5 - 0
src/map/script.c

@@ -9124,6 +9124,11 @@ BUILDIN_FUNC(birthpet)
 	if( sd == NULL )
 		return 0;
 
+	if( sd->status.pet_id )
+	{// do not send egg list, when you already have a pet
+		return 0;
+	}
+
 	clif_sendegg(sd);
 	return 0;
 }