foxygit / doom Log in
commit 8f00200a9795697a7a432ab93ff059281c6ed87d
Author:     James Haley <haleyjd@hotmail.com>
AuthorDate: Sun Jul 15 09:35:45 2012 +0000
Commit:     James Haley <haleyjd@hotmail.com>
CommitDate: Sun Jul 15 09:35:45 2012 +0000

    Fix problem with uninitialized values in the settings structure which
    surfaces during debug builds under MSVC. ATTN fraggle: review other
    games' code for similar problems.

    Subversion-branch: /branches/v2-branch
    Subversion-revision: 2515
---
 src/hexen/d_net.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/hexen/d_net.c b/src/hexen/d_net.c
index 9b26af31..0fe5ed1e 100644
--- a/src/hexen/d_net.c
+++ b/src/hexen/d_net.c
@@ -155,6 +155,11 @@ static void SaveGameSettings(net_gamesettings_t *settings,
 {
     int i;

+    // jhaley 20120715: Some parts of the structure are being left
+    // uninitialized. If -class is not used on the command line, this
+    // can lead to a crash in SB_Init due to player class == 0xCCCCCCCC.
+    memset(settings, 0, sizeof(*settings));
+
     // Fill in game settings structure with appropriate parameters
     // for the new game