foxygit / doom Log in
commit 1e15f8923197e50811336bc4d323a406e0d704f0
Author:     Thomas A. Birkel <capnclever@gmail.com>
AuthorDate: Mon Oct 31 13:29:15 2016 -0400
Commit:     Thomas A. Birkel <capnclever@gmail.com>
CommitDate: Mon Oct 31 13:29:15 2016 -0400

    Update branch with requested changes

    Whitespace error; string-compare handling; rewording of NEWS description;
    removed useless variables.
---
 NEWS.md               |  4 ++--
 src/heretic/p_saveg.c |  4 ----
 src/hexen/sv_save.c   | 14 +++++++-------
 3 files changed, 9 insertions(+), 13 deletions(-)

diff --git a/NEWS.md b/NEWS.md
index aa36c942..dddf5105 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -52,14 +52,14 @@
 ### Heretic
   * Added map names for Episode 6, fixing a crash after completing a
     level in this episode. (thanks J.Benaim)
-  * Add unlimited demo/savegame support. (thanks CapnClever)
+  * Added unlimited demo/savegame support. (thanks CapnClever)

 ### Hexen
   * The MRJONES cheat code returns an identical string as vanilla, and
     enables fully reproducable builds. (thanks Fabian)
   * Fixed an issue where the game crashed while killing the
     Wraithverge in 64-bit builds. (thanks J.Benaim)
-  * Add unlimited demo/savegame support. (thanks CapnClever)
+  * Added unlimited demo/savegame support. (thanks CapnClever)

 ### Strife
   * Support added for automatic loading of the IWAD from the GOG.com
diff --git a/src/heretic/p_saveg.c b/src/heretic/p_saveg.c
index e21e6689..8f33b316 100644
--- a/src/heretic/p_saveg.c
+++ b/src/heretic/p_saveg.c
@@ -25,11 +25,7 @@
 #include "p_local.h"
 #include "v_video.h"

-#define SVG_RAM 0
-#define SVG_FILE 1
-
 static FILE *SaveGameFP;
-static byte *savebuffer, *save_p;

 int vanilla_savegame_limit = 1;

diff --git a/src/hexen/sv_save.c b/src/hexen/sv_save.c
index a8df4d90..b433292a 100644
--- a/src/hexen/sv_save.c
+++ b/src/hexen/sv_save.c
@@ -2027,7 +2027,7 @@ void SV_LoadGame(int slot)
 {
     int i;
     char fileName[100];
-    char version_text[16];
+    char version_text[HXS_VERSION_TEXT_LENGTH];
     player_t playerBackup[MAXPLAYERS];
     mobj_t *mobj;

@@ -2049,11 +2049,11 @@ void SV_LoadGame(int slot)

     // Check the version text

-    for (i = 0; i < 16; ++i)
+    for (i = 0; i < sizeof(version_text); ++i)
     {
         version_text[i] = SV_ReadByte();
     }
-    if (strcmp(version_text, HXS_VERSION_TEXT) != 0)
+    if (strncmp(version_text, HXS_VERSION_TEXT, HXS_VERSION_TEXT_LENGTH) != 0)
     {                           // Bad version
         return;
     }
@@ -3262,7 +3262,7 @@ static void CopyFile(char *source_name, char *dest_name)
     read_handle = fopen(source_name, "rb");
     if (read_handle == NULL)
     {
-	    I_Error ("Couldn't read file %s", source_name);
+        I_Error ("Couldn't read file %s", source_name);
     }
     file_length = file_remaining = M_FileLength(read_handle);

@@ -3281,7 +3281,7 @@ static void CopyFile(char *source_name, char *dest_name)
     write_handle = fopen(dest_name, "wb");
     if (write_handle == NULL)
     {
-	    I_Error ("Couldn't read file %s", dest_name);
+        I_Error ("Couldn't read file %s", dest_name);
     }

     buffer = Z_Malloc (BUFFER_CHUNK_SIZE, PU_STATIC, NULL);
@@ -3297,12 +3297,12 @@ static void CopyFile(char *source_name, char *dest_name)
         read_count = fread(buffer, 1, buf_count, read_handle);
         if (read_count < buf_count)
         {
-	        I_Error ("Couldn't read file %s", source_name);
+            I_Error ("Couldn't read file %s", source_name);
         }
         write_count = fwrite(buffer, 1, buf_count, write_handle);
         if (read_count < buf_count)
         {
-	        I_Error ("Couldn't read file %s", dest_name);
+            I_Error ("Couldn't read file %s", dest_name);
         }

         file_remaining -= buf_count;