file-format: fix to load files generated by simcity classic

Warning- loading and then saving such a file will probably cause
the file to be unreadable to simcity classic

git-svn-id: https://micropolis.googlecode.com/svn/trunk/micropolis-java@606 d9718cc8-9f43-0410-858b-315f434eb58c
This commit is contained in:
jason@long.name 2013-04-07 00:15:13 +00:00
parent 1bbc20487f
commit 7e52c97246

View file

@ -2029,7 +2029,17 @@ public class Micropolis
public void load(File filename)
throws IOException
{
load(new FileInputStream(filename));
FileInputStream fis = new FileInputStream(filename);
if (fis.getChannel().size() > 27120) {
// some editions of the classic Simcity game
// start the file off with a 128-byte header,
// but otherwise use the same format as us,
// so read in that 128-byte header and continue
// as before.
byte [] bbHeader = new byte[128];
fis.read(bbHeader);
}
load(fis);
}
void checkPowerMap()