Skip to content

Commit

Permalink
Proposed fix for MegaMek#2873 - saving the part new flag correctly
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
HoneySkull committed Sep 13, 2021
1 parent e5ba0c6 commit 73bfece
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions MekHQ/src/mekhq/campaign/parts/Part.java
Original file line number Diff line number Diff line change
Expand Up @@ -681,10 +681,12 @@ protected void writeToXmlBegin(PrintWriter pw1, int indent) {
.append("</daysToArrival>")
.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("<brandNew>")
.append(true)
.append(false)
.append("</brandNew>")
.append(NL);
}
Expand Down

0 comments on commit 73bfece

Please sign in to comment.