qbsp: replace error enums in surfaces.c, solidbsp.c

Signed-off-by: Kevin Shanahan <kmshanah@disenchant.net>
This commit is contained in:
Kevin Shanahan 2013-04-22 19:16:53 +09:30
parent b9fa895988
commit ea5e46f9df
4 changed files with 12 additions and 30 deletions

View File

@ -81,18 +81,9 @@ const char *rgszWarnings[cWarnings] = {
const char *rgszErrors[cErrors] = {
"No axis found for winding",
"Points on winding exceeded estimate",
"No valid planes in surface list",
"Surface with no faces",
"Bad contents in face",
"Mixed face contents in leafnode near (%.2f %.2f %.2f)",
"Surface without a face",
"Degenerate edge at (%.3f %.3f %.3f)",
"Found a non-canonical vector",
"Normalization error in FindPlane (vector length %.4f)",
"Didn't split the polygon in SubdivideFace",
"Internal error: entity->iVertices > entity->cVertices",
"0 contents in GetEdge",
"Internal error: entity->iEdges >= entity->cEdges",
"Internal error: pWorldEnt->lumps[BSPPLANE].index >= pWorldEnt->lumps[BSPPLANE].count",
"Internal error: numwedges >= cWEdges",
"Internal error: numwverts >= cWVerts",

View File

@ -276,7 +276,7 @@ ChooseMidPlaneFromList(surface_t *surfaces, vec3_t mins, vec3_t maxs)
}
}
if (!bestsurface)
Error(errNoValidPlanes);
Error_("No valid planes in surface list (%s)", __func__);
return bestsurface;
}
@ -460,7 +460,7 @@ CalcSurfaceInfo(surface_t *surf)
for (f = surf->faces; f; f = f->next) {
if (f->contents[0] >= 0 || f->contents[1] >= 0)
Error(errBadContents);
Error_("Bad contents in face (%s)", __func__);
for (i = 0; i < f->w.numpoints; i++)
for (j = 0; j < 3; j++) {
if (f->w.points[i][j] < surf->mins[j])
@ -618,8 +618,8 @@ LinkConvexFaces(surface_t *planelist, node_t *leafnode)
if (!leafnode->contents)
leafnode->contents = f->contents[0];
else if (leafnode->contents != f->contents[0])
Error(errMixedFaceContents, f->w.points[0][0],
f->w.points[0][1], f->w.points[0][2]);
Error_("Mixed face contents in leafnode near (%.2f %.2f %.2f)",
f->w.points[0][0], f->w.points[0][1], f->w.points[0][2]);
}
}
@ -640,7 +640,7 @@ LinkConvexFaces(surface_t *planelist, node_t *leafnode)
c_water++;
break;
default:
Error(errBadContents);
Error_("Bad contents in face (%s)", __func__);
}
// write the list of faces, and free the originals
@ -747,13 +747,13 @@ PartitionSurfaces(surface_t *surfaces, node_t *node)
if (frontfrag) {
if (!frontfrag->faces)
Error(errNoSurfaceFaces);
Error_("Surface with no faces (%s)", __func__);
frontfrag->next = frontlist;
frontlist = frontfrag;
}
if (backfrag) {
if (!backfrag->faces)
Error(errNoSurfaceFaces);
Error_("Surface with no faces (%s)", __func__);
backfrag->next = backlist;
backlist = backfrag;
}

View File

@ -76,7 +76,7 @@ SubdivideFace(face_t *f, face_t **prevptr)
next = f->next;
SplitFace(f, &plane, &front, &back);
if (!front || !back)
Error(errNoPolygonSplit);
Error_("Didn't split the polygon (%s)", __func__);
*prevptr = back;
back->next = front;
front->next = next;
@ -243,7 +243,7 @@ GetVertex(mapentity_t *entity, const vec3_t in)
map.cTotal[BSPVERTEX]++;
if (vertices->index > vertices->count)
Error(errLowVertexCount);
Error_("Internal error: didn't allocate enough vertices?");
return hv->num;
}
@ -268,7 +268,7 @@ GetEdge(mapentity_t *entity, vec3_t p1, vec3_t p2, face_t *f)
struct lumpdata *edges = &entity->lumps[BSPEDGE];
if (!f->contents[0])
Error(errZeroContents);
Error_("Face with 0 contents (%s)", __func__);
c_tryedges++;
v1 = GetVertex(entity, p1);
@ -284,9 +284,9 @@ GetEdge(mapentity_t *entity, vec3_t p1, vec3_t p2, face_t *f)
}
}
// emit an edge
/* emit an edge */
if (edges->index >= edges->count)
Error(errLowEdgeCount);
Error_("Internal error: didn't allocate enough edges?");
edge = (dedge_t *)edges->data + edges->index;
edges->index++;

View File

@ -52,18 +52,9 @@ enum {
enum {
errNoWindingAxis,
errLowPointCount,
errNoValidPlanes,
errNoSurfaceFaces,
errBadContents,
errMixedFaceContents,
errNoSurfaceFace,
errDegenerateEdge,
errNonCanonicalVector,
errNormalization,
errNoPolygonSplit,
errLowVertexCount,
errZeroContents,
errLowEdgeCount,
errLowPlaneCount,
errLowWedgeCount,
errLowWvertCount,