From 2bb7d49664ab36c3d1bcad9490a36bc76d6ab1cf Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Thu, 10 Jan 2019 11:15:35 +0200 Subject: [PATCH] - register interpolators on reading serialization only Interpolators were added twice when saving a game which led to a cycle in linked list and so to an infinite loop --- src/r_data/r_interpolate.cpp | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/r_data/r_interpolate.cpp b/src/r_data/r_interpolate.cpp index 4fe3ec90738..12149d0c50e 100644 --- a/src/r_data/r_interpolate.cpp +++ b/src/r_data/r_interpolate.cpp @@ -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); + } } @@ -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); + } } @@ -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); + } } //========================================================================== @@ -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); + } }