UFO: Alien Invasion Issue Tracker
UFO: Alien Invasion
Go to the previous open issue
Go to the previous issue (open or closed)
star_faded.png
Please log in to bookmark issues
icon_project.png UFO: Alien Invasion / Closed Bug report #5749 Transferred antimatter disappears on save - load cycles
Go to the next issue (open or closed)
Go to the next open issue
This issue has been closed with status "Closed" and resolution "RESOLVED".
Issue basics
  • Type of issue
    Bug report
  • Category
    Not determined
  • Targetted for
    Not determined
  • Status
    Closed
  • Progress
  • Priority
    Not determined
User pain
  • Type of bug
    Not triaged
  • Likelihood
    Not triaged
  • Effect
    Not triaged
Affected by this issue (1)
People involved
Times and dates
  • Posted at
  • Last updated
  • Estimated time
    Not estimated
Issue details
  • Resolution
    RESOLVED
  • Reproducability
    Not determined
  • Severity
    Not determined
  • Complexity
    Not determined
  • Platform
    Not determined
  • Architecture
    Not determined
Attachments (0)
There is nothing attached to this issue
Duplicate issues (0)
This issue does not have any duplicates
Description
Antimatter currently in transfer between bases is not reloaded after a save - shut down - reload cycle. This patch seems to work (looks like someone forgot it):

diff --git a/src/client/cgame/campaign/cp_transfer.cpp b/src/client/cgame/campaign/cp_transfer.cpp
index 47b33123cc..5441056c4c 100644
--- a/src/client/cgame/campaign/cp_transfer.cpp
+++ b/src/client/cgame/campaign/cp_transfer.cpp
@@ -433,7 +433,10 @@ bool TR_SaveXML (xmlNode_t* p)
 			cgi->XML_AddInt(s, SAVE_TRANSFER_SRCBASE, transfer->srcBase->idx);
 		/* save antimatter */
 		if (transfer->antimatter > 0) {
-
+			xmlNode_t* itemNode = cgi->XML_AddNode(s, SAVE_TRANSFER_ANTIMATTER);
+			if (!itemNode)
+				return false;
+			cgi->XML_AddInt(itemNode, SAVE_TRANSFER_ANTIMATTER_AMOUNT, transfer->antimatter);
 		}
 		/* save items */
 		if (transfer->itemCargo != nullptr) {
@@ -502,6 +505,12 @@ bool TR_LoadXML (xmlNode_t* p)
 		/* Initializing some variables */
 		transfer.hasEmployees = false;
 
+		/* load antimatter */
+		ss = cgi->XML_GetNode(s, SAVE_TRANSFER_ANTIMATTER);
+		if (ss) {
+			const int amount = cgi->XML_GetInt(ss, SAVE_TRANSFER_ANTIMATTER_AMOUNT, 0);
+			transfer.antimatter = amount;
+		}
 		/* load items */
 		ss = cgi->XML_GetNode(s, SAVE_TRANSFER_ITEMCARGO);
 		if (ss) {
diff --git a/src/client/cgame/campaign/save/save_transfer.h b/src/client/cgame/campaign/save/save_transfer.h
index 93d5a29e67..3aabc7a1dc 100644
--- a/src/client/cgame/campaign/save/save_transfer.h
+++ b/src/client/cgame/campaign/save/save_transfer.h
@@ -45,6 +45,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #define SAVE_TRANSFER_AIRCRAFT "aircraft"
 #define SAVE_TRANSFER_ID "id"
 
+#define SAVE_TRANSFER_ANTIMATTER "antimatter"
+#define SAVE_TRANSFER_ANTIMATTER_AMOUNT "amount"
+
 /*
 DTD:
Steps to reproduce this issue
Nothing entered.
Todos (0 / 0)
Issue created
footer_logo.png The Bug Genie 4.3.1 | Support | Feedback spinning_16.gif