summaryrefslogtreecommitdiff
path: root/src/map/npc.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-07-28 04:17:24 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-07-28 04:17:24 +0000
commit652a86beab80b9d5fa43c502b5e102ae3706e14d (patch)
tree7a3aff7f627ae7e720ca731484baebceb670bbb9 /src/map/npc.c
parentc7062660486e8636edf6e4079185e774606dcaf1 (diff)
downloadhercules-652a86beab80b9d5fa43c502b5e102ae3706e14d.tar.gz
hercules-652a86beab80b9d5fa43c502b5e102ae3706e14d.tar.bz2
hercules-652a86beab80b9d5fa43c502b5e102ae3706e14d.tar.xz
hercules-652a86beab80b9d5fa43c502b5e102ae3706e14d.zip
- Fixed a memory leak when there exists more than one user function with the same name, added the appropiate warning when this happens.
- Added reporting source file when an npc shops item's price is exploitable. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7935 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/npc.c')
-rw-r--r--src/map/npc.c16
1 files changed, 11 insertions, 5 deletions
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);