mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 15:21:51 +00:00
- fixed a few occurences where ACTION_RETURN_* eliminated the side effect of its argument when no return value was requested.
This macro should not be used on function calls that actually perform an action aside from calculating the return value!
This commit is contained in:
parent
85fbcf0428
commit
7ede77c1d2
1 changed files with 12 additions and 6 deletions
|
@ -2008,13 +2008,15 @@ static bool DoGiveInventory(AActor *receiver, bool orresult, VM_ARGS)
|
|||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveInventory)
|
||||
{
|
||||
PARAM_ACTION_PROLOGUE;
|
||||
ACTION_RETURN_BOOL(DoGiveInventory(self, false, VM_ARGS_NAMES));
|
||||
bool result = DoGiveInventory(self, false, VM_ARGS_NAMES);
|
||||
ACTION_RETURN_BOOL(result);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveToTarget)
|
||||
{
|
||||
PARAM_ACTION_PROLOGUE;
|
||||
ACTION_RETURN_BOOL(DoGiveInventory(self->target, false, VM_ARGS_NAMES));
|
||||
bool result = DoGiveInventory(self->target, false, VM_ARGS_NAMES);
|
||||
ACTION_RETURN_BOOL(result);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveToChildren)
|
||||
|
@ -2094,13 +2096,15 @@ bool DoTakeInventory(AActor *receiver, bool orresult, VM_ARGS)
|
|||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_TakeInventory)
|
||||
{
|
||||
PARAM_ACTION_PROLOGUE;
|
||||
ACTION_RETURN_BOOL(DoTakeInventory(self, false, VM_ARGS_NAMES));
|
||||
bool result = DoTakeInventory(self, false, VM_ARGS_NAMES);
|
||||
ACTION_RETURN_BOOL(result);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_TakeFromTarget)
|
||||
{
|
||||
PARAM_ACTION_PROLOGUE;
|
||||
ACTION_RETURN_BOOL(DoTakeInventory(self->target, false, VM_ARGS_NAMES));
|
||||
bool result = DoTakeInventory(self->target, false, VM_ARGS_NAMES);
|
||||
ACTION_RETURN_BOOL(result);
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_TakeFromChildren)
|
||||
|
@ -2401,7 +2405,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SpawnItem)
|
|||
AActor *mo = Spawn( missile, self->Vec3Angle(distance, self->angle, -self->floorclip + self->GetBobOffset() + zheight), ALLOW_REPLACE);
|
||||
|
||||
int flags = (transfer_translation ? SIXF_TRANSFERTRANSLATION : 0) + (useammo ? SIXF_SETMASTER : 0);
|
||||
ACTION_RETURN_BOOL(InitSpawnedItem(self, mo, flags)); // for an inventory item's use state
|
||||
bool result = InitSpawnedItem(self, mo, flags);
|
||||
ACTION_RETURN_BOOL(result); // for an inventory item's use state
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
@ -3250,7 +3255,8 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_JumpIf)
|
|||
PARAM_BOOL (condition);
|
||||
PARAM_STATE (jump);
|
||||
|
||||
ACTION_RETURN_STATE(condition ? jump : NULL);
|
||||
if (!condition) jump = NULL;
|
||||
ACTION_RETURN_STATE(jump);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
|
|
Loading…
Reference in a new issue