From 1efff8cdfe94cde328a770b1819140f9291ac1a8 Mon Sep 17 00:00:00 2001 From: Garux Date: Wed, 27 Jan 2021 11:53:32 +0300 Subject: [PATCH] refactor enum vstatus_t --- tools/quake3/q3map2/q3map2.h | 13 ++++++------- tools/quake3/q3map2/vis.cpp | 4 ++-- tools/quake3/q3map2/visflow.cpp | 26 +++++++++++++------------- 3 files changed, 21 insertions(+), 22 deletions(-) diff --git a/tools/quake3/q3map2/q3map2.h b/tools/quake3/q3map2/q3map2.h index 94316453..5d062293 100644 --- a/tools/quake3/q3map2/q3map2.h +++ b/tools/quake3/q3map2/q3map2.h @@ -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 */ diff --git a/tools/quake3/q3map2/vis.cpp b/tools/quake3/q3map2/vis.cpp index 5af319f3..b9476c67 100644 --- a/tools/quake3/q3map2/vis.cpp +++ b/tools/quake3/q3map2/vis.cpp @@ -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; } } diff --git a/tools/quake3/q3map2/visflow.cpp b/tools/quake3/q3map2/visflow.cpp index a4ab8b89..d8f6d910 100644 --- a/tools/quake3/q3map2/visflow.cpp +++ b/tools/quake3/q3map2/visflow.cpp @@ -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; }