From d7fc6a1ac3ca73a7d7ae82fbceb829e875b5672e Mon Sep 17 00:00:00 2001 From: Kaelan Date: Wed, 16 Oct 2024 16:31:40 -0600 Subject: [PATCH] Re-move bounds checks out of core engine per request --- src/gamedata/r_defs.h | 3 --- src/scripting/vmthunks.cpp | 2 ++ 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/gamedata/r_defs.h b/src/gamedata/r_defs.h index e940d80abd3..bf0f6be4b9a 100644 --- a/src/gamedata/r_defs.h +++ b/src/gamedata/r_defs.h @@ -40,7 +40,6 @@ #include "r_sky.h" #include "p_terrain.h" #include "p_effect.h" -#include "vm.h" #include "hwrenderer/data/buffers.h" @@ -1032,13 +1031,11 @@ struct sector_t void SetPlaneReflectivity(int pos, double val) { - if (pos < 0 || pos > 1) ThrowAbortException(X_ARRAY_OUT_OF_BOUNDS, "pos must be either 0 or 1"); reflect[pos] = val; } double GetPlaneReflectivity(int pos) { - if (pos < 0 || pos > 1) ThrowAbortException(X_ARRAY_OUT_OF_BOUNDS, "pos must be either 0 or 1"); return reflect[pos]; } diff --git a/src/scripting/vmthunks.cpp b/src/scripting/vmthunks.cpp index d93a83fdcdd..384347da3c4 100644 --- a/src/scripting/vmthunks.cpp +++ b/src/scripting/vmthunks.cpp @@ -871,6 +871,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Sector, SetXOffset, SetXOffset) static void SetPlaneReflectivity(sector_t* self, int pos, double val) { + if (pos < 0 || pos > 1) ThrowAbortException(X_ARRAY_OUT_OF_BOUNDS, "pos must be either 0 or 1"); self->SetPlaneReflectivity(pos, val); } @@ -885,6 +886,7 @@ DEFINE_ACTION_FUNCTION_NATIVE(_Sector, SetXOffset, SetXOffset) static double GetPlaneReflectivity(sector_t* self, int pos) { + if (pos < 0 || pos > 1) ThrowAbortException(X_ARRAY_OUT_OF_BOUNDS, "pos must be either 0 or 1"); return self->GetPlaneReflectivity(pos); }