summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c32
1 files changed, 9 insertions, 23 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 8fdefe2c2..5f84aa2d9 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -3634,24 +3634,10 @@ int script_config_read(char *cfgName)
return 0;
}
-static int do_final_userfunc_sub (DBKey key,void *data,va_list ap)
+static int db_script_free_code_sub(DBKey key, void *data, va_list ap)
{
- struct script_code *code = (struct script_code *)data;
- if(code){
- script_free_vars( &code->script_vars );
- aFree( code->script_buf );
- aFree( code );
- }
- return 0;
-}
-
-static int do_final_autobonus_sub (DBKey key,void *data,va_list ap)
-{
- struct script_code *script = (struct script_code *)data;
-
- if( script )
- script_free_code(script);
-
+ if (data)
+ script_free_code(data);
return 0;
}
@@ -3807,9 +3793,9 @@ int do_final_script()
mapreg_final();
- scriptlabel_db->destroy(scriptlabel_db,NULL);
- userfunc_db->destroy(userfunc_db,do_final_userfunc_sub);
- autobonus_db->destroy(autobonus_db, do_final_autobonus_sub);
+ db_destroy(scriptlabel_db);
+ userfunc_db->destroy(userfunc_db, db_script_free_code_sub);
+ autobonus_db->destroy(autobonus_db, db_script_free_code_sub);
if(sleep_db) {
struct linkdb_node *n = (struct linkdb_node *)sleep_db;
while(n) {
@@ -3833,7 +3819,7 @@ int do_final_script()
int do_init_script()
{
userfunc_db=strdb_alloc(DB_OPT_DUP_KEY,0);
- scriptlabel_db=strdb_alloc((DBOptions)(DB_OPT_DUP_KEY|DB_OPT_ALLOW_NULL_DATA),50);
+ scriptlabel_db=strdb_alloc(DB_OPT_DUP_KEY|DB_OPT_ALLOW_NULL_DATA,50);
autobonus_db = strdb_alloc(DB_OPT_DUP_KEY,0);
mapreg_init();
@@ -3843,8 +3829,8 @@ int do_init_script()
int script_reload()
{
- userfunc_db->clear(userfunc_db,do_final_userfunc_sub);
- scriptlabel_db->clear(scriptlabel_db, NULL);
+ userfunc_db->clear(userfunc_db, db_script_free_code_sub);
+ db_clear(scriptlabel_db);
if(sleep_db) {
struct linkdb_node *n = (struct linkdb_node *)sleep_db;