From 6384f1dd85e311f1456351388f9a94a32ac1fad4 Mon Sep 17 00:00:00 2001 From: skotlex Date: Thu, 27 Jul 2006 21:00:19 +0000 Subject: - Synced the script.c file with as much data as possible from jA's: - A lot of functions were moved around, a bunch of indentation and space-usage changes were done to make it easier to diff against their files. - Miscellanous addition and corrections were applied. - Largest one is likely a restructuring of run_script_main, which hopes to solve the memory leaks. - script engine now uses the setjmp functions to restore memory state when there's an error parsing scripts, which means that script errors won't cause the map-server to inmediately bail out anymore. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7926 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/itemdb.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'src/map/itemdb.c') diff --git a/src/map/itemdb.c b/src/map/itemdb.c index 4972f2452..728ea0108 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -956,10 +956,10 @@ static int itemdb_read_sqldb(void) script_free_code(id->script); if (sql_row[19] != NULL) { if (sql_row[19][0] == '{') - id->script = parse_script((unsigned char *) sql_row[19], 0); + id->script = parse_script((unsigned char *) sql_row[19],item_db_name[i], 0); else { sprintf(script, "{%s}", sql_row[19]); - id->script = parse_script((unsigned char *) script, 0); + id->script = parse_script((unsigned char *) script, item_db_name[i], 0); } } else id->script = NULL; @@ -967,10 +967,10 @@ static int itemdb_read_sqldb(void) script_free_code(id->equip_script); if (sql_row[20] != NULL) { if (sql_row[20][0] == '{') - id->equip_script = parse_script((unsigned char *) sql_row[20], 0); + id->equip_script = parse_script((unsigned char *) sql_row[20], item_db_name[i], 0); else { sprintf(script, "{%s}", sql_row[20]); - id->equip_script = parse_script((unsigned char *) script, 0); + id->equip_script = parse_script((unsigned char *) script, item_db_name[i], 0); } } else id->equip_script = NULL; @@ -978,10 +978,10 @@ static int itemdb_read_sqldb(void) script_free_code(id->unequip_script); if (sql_row[21] != NULL) { if (sql_row[21][0] == '{') - id->unequip_script = parse_script((unsigned char *) sql_row[21], 0); + id->unequip_script = parse_script((unsigned char *) sql_row[21],item_db_name[i], 0); else { sprintf(script, "{%s}", sql_row[21]); - id->unequip_script = parse_script((unsigned char *) script, 0); + id->unequip_script = parse_script((unsigned char *) script, item_db_name[i], 0); } } else id->unequip_script = NULL; @@ -1148,11 +1148,11 @@ static int itemdb_readdb(void) np = strchr(np+1,'}'); //Jump close brackets until the next field is found. if (!np || !np[1]) { //Couldn't find the end of the script field. - id->script = parse_script((unsigned char *) str[19],lines); + id->script = parse_script((unsigned char *) str[19],filename[i],lines); continue; } np[1] = '\0'; //Set end of script - id->script = parse_script((unsigned char *) str[19],lines); + id->script = parse_script((unsigned char *) str[19],filename[i],lines); np+=2; //Skip to next field if(!np || (p=strchr(np,'{'))==NULL) @@ -1165,18 +1165,18 @@ static int itemdb_readdb(void) np = strchr(np+1,'}'); //Jump close brackets until the next field is found. if (!np || !np[1]) { //Couldn't find the end of the script field. - id->equip_script = parse_script((unsigned char *) str[20],lines); + id->equip_script = parse_script((unsigned char *) str[20],filename[i],lines); continue; } np[1] = '\0'; //Set end of script - id->equip_script = parse_script((unsigned char *) str[20],lines); + id->equip_script = parse_script((unsigned char *) str[20],filename[i],lines); np+=2; //Skip comma, to next field if(!np || (p=strchr(np,'{'))==NULL) continue; //Unequip script, last column. - id->unequip_script = parse_script((unsigned char *) p,lines); + id->unequip_script = parse_script((unsigned char *) p,filename[i],lines); } fclose(fp); if (ln > 0) { -- cgit v1.2.3-70-g09d2