]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - tools/quake3/q3map2/bspfile_rbsp.c
fix drawindexes crash when loading BSP files
[xonotic/netradiant.git] / tools / quake3 / q3map2 / bspfile_rbsp.c
index 0a48aae6135de9f98162b0732ecb042d3b3e9a42..22ead1844b626d02e5e0259012143f8fa90ec6ee 100644 (file)
@@ -146,7 +146,7 @@ static void AddLightGridLumps( FILE *file, rbspHeader_t *header )
                        out = &gridPoints[ j ];
                        
                        /* compare styles */
-                       if( *((unsigned int*) in->styles) != *((unsigned int*) out->styles) )
+                       if( memcmp(in->styles, out->styles, MAX_LIGHTMAPS) )
                                continue;
                        
                        /* compare direction */
@@ -257,7 +257,7 @@ void LoadRBSPFile( const char *filename )
        
        numBSPFogs = CopyLump( (bspHeader_t*) header, LUMP_FOGS, bspFogs, sizeof( bspFogs[ 0 ] ) );
        
-       numBSPDrawIndexes = CopyLump( (bspHeader_t*) header, LUMP_DRAWINDEXES, bspDrawIndexes, sizeof( bspDrawIndexes[ 0 ] ) );
+       numBSPDrawIndexes = CopyLump_Allocate( (bspHeader_t*) header, LUMP_DRAWINDEXES, (void **) &bspDrawIndexes, sizeof( bspDrawIndexes[ 0 ] ), &allocatedBSPDrawIndexes );
        
        numBSPVisBytes = CopyLump( (bspHeader_t*) header, LUMP_VISIBILITY, bspVisBytes, 1 );
        
@@ -265,7 +265,7 @@ void LoadRBSPFile( const char *filename )
                bspLightBytes = safe_malloc( numBSPLightBytes );
                CopyLump( (bspHeader_t*) header, LUMP_LIGHTMAPS, bspLightBytes, 1 );
        
-       bspEntDataSize = CopyLump( (bspHeader_t*) header, LUMP_ENTITIES, bspEntData, 1);
+       bspEntDataSize = CopyLump_Allocate( (bspHeader_t*) header, LUMP_ENTITIES, (void **) &bspEntData, 1, &allocatedBSPEntData);
        
        CopyLightGridLumps( header );