FIX BUG: FileManager

Problème de lecture
This commit is contained in:
Lyanis SOUIDI 2023-04-28 15:44:56 +02:00
parent fc9046b898
commit e2a5d20014
Signed by: Lyanis SOUIDI
GPG Key ID: 251ADD56CFE6A854

View File

@ -1,7 +1,7 @@
import java.io.*; import java.io.*;
/** /**
* Class to manage file import/export * Class to manage file import/export
* @version 1.0 * @version 1.1
* @author Amir Daouadi * @author Amir Daouadi
* @author Lyanis Souidi * @author Lyanis Souidi
*/ */
@ -18,16 +18,16 @@ public class FileManager {
FileInputStream fs = new FileInputStream(file); FileInputStream fs = new FileInputStream(file);
DataInputStream ds = new DataInputStream(fs); DataInputStream ds = new DataInputStream(fs);
try { try {
grid = new Grid(ds.readByte()); grid = new Grid(ds.read());
grid.getThesee().setSquare(grid.getSquare(ds.readByte(), ds.readByte())); grid.getThesee().setSquare(grid.getSquare(ds.read(), ds.read()));
grid.getSquare(ds.readByte(), ds.readByte()).setExit(); grid.getSquare(ds.read(), ds.read()).setExit();
int bit = 8; int bit = 8;
byte value = 0; int value = 0;
for (int i = 0; i < grid.getSize(); i++) { for (int i = 0; i < grid.getSize(); i++) {
for (int j = 0; j < grid.getSize(); j++) { for (int j = 0; j < grid.getSize(); j++) {
if (bit == 8) { if (bit == 8) {
value = ds.readByte(); value = ds.read();
bit = 0; bit = 0;
} }
if (((value >> (7 - bit)) & 1) == 1) grid.getSquare(j, i).setWall(); if (((value >> (7 - bit)) & 1) == 1) grid.getSquare(j, i).setWall();