X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=tools%2Fquake3%2Fq3map2%2Fvis.c;h=b92919226af604a9089019940bcb33f8410c3a5c;hb=d5d6e981910d68cc6604e15833a431ebf3fe7aac;hp=e9d36c4748fdec1ddd01082b08bb8c309176566c;hpb=e8fcd30f80784b8b87e3b6808447c9711be7e233;p=xonotic%2Fnetradiant.git diff --git a/tools/quake3/q3map2/vis.c b/tools/quake3/q3map2/vis.c index e9d36c47..b9291922 100644 --- a/tools/quake3/q3map2/vis.c +++ b/tools/quake3/q3map2/vis.c @@ -102,9 +102,9 @@ the earlier information. */ int PComp (const void *a, const void *b) { - if ( (*(vportal_t **)a)->nummightsee == (*(vportal_t **)b)->nummightsee) + if ( (*(const vportal_t *const *)a)->nummightsee == (*(const vportal_t *const *)b)->nummightsee) return 0; - if ( (*(vportal_t **)a)->nummightsee < (*(vportal_t **)b)->nummightsee) + if ( (*(const vportal_t *const *)a)->nummightsee < (*(const vportal_t *const *)b)->nummightsee) return -1; return 1; } @@ -382,10 +382,10 @@ void CalcVis (void) Sys_Printf( "Total clusters: %i\n", portalclusters ); Sys_Printf( "Total visible clusters: %.0f\n", totalvis ); - Sys_Printf( "Average clusters visible: %.2f (%.3f %%/total)\n", mu, mu / portalclusters * 100.0); - Sys_Printf( " Standard deviation: %.2f (%.3f %%/total, %.3f %%/avg)\n", sigma, sigma / portalclusters * 100.0, sigma / mu * 100.0); - Sys_Printf( " Minimum: %i (%.3f %%/total, %.3f %%/avg)\n", minvis, minvis / (double) portalclusters * 100.0, minvis / mu * 100.0); - Sys_Printf( " Maximum: %i (%.3f %%/total, %.3f %%/avg)\n", maxvis, maxvis / (double) portalclusters * 100.0, maxvis / mu * 100.0); + Sys_Printf( "Average clusters visible: %.2f (%.3f%%/total)\n", mu, mu / portalclusters * 100.0); + Sys_Printf( " Standard deviation: %.2f (%.3f%%/total, %.3f%%/avg)\n", sigma, sigma / portalclusters * 100.0, sigma / mu * 100.0); + Sys_Printf( " Minimum: %i (%.3f%%/total, %.3f%%/avg)\n", minvis, minvis / (double) portalclusters * 100.0, minvis / mu * 100.0); + Sys_Printf( " Maximum: %i (%.3f%%/total, %.3f%%/avg)\n", maxvis, maxvis / (double) portalclusters * 100.0, maxvis / mu * 100.0); } /* @@ -897,6 +897,9 @@ void LoadPortals (char *name) Sys_Printf ("%6i portalclusters\n", portalclusters); Sys_Printf ("%6i numportals\n", numportals); Sys_Printf ("%6i numfaces\n", numfaces); + + if(numportals > MAX_PORTALS) + Error("MAX_PORTALS"); // these counts should take advantage of 64 bit systems automatically leafbytes = ((portalclusters+63)&~63)>>3; @@ -929,8 +932,8 @@ void LoadPortals (char *name) Error ("LoadPortals: reading portal %i", i); if (numpoints > MAX_POINTS_ON_WINDING) Error ("LoadPortals: portal %i has too many points", i); - if ( (unsigned)leafnums[0] > portalclusters - || (unsigned)leafnums[1] > portalclusters) + if (leafnums[0] > portalclusters + || leafnums[1] > portalclusters) Error ("LoadPortals: reading portal %i", i); if (fscanf (f, "%i ", &hint) != 1) Error ("LoadPortals: reading hint state"); @@ -951,7 +954,10 @@ void LoadPortals (char *name) for (k=0 ; k<3 ; k++) w->points[j][k] = v[k]; } - fscanf (f, "\n"); + if(fscanf (f, "\n") != 0) + { + // silence gcc warning + } // calc plane PlaneFromWinding (w, &plane); @@ -1022,7 +1028,10 @@ void LoadPortals (char *name) for (k=0 ; k<3 ; k++) w->points[j][k] = v[k]; } - fscanf (f, "\n"); + if(fscanf (f, "\n") != 0) + { + // silence gcc warning + } // calc plane PlaneFromWinding (w, &plane);