|
@@ -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);
|
|
|
|