Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move terrainType to AtBScenario #4050

Merged
merged 3 commits into from
May 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions MekHQ/src/mekhq/campaign/mission/AtBScenario.java
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ public abstract class AtBScenario extends Scenario implements IAtBScenario {

private Map<Integer, Integer> numPlayerMinefields;

private String terrainType;

protected final transient ResourceBundle defaultResourceBundle = ResourceBundle.getBundle("mekhq.resources.AtBScenarioBuiltIn",
MekHQ.getMHQOptions().getLocale());

Expand Down Expand Up @@ -252,6 +254,14 @@ public String getDesc() {
return getScenarioTypeDescription() + (isStandardScenario() ? (isAttacker() ? " (Attacker)" : " (Defender)") : "");
}

public String getTerrainType() {
return terrainType;
}

public void setTerrainType(String terrainType) {
this.terrainType = terrainType;
}

@Override
public boolean isStandardScenario() {
return !isSpecialScenario() && !isBigBattle();
Expand Down Expand Up @@ -1505,6 +1515,7 @@ protected void writeToXMLEnd(final PrintWriter pw, int indent) {
MHQXMLUtility.writeSimpleXMLTag(pw, indent, "deploymentDelay", deploymentDelay);
MHQXMLUtility.writeSimpleXMLTag(pw, indent, "lanceCount", lanceCount);
MHQXMLUtility.writeSimpleXMLTag(pw, indent, "rerollsRemaining", rerollsRemaining);
MHQXMLUtility.writeSimpleXMLTag(pw, indent, "terrainType", terrainType);

if (null != bigBattleAllies && !bigBattleAllies.isEmpty()) {
MHQXMLUtility.writeSimpleXMLOpenTag(pw, indent++, "bigBattleAllies");
Expand Down Expand Up @@ -1603,6 +1614,8 @@ protected void loadFieldsFromXmlNode(final Node wn, final Version version, final
lanceCount = Integer.parseInt(wn2.getTextContent());
} else if (wn2.getNodeName().equalsIgnoreCase("rerollsRemaining")) {
rerollsRemaining = Integer.parseInt(wn2.getTextContent());
} else if (wn2.getNodeName().equalsIgnoreCase("terrainType")) {
terrainType = wn2.getTextContent();
} else if (wn2.getNodeName().equalsIgnoreCase("alliesPlayer")) {
NodeList nl2 = wn2.getChildNodes();
for (int i = 0; i < nl2.getLength(); i++) {
Expand Down
13 changes: 1 addition & 12 deletions MekHQ/src/mekhq/campaign/mission/Scenario.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ public class Scenario {
private Map<String, Entity> externalIDLookup;

/** map generation variables **/
private String terrainType;
private int mapSizeX;
private int mapSizeY;
// map can be used to represent both fixed and random maps
private String map;
private boolean usingFixedMap;

Expand Down Expand Up @@ -235,10 +235,6 @@ public void setCloaked(boolean cloaked) {
this.cloaked = cloaked;
}

public String getTerrainType() {
return terrainType;
}

public int getStartingPos() {
return startingPos;
}
Expand Down Expand Up @@ -295,10 +291,6 @@ public void setStartingAnySEy(int startingAnySEy) {
this.startingAnySEy = startingAnySEy;
}

public void setTerrainType(String terrainType) {
this.terrainType = terrainType;
}

public void setBoardType(int boardType) {
this.boardType = boardType;
}
Expand Down Expand Up @@ -876,7 +868,6 @@ protected int writeToXMLBegin(final PrintWriter pw, int indent) {
MHQXMLUtility.writeSimpleXMLTag(pw, indent, "date", date);
MHQXMLUtility.writeSimpleXMLTag(pw, indent, "cloaked", isCloaked());
MHQXMLUtility.writeSimpleXMLTag(pw, indent, "boardType", boardType);
MHQXMLUtility.writeSimpleXMLTag(pw, indent, "terrainType", terrainType);
MHQXMLUtility.writeSimpleXMLTag(pw, indent, "hasTrack", hasTrack);
MHQXMLUtility.writeSimpleXMLTag(pw, indent, "usingFixedMap", isUsingFixedMap());
MHQXMLUtility.writeSimpleXMLTag(pw, indent, "mapSize", mapSizeX, mapSizeY);
Expand Down Expand Up @@ -1014,8 +1005,6 @@ public static Scenario generateInstanceFromXML(Node wn, Campaign c, Version vers
retVal.setUsingFixedMap(Boolean.parseBoolean(wn2.getTextContent().trim()));
} else if (wn2.getNodeName().equalsIgnoreCase("boardType")) {
retVal.boardType = Integer.parseInt(wn2.getTextContent());
} else if (wn2.getNodeName().equalsIgnoreCase("terrainType")) {
retVal.terrainType = wn2.getTextContent();
} else if (wn2.getNodeName().equalsIgnoreCase("hasTrack")) {
retVal.hasTrack = Boolean.parseBoolean(wn2.getTextContent());
} else if (wn2.getNodeName().equalsIgnoreCase("mapSize")) {
Expand Down
Loading