Removed unused parameter from several functions in FStateDefinitions class

src/p_states.cpp:724:54: warning: parameter ‘actor’ set but not used [-Wunused-but-set-parameter]
https://forum.zdoom.org/viewtopic.php?t=58364
This commit is contained in:
alexey.lysiuk 2017-11-05 13:15:42 +02:00
parent bd08568b90
commit 274951839a
3 changed files with 13 additions and 17 deletions

View file

@ -322,18 +322,16 @@ bool PClassActor::SetReplacement(FName replaceName)
void AActor::Finalize(FStateDefinitions &statedef) void AActor::Finalize(FStateDefinitions &statedef)
{ {
AActor *defaults = this;
try try
{ {
statedef.FinishStates(GetClass(), defaults); statedef.FinishStates(GetClass());
} }
catch (CRecoverableError &) catch (CRecoverableError &)
{ {
statedef.MakeStateDefines(nullptr); statedef.MakeStateDefines(nullptr);
throw; throw;
} }
statedef.InstallStates(GetClass(), defaults); statedef.InstallStates(GetClass(), this);
statedef.MakeStateDefines(nullptr); statedef.MakeStateDefines(nullptr);
} }

View file

@ -721,7 +721,7 @@ void FStateDefinitions::RetargetStates (intptr_t count, const char *target)
// //
//========================================================================== //==========================================================================
FState *FStateDefinitions::ResolveGotoLabel (AActor *actor, PClassActor *mytype, char *name) FState *FStateDefinitions::ResolveGotoLabel (PClassActor *mytype, char *name)
{ {
PClassActor *type = mytype; PClassActor *type = mytype;
FState *state; FState *state;
@ -741,7 +741,6 @@ FState *FStateDefinitions::ResolveGotoLabel (AActor *actor, PClassActor *mytype,
if (stricmp (classname, "Super") == 0) if (stricmp (classname, "Super") == 0)
{ {
type = ValidateActor(type->ParentClass); type = ValidateActor(type->ParentClass);
actor = GetDefaultByType(type);
} }
else else
{ {
@ -763,7 +762,6 @@ FState *FStateDefinitions::ResolveGotoLabel (AActor *actor, PClassActor *mytype,
if (type != stype) if (type != stype)
{ {
type = static_cast<PClassActor *>(stype); type = static_cast<PClassActor *>(stype);
actor = GetDefaultByType (type);
} }
} }
} }
@ -836,16 +834,16 @@ void FStateDefinitions::FixStatePointers (PClassActor *actor, TArray<FStateDefin
// //
//========================================================================== //==========================================================================
void FStateDefinitions::ResolveGotoLabels (PClassActor *actor, AActor *defaults, TArray<FStateDefine> & list) void FStateDefinitions::ResolveGotoLabels (PClassActor *actor, TArray<FStateDefine> & list)
{ {
for (unsigned i = 0; i < list.Size(); i++) for (unsigned i = 0; i < list.Size(); i++)
{ {
if (list[i].State != NULL && list[i].DefineFlags == SDF_LABEL) if (list[i].State != NULL && list[i].DefineFlags == SDF_LABEL)
{ // It's not a valid state, so it must be a label string. Resolve it. { // It's not a valid state, so it must be a label string. Resolve it.
list[i].State = ResolveGotoLabel (defaults, actor, (char *)list[i].State); list[i].State = ResolveGotoLabel (actor, (char *)list[i].State);
list[i].DefineFlags = SDF_STATE; list[i].DefineFlags = SDF_STATE;
} }
if (list[i].Children.Size() > 0) ResolveGotoLabels(actor, defaults, list[i].Children); if (list[i].Children.Size() > 0) ResolveGotoLabels(actor, list[i].Children);
} }
} }
@ -1004,7 +1002,7 @@ int FStateDefinitions::AddStates(FState *state, const char *framechars, const FS
// //
//========================================================================== //==========================================================================
int FStateDefinitions::FinishStates(PClassActor *actor, AActor *defaults) int FStateDefinitions::FinishStates(PClassActor *actor)
{ {
int count = StateArray.Size(); int count = StateArray.Size();
@ -1023,7 +1021,7 @@ int FStateDefinitions::FinishStates(PClassActor *actor, AActor *defaults)
FixStatePointers(actor, StateLabels); FixStatePointers(actor, StateLabels);
// Fix state pointers that are gotos // Fix state pointers that are gotos
ResolveGotoLabels(actor, defaults, StateLabels); ResolveGotoLabels(actor, StateLabels);
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
{ {
@ -1047,7 +1045,7 @@ int FStateDefinitions::FinishStates(PClassActor *actor, AActor *defaults)
break; break;
case SDF_LABEL: case SDF_LABEL:
realstates[i].NextState = ResolveGotoLabel(defaults, actor, (char *)realstates[i].NextState); realstates[i].NextState = ResolveGotoLabel(actor, (char *)realstates[i].NextState);
break; break;
} }
} }
@ -1055,7 +1053,7 @@ int FStateDefinitions::FinishStates(PClassActor *actor, AActor *defaults)
else else
{ {
// Fix state pointers that are gotos // Fix state pointers that are gotos
ResolveGotoLabels(actor, defaults, StateLabels); ResolveGotoLabels(actor, StateLabels);
} }
return count; return count;
} }

View file

@ -113,9 +113,9 @@ class FStateDefinitions
FStateDefine *FindStateAddress(const char *name); FStateDefine *FindStateAddress(const char *name);
FState *FindState(const char *name); FState *FindState(const char *name);
FState *ResolveGotoLabel(AActor *actor, PClassActor *mytype, char *name); FState *ResolveGotoLabel(PClassActor *mytype, char *name);
static void FixStatePointers(PClassActor *actor, TArray<FStateDefine> & list); static void FixStatePointers(PClassActor *actor, TArray<FStateDefine> & list);
void ResolveGotoLabels(PClassActor *actor, AActor *defaults, TArray<FStateDefine> & list); void ResolveGotoLabels(PClassActor *actor, TArray<FStateDefine> & list);
public: public:
FStateDefinitions() FStateDefinitions()
@ -129,7 +129,7 @@ public:
void AddStateLabel(const char *statename); void AddStateLabel(const char *statename);
int GetStateLabelIndex (FName statename); int GetStateLabelIndex (FName statename);
void InstallStates(PClassActor *info, AActor *defaults); void InstallStates(PClassActor *info, AActor *defaults);
int FinishStates(PClassActor *actor, AActor *defaults); int FinishStates(PClassActor *actor);
void MakeStateDefines(const PClassActor *cls); void MakeStateDefines(const PClassActor *cls);
void AddStateDefines(const FStateLabels *list); void AddStateDefines(const FStateLabels *list);