style cleanup, brackets in else/if, some indentation.
[blender.git] / source / blender / blenkernel / intern / navmesh_conversion.c
index 72523ae54e027f861b953c83a76b9bfb5a02efbf..cdba036a6aed742ab3cc2cd47c2b05928ea392e4 100644 (file)
@@ -248,8 +248,7 @@ int buildPolygonsByDetailedMeshes(const int vertsPerPoly, const int npolys,
                                //move to next edge                                     
                                edge = (edge+1)%3;
                        }
                                //move to next edge                                     
                                edge = (edge+1)%3;
                        }
-                       else
-                       {
+                       else {
                                //move to next tri
                                int twinedge = -1;
                                for (k=0; k<3; k++)
                                //move to next tri
                                int twinedge = -1;
                                for (k=0; k<3; k++)
@@ -344,7 +343,7 @@ int buildNavMeshData(const int nverts, const float* verts,
                                                         int *vertsPerPoly_r, int **dtrisToPolysMap_r, int **dtrisToTrisMap_r)
 
 {
                                                         int *vertsPerPoly_r, int **dtrisToPolysMap_r, int **dtrisToTrisMap_r)
 
 {
-       int *trisMapping = MEM_callocN(sizeof(int)*ntris, "buildNavMeshData trisMapping");
+       int *trisMapping;
        int i;
        struct SortContext context;
        int validTriStart, prevPolyIdx, curPolyIdx, newPolyIdx, prevpolyidx;
        int i;
        struct SortContext context;
        int validTriStart, prevPolyIdx, curPolyIdx, newPolyIdx, prevpolyidx;
@@ -360,6 +359,8 @@ int buildNavMeshData(const int nverts, const float* verts,
                return 0;
        }
 
                return 0;
        }
 
+       trisMapping = MEM_callocN(sizeof(int)*ntris, "buildNavMeshData trisMapping");
+
        //sort the triangles by polygon idx
        for (i=0; i<ntris; i++)
                trisMapping[i]=i;
        //sort the triangles by polygon idx
        for (i=0; i<ntris; i++)
                trisMapping[i]=i;