Fixing SysError

This commit is contained in:
Shadow15510 2021-06-03 18:55:25 +02:00
parent cf708175e8
commit 25ca36ea50
2 changed files with 5 additions and 8 deletions

Binary file not shown.

View File

@ -15,8 +15,6 @@ void read_save(struct game *current_game)
// Sizes of data
const int planes_size = sizeof(*current_game->planes);
struct plane *planes[NB_PLANES + 1];
const int data_size = current_game->grid.width * current_game->grid.height;
uint8_t *data = current_game->grid.data;
@ -37,15 +35,14 @@ void read_save(struct game *current_game)
fd = BFile_Open(filename, BFile_ReadOnly);
BFile_Read(fd, current_game, sizeof(*current_game), 0);
BFile_Read(fd, planes, planes_size, -1);
for (int i = 0; i < NB_PLANES; i ++)
{
BFile_Read(fd, current_game->planes[i], sizeof(struct plane), -1);
}
BFile_Read(fd, data, data_size, -1);
BFile_Close(fd);
for (int i = 0; planes[i]; i ++)
{
current_game->planes[i] = planes[i];
}
current_game->grid.data = data;
}
}