public static void load(Map mapData) throws IOException {
// a much simpler way than TeleNubby's
logger.info("Reading mapdata...");
DataInputStream in = new DataInputStream(new FileInputStream("data/mapdata/packed.dat"));
int useableMapdata = 0;
while(in.available() >= 20) {
int area = in.readInt();
int[] parts = new int[4];
for(int j = 0; j < 4; j++) {
parts[j] = in.readInt();
}
if(parts[0] != 0 && parts[1] != 0 && parts[2] != 0 && parts[3] != 0) {
useableMapdata++;
}
mapData.put(area, parts);
}
logger.info("Loaded mapdata.");
}
|