From 9ba2a3b7194d1bb23c24fa6333bbff3ae05316ea Mon Sep 17 00:00:00 2001 From: terminx Date: Sun, 19 May 2019 03:54:48 +0000 Subject: [PATCH] Fix old issue with VM_CONDITIONAL macro git-svn-id: https://svn.eduke32.com/eduke32@7655 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/duke3d/src/gameexec.cpp | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/source/duke3d/src/gameexec.cpp b/source/duke3d/src/gameexec.cpp index 57b87493d..c48e7f5fc 100644 --- a/source/duke3d/src/gameexec.cpp +++ b/source/duke3d/src/gameexec.cpp @@ -1257,16 +1257,6 @@ void Screen_Play(void) } #if !defined LUNATIC -// be careful when changing this--the assignment used as a condition doubles as a null pointer check -#define VM_CONDITIONAL(xxx) \ - { \ - if ((xxx) || ((insptr = (intptr_t *)insptr[1]) && ((*insptr & VM_INSTMASK) == CON_ELSE))) \ - { \ - insptr += 2; \ - VM_Execute(); \ - } \ - } - #if defined __GNUC__ || defined __clang__ # define CON_USE_COMPUTED_GOTO #endif @@ -1300,6 +1290,17 @@ void Screen_Play(void) } \ } while (0) +// be careful when changing this--the assignment used as a condition doubles as a null pointer check +#define VM_CONDITIONAL(xxx) \ + do \ + { \ + if ((xxx) || ((insptr = (intptr_t *)insptr[1]) && ((*insptr & VM_INSTMASK) == CON_ELSE))) \ + { \ + insptr += 2; \ + VM_Execute(); \ + } \ + } while (0) + GAMEEXEC_STATIC void VM_Execute(bool const loop /*= false*/) { native_t vm_execution_depth = loop; @@ -2997,11 +2998,11 @@ badindex: vInstruction(CON_IFRESPAWN): if (A_CheckEnemySprite(vm.pSprite)) - VM_CONDITIONAL(ud.respawn_monsters) + VM_CONDITIONAL(ud.respawn_monsters); else if (A_CheckInventorySprite(vm.pSprite)) - VM_CONDITIONAL(ud.respawn_inventory) + VM_CONDITIONAL(ud.respawn_inventory); else - VM_CONDITIONAL(ud.respawn_items) + VM_CONDITIONAL(ud.respawn_items); dispatch(); vInstruction(CON_IFINOUTERSPACE):