From 73bfece5ec4e3f13c61133eee80675283710accd Mon Sep 17 00:00:00 2001 From: Eric Gruetzmacher Date: Mon, 13 Sep 2021 16:17:33 -0500 Subject: [PATCH] Proposed fix for #2873 - saving the part new flag correctly When saving the parts list for GM added units, the tag is only saved when the 'brandNew' property is TRUE and leave the tag out if the property is FALSE. Because the default constructor sets the property to TRUE, false values re never saved and loaded. --- MekHQ/src/mekhq/campaign/parts/Part.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/MekHQ/src/mekhq/campaign/parts/Part.java b/MekHQ/src/mekhq/campaign/parts/Part.java index fe8ca36ec7..899c6ed130 100644 --- a/MekHQ/src/mekhq/campaign/parts/Part.java +++ b/MekHQ/src/mekhq/campaign/parts/Part.java @@ -681,10 +681,12 @@ protected void writeToXmlBegin(PrintWriter pw1, int indent) { .append("") .append(NL); } - if (brandNew) { + if (!brandNew) { + //The default value for Part.brandNew is true. Only store the tag if the value is false. + //The lack of tag in the save file will ALWAYS result in TRUE. builder.append(level1) .append("") - .append(true) + .append(false) .append("") .append(NL); }