Mercurial > hg > early-roguelike
comparison rogue5/state.c @ 124:d10fc4a065ac
rogue5: ignore the file name stored in the save file.
state.c had put file_name into the save file.  The saved value was used
to overwrite file_name on restore.  If the save file had been renamed,
unlink(file_name) would then fail, because file_name held the old name.
To avoid breaking savefile compatibility, file_name is still saved, but
it is read back into a temporary buffer and then ignored.
I thought I fixed this already.
| author | John "Elwin" Edwards | 
|---|---|
| date | Fri, 16 Jan 2015 13:42:30 -0500 | 
| parents | 7f8f43943b1f | 
| children | 696277507a2e | 
   comparison
  equal
  deleted
  inserted
  replaced
| 123:8dd4b06a9155 | 124:d10fc4a065ac | 
|---|---|
| 1387 } | 1387 } | 
| 1388 | 1388 | 
| 1389 int | 1389 int | 
| 1390 rs_restore_file(FILE *savef) | 1390 rs_restore_file(FILE *savef) | 
| 1391 { | 1391 { | 
| 1392 char fake_file_name[MAXSTR]; | |
| 1392 THING *mitem; | 1393 THING *mitem; | 
| 1393 encclearerr(); | 1394 encclearerr(); | 
| 1394 | 1395 | 
| 1395 rs_read_int(savef, &noscore); | 1396 rs_read_int(savef, &noscore); | 
| 1396 rs_read_int(savef, &seenstairs); | 1397 rs_read_int(savef, &seenstairs); | 
| 1400 rs_read_int(savef, &passgo); | 1401 rs_read_int(savef, &passgo); | 
| 1401 rs_read_int(savef, &see_floor); | 1402 rs_read_int(savef, &see_floor); | 
| 1402 rs_read_int(savef, &terse); | 1403 rs_read_int(savef, &terse); | 
| 1403 rs_read_int(savef, &tombstone); | 1404 rs_read_int(savef, &tombstone); | 
| 1404 rs_read_ints(savef, pack_used, 26); | 1405 rs_read_ints(savef, pack_used, 26); | 
| 1405 rs_read_chars(savef, file_name, MAXSTR); | 1406 rs_read_chars(savef, fake_file_name, MAXSTR); | 
| 1406 rs_read_chars(savef, huh, MAXSTR); | 1407 rs_read_chars(savef, huh, MAXSTR); | 
| 1407 rs_read_potions(savef); | 1408 rs_read_potions(savef); | 
| 1408 rs_read_rings(savef); | 1409 rs_read_rings(savef); | 
| 1409 rs_read_scrolls(savef); | 1410 rs_read_scrolls(savef); | 
| 1410 rs_read_chars(savef, whoami, MAXSTR); | 1411 rs_read_chars(savef, whoami, MAXSTR); | 
