Revert "- fixed: Since A_Give/TaketoChildren/siblings use the same code as A_Give/TakeInventory but do not use the third parameter this must be ignored by the code. This is merely a band-aid fix, because this problem doesn't exist in the same form in the scripting branch."

This reverts commit a4c07a9ee3.

- This commit touched every line of thingdef_codeptr.cpp, which would make
  merging it into the scripting branch a pain in the ass.
This commit is contained in:
Randy Heit 2015-01-29 19:30:26 -06:00
parent 72506fa6e9
commit d828173ce3

View file

@ -1670,17 +1670,14 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_CustomRailgun)
// //
//=========================================================================== //===========================================================================
static void DoGiveInventory(AActor * receiver, bool use_aaptr, DECLARE_PARAMINFO) static void DoGiveInventory(AActor * receiver, DECLARE_PARAMINFO)
{ {
ACTION_PARAM_START(2+use_aaptr); ACTION_PARAM_START(3);
ACTION_PARAM_CLASS(mi, 0); ACTION_PARAM_CLASS(mi, 0);
ACTION_PARAM_INT(amount, 1); ACTION_PARAM_INT(amount, 1);
if (use_aaptr)
{
ACTION_PARAM_INT(setreceiver, 2); ACTION_PARAM_INT(setreceiver, 2);
COPY_AAPTR_NOT_NULL(receiver, receiver, setreceiver); COPY_AAPTR_NOT_NULL(receiver, receiver, setreceiver);
}
bool res=true; bool res=true;
@ -1688,11 +1685,6 @@ static void DoGiveInventory(AActor * receiver, bool use_aaptr, DECLARE_PARAMINFO
if (mi) if (mi)
{ {
AInventory *item = static_cast<AInventory *>(Spawn (mi, 0, 0, 0, NO_REPLACE)); AInventory *item = static_cast<AInventory *>(Spawn (mi, 0, 0, 0, NO_REPLACE));
if (!item)
{
ACTION_SET_RESULT(false);
return;
}
if (item->IsKindOf(RUNTIME_CLASS(AHealth))) if (item->IsKindOf(RUNTIME_CLASS(AHealth)))
{ {
item->Amount *= amount; item->Amount *= amount;
@ -1717,12 +1709,12 @@ static void DoGiveInventory(AActor * receiver, bool use_aaptr, DECLARE_PARAMINFO
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveInventory) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveInventory)
{ {
DoGiveInventory(self, true, PUSH_PARAMINFO); DoGiveInventory(self, PUSH_PARAMINFO);
} }
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveToTarget) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveToTarget)
{ {
DoGiveInventory(self->target, true, PUSH_PARAMINFO); DoGiveInventory(self->target, PUSH_PARAMINFO);
} }
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveToChildren) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveToChildren)
@ -1732,7 +1724,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveToChildren)
while ((mo = it.Next())) while ((mo = it.Next()))
{ {
if (mo->master == self) DoGiveInventory(mo, false, PUSH_PARAMINFO); if (mo->master == self) DoGiveInventory(mo, PUSH_PARAMINFO);
} }
} }
@ -1745,7 +1737,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveToSiblings)
{ {
while ((mo = it.Next())) while ((mo = it.Next()))
{ {
if (mo->master == self->master && mo != self) DoGiveInventory(mo, false, PUSH_PARAMINFO); if (mo->master == self->master && mo != self) DoGiveInventory(mo, PUSH_PARAMINFO);
} }
} }
} }
@ -1761,23 +1753,16 @@ enum
TIF_NOTAKEINFINITE = 1, TIF_NOTAKEINFINITE = 1,
}; };
void DoTakeInventory(AActor * receiver, bool use_aaptr, DECLARE_PARAMINFO) void DoTakeInventory(AActor * receiver, DECLARE_PARAMINFO)
{ {
ACTION_PARAM_START(3+use_aaptr); ACTION_PARAM_START(4);
ACTION_PARAM_CLASS(item, 0); ACTION_PARAM_CLASS(item, 0);
ACTION_PARAM_INT(amount, 1); ACTION_PARAM_INT(amount, 1);
ACTION_PARAM_INT(flags, 2); ACTION_PARAM_INT(flags, 2);
if (!item)
{
ACTION_SET_RESULT(false);
return;
}
if (use_aaptr)
{
ACTION_PARAM_INT(setreceiver, 3); ACTION_PARAM_INT(setreceiver, 3);
if (!item) return;
COPY_AAPTR_NOT_NULL(receiver, receiver, setreceiver); COPY_AAPTR_NOT_NULL(receiver, receiver, setreceiver);
}
bool res = false; bool res = false;
@ -1809,12 +1794,12 @@ void DoTakeInventory(AActor * receiver, bool use_aaptr, DECLARE_PARAMINFO)
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_TakeInventory) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_TakeInventory)
{ {
DoTakeInventory(self, true, PUSH_PARAMINFO); DoTakeInventory(self, PUSH_PARAMINFO);
} }
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_TakeFromTarget) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_TakeFromTarget)
{ {
DoTakeInventory(self->target, true, PUSH_PARAMINFO); DoTakeInventory(self->target, PUSH_PARAMINFO);
} }
DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_TakeFromChildren) DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_TakeFromChildren)
@ -1824,7 +1809,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_TakeFromChildren)
while ((mo = it.Next())) while ((mo = it.Next()))
{ {
if (mo->master == self) DoTakeInventory(mo, false, PUSH_PARAMINFO); if (mo->master == self) DoTakeInventory(mo, PUSH_PARAMINFO);
} }
} }
@ -1837,7 +1822,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_TakeFromSiblings)
{ {
while ((mo = it.Next())) while ((mo = it.Next()))
{ {
if (mo->master == self->master && mo != self) DoTakeInventory(mo, false, PUSH_PARAMINFO); if (mo->master == self->master && mo != self) DoTakeInventory(mo, PUSH_PARAMINFO);
} }
} }
} }