From 250f37492fe9e9b02cea843dcfdb82e697fecfe8 Mon Sep 17 00:00:00 2001 From: Bas Slats Date: Sat, 15 Aug 2026 13:05:52 -0500 Subject: [PATCH] bugfix(ai): Fix AICommandParmsStorage::doXfer to transfer the command source --- Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp | 8 +++++++- .../Code/GameEngine/Source/GameLogic/AI/AIStates.cpp | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp b/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp index 385ae65a089..0698bd3e33c 100644 --- a/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp +++ b/Generals/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp @@ -126,7 +126,13 @@ void AICommandParmsStorage::reconstitute(AICommandParms& parms) const void AICommandParmsStorage::doXfer(Xfer *xfer) { xfer->xferUser(&m_cmd, sizeof(m_cmd)); - xfer->xferUser(&m_cmd, sizeof(m_cmdSource)); + // TheSuperHackers @bugfix Transfer the command source instead of the command twice. + xfer->xferUser(&m_cmdSource, sizeof(m_cmdSource)); + if (xfer->getXferMode() == XFER_LOAD && (m_cmdSource < CMD_FROM_PLAYER || m_cmdSource >= COMMAND_SOURCE_TYPE_COUNT)) + { + // TheSuperHackers @info Saves from before this fix contain a copy of the command in the command source slot. + m_cmdSource = CMD_FROM_AI; + } xfer->xferCoord3D(&m_pos); xfer->xferObjectID(&m_obj); xfer->xferObjectID(&m_otherObj); diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp index 93474df91f7..063b2a2979a 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIStates.cpp @@ -129,7 +129,13 @@ void AICommandParmsStorage::reconstitute(AICommandParms& parms) const void AICommandParmsStorage::doXfer(Xfer *xfer) { xfer->xferUser(&m_cmd, sizeof(m_cmd)); - xfer->xferUser(&m_cmd, sizeof(m_cmdSource)); + // TheSuperHackers @bugfix Transfer the command source instead of the command twice. + xfer->xferUser(&m_cmdSource, sizeof(m_cmdSource)); + if (xfer->getXferMode() == XFER_LOAD && (m_cmdSource < CMD_FROM_PLAYER || m_cmdSource >= COMMAND_SOURCE_TYPE_COUNT)) + { + // TheSuperHackers @info Saves from before this fix contain a copy of the command in the command source slot. + m_cmdSource = CMD_FROM_AI; + } xfer->xferCoord3D(&m_pos); xfer->xferObjectID(&m_obj); xfer->xferObjectID(&m_otherObj);