Skip to content

Commit

Permalink
- register interpolators on reading serialization only
Browse files Browse the repository at this point in the history
Interpolators were added twice when saving a game which led to a cycle in linked list and so to an infinite loop
  • Loading branch information
alexey-lysiuk committed Jan 10, 2019
1 parent f44cf00 commit 2bb7d49
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions src/r_data/r_interpolate.cpp
Expand Up @@ -535,7 +535,10 @@ void DSectorPlaneInterpolation::Serialize(FSerializer &arc)
("oldtexz", oldtexz)
("attached", attached);

sector->Level->interpolator.AddInterpolation(this);
if (arc.isReading())
{
sector->Level->interpolator.AddInterpolation(this);
}
}


Expand Down Expand Up @@ -656,7 +659,10 @@ void DSectorScrollInterpolation::Serialize(FSerializer &arc)
("oldx", oldx)
("oldy", oldy);

sector->Level->interpolator.AddInterpolation(this);
if (arc.isReading())
{
sector->Level->interpolator.AddInterpolation(this);
}
}


Expand Down Expand Up @@ -755,8 +761,10 @@ void DWallScrollInterpolation::Serialize(FSerializer &arc)
("oldx", oldx)
("oldy", oldy);

side->sector->Level->interpolator.AddInterpolation(this);

if (arc.isReading())
{
side->sector->Level->interpolator.AddInterpolation(this);
}
}

//==========================================================================
Expand Down Expand Up @@ -879,10 +887,11 @@ void DPolyobjInterpolation::Serialize(FSerializer &arc)
("oldverts", oldverts)
("oldcx", oldcx)
("oldcy", oldcy);
if (arc.isReading()) bakverts.Resize(oldverts.Size());

poly->GetLevel()->interpolator.AddInterpolation(this);

if (arc.isReading())
{
bakverts.Resize(oldverts.Size());
poly->GetLevel()->interpolator.AddInterpolation(this);
}
}


Expand Down

0 comments on commit 2bb7d49

Please sign in to comment.