enum class EFloodEntities

This commit is contained in:
Garux 2021-02-07 07:34:57 +03:00
parent a17bf05f5c
commit ca34e8f38f
3 changed files with 16 additions and 16 deletions

View File

@ -294,7 +294,6 @@ void ProcessWorldModel( void ){
xmlNodePtr polyline, leaknode; xmlNodePtr polyline, leaknode;
char level[ 2 ]; char level[ 2 ];
const char *value; const char *value;
int leakStatus;
/* sets integer blockSize from worldspawn "_blocksize" key if it exists */ /* sets integer blockSize from worldspawn "_blocksize" key if it exists */
if( entities[ 0 ].read_keyvalue( value, "_blocksize", "blocksize", "chopsize" ) ) { /* "chopsize" : sof2 */ if( entities[ 0 ].read_keyvalue( value, "_blocksize", "blocksize", "chopsize" ) ) { /* "chopsize" : sof2 */
@ -333,14 +332,12 @@ void ProcessWorldModel( void ){
FilterStructuralBrushesIntoTree( e, tree ); FilterStructuralBrushesIntoTree( e, tree );
/* see if the bsp is completely enclosed */ /* see if the bsp is completely enclosed */
leakStatus = FloodEntities( tree ); EFloodEntities leakStatus = FloodEntities( tree );
if ( ignoreLeaks ) { if ( ignoreLeaks && leakStatus == EFloodEntities::Leaked ) {
if ( leakStatus == FLOODENTITIES_LEAKED ) { leakStatus = EFloodEntities::Good;
leakStatus = FLOODENTITIES_GOOD;
}
} }
const bool leaked = ( leakStatus != FLOODENTITIES_GOOD ); const bool leaked = ( leakStatus != EFloodEntities::Good );
if( leaked ){ if( leaked ){
Sys_FPrintf( SYS_NOXMLflag | SYS_ERR, "**********************\n" ); Sys_FPrintf( SYS_NOXMLflag | SYS_ERR, "**********************\n" );
Sys_FPrintf( SYS_NOXMLflag | SYS_ERR, "******* leaked *******\n" ); Sys_FPrintf( SYS_NOXMLflag | SYS_ERR, "******* leaked *******\n" );
@ -359,7 +356,7 @@ void ProcessWorldModel( void ){
} }
} }
if ( leakStatus != FLOODENTITIES_EMPTY ) { /* if no entities exist, this would accidentally the whole map, and that IS bad */ if ( leakStatus != EFloodEntities::Empty ) { /* if no entities exist, this would accidentally the whole map, and that IS bad */
/* rebuild a better bsp tree using only the sides that are visible from the inside */ /* rebuild a better bsp tree using only the sides that are visible from the inside */
FillOutside( tree->headnode ); FillOutside( tree->headnode );

View File

@ -626,7 +626,7 @@ bool PlaceOccupant( node_t *headnode, vec3_t origin, const entity_t *occupant, b
============= =============
*/ */
int FloodEntities( tree_t *tree ){ EFloodEntities FloodEntities( tree_t *tree ){
bool r, inside, skybox; bool r, inside, skybox;
node_t *headnode; node_t *headnode;
const char *value; const char *value;
@ -706,14 +706,14 @@ int FloodEntities( tree_t *tree ){
if ( !inside ) { if ( !inside ) {
Sys_FPrintf( SYS_WRN | SYS_VRBflag, "no entities in open -- no filling\n" ); Sys_FPrintf( SYS_WRN | SYS_VRBflag, "no entities in open -- no filling\n" );
return FLOODENTITIES_EMPTY; return EFloodEntities::Empty;
} }
if ( tree->outside_node.occupied ) { if ( tree->outside_node.occupied ) {
Sys_FPrintf( SYS_WRN | SYS_VRBflag, "entity reached from outside -- leak detected\n" ); Sys_FPrintf( SYS_WRN | SYS_VRBflag, "entity reached from outside -- leak detected\n" );
return FLOODENTITIES_LEAKED; return EFloodEntities::Leaked;
} }
return FLOODENTITIES_GOOD; return EFloodEntities::Good;
} }
/* /*

View File

@ -1574,10 +1574,13 @@ void SplitNodePortals( node_t *node );
bool PortalPassable( portal_t *p ); bool PortalPassable( portal_t *p );
#define FLOODENTITIES_LEAKED 1 enum class EFloodEntities
#define FLOODENTITIES_GOOD 0 {
#define FLOODENTITIES_EMPTY -1 Leaked,
int FloodEntities( tree_t *tree ); Good,
Empty
};
EFloodEntities FloodEntities( tree_t *tree );
void FillOutside( node_t *headnode ); void FillOutside( node_t *headnode );
void FloodAreas( tree_t *tree ); void FloodAreas( tree_t *tree );
face_t *VisibleFaces( entity_t *e, tree_t *tree ); face_t *VisibleFaces( entity_t *e, tree_t *tree );