From 4096939f72ff1374d0ecddde59b223d49be8d637 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 13 Mar 2008 10:06:53 +0000 Subject: [PATCH] - Fixed: Pointer substitution changed the pointers for the thinker ring list resulting in a freeze. SVN r802 (trunk) --- docs/rh-log.txt | 4 ++++ src/dthinker.cpp | 11 +++++++++++ src/dthinker.h | 3 ++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index c7d4f7c3e..20d712642 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,7 @@ +March 13, 2008 (Changes by Graf Zahl) +- Fixed: Pointer substitution changed the pointers for the thinker ring list + resulting in a freeze. + March 12, 2008 - Fixed: DACSThinker::ActiveThinker was missing a read barrier. - Loading a save game now initiates a collection. diff --git a/src/dthinker.cpp b/src/dthinker.cpp index 37ff39543..92003bb5c 100644 --- a/src/dthinker.cpp +++ b/src/dthinker.cpp @@ -435,6 +435,17 @@ void DThinker::Tick () { } +void DThinker::PointerSubstitution(DObject *old, DObject *notOld) +{ + // Pointer substitution must not, under any circumstances, change + // the linked thinker list or the game will freeze badly. + DThinker *next = NextThinker; + DThinker *prev = PrevThinker; + Super::PointerSubstitution(old, notOld); + NextThinker = next; + PrevThinker = prev; +} + FThinkerIterator::FThinkerIterator (const PClass *type, int statnum) { if ((unsigned)statnum > MAX_STATNUM) diff --git a/src/dthinker.h b/src/dthinker.h index d6611c0c7..a9fc91e72 100644 --- a/src/dthinker.h +++ b/src/dthinker.h @@ -69,7 +69,8 @@ public: virtual ~DThinker (); virtual void Tick (); virtual void PostBeginPlay (); // Called just before the first tick - + void PointerSubstitution(DObject *old, DObject *notOld); + void ChangeStatNum (int statnum); static void RunThinkers ();