# HG changeset patch # User John "Elwin" Edwards # Date 1620006851 14400 # Node ID 11aeff9acc0723fc21f4aa7e5cfd287512e25252 # Parent 13b482bd9e6627eab39b84e16e947de98ec721c5 Advanced Rogue 7: ignore file locations in the save file when restoring. The variables file_name, score_file, and home are no longer overwritten with the values stored in the save file. Those values could be inaccurate if the files have been moved or configuration has changed. diff -r 13b482bd9e66 -r 11aeff9acc07 arogue7/state.c --- a/arogue7/state.c Sat May 01 09:51:30 2021 -0400 +++ b/arogue7/state.c Sun May 02 21:54:11 2021 -0400 @@ -2511,6 +2511,7 @@ rs_save_file(FILE *savef) { int i; + char temp_buf[LINELEN]; if (write_error) return(WRITESTAT); @@ -2583,9 +2584,17 @@ rs_write_misc(savef); rs_write(savef,whoami,LINELEN); rs_write(savef,huh,LINELEN); - rs_write(savef,file_name,LINELEN); - rs_write(savef,score_file,LINELEN); - rs_write(savef,home,LINELEN); + /* These path names are no longer used when restoring. They are only + * written here for compatibility. */ + strncpy(temp_buf, file_name, LINELEN); + temp_buf[LINELEN-1] = '\0'; + rs_write(savef, temp_buf, LINELEN); + strncpy(temp_buf, score_file, LINELEN); + temp_buf[LINELEN-1] = '\0'; + rs_write(savef, temp_buf, LINELEN); + strncpy(temp_buf, home, LINELEN); + temp_buf[LINELEN-1] = '\0'; + rs_write(savef, temp_buf, LINELEN); rs_write_window(savef, cw); rs_write_window(savef, hw); rs_write_window(savef, mw); @@ -2638,6 +2647,7 @@ rs_restore_file(FILE *inf) { int i; + char unused_buf[LINELEN]; if (read_error || format_error) return(READSTAT); @@ -2715,9 +2725,10 @@ rs_read_misc(inf); rs_read(inf,whoami,LINELEN); rs_read(inf,huh,LINELEN); - rs_read(inf,file_name,LINELEN); - rs_read(inf,score_file,LINELEN); - rs_read(inf,home,LINELEN); + /* These three path names are now ignored. */ + rs_read(inf, unused_buf, LINELEN); /* file_name */ + rs_read(inf, unused_buf, LINELEN); /* score_file */ + rs_read(inf, unused_buf, LINELEN); /* home */ rs_read_window(inf, cw); rs_read_window(inf, hw); rs_read_window(inf, mw);