Parcourir la source

Rewrote and reorganized checks in @autotrade to check and display most useful information first (bugreport:4253).

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@14317 54d463be-8e91-2dee-dedb-b68131a5f0ec
Paradox924X il y a 15 ans
Parent
commit
b2f667910d
2 fichiers modifiés avec 24 ajouts et 22 suppressions
  1. 2 0
      Changelog-Trunk.txt
  2. 22 22
      src/map/atcommand.c

+ 2 - 0
Changelog-Trunk.txt

@@ -3,6 +3,8 @@ 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.
 
+2010/05/31
+	* Rewrote and reorganized checks in @autotrade to check and display most useful information first (bugreport:4253). [Paradox924X]
 2010/05/30
 	* Damaged reflected from skills will now be shown as multiple hits if the skill used was multi-hit. [Paradox924X]
 2010/05/29

+ 22 - 22
src/map/atcommand.c

@@ -5873,36 +5873,36 @@ int atcommand_changelook(const int fd, struct map_session_data* sd, const char*
 }
 
 /*==========================================
- * @autotrade by durf (changed by Lupus)
+ * @autotrade by durf [Lupus] [Paradox924X]
  * Turns on/off Autotrade for a specific player
  *------------------------------------------*/
 int atcommand_autotrade(const int fd, struct map_session_data* sd, const char* command, const char* message)
 {
 	nullpo_retr(-1, sd);
-	if( sd->vender_id ) //check if player's vending
-	{
-		if( pc_isdead(sd) )
-		{
-			clif_displaymessage(fd, "Cannot Autotrade if you are dead.");
-			return -1;
-		}
-
-		if( map[sd->bl.m].flag.autotrade == battle_config.autotrade_mapflag )
-		{
-			sd->state.autotrade = 1;
-			if( battle_config.at_timeout )
-			{
-				int timeout = atoi(message);
-				status_change_start(&sd->bl, SC_AUTOTRADE, 10000, 0, 0, 0, 0, ((timeout > 0) ? min(timeout,battle_config.at_timeout) : battle_config.at_timeout) * 60000, 0);
-			}
+	
+	if( map[sd->bl.m].flag.autotrade != battle_config.autotrade_mapflag ) {
+		clif_displaymessage(fd, "Autotrade is not allowed on this map.");
+		return -1;
+	}
 
-			clif_authfail_fd(fd, 15);
-		} else
-			clif_displaymessage(fd, "Autotrade is not allowed on this map.");
+	if( pc_isdead(sd) ) {
+		clif_displaymessage(fd, "Cannot Autotrade if you are dead.");
+		return -1;
 	}
-	else
+	
+	if( !sd->vender_id ) { //check if player is vending
 		clif_displaymessage(fd, msg_txt(549)); // You should be vending to use @Autotrade.
-
+		return -1;
+	}
+	
+	sd->state.autotrade = 1;
+	if( battle_config.at_timeout )
+	{
+		int timeout = atoi(message);
+		status_change_start(&sd->bl, SC_AUTOTRADE, 10000, 0, 0, 0, 0, ((timeout > 0) ? min(timeout,battle_config.at_timeout) : battle_config.at_timeout) * 60000, 0);
+	}
+	clif_authfail_fd(fd, 15);
+		
 	return 0;
 }