From 436d8edbb83fd51dd75563d608b5d592f9eecece Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Wed, 23 Oct 2013 00:40:09 +0000 Subject: When loading Heretic savegames, NULL out certain special values which hold pointers to other mobj_t objects that will no longer be valid. Subversion-branch: /branches/v2-branch Subversion-revision: 2718 --- src/heretic/p_saveg.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src') diff --git a/src/heretic/p_saveg.c b/src/heretic/p_saveg.c index 195f36a4..e0983f8c 100644 --- a/src/heretic/p_saveg.c +++ b/src/heretic/p_saveg.c @@ -879,6 +879,32 @@ static void saveg_read_mobj_t(mobj_t *str) // specialval_t special2; saveg_read_specialval_t(&str->special2); + // Now we have a bunch of hacks to try to NULL out special values + // where special[12] contained a mobj_t pointer that isn't valid + // any more. This isn't in Vanilla but at least it stops the game + // from crashing. + + switch (str->type) + { + // Gas pods use special2.m to point to the pod generator + // that made it. + case MT_POD: + str->special2.m = NULL; + break; + + // Several thing types use special1.m to mean 'target': + case MT_MACEFX4: // A_DeathBallImpact + case MT_WHIRLWIND: // A_WhirlwindSeek + case MT_MUMMYFX1: // A_MummyFX1Seek + case MT_HORNRODFX2: // A_SkullRodPL2Seek + case MT_PHOENIXFX1: // A_PhoenixPuff + str->special1.m = NULL; + break; + + default: + break; + } + // int health; str->health = SV_ReadLong(); -- cgit v1.2.3