diff srogue/save.c @ 82:f11eeafc6568

srogue: don't store machine-dependent metadata in the savefile. Super-Rogue, like Rogue V4, stored data of machine-dependent length in the savefile, to prevent cheating. This made saved games non-portable. Also deleted was a check that used this data, and prevented restoring savefiles from backup. This change BREAKS SAVEFILE COMPATIBILITY, but old files can be converted by removing the block at offset 0x1e with length sizeof(ino_t) + sizeof(dev_t) + 2 * sizeof(time_t). That seems to be 0x14 on i686 and 0x20 on x86_64.
author John "Elwin" Edwards
date Tue, 06 Aug 2013 19:02:58 -0700
parents 3aa87373c908
children d852b8f088c5
line wrap: on
line diff
--- a/srogue/save.c	Mon Aug 05 20:49:41 2013 -0700
+++ b/srogue/save.c	Tue Aug 06 19:02:58 2013 -0700
@@ -186,10 +186,6 @@
 	write(fnum, "RDK", 4);
 	lseek(fnum, 0L, 0);
 	encwrite(version,strlen(version)+1,savef);
-	encwrite(&sbuf.st_ino,sizeof(sbuf.st_ino),savef);
-	encwrite(&sbuf.st_dev,sizeof(sbuf.st_dev),savef);
-	encwrite(&sbuf.st_ctime,sizeof(sbuf.st_ctime),savef);
-	encwrite(&sbuf.st_mtime,sizeof(sbuf.st_mtime),savef);
 	encwrite(&slines,sizeof(slines),savef);
 	encwrite(&scols,sizeof(scols),savef);
 	msg("");
@@ -238,10 +234,6 @@
 
 	fstat(inf, &sbuf2);
 
-	encread(&sbuf.st_ino,sizeof(sbuf.st_ino), inf);
-	encread(&sbuf.st_dev,sizeof(sbuf.st_dev), inf);
-	encread(&sbuf.st_ctime,sizeof(sbuf.st_ctime), inf);
-	encread(&sbuf.st_mtime,sizeof(sbuf.st_mtime), inf);
 	encread(&slines,sizeof(slines),inf);
 	encread(&scols,sizeof(scols),inf);
 
@@ -250,14 +242,6 @@
 	 * inode for as long as possible
 	 */
 
-	if (!wizard)
-	{
-		if(sbuf2.st_ino!=sbuf.st_ino || sbuf2.st_dev!=sbuf.st_dev) {
-			printf("Sorry, saved game is not in the same file.\n");
-			return FALSE;
-		}
-	}
-
 #ifdef __INTERIX
 	setenv("TERM","interix");
 #endif