summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog-Trunk.txt1
-rw-r--r--src/map/npc.c15
2 files changed, 12 insertions, 4 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index 027ee1b9d..fb70efb7f 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -5,6 +5,7 @@ IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2006/10/26
* Updated sql files [Playtester]
+ * Experimental tweak to npc_parse_function - Overwrite existing functions. [Lance]
2006/10/25
* Cleaned up some more the event dequeue code, it will no longer clear out
the npc_id if there's no events waiting to be executed (why does it clears
diff --git a/src/map/npc.c b/src/map/npc.c
index 77b6667f9..448bd18aa 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -2101,6 +2101,7 @@ static int npc_parse_function (char *w1, char *w2, char *w3, char *w4, char *fir
{
unsigned char *srcbuf, *p;
struct script_code *script;
+ struct script_code *oldscript;
int srcsize = 65536;
int startline = 0;
char line[1024];
@@ -2151,11 +2152,17 @@ 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();
- if(strdb_get(user_db, p) != NULL) {
+ oldscript = (struct script_code *)strdb_get(user_db, p);
+ if(oldscript != 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);
+ //ShowWarning("parse_function: Duplicate user function [%s] (%s:%d)\n", p, file, *lines);
+ //aFree(p);
+ //script_free_code(script);
+ // Experimental function overwriting - [Lance]
+ ShowInfo("parse_function: Overwriting user function [%s] (%s:%d)\n", p, file, *lines);
+ script_free_code(oldscript);
+ user_db->remove(user_db,p);
+ strdb_put(user_db, p, script);
} else
strdb_put(user_db, p, script);