file-format: keep misc sanity checks in place

This commit is contained in:
Jason Long 2013-07-28 22:20:49 -04:00
parent 95155a579f
commit 98a2b4b007

View file

@ -1973,9 +1973,6 @@ public class Micropolis
crimeAverage = Integer.parseInt(in.getAttributeValue(null, "crimeAverage"));
pollutionAverage = Integer.parseInt(in.getAttributeValue(null, "pollutionAverage"));
gameLevel = Integer.parseInt(in.getAttributeValue(null, "gameLevel"));
if (!GameLevel.isValid(gameLevel)) {
gameLevel = 0;
}
autoBulldoze = Boolean.parseBoolean(in.getAttributeValue(null, "autoBulldoze"));
autoBudget = Boolean.parseBoolean(in.getAttributeValue(null, "autoBudget"));
autoGo = Boolean.parseBoolean(in.getAttributeValue(null, "autoGo"));
@ -1983,6 +1980,10 @@ public class Micropolis
simSpeed = Speed.valueOf(in.getAttributeValue(null, "simSpeed"));
XML_Helper.skipToEndElement(in);
if (cityTime < 0) { cityTime = 0; }
if (cityTax < 0 || cityTax > 20) { cityTax = 7; }
if (gameLevel < 0 || gameLevel > 2) { gameLevel = 0; }
resCap = false;
comCap = false;
indCap = false;