Ver Fonte

* Fixed impropper filling of w4 in npc_parsesrcfile when there are less than 4 fields. (bugreport:1063)
* Simplified atcommand_spiritball. (deprecated msg_txt 204 and 205)

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@13538 54d463be-8e91-2dee-dedb-b68131a5f0ec

FlavioJS há 16 anos atrás
pai
commit
ad963e52e6
4 ficheiros alterados com 21 adições e 24 exclusões
  1. 3 0
      Changelog-Trunk.txt
  2. 2 2
      conf/msg_athena.conf
  3. 8 19
      src/map/atcommand.c
  4. 8 3
      src/map/npc.c

+ 3 - 0
Changelog-Trunk.txt

@@ -3,6 +3,9 @@ Date	Added
 AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
+2009/02/19
+	* Fixed impropper filling of w4 in npc_parsesrcfile when there are less than 4 fields. (bugreport:1063) [FlavioJS]
+	* Simplified atcommand_spiritball. (deprecated msg_txt 204 and 205)
 2009/02/06
 	* Follow up to r13485. (bugreport:2741) [FlavioJS]
 	- @spiritball creates spiritballs without timer (limited to the array size instead of 500)

+ 2 - 2
conf/msg_athena.conf

@@ -217,8 +217,8 @@
 201: You don't have this quest skill.
 202: This player has forgotten the skill.
 203: This player doesn't have this quest skill.
-204: WARNING: more than 1000 spiritballs can CRASH your server and/or client!
-205: You already have that number of spiritballs.
+//204: FREE
+//205: FREE
 206: '%s' skill points reset.
 207: '%s' stats points reset.
 208: '%s' skill and stat points have been reset.

+ 8 - 19
src/map/atcommand.c

@@ -3717,30 +3717,19 @@ int atcommand_spiritball(const int fd, struct map_session_data* sd, const char*
 	int number;
 	nullpo_retr(-1, sd);
 
-	if (!message || !*message || (number = atoi(message)) < 0 || number >= max_spiritballs) {
+	if( !message || !*message || (number = atoi(message)) < 0 || number > max_spiritballs )
+	{
 		char msg[256];
-		safesnprintf(msg, sizeof(msg), "Please, enter a spirit ball number (usage: @spiritball <number: 0-%d>).", max_spiritballs);
+		safesnprintf(msg, sizeof(msg), "Usage: @spiritball <number: 0-%d>", max_spiritballs);
 		clif_displaymessage(fd, msg);
 		return -1;
 	}
 
-	if (number >= 0 && number <= max_spiritballs) {
-		if (sd->spiritball != number) {
-			if (sd->spiritball > 0)
-				pc_delspiritball(sd, sd->spiritball, 1);
-			sd->spiritball = number;
-			clif_spiritball(sd);
-			// no message, player can look the difference
-			if (number > 1000)
-				clif_displaymessage(fd, msg_txt(204)); // WARNING: more than 1000 spiritballs can CRASH your server and/or client!
-		} else {
-			clif_displaymessage(fd, msg_txt(205)); // You already have this number of spiritballs.
-			return -1;
-		}
-	} else {
-		clif_displaymessage(fd, msg_txt(37)); // An invalid number was specified.
-		return -1;
-	}
+	if( sd->spiritball > 0 )
+		pc_delspiritball(sd, sd->spiritball, 1);
+	sd->spiritball = number;
+	clif_spiritball(sd);
+	// no message, player can look the difference
 
 	return 0;
 }

+ 8 - 3
src/map/npc.c

@@ -2875,9 +2875,14 @@ void npc_parsesrcfile(const char* filepath)
 		// fill w4 (to end of line)
 		if( pos[1]-pos[8] > ARRAYLENGTH(w4)-1 )
 			ShowWarning("npc_parsesrcfile: w4 truncated, too much data (%d) in file '%s', line '%d'.\n", pos[1]-pos[8], filepath, strline(buffer,p-buffer));
-		i = min(pos[1]-pos[8], ARRAYLENGTH(w4)-1);
-		memcpy(w4, p+pos[8], i*sizeof(char));
-		w4[i] = '\0';
+		if( pos[8] != -1 )
+		{
+			i = min(pos[1]-pos[8], ARRAYLENGTH(w4)-1);
+			memcpy(w4, p+pos[8], i*sizeof(char));
+			w4[i] = '\0';
+		}
+		else
+			w4[0] = '\0';
 
 		if( count < 3 )
 		{// Unknown syntax