summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLance <Lance@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-10-27 05:33:08 +0000
committerLance <Lance@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-10-27 05:33:08 +0000
commit3c55cc9c5578d8041fd8b7249b5ecf063fd983d3 (patch)
tree58f5d94f83bb40556fd29bc5e42985276675ccf3
parent700eafc1e0683486356c9722d61dedad3524e0af (diff)
downloadhercules-3c55cc9c5578d8041fd8b7249b5ecf063fd983d3.tar.gz
hercules-3c55cc9c5578d8041fd8b7249b5ecf063fd983d3.tar.bz2
hercules-3c55cc9c5578d8041fd8b7249b5ecf063fd983d3.tar.xz
hercules-3c55cc9c5578d8041fd8b7249b5ecf063fd983d3.zip
* 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
-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);