]> de.git.xonotic.org Git - xonotic/netradiant.git/commitdiff
revert "allocate bigger first" 32/head
authorThomas Debesse <dev@illwieckz.net>
Fri, 7 Oct 2016 12:45:36 +0000 (14:45 +0200)
committerThomas Debesse <dev@illwieckz.net>
Fri, 7 Oct 2016 12:57:43 +0000 (14:57 +0200)
partial revert of d4fa608
see #54

"allocate bigger first" change was meant to save allocation time keeping same lightmap file size, actually wastes both time and size

tools/quake3/q3map2/lightmaps_ydnar.c

index 19791c4a7118738b539d877e5d2d150c4fc534cd..462331f1ad79ebdef34173719157122209db6f18 100644 (file)
@@ -2310,12 +2310,6 @@ static int CompareRawLightmap( const void *a, const void *b ){
        /* get min number of surfaces */
        min = ( alm->numLightSurfaces < blm->numLightSurfaces ? alm->numLightSurfaces : blm->numLightSurfaces );
 
-       /* compare size, allocate bigger first */
-       diff = ( blm->w * blm->h ) - ( alm->w * alm->h );
-       if ( diff != 0 ) {
-               return diff;
-       }
-
        /* iterate */
        for ( i = 0; i < min; i++ )
        {
@@ -2338,6 +2332,12 @@ static int CompareRawLightmap( const void *a, const void *b ){
                return diff;
        }
 
+       /* compare size */
+       diff = ( blm->w * blm->h ) - ( alm->w * alm->h );
+       if ( diff != 0 ) {
+               return diff;
+       }
+
        /* must be equivalent */
        return 0;
 }