]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - prvm_exec.c
Don't crash the game if a "nasty" -game name is rejected, matches behavior of missing...
[xonotic/darkplaces.git] / prvm_exec.c
index 762488c6a522c3c281aa8fc6c9e9dad31b55f3ad..452f2803f1b780c3dd1ca70cd0c45b7af03c7308 100644 (file)
@@ -549,7 +549,7 @@ void PRVM_Crash(prvm_prog_t *prog)
        if(prvm_errordump.integer)
        {
                // make a savegame
-               Host_Savegame_to(prog, va(vabuf, sizeof(vabuf), "crash-%s.dmp", prog->name));
+               SV_Savegame_to(prog, va(vabuf, sizeof(vabuf), "crash-%s.dmp", prog->name));
        }
 
        // dump the stack so host_error can shutdown functions
@@ -716,13 +716,15 @@ static void PRVM_StatementCoverageEvent(prvm_prog_t *prog, mfunction_t *func, in
        Con_Printf("prvm_coverage: %s just executed a statement at %s for the first time. Coverage: %.2f%%.\n", prog->name, PRVM_WhereAmI(vabuf, sizeof(vabuf), prog, func, statement), prog->statements_covered * 100.0 / prog->numstatements);
 }
 
-#ifdef __GNUC__
-#define HAVE_COMPUTED_GOTOS 1
+#if defined (__GNUC__) || (__clang__) || (__TINYC__)
+#  ifndef CONFIG_PEDANTIC
+#  define HAVE_COMPUTED_GOTOS 1
+#  endif
 #endif
 
-#define OPA ((prvm_eval_t *)&prog->globals.fp[st->operand[0]])
-#define OPB ((prvm_eval_t *)&prog->globals.fp[st->operand[1]])
-#define OPC ((prvm_eval_t *)&prog->globals.fp[st->operand[2]])
+#define OPA ((prvm_eval_t *)&globals[st->operand[0]])
+#define OPB ((prvm_eval_t *)&globals[st->operand[1]])
+#define OPC ((prvm_eval_t *)&globals[st->operand[2]])
 extern cvar_t prvm_traceqc;
 extern cvar_t prvm_statementprofiling;
 extern qboolean prvm_runawaycheck;
@@ -746,7 +748,7 @@ void MVM_ExecuteProgram (prvm_prog_t *prog, func_t fnum, const char *errormessag
        double tm, starttm;
        prvm_vec_t tempfloat;
        // these may become out of date when a builtin is called, and are updated accordingly
-       prvm_vec_t *cached_edictsfields = prog->edictsfields;
+       prvm_vec_t *cached_edictsfields = prog->edictsfields.fp;
        unsigned int cached_entityfields = prog->entityfields;
        unsigned int cached_entityfields_3 = prog->entityfields - 3;
        unsigned int cached_entityfieldsarea = prog->entityfieldsarea;
@@ -759,6 +761,8 @@ void MVM_ExecuteProgram (prvm_prog_t *prog, func_t fnum, const char *errormessag
        qboolean cached_allowworldwrites = prog->allowworldwrites;
        unsigned int cached_flag = prog->flag;
 
+       prvm_vec_t *globals = prog->globals.fp;
+
        calltime = Sys_DirtyTime();
 
        if (!fnum || fnum >= (unsigned int)prog->numfunctions)
@@ -853,7 +857,7 @@ void CLVM_ExecuteProgram (prvm_prog_t *prog, func_t fnum, const char *errormessa
        double tm, starttm;
        prvm_vec_t tempfloat;
        // these may become out of date when a builtin is called, and are updated accordingly
-       prvm_vec_t *cached_edictsfields = prog->edictsfields;
+       prvm_vec_t *cached_edictsfields = prog->edictsfields.fp;
        unsigned int cached_entityfields = prog->entityfields;
        unsigned int cached_entityfields_3 = prog->entityfields - 3;
        unsigned int cached_entityfieldsarea = prog->entityfieldsarea;
@@ -866,6 +870,8 @@ void CLVM_ExecuteProgram (prvm_prog_t *prog, func_t fnum, const char *errormessa
        qboolean cached_allowworldwrites = prog->allowworldwrites;
        unsigned int cached_flag = prog->flag;
 
+       prvm_vec_t *globals = prog->globals.fp;
+
        calltime = Sys_DirtyTime();
 
        if (!fnum || fnum >= (unsigned int)prog->numfunctions)
@@ -964,7 +970,7 @@ void PRVM_ExecuteProgram (prvm_prog_t *prog, func_t fnum, const char *errormessa
        double tm, starttm;
        prvm_vec_t tempfloat;
        // these may become out of date when a builtin is called, and are updated accordingly
-       prvm_vec_t *cached_edictsfields = prog->edictsfields;
+       prvm_vec_t *cached_edictsfields = prog->edictsfields.fp;
        unsigned int cached_entityfields = prog->entityfields;
        unsigned int cached_entityfields_3 = prog->entityfields - 3;
        unsigned int cached_entityfieldsarea = prog->entityfieldsarea;
@@ -977,6 +983,8 @@ void PRVM_ExecuteProgram (prvm_prog_t *prog, func_t fnum, const char *errormessa
        qboolean cached_allowworldwrites = prog->allowworldwrites;
        unsigned int cached_flag = prog->flag;
 
+       prvm_vec_t *globals = prog->globals.fp;
+
        calltime = Sys_DirtyTime();
 
        if (!fnum || fnum >= (unsigned int)prog->numfunctions)