Skip to content

Commit

Permalink
Merge pull request #6011 from IllianiCBT/copyrightProject_portraitHan…
Browse files Browse the repository at this point in the history
…dlers

Added Post-Name Change Compatibility Handlers to AbstractIcon.java
  • Loading branch information
IllianiCBT authored Sep 17, 2024
2 parents 052e193 + 301153e commit 4315a7d
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions megamek/src/megamek/common/icons/AbstractIcon.java
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,29 @@ public void parseNodes(final NodeList nl) {
}
}

protected void parseNode(final Node wn) {
switch (wn.getNodeName()) {
/**
* Parses a given node and performs actions based on the node name.
*
* @param workingNode The node to parse
*/
protected void parseNode(final Node workingNode) {
switch (workingNode.getNodeName()) {
case "category":
setCategory(MMXMLUtility.unEscape(wn.getTextContent().trim()));
// setCategory(MMXMLUtility.unEscape(workingNode.getTextContent().trim()));

//start <50.01 compatibility handlers, the above-commented code can be uncommented
// when the below handlers are removed
String category = MMXMLUtility.unEscape(workingNode.getTextContent().trim());
category = category.replaceAll("Aero ", "Aerospace ");
category = category.replaceAll("Mech ", "Mek ");
category = category.replaceAll("MechWarrior", "MekWarrior");
category = category.replaceAll("ProtoMech", "ProtoMek");

setCategory(category);
//end <50.01 compatibility handlers
break;
case "filename":
setFilename(MMXMLUtility.unEscape(wn.getTextContent().trim()));
setFilename(MMXMLUtility.unEscape(workingNode.getTextContent().trim()));
break;
default:
break;
Expand All @@ -240,8 +256,7 @@ public boolean equals(final @Nullable Object other) {
return false;
} else if (this == other) {
return true;
} else if (other instanceof AbstractIcon) {
final AbstractIcon dOther = (AbstractIcon) other;
} else if (other instanceof AbstractIcon dOther) {
return dOther.getCategory().equals(getCategory()) && dOther.getFilename().equals(getFilename());
} else {
return false;
Expand Down

0 comments on commit 4315a7d

Please sign in to comment.