From ff8cea673e3a5bed51147beba39a5c0b5061e163 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Sun, 24 Sep 2023 17:21:17 +1000 Subject: [PATCH] - Duke: Ensure `player_struct` Serialiser only attempts to set variables when reading, not unconditionally. --- source/games/duke/src/savegame.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/source/games/duke/src/savegame.cpp b/source/games/duke/src/savegame.cpp index ba8e8fd71..6620277df 100644 --- a/source/games/duke/src/savegame.cpp +++ b/source/games/duke/src/savegame.cpp @@ -271,11 +271,14 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, player_struct& w, ("fistsign", w.fistsign) .EndObject(); - w.invdisptime = 0; - w.GetActor()->backuploc(); - w.opyoff = w.pyoff; - w.backupweapon(); - w.sync.actions &= SB_CENTERVIEW|SB_CROUCH; // these are the only bits we need to preserve. + if (arc.isReading()) + { + w.invdisptime = 0; + w.GetActor()->backuploc(); + w.opyoff = w.pyoff; + w.backupweapon(); + w.sync.actions &= SB_CENTERVIEW|SB_CROUCH; // these are the only bits we need to preserve. + } } return arc; }