file-format: throw an exception if an unrecognized tile id is seen

This commit is contained in:
Jason Long 2013-12-12 14:51:52 -05:00
parent 71790c078f
commit 9b769d17b3

View file

@ -2162,11 +2162,24 @@ public class Micropolis
String [] s_parts = tmp.get(i).split(":");
TileSpec t = Tiles.load(s_parts[0]);
if (t == null) {
throw new XMLStreamException(
"Unrecognized tile '"+s_parts[0]+"' at map coordinates ("+i+","+mapList.size()+")",
in.getLocation()
);
}
int z = t.tileNumber;
for (int j = 1; j < s_parts.length; j++) {
if (s_parts[j].equals("pwr")) {
z |= PWRBIT;
}
else {
throw new XMLStreamException(
"Unrecognized tile modifier '"+s_parts[j]+"' at map coordinates ("+i+","+mapList.size()+")",
in.getLocation()
);
}
}
row[i] = (char)z;
}