From: havoc Date: Wed, 14 Aug 2002 23:48:14 +0000 (+0000) Subject: reset stack position when new progs loaded, or error occurs X-Git-Tag: RELEASE_0_2_0_RC1~345 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=a133a79072591972ca0e0c48df62507da6b710f0;p=xonotic%2Fdarkplaces.git 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 --- 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);