From 0f8972c96b1b5ae56415613f28f02b3f38290a1c Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 28 Apr 2015 21:30:12 +0200 Subject: [PATCH] - don't delete any DObjects FraggleScript's global_script was deleted instead of destroyed. --- src/fragglescript/t_script.cpp | 22 +--------------------- src/p_enemy.cpp | 12 ++++++------ 2 files changed, 7 insertions(+), 27 deletions(-) diff --git a/src/fragglescript/t_script.cpp b/src/fragglescript/t_script.cpp index 48f0c62500..72e1e4ae8a 100644 --- a/src/fragglescript/t_script.cpp +++ b/src/fragglescript/t_script.cpp @@ -170,7 +170,6 @@ DFsScript::DFsScript() void DFsScript::Destroy() { - if (this == global_script) global_script = NULL; ClearVariables(true); ClearSections(); ClearChildren(); @@ -667,29 +666,10 @@ static int LS_FS_Execute (line_t *ln, AActor *it, bool backSide, void FS_Close() { - int i; - DFsVariable *current, *next; - if (global_script != NULL) { - // we have to actually delete the global variables if we don't want - // to get them reported as memory leaks. - for (i = 0; i < VARIABLESLOTS; i++) - { - current = global_script->variables[i]; - - while (current) - { - next = current->next; // save for after freeing - - current->ObjectFlags |= OF_YesReallyDelete; - delete current; - current = next; // go to next in chain - } - } GC::DelSoftRoot(global_script); - global_script->ObjectFlags |= OF_YesReallyDelete; - delete global_script; + global_script->Destroy(); global_script = NULL; } } diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index 7e0332963e..25b3c87677 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -2892,8 +2892,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FaceTarget) PARAM_ANGLE_OPT(max_turn) { max_turn = 0; } PARAM_ANGLE_OPT(max_pitch) { max_pitch = 270; } PARAM_ANGLE_OPT(ang_offset) { max_turn = 0; } - PARAM_ANGLE_OPT(pitch_offset) { max_turn = 0; } - PARAM_INT_OPT(flags) { max_turn = 0; } + PARAM_ANGLE_OPT(pitch_offset) { pitch_offset = 0; } + PARAM_INT_OPT(flags) { flags = 0; } A_FaceTarget(self, max_turn, max_pitch, ang_offset, pitch_offset, flags); return 0; @@ -2905,8 +2905,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FaceMaster) PARAM_ANGLE_OPT(max_turn) { max_turn = 0; } PARAM_ANGLE_OPT(max_pitch) { max_pitch = 270; } PARAM_ANGLE_OPT(ang_offset) { max_turn = 0; } - PARAM_ANGLE_OPT(pitch_offset) { max_turn = 0; } - PARAM_INT_OPT(flags) { max_turn = 0; } + PARAM_ANGLE_OPT(pitch_offset) { pitch_offset = 0; } + PARAM_INT_OPT(flags) { flags = 0; } A_FaceMaster(self, max_turn, max_pitch, ang_offset, pitch_offset, flags); return 0; @@ -2918,8 +2918,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_FaceTracer) PARAM_ANGLE_OPT(max_turn) { max_turn = 0; } PARAM_ANGLE_OPT(max_pitch) { max_pitch = 270; } PARAM_ANGLE_OPT(ang_offset) { max_turn = 0; } - PARAM_ANGLE_OPT(pitch_offset) { max_turn = 0; } - PARAM_INT_OPT(flags) { max_turn = 0; } + PARAM_ANGLE_OPT(pitch_offset) { pitch_offset = 0; } + PARAM_INT_OPT(flags) { flags = 0; } A_FaceTracer(self, max_turn, max_pitch, ang_offset, pitch_offset, flags); return 0;