refactor enum vstatus_t

This commit is contained in:
Garux 2021-01-27 11:53:32 +03:00
parent 62a0ae5623
commit 1efff8cdfe
3 changed files with 21 additions and 22 deletions

View File

@ -1133,13 +1133,12 @@ struct passage_t
};
typedef enum
enum class EVStatus
{
stat_none,
stat_working,
stat_done
}
vstatus_t;
None,
Working,
Done
};
struct vportal_t
@ -1155,7 +1154,7 @@ struct vportal_t
float radius;
fixedWinding_t *winding;
vstatus_t status;
EVStatus status;
byte *portalfront; /* [portals], preliminary */
byte *portalflood; /* [portals], intermediate */
byte *portalvis; /* [portals], final */

View File

@ -180,7 +180,7 @@ void ClusterMerge( int leafnum ){
continue;
}
if ( p->status != stat_done ) {
if ( p->status != EVStatus::Done ) {
Error( "portal not done" );
}
for ( j = 0 ; j < portallongs ; j++ )
@ -284,7 +284,7 @@ void CalcFastVis( void ){
for ( i = 0 ; i < numportals * 2 ; i++ )
{
portals[i].portalvis = portals[i].portalflood;
portals[i].status = stat_done;
portals[i].status = EVStatus::Done;
}
}

View File

@ -477,7 +477,7 @@ void RecursiveLeafFlow( int leafnum, threaddata_t *thread, pstack_t *prevstack )
}
// if the portal can't see anything we haven't allready seen, skip it
if ( p->status == stat_done ) {
if ( p->status == EVStatus::Done ) {
test = (long *)p->portalvis;
}
else
@ -653,11 +653,11 @@ void PortalFlow( int portalnum ){
p = sorted_portals[portalnum];
if ( p->removed ) {
p->status = stat_done;
p->status = EVStatus::Done;
return;
}
p->status = stat_working;
p->status = EVStatus::Working;
c_might = CountBits( p->portalflood, numportals * 2 );
@ -673,7 +673,7 @@ void PortalFlow( int portalnum ){
RecursiveLeafFlow( p->leaf, &data, &data.pstack_head );
p->status = stat_done;
p->status = EVStatus::Done;
c_can = CountBits( p->portalvis, numportals * 2 );
@ -727,7 +727,7 @@ void RecursivePassageFlow( vportal_t *portal, threaddata_t *thread, pstack_t *pr
cansee = (long *)passage->cansee;
might = (long *)stack.mightsee;
memcpy( might, prevmight, portalbytes );
if ( p->status == stat_done ) {
if ( p->status == EVStatus::Done ) {
portalvis = (long *) p->portalvis;
}
else{
@ -778,11 +778,11 @@ void PassageFlow( int portalnum ){
p = sorted_portals[portalnum];
if ( p->removed ) {
p->status = stat_done;
p->status = EVStatus::Done;
return;
}
p->status = stat_working;
p->status = EVStatus::Working;
// c_might = CountBits (p->portalflood, numportals*2);
@ -798,7 +798,7 @@ void PassageFlow( int portalnum ){
RecursivePassageFlow( p, &data, &data.pstack_head );
p->status = stat_done;
p->status = EVStatus::Done;
/*
c_can = CountBits (p->portalvis, numportals*2);
@ -862,7 +862,7 @@ void RecursivePassagePortalFlow( vportal_t *portal, threaddata_t *thread, pstack
cansee = (long *)passage->cansee;
might = (long *)stack.mightsee;
memcpy( might, prevmight, portalbytes );
if ( p->status == stat_done ) {
if ( p->status == EVStatus::Done ) {
portalvis = (long *) p->portalvis;
}
else{
@ -1040,11 +1040,11 @@ void PassagePortalFlow( int portalnum ){
p = sorted_portals[portalnum];
if ( p->removed ) {
p->status = stat_done;
p->status = EVStatus::Done;
return;
}
p->status = stat_working;
p->status = EVStatus::Working;
// c_might = CountBits (p->portalflood, numportals*2);
@ -1060,7 +1060,7 @@ void PassagePortalFlow( int portalnum ){
RecursivePassagePortalFlow( p, &data, &data.pstack_head );
p->status = stat_done;
p->status = EVStatus::Done;
/*
c_can = CountBits (p->portalvis, numportals*2);
@ -1340,7 +1340,7 @@ void CreatePassages( int portalnum ){
portal = sorted_portals[portalnum];
if ( portal->removed ) {
portal->status = stat_done;
portal->status = EVStatus::Done;
return;
}