]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
reset stack position when new progs loaded, or error occurs
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 14 Aug 2002 23:48:14 +0000 (23:48 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Wed, 14 Aug 2002 23:48:14 +0000 (23:48 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@2243 d7cf8633-e32d-0410-b094-e92efae38249

pr_edict.c
pr_exec.c
progs.h

index bf351309ad331e3b39617e44ffb227ea7fb9e128..f0b3524f7d1021f32ae95b10d7c5167f0731247b 100644 (file)
@@ -1378,6 +1378,7 @@ void PR_LoadProgs (void)
        }
 
        FindEdictFieldOffsets(); // LordHavoc: update field offset list
+       PR_Execute_ProgsLoaded();
 }
 
 
index 113941a9d1567dee06e7c49b31308c05b1d58941..eda7404f8d03efa01e17d1db6de90f8b0cc42d98 100644 (file)
--- 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 f8e15136bdcbe9d0978723a735da799db975ab1a..c456c8943bd3ba3a51e42122ec6a95edf16b92c7 100644 (file)
--- 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);