Przeglądaj źródła

* Fixed a variable loopback problem on NPC shop price checking routine.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@5559 54d463be-8e91-2dee-dedb-b68131a5f0ec
Lance 19 lat temu
rodzic
commit
71fc431888
2 zmienionych plików z 2 dodań i 1 usunięć
  1. 1 0
      Changelog-Trunk.txt
  2. 1 1
      src/map/npc.c

+ 1 - 0
Changelog-Trunk.txt

@@ -5,6 +5,7 @@ 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/10
+	* Fixed a variable loopback problem on NPC shop price checking routine. [Lance]
 	* Fixed a memory overwrite crash on pc_readdb, thanks to foobar for the
 	  fix. [Skotlex]
 	* Fixed only the first TK stance triggering when you have multiple of them

+ 1 - 1
src/map/npc.c

@@ -1747,7 +1747,7 @@ static int npc_parse_shop (char *w1, char *w2, char *w3, char *w4)
 			value = id->value_buy;
 		nd->u.shop_item[pos].value = value;
 		// check for bad prices that can possibly cause exploits
-		if (value*75/100 < id->value_sell*124/100) {
+		if (value/100*75 < id->value_sell/100*124) { // Modified to prevent loopbacks, divide before multiplying [Lance]
 			printf("\r"); //Carriage return to clear the 'loading..' line. [Skotlex]
 			ShowWarning ("Item %s [%d] buying price (%d) is less than selling price (%d)\n",
 				id->name, id->nameid, value*75/100, id->value_sell*124/100);