writebsp.cc: Assert we never write a private contents type to the bsp

This commit is contained in:
Eric Wasylishen 2017-06-04 20:38:21 -06:00
parent dffee91191
commit e3da31b308
2 changed files with 21 additions and 1 deletions

View File

@ -24,6 +24,7 @@
extern int splitnodes;
const char *GetContentsName( int Contents );
void DivideFacet(face_t *in, qbsp_plane_t *split, face_t **front, face_t **back);
void CalcSurfaceInfo(surface_t *surf);
void SubdivideFace(face_t *f, face_t **prevptr);

View File

@ -23,6 +23,22 @@
#include <qbsp/qbsp.hh>
#include <qbsp/wad.hh>
static void
AssertVanillaContentType(int content)
{
switch (content) {
case CONTENTS_EMPTY:
case CONTENTS_SOLID:
case CONTENTS_WATER:
case CONTENTS_SLIME:
case CONTENTS_LAVA:
case CONTENTS_SKY:
break;
default:
Error("Internal error: Tried to save compiler-internal contents type %s\n", GetContentsName(content));
}
}
static void
ExportNodePlanes_r(node_t *node, int *planemap)
{
@ -347,6 +363,7 @@ ExportLeaf_BSP29(mapentity_t *entity, node_t *node)
map.cTotal[LUMP_LEAFS]++;
dleaf->contents = node->contents;
AssertVanillaContentType(dleaf->contents);
/*
* write bounding box info
@ -396,7 +413,8 @@ ExportLeaf_BSP2(mapentity_t *entity, node_t *node)
map.cTotal[LUMP_LEAFS]++;
dleaf->contents = node->contents;
AssertVanillaContentType(dleaf->contents);
/*
* write bounding box info
* (VectorCopy doesn't work double->float)
@ -445,6 +463,7 @@ ExportLeaf_BSP2rmq(mapentity_t *entity, node_t *node)
map.cTotal[LUMP_LEAFS]++;
dleaf->contents = node->contents;
AssertVanillaContentType(dleaf->contents);
/*
* write bounding box info