diff options
-rw-r--r-- | Changelog-Trunk.txt | 4 | ||||
-rw-r--r-- | src/map/npc.c | 16 |
2 files changed, 15 insertions, 5 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 638f4bf8e..0183db62a 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -4,6 +4,10 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2006/07/27
+ * Fixed a memory leak when there exists more than one user function with
+ the same name, added the appropiate warning when this happens. [Skotlex]
+ * Added reporting source file when an npc shops item's price is
+ exploitable. [Skotlex]
* The picklog will now record negative values for items sold to npcs.
[Skotlex]
* Added inmediate position and hp-bar update when a character joins a
diff --git a/src/map/npc.c b/src/map/npc.c index 696775cc2..2aee1c58c 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -1625,11 +1625,11 @@ static int npc_parse_shop (char *w1, char *w2, char *w3, char *w4) if (value/124. < id->value_sell/75.) { //Clened up formula to prevent overflows.
printf("\r"); //Carriage return to clear the 'loading..' line. [Skotlex]
if (value < id->value_sell)
- ShowWarning ("Item %s [%d] buying price (%d) is less than selling price (%d)\n",
- id->name, id->nameid, value, id->value_sell);
+ ShowWarning ("Item %s [%d] buying price (%d) is less than selling price (%d) at %s\n",
+ id->name, id->nameid, value, id->value_sell, current_file);
else
- ShowWarning ("Item %s [%d] discounted buying price (%d) is less than overcharged selling price (%d)\n",
- id->name, id->nameid, value/100*75, id->value_sell/100*124);
+ ShowWarning ("Item %s [%d] discounted buying price (%d) is less than overcharged selling price (%d) at %s\n",
+ id->name, id->nameid, value/100*75, id->value_sell/100*124, current_file);
}
//for logs filters, atcommands and iteminfo script command
if (id->maxchance<=0)
@@ -2124,7 +2124,13 @@ static int npc_parse_function (char *w1, char *w2, char *w3, char *w4, char *fir strncpy(p, w3, 50);
user_db = script_get_userfunc_db();
- strdb_put(user_db, p, script);
+ if(strdb_get(user_db, p) != NULL) {
+ printf("\r"); //Carriage return to clear the 'loading..' line. [Skotlex]
+ ShowWarning("parse_function: Duplicate user function [%s] (%s:%d)\n", p, file, *lines);
+ aFree(p);
+ script_free_code(script);
+ } else
+ strdb_put(user_db, p, script);
// もう使わないのでバッファ解放
aFree(srcbuf);
|