]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
rearranged error checking during portal building so it will only Host_Error when...
authorlordhavoc <lordhavoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 19 Jan 2002 21:36:53 +0000 (21:36 +0000)
committerlordhavoc <lordhavoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 19 Jan 2002 21:36:53 +0000 (21:36 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@1367 d7cf8633-e32d-0410-b094-e92efae38249

model_brush.c

index 63880a90e3a13f1062651791eef5da0dfb5b99e4..3a689286de1915d488689963f3d1dfd2fbd2ff8b 100644 (file)
@@ -372,7 +372,7 @@ static void Mod_LoadTextures (lump_t *l)
                                        }
                                        if (fullbrights)
                                        {
-                                               data2 = Mem_Alloc(tempmempool, tx->width*tx->height);
+                                               data2 = Mem_Alloc(loadmodel->mempool, tx->width*tx->height);
                                                for (j = 0;j < tx->width*tx->height;j++)
                                                        data2[j] = data[j] >= 224 ? 0 : data[j]; // no fullbrights
                                                tx->texture = R_LoadTexture (loadmodel->texturepool, tx->name, tx->width, tx->height, data2, TEXTYPE_QPALETTE, TEXF_MIPMAP | TEXF_PRECACHE);
@@ -1665,7 +1665,7 @@ static winding_t *NewWinding (int points)
                Host_Error("NewWinding: too many points\n");
 
        size = sizeof(windingsizeof_t) + sizeof(double[3]) * points;
-       w = Mem_Alloc(tempmempool, size);
+       w = Mem_Alloc(loadmodel->mempool, size);
        memset (w, 0, size);
 
        return w;
@@ -1769,6 +1769,9 @@ static winding_t *ClipWinding (winding_t *in, mplane_t *split, int keepon)
 
        for (i = 0;i < in->numpoints;i++)
        {
+               if (neww->numpoints >= maxpts)
+                       Host_Error ("ClipWinding: points exceeded estimate");
+
                p1 = in->points[i];
 
                if (sides[i] == SIDE_ON)
@@ -1805,9 +1808,6 @@ static winding_t *ClipWinding (winding_t *in, mplane_t *split, int keepon)
                neww->numpoints++;
        }
 
-       if (neww->numpoints > maxpts)
-               Host_Error ("ClipWinding: points exceeded estimate");
-
        // free the original winding
        FreeWinding (in);
 
@@ -1873,6 +1873,9 @@ static void DivideWinding (winding_t *in, mplane_t *split, winding_t **front, wi
 
        for (i = 0;i < in->numpoints;i++)
        {
+               if (f->numpoints >= maxpts || b->numpoints >= maxpts)
+                       Host_Error ("DivideWinding: points exceeded estimate");
+
                p1 = in->points[i];
 
                if (sides[i] == SIDE_ON)
@@ -1917,9 +1920,6 @@ static void DivideWinding (winding_t *in, mplane_t *split, winding_t **front, wi
                VectorCopy (mid, b->points[b->numpoints]);
                b->numpoints++;
        }
-
-       if (f->numpoints > maxpts || b->numpoints > maxpts)
-               Host_Error ("DivideWinding: points exceeded estimate");
 }
 
 typedef struct portal_s
@@ -1942,7 +1942,7 @@ AllocPortal
 static portal_t *AllocPortal (void)
 {
        portal_t *p;
-       p = Mem_Alloc(tempmempool, sizeof(portal_t));
+       p = Mem_Alloc(loadmodel->mempool, sizeof(portal_t));
        //memset(p, 0, sizeof(portal_t));
        p->chain = portalchain;
        portalchain = p;