From a133a79072591972ca0e0c48df62507da6b710f0 Mon Sep 17 00:00:00 2001 From: havoc Date: Wed, 14 Aug 2002 23:48:14 +0000 Subject: [PATCH] reset stack position when new progs loaded, or error occurs git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@2243 d7cf8633-e32d-0410-b094-e92efae38249 --- pr_edict.c | 1 + pr_exec.c | 11 ++++++++++- progs.h | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/pr_edict.c b/pr_edict.c index bf351309..f0b3524f 100644 --- a/pr_edict.c +++ b/pr_edict.c @@ -1378,6 +1378,7 @@ void PR_LoadProgs (void) } FindEdictFieldOffsets(); // LordHavoc: update field offset list + PR_Execute_ProgsLoaded(); } diff --git a/pr_exec.c b/pr_exec.c index 113941a9..eda7404f 100644 --- a/pr_exec.c +++ b/pr_exec.c @@ -268,7 +268,9 @@ void PR_RunError (char *error, ...) PR_StackTrace (); Con_Printf ("%s\n", string); - pr_depth = 0; // dump the stack so host_error can shutdown functions + // dump the stack so host_error can shutdown functions + pr_depth = 0; + localstack_used = 0; Host_Error ("Program error"); } @@ -354,6 +356,13 @@ int PR_LeaveFunction (void) return pr_stack[pr_depth].s; } +void PR_Execute_ProgsLoaded(void) +{ + // dump the stack + pr_depth = 0; + localstack_used = 0; +} + /* ==================== PR_ExecuteProgram diff --git a/progs.h b/progs.h index f8e15136..c456c894 100644 --- a/progs.h +++ b/progs.h @@ -177,6 +177,7 @@ extern int pr_xstatement; extern unsigned short pr_crc; void PR_RunError (char *error, ...); +void PR_Execute_ProgsLoaded(void); void ED_PrintEdicts (void); void ED_PrintNum (int ent); -- 2.39.2