]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - pr_exec.c
reset stack position when new progs loaded, or error occurs
[xonotic/darkplaces.git] / pr_exec.c
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