From 3c55cc9c5578d8041fd8b7249b5ecf063fd983d3 Mon Sep 17 00:00:00 2001 From: Lance Date: Fri, 27 Oct 2006 05:33:08 +0000 Subject: * Experimental tweak to npc_parse_function - Overwrite existing functions. modified Changelog-Trunk.txt modified src/map/npc.c git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9084 54d463be-8e91-2dee-dedb-b68131a5f0ec --- Changelog-Trunk.txt | 1 + src/map/npc.c | 15 +++++++++++---- 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); -- cgit v1.2.3-70-g09d2