Bläddra i källkod

Fixed @npcmove

git-svn-id: https://svn.code.sf.net/p/rathena/svn/branches/stable@435 54d463be-8e91-2dee-dedb-b68131a5f0ec
celest 20 år sedan
förälder
incheckning
90e4b14002
2 ändrade filer med 11 tillägg och 11 borttagningar
  1. 1 0
      Changelog.txt
  2. 10 11
      src/map/atcommand.c

+ 1 - 0
Changelog.txt

@@ -5,6 +5,7 @@ Date	Added
           - Updated Berserk, Chase Walk, Slim Pitcher
           - Added skill_range_leniency
         * Added check for clif.c in case the server didn't realise we've died [celest]
+        * Added a fix for @npcmove by JohnC and Fredzilla
 
 12/1
 	- Make it build against gcc 2.95 [MouseJstr]

+ 10 - 11
src/map/atcommand.c

@@ -6896,27 +6896,26 @@ atcommand_npcmove(const int fd, struct map_session_data* sd,
 	int x = 0, y = 0;
 	struct npc_data *nd = 0;
 	
-	if( sd == NULL )
-		return -1;
+	nullpo_retr(-1, sd);	
 
 	if (!message || !*message)
 		return -1;
 
 	memset(character, '\0', sizeof character);
 
-	if (sscanf(message, "%d %d %99[^\n]", &x, &y, character) < 4)
+	if (sscanf(message, "%d %d %99[^\n]", &x, &y, character) < 3) {
+		clif_displaymessage(fd, "Usage: @npcmove <X> <Y> <npc_name>");
 		return -1;
+	}
 
-        nd=npc_name2id(character);
-        if (nd==NULL)
-	     return -1;
+	nullpo_retr(-1, (nd = npc_name2id(character)));
 
-        npc_enable(character, 0);
-        nd->bl.x = x;
-        nd->bl.y = y;
-        npc_enable(character, 1);
+	npc_enable(character, 0);
+	nd->bl.x = x;
+	nd->bl.y = y;
+	npc_enable(character, 1);
 
-   return 0;
+	return 0;
 }
 
 /*==========================================