- removed an assert from APowerMorph::EndEffect. With some recent changes to DestroyAllInventory it appears that the asserted condition no longer is true at this point when ending a game.

- fixed: When replacing a tentative class, the pointers in the morph objects were not replaced. Instead of adding more ReplaceClassRef methods I chose to integrate this part into the PointerSubstitution mechanism and delete ReplaceClassRef entirely. The code had some oversights anyway that would have caused problems, now that non-actors can be created.
This commit is contained in:
Christoph Oelckers 2016-12-01 00:05:23 +01:00
parent 0233c21e33
commit 87484950cf
20 changed files with 72 additions and 132 deletions

View file

@ -68,7 +68,6 @@
// EXTERNAL FUNCTION PROTOTYPES --------------------------------------------
void InitThingdef();
TArray<PClassActor **> OptionalClassPtrs;
// STATIC FUNCTION PROTOTYPES --------------------------------------------
PClassActor *QuestItemClasses[31];
@ -365,7 +364,7 @@ static void CheckStates(PClassActor *obj)
void ParseScripts();
void ParseAllDecorate();
void LoadActors ()
void LoadActors()
{
cycle_t timer;
@ -387,7 +386,7 @@ void LoadActors ()
}
FScriptPosition::ResetErrorCounter();
for (int i = PClassActor::AllActorClasses.Size()-1; i>=0;i--)
for (int i = PClassActor::AllActorClasses.Size() - 1; i >= 0; i--)
{
auto ti = PClassActor::AllActorClasses[i];
if (ti->Size == TentativeClass)
@ -397,10 +396,6 @@ void LoadActors ()
Printf(TEXTCOLOR_ORANGE "Class %s referenced but not defined\n", ti->TypeName.GetChars());
FScriptPosition::WarnCounter++;
DObject::StaticPointerSubstitution(ti, nullptr);
for (auto op : OptionalClassPtrs)
{
if (*op == ti) *op = nullptr;
}
PClassActor::AllActorClasses.Delete(i);
}
else
@ -420,7 +415,7 @@ void LoadActors ()
CheckStates(ti);
if (ti->bDecorateClass && ti->IsDescendantOf(RUNTIME_CLASS(AStateProvider)))
{
// either a DECORATE based weapon or CustomInventory.
@ -429,7 +424,7 @@ void LoadActors ()
// hits an unsafe state. If we can find something here it can be handled wuth a compile error rather than a runtime error.
CheckForUnsafeStates(ti);
}
}
if (FScriptPosition::ErrorCounter > 0)
{
@ -447,6 +442,4 @@ void LoadActors ()
QuestItemClasses[i] = PClass::FindActor(fmt);
}
StateSourceLines.Clear();
OptionalClassPtrs.Clear();
OptionalClassPtrs.ShrinkToFit();
}

View file

@ -74,8 +74,6 @@
#include "a_health.h"
#include "a_keys.h"
extern TArray<PClassActor **> OptionalClassPtrs;
//==========================================================================
//
// Gets a class pointer and performs an error check for correct type
@ -2998,7 +2996,6 @@ DEFINE_CLASS_PROPERTY(playerclass, S, MorphProjectile)
{
PROP_STRING_PARM(str, 0);
defaults->PlayerClass = FindClassTentativePlayerPawn(str, bag.fromDecorate);
if (bag.fromDecorate) OptionalClassPtrs.Push((PClassActor**)&defaults->PlayerClass);
}
//==========================================================================
@ -3008,7 +3005,6 @@ DEFINE_CLASS_PROPERTY(monsterclass, S, MorphProjectile)
{
PROP_STRING_PARM(str, 0);
defaults->MonsterClass = FindClassTentative(str, RUNTIME_CLASS(AActor), bag.fromDecorate);
if (bag.fromDecorate) OptionalClassPtrs.Push(&defaults->MonsterClass);
}
//==========================================================================
@ -3036,7 +3032,6 @@ DEFINE_CLASS_PROPERTY(morphflash, S, MorphProjectile)
{
PROP_STRING_PARM(str, 0);
defaults->MorphFlash = FindClassTentative(str, RUNTIME_CLASS(AActor), bag.fromDecorate);
if (bag.fromDecorate) OptionalClassPtrs.Push(&defaults->MorphFlash);
}
//==========================================================================
@ -3046,7 +3041,6 @@ DEFINE_CLASS_PROPERTY(unmorphflash, S, MorphProjectile)
{
PROP_STRING_PARM(str, 0);
defaults->UnMorphFlash = FindClassTentative(str, RUNTIME_CLASS(AActor), bag.fromDecorate);
if (bag.fromDecorate) OptionalClassPtrs.Push(&defaults->UnMorphFlash);
}
//==========================================================================
@ -3056,7 +3050,6 @@ DEFINE_CLASS_PROPERTY(playerclass, S, PowerMorph)
{
PROP_STRING_PARM(str, 0);
defaults->PlayerClass = FindClassTentativePlayerPawn(str, bag.fromDecorate);
if (bag.fromDecorate) OptionalClassPtrs.Push((PClassActor**)&defaults->PlayerClass);
}
//==========================================================================
@ -3075,7 +3068,6 @@ DEFINE_CLASS_PROPERTY(morphflash, S, PowerMorph)
{
PROP_STRING_PARM(str, 0);
defaults->MorphFlash = FindClassTentative(str, RUNTIME_CLASS(AActor), bag.fromDecorate);
if (bag.fromDecorate) OptionalClassPtrs.Push(&defaults->MorphFlash);
}
//==========================================================================
@ -3085,7 +3077,6 @@ DEFINE_CLASS_PROPERTY(unmorphflash, S, PowerMorph)
{
PROP_STRING_PARM(str, 0);
defaults->UnMorphFlash = FindClassTentative(str, RUNTIME_CLASS(AActor), bag.fromDecorate);
if (bag.fromDecorate) OptionalClassPtrs.Push(&defaults->UnMorphFlash);
}