summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Howard2014-03-16 01:45:29 -0400
committerSimon Howard2014-03-16 01:45:29 -0400
commit9f955ea5b1f124554d58733238dff4da1d9f54c4 (patch)
treee8321f329420eed0dd49b8f540f33aab6e47febb
parent7e118463ae5ef0752ab0ae509eecfe409b82bdc3 (diff)
downloadchocolate-doom-9f955ea5b1f124554d58733238dff4da1d9f54c4.tar.gz
chocolate-doom-9f955ea5b1f124554d58733238dff4da1d9f54c4.tar.bz2
chocolate-doom-9f955ea5b1f124554d58733238dff4da1d9f54c4.zip
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.
-rw-r--r--src/heretic/p_saveg.c9
1 files changed, 7 insertions, 2 deletions
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;