- avoid double linking to and unlinking from the world for actors.

Some people apparently have to toy around with the engine's innards without fully understanding them. :(
When properly used the saveguards should never be triggered.
This commit is contained in:
Christoph Oelckers 2020-09-26 19:09:00 +02:00
commit 8fc9f1e5ef
3 changed files with 15 additions and 1 deletions

View file

@ -286,6 +286,12 @@ void P_LineOpening (FLineOpening &open, AActor *actor, const line_t *linedef, co
void AActor::UnlinkFromWorld (FLinkContext *ctx)
{
if (ctx != nullptr) ctx->sector_list = nullptr;
if (!(flags8 & MF8_LINKEDTOWORLD))
{
//assert(false);
return;
}
flags8 &= ~MF8_LINKEDTOWORLD;
if (!(flags & MF_NOSECTOR))
{
// invisible things don't need to be in sector list
@ -443,6 +449,12 @@ bool AActor::FixMapthingPos()
void AActor::LinkToWorld(FLinkContext *ctx, bool spawningmapthing, sector_t *sector)
{
if (flags8 & MF8_LINKEDTOWORLD)
{
//assert(false);
return;
}
bool spawning = spawningmapthing;
if (spawning)
@ -468,6 +480,7 @@ void AActor::LinkToWorld(FLinkContext *ctx, bool spawningmapthing, sector_t *sec
Sector = sector;
subsector = Level->PointInRenderSubsector(Pos()); // this is from the rendering nodes, not the gameplay nodes!
section = subsector->section;
flags8 |= MF8_LINKEDTOWORLD;
if (!(flags & MF_NOSECTOR))
{