shithub: choc

Download patch

ref: 1e15f8923197e50811336bc4d323a406e0d704f0
parent: 52cee8eac843c5488cfe03fc1717dea5d2eb307c
author: Thomas A. Birkel <[email protected]>
date: Mon Oct 31 09:29:15 EDT 2016

Update branch with requested changes

Whitespace error; string-compare handling; rewording of NEWS description;
removed useless variables.

--- a/NEWS.md
+++ b/NEWS.md
@@ -52,7 +52,7 @@
 ### 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
@@ -59,7 +59,7 @@
     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
--- 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;
 
--- a/src/hexen/sv_save.c
+++ b/src/hexen/sv_save.c
@@ -2027,7 +2027,7 @@
 {
     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 @@
 
     // 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 @@
     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 @@
     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 @@
         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;