From 5e298173f7c7367d7acbf426a8908b1e36d78146 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Sat, 20 Feb 2016 21:34:58 -0600 Subject: [PATCH] Redo ACTION_RETURN macros so they can be treated like return statements --- src/thingdef/thingdef.h | 4 ++-- src/thingdef/thingdef_codeptr.cpp | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/thingdef/thingdef.h b/src/thingdef/thingdef.h index a9703ffa63..f5f2d156c9 100644 --- a/src/thingdef/thingdef.h +++ b/src/thingdef/thingdef.h @@ -357,8 +357,8 @@ int MatchString (const char *in, const char **strings); } -#define ACTION_RETURN_STATE(state) if (numret > 0) { assert(ret != NULL); ret->SetPointer(state, ATAG_STATE); return 1; } return 0 -#define ACTION_RETURN_INT(v) if (numret > 0) { assert(ret != NULL); ret->SetInt(v); return 1; } return 0 +#define ACTION_RETURN_STATE(v) do { FState *state = v; if (numret > 0) { assert(ret != NULL); ret->SetPointer(state, ATAG_STATE); return 1; } return 0; } while(0) +#define ACTION_RETURN_INT(v) do { int u = v; if (numret > 0) { assert(ret != NULL); ret->SetInt(u); return 1; } return 0; } while(0) #define ACTION_RETURN_BOOL(v) ACTION_RETURN_INT(v) // Checks to see what called the current action function diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 7b5f338751..ad6a8b903b 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -1969,8 +1969,6 @@ static bool DoGiveInventory(AActor *receiver, bool orresult, VM_ARGS) return false; } - bool res = true; - if (amount <= 0) { amount = 1;