- removed AStateProvider from native code.

The only place still referencing it was CallStateChain, so this has been made a static function now instead of a class method.
This commit is contained in:
Christoph Oelckers 2018-11-25 10:09:06 +01:00 committed by drfrag
parent 376c47bef6
commit 20ec6ddce4
6 changed files with 14 additions and 27 deletions

View file

@ -381,10 +381,3 @@ CCMD (targetinv)
"the NOBLOCKMAP flag or have height/radius of 0.\n");
}
//===========================================================================
//===========================================================================
IMPLEMENT_CLASS(AStateProvider, false, false)

View file

@ -102,11 +102,4 @@ public:
FSoundIDNoInit PickupSound;
};
class AStateProvider : public AInventory
{
DECLARE_CLASS (AStateProvider, AInventory)
public:
bool CallStateChain(AActor *actor, FState *state);
};
#endif //__A_PICKUPS_H__

View file

@ -204,6 +204,7 @@ xx(PowerDrain)
xx(Reflection)
xx(CustomInventory)
xx(Inventory)
xx(StateProvider)
xx(CallTryPickup)
xx(QuestItem25)
xx(QuestItem28)

View file

@ -113,7 +113,7 @@ FRandom pr_cajump("CustomJump");
extern TArray<VMValue> actionParams; // this can use the same storage as CallAction
bool AStateProvider::CallStateChain (AActor *actor, FState *state)
static bool CallStateChain (AActor *self, AActor *actor, FState *state)
{
INTBOOL result = false;
int counter = 0;
@ -126,7 +126,7 @@ bool AStateProvider::CallStateChain (AActor *actor, FState *state)
ret[0].PointerAt((void **)&nextstate);
ret[1].IntAt(&retval);
FState *savedstate = this->state;
FState *savedstate = self->state;
while (state != NULL)
{
@ -136,7 +136,7 @@ bool AStateProvider::CallStateChain (AActor *actor, FState *state)
return false;
}
this->state = state;
self->state = state;
nextstate = NULL; // assume no jump
if (state->ActionFunc != NULL)
@ -185,7 +185,7 @@ bool AStateProvider::CallStateChain (AActor *actor, FState *state)
try
{
state->CheckCallerType(actor, this);
state->CheckCallerType(actor, self);
if (state->ActionFunc->DefaultArgs.Size() > 0)
{
@ -202,7 +202,7 @@ bool AStateProvider::CallStateChain (AActor *actor, FState *state)
}
if (state->ActionFunc->ImplicitArgs == 3)
{
actionParams[index + 1] = this;
actionParams[index + 1] = self;
actionParams[index + 2] = VMValue(&stp);
}
@ -211,14 +211,14 @@ bool AStateProvider::CallStateChain (AActor *actor, FState *state)
}
else
{
VMValue params[3] = { actor, this, VMValue(&stp) };
VMValue params[3] = { actor, self, VMValue(&stp) };
VMCallAction(state->ActionFunc, params, state->ActionFunc->ImplicitArgs, wantret, numret);
}
}
catch (CVMAbortException &err)
{
err.MaybePrintMessage();
err.stacktrace.AppendFormat("Called from state %s in inventory state chain in %s\n", FState::StaticGetStateName(state).GetChars(), GetClass()->TypeName.GetChars());
err.stacktrace.AppendFormat("Called from state %s in inventory state chain in %s\n", FState::StaticGetStateName(state).GetChars(), self->GetClass()->TypeName.GetChars());
throw;
}
@ -246,16 +246,16 @@ bool AStateProvider::CallStateChain (AActor *actor, FState *state)
}
state = nextstate;
}
this->state = savedstate;
self->state = savedstate;
return !!result;
}
DEFINE_ACTION_FUNCTION(ACustomInventory, CallStateChain)
{
PARAM_SELF_PROLOGUE(AStateProvider);
PARAM_SELF_PROLOGUE(AActor);
PARAM_OBJECT(affectee, AActor);
PARAM_POINTER(state, FState);
ACTION_RETURN_BOOL(self->CallStateChain(affectee, state));
ACTION_RETURN_BOOL(CallStateChain(self, affectee, state));
}
//==========================================================================

View file

@ -337,7 +337,7 @@ static void CheckForUnsafeStates(PClassActor *obj)
if (obj->Size == citype->Size) return; // This class cannot have user variables.
test = pickupstates;
}
else return; // something else derived from AStateProvider. We do not know what this may be.
else return; // something else derived from StateProvider. We do not know what this may be.
}
for (; *test != NAME_None; test++)
@ -496,7 +496,7 @@ void LoadActors()
CheckStates(ti);
if (ti->bDecorateClass && ti->IsDescendantOf(RUNTIME_CLASS(AStateProvider)))
if (ti->bDecorateClass && ti->IsDescendantOf(NAME_StateProvider))
{
// either a DECORATE based weapon or CustomInventory.
// These are subject to relaxed rules for user variables in states.

View file

@ -1,5 +1,5 @@
class StateProvider : Inventory native
class StateProvider : Inventory
{
//==========================================================================
//