foxygit / doom Log in
commit e17b104d1bcb6dc1fdc4dc99ca202fd693955dfc
Author:     Russell Rice <rtc_marine@hotmail.com>
AuthorDate: Wed Sep 20 06:08:37 2006 +0000
Commit:     Russell Rice <rtc_marine@hotmail.com>
CommitDate: Wed Sep 20 06:08:37 2006 +0000

    add extra defines when building
    don't crash if numlumps = 0 (which is caused when an iwad has an invalid path)

    Subversion-branch: /trunk/chocolate-doom
    Subversion-revision: 629
---
 codeblocks/chocolate-doom.cbp |  3 +++
 src/w_wad.c                   | 28 +++++++++++++++-------------
 2 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/codeblocks/chocolate-doom.cbp b/codeblocks/chocolate-doom.cbp
index efe6ccd0..1f330572 100644
--- a/codeblocks/chocolate-doom.cbp
+++ b/codeblocks/chocolate-doom.cbp
@@ -15,6 +15,7 @@
 				<Option type="1" />
 				<Option compiler="gcc" />
 				<Option use_console_runner="0" />
+				<Option parameters="-iwad d:\russell\games\doom2\iwad\doom2.wad" />
 				<Compiler>
 					<Add option="-W" />
 					<Add option="-g" />
@@ -40,6 +41,8 @@
 		</VirtualTargets>
 		<Compiler>
 			<Add option="-DFEATURE_MULTIPLAYER" />
+			<Add option="-DFEATURE_DEHACKED" />
+			<Add option="-DFEATURE_WAD_MERGE" />
 			<Add directory="..\textscreen" />
 			<Add directory="..\msvc" />
 			<Add directory="..\src" />
diff --git a/src/w_wad.c b/src/w_wad.c
index 61827c34..a0b103ae 100644
--- a/src/w_wad.c
+++ b/src/w_wad.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*-
 //-----------------------------------------------------------------------------
 //
-// $Id: w_wad.c 596 2006-09-02 19:10:07Z fraggle $
+// $Id: w_wad.c 629 2006-09-20 06:08:37Z rtc_marine $
 //
 // Copyright(C) 1993-1996 Id Software, Inc.
 // Copyright(C) 2005 Simon Howard
@@ -66,7 +66,7 @@


 static const char
-rcsid[] = "$Id: w_wad.c 596 2006-09-02 19:10:07Z fraggle $";
+rcsid[] = "$Id: w_wad.c 629 2006-09-20 06:08:37Z rtc_marine $";


 #include <ctype.h>
@@ -595,21 +595,23 @@ void W_GenerateHashTable(void)
     }

     // Generate hash table
+    if (numlumps > 0)
+        {
+            lumphash = Z_Malloc(sizeof(lumpinfo_t *) * numlumps, PU_STATIC, NULL);
+            memset(lumphash, 0, sizeof(lumpinfo_t *) * numlumps);

-    lumphash = Z_Malloc(sizeof(lumpinfo_t *) * numlumps, PU_STATIC, NULL);
-    memset(lumphash, 0, sizeof(lumpinfo_t *) * numlumps);
-
-    for (i=0; i<numlumps; ++i)
-    {
-        unsigned int hash;
+            for (i=0; i<numlumps; ++i)
+            {
+                unsigned int hash;

-        hash = W_LumpNameHash(lumpinfo[i].name) % numlumps;
+                hash = W_LumpNameHash(lumpinfo[i].name) % numlumps;

-        // Hook into the hash table
+                // Hook into the hash table

-        lumpinfo[i].next = lumphash[hash];
-        lumphash[hash] = &lumpinfo[i];
-    }
+                lumpinfo[i].next = lumphash[hash];
+                lumphash[hash] = &lumpinfo[i];
+            }
+        }

     // All done!
 }