Fix automap save bug in large levels

This commit is contained in:
Kp 2012-11-25 02:38:50 +00:00
parent eac771f01e
commit 2ef100dafd

View file

@ -1052,8 +1052,7 @@ int state_save_all_sub(char *filename, char *desc)
// Save the automap visited info
if ( Highest_segment_index+1 > MAX_SEGMENTS_ORIGINAL )
{
for ( i = 0; i <= Highest_segment_index; i++ )
PHYSFS_write(fp, Automap_visited, sizeof(ubyte), 1);
PHYSFS_write(fp, Automap_visited, sizeof(ubyte), Highest_segment_index + 1);
}
else
PHYSFS_write(fp, Automap_visited, sizeof(ubyte), MAX_SEGMENTS_ORIGINAL);
@ -1507,8 +1506,7 @@ int state_restore_all_sub(char *filename, int secret_restore)
if ( Highest_segment_index+1 > MAX_SEGMENTS_ORIGINAL )
{
memset(&Automap_visited, 0, MAX_SEGMENTS);
for ( i = 0; i <= Highest_segment_index; i++ )
PHYSFS_read(fp, Automap_visited, sizeof(ubyte), 1);
PHYSFS_read(fp, Automap_visited, sizeof(ubyte), Highest_segment_index + 1);
}
else
PHYSFS_read(fp, Automap_visited, sizeof(ubyte), MAX_SEGMENTS_ORIGINAL);