From 9f955ea5b1f124554d58733238dff4da1d9f54c4 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sun, 16 Mar 2014 01:45:29 -0400 Subject: heretic: Fix plat_t read when loading savegames. The fix-up of the thinker function was (unnecessarily) guarded by an if() condition that meant it was not being reset properly on load. This caused moving platforms to be not restored properly when loading savegames. Fixes #343. Thanks to romeroyakovlev for the bug report. --- src/heretic/p_saveg.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/heretic/p_saveg.c') diff --git a/src/heretic/p_saveg.c b/src/heretic/p_saveg.c index e0983f8c..a7ca3be0 100644 --- a/src/heretic/p_saveg.c +++ b/src/heretic/p_saveg.c @@ -1889,8 +1889,13 @@ void P_UnArchiveSpecials(void) plat = Z_Malloc(sizeof(*plat), PU_LEVEL, NULL); saveg_read_plat_t(plat); plat->sector->specialdata = T_PlatRaise; - if (plat->thinker.function) - plat->thinker.function = T_PlatRaise; + // In the original Heretic code this was a conditional "fix" + // of the thinker function, but the save code (above) decides + // whether to save a T_PlatRaise based on thinker function + // anyway, so it can't be NULL. Having the conditional causes + // a bug, as our saveg_read_thinker_t sets these to NULL. + // if (plat->thinker.function) + plat->thinker.function = T_PlatRaise; P_AddThinker(&plat->thinker); P_AddActivePlat(plat); break; -- cgit v1.2.3