diff --git a/Sources/CMakeLists.txt b/Sources/CMakeLists.txt index 5683ced..ef8aee2 100644 --- a/Sources/CMakeLists.txt +++ b/Sources/CMakeLists.txt @@ -121,7 +121,7 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang") MESSAGE(WARNING, "re-enable some of the warnings some day!") if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "AppleClang") - add_compile_options(-Wno-tautological-undefined-compare) # don't complain about if(this!=NULL) + # !!! FIXME: turn a bunch of these off, this is just for now. I hope. --ryan. add_compile_options(-Wno-c++11-compat-deprecated-writable-strings) endif() diff --git a/Sources/Engine/Brushes/BrushShadows.cpp b/Sources/Engine/Brushes/BrushShadows.cpp index d0d832f..8cf91d9 100644 --- a/Sources/Engine/Brushes/BrushShadows.cpp +++ b/Sources/Engine/Brushes/BrushShadows.cpp @@ -562,9 +562,9 @@ void CBrushShadowMap::CheckLayersUpToDate(void) CBrushShadowLayer &bsl = *itbsl; if( bsl.bsl_ulFlags&BSLF_ALLDARK) continue; // light source must be valid + ASSERT( bsl.bsl_plsLightSource!=NULL); + if( bsl.bsl_plsLightSource==NULL) continue; CLightSource &ls = *bsl.bsl_plsLightSource; - ASSERT( &ls!=NULL); - if( &ls==NULL) continue; // if the layer is not up to date if( bsl.bsl_colLastAnim != ls.GetLightColor()) { // invalidate entire shadow map @@ -581,9 +581,9 @@ BOOL CBrushShadowMap::HasDynamicLayers(void) // for each layer FOREACHINLIST( CBrushShadowLayer, bsl_lnInShadowMap, bsm_lhLayers, itbsl) { // light source must be valid + ASSERT( itbsl->bsl_plsLightSource!=NULL); + if( itbsl->bsl_plsLightSource==NULL) continue; CLightSource &ls = *itbsl->bsl_plsLightSource; - ASSERT( &ls!=NULL); - if( &ls==NULL) continue; // if the layer is dynamic, it has if( ls.ls_ulFlags&LSF_DYNAMIC) return TRUE; } diff --git a/Sources/Engine/Entities/Entity.h b/Sources/Engine/Entities/Entity.h index 5f98d38..57d174d 100644 --- a/Sources/Engine/Entities/Entity.h +++ b/Sources/Engine/Entities/Entity.h @@ -688,6 +688,7 @@ inline const CEntityPointer &CEntityPointer::operator=(const CEntityPointer &pen return *this; } inline CEntity* CEntityPointer::operator->(void) const { return ep_pen; } +inline CEntity* CEntityPointer::get(void) const { return ep_pen; } inline CEntityPointer::operator CEntity*(void) const { return ep_pen; } inline CEntity& CEntityPointer::operator*(void) const { return *ep_pen; } diff --git a/Sources/Engine/Entities/EntityPointer.h b/Sources/Engine/Entities/EntityPointer.h index 349982a..614387b 100644 --- a/Sources/Engine/Entities/EntityPointer.h +++ b/Sources/Engine/Entities/EntityPointer.h @@ -35,6 +35,7 @@ public: inline const CEntityPointer &operator=(CEntity *pen); inline const CEntityPointer &operator=(const CEntityPointer &penOther); inline CEntity* operator->(void) const; + inline CEntity* get(void) const; inline operator CEntity*(void) const; inline CEntity& operator*(void) const; }; diff --git a/Sources/Engine/Light/LayerMixer.cpp b/Sources/Engine/Light/LayerMixer.cpp index 5d8750f..9b9992d 100755 --- a/Sources/Engine/Light/LayerMixer.cpp +++ b/Sources/Engine/Light/LayerMixer.cpp @@ -1770,8 +1770,9 @@ void CLayerMixer::MixOneMipmap(CBrushShadowMap *pbsm, INDEX iMipmap) if( lm_pbpoPolygon->bpo_ulFlags&BPOF_HASDIRECTIONALAMBIENT) { {FOREACHINLIST( CBrushShadowLayer, bsl_lnInShadowMap, lm_pbsmShadowMap->bsm_lhLayers, itbsl) { CBrushShadowLayer &bsl = *itbsl; + ASSERT( bsl.bsl_plsLightSource!=NULL); + if( bsl.bsl_plsLightSource==NULL) continue; // safety check CLightSource &ls = *bsl.bsl_plsLightSource; - ASSERT( &ls!=NULL); if( &ls==NULL) continue; // safety check if( !(ls.ls_ulFlags&LSF_DIRECTIONAL)) continue; // skip non-directional layers COLOR col = AdjustColor( ls.GetLightAmbient(), _slShdHueShift, _slShdSaturation); colAmbient = AddColors( colAmbient, col); @@ -1843,8 +1844,9 @@ void CLayerMixer::MixOneMipmap(CBrushShadowMap *pbsm, INDEX iMipmap) {FORDELETELIST( CBrushShadowLayer, bsl_lnInShadowMap, lm_pbsmShadowMap->bsm_lhLayers, itbsl) { CBrushShadowLayer &bsl = *itbsl; + ASSERT( bsl.bsl_plsLightSource!=NULL); + if( bsl.bsl_plsLightSource==NULL) continue; // safety check CLightSource &ls = *bsl.bsl_plsLightSource; - ASSERT( &ls!=NULL); if( &ls==NULL) continue; // safety check // skip if should not be applied if( (bDynamicOnly && !(ls.ls_ulFlags&LSF_NONPERSISTENT)) || (ls.ls_ulFlags & LSF_DYNAMIC)) continue; diff --git a/Sources/Engine/Math/ObjectSector.cpp b/Sources/Engine/Math/ObjectSector.cpp index f02d59b..960fb63 100644 --- a/Sources/Engine/Math/ObjectSector.cpp +++ b/Sources/Engine/Math/ObjectSector.cpp @@ -1115,10 +1115,10 @@ void CObjectPolygon::JoinContinuingEdges(CDynamicArray &oedEdges) // for each edge {FOREACHINDYNAMICARRAY(opo_PolygonEdges, CObjectPolygonEdge, itope) { - CObjectEdge &oedThis = *itope->ope_Edge; + CObjectEdge *poedThis = itope->ope_Edge; // if not already marked for removal - if (&oedThis != NULL) { + if (poedThis != NULL) { CObjectVertex *povxStartThis, *povxEndThis; // get start and end vertices itope->GetVertices(povxStartThis, povxEndThis); @@ -1133,12 +1133,12 @@ void CObjectPolygon::JoinContinuingEdges(CDynamicArray &oedEdges) // for each edge {FOREACHINDYNAMICARRAY(opo_PolygonEdges, CObjectPolygonEdge, itope2) { - CObjectEdge &oedOther = *itope2->ope_Edge; + CObjectEdge *poedOther = itope2->ope_Edge; // if not already marked for removal - if (&oedOther != NULL) { + if (poedOther != NULL) { // if the two edges are collinear - if ( CompareEdgeLines(*oedThis.colinear2.oed_pedxLine, *oedOther.colinear2.oed_pedxLine)==0) { + if ( CompareEdgeLines(*poedThis->colinear2.oed_pedxLine, *poedOther->colinear2.oed_pedxLine)==0) { CObjectVertex *povxStartOther, *povxEndOther; // get start and end vertices itope2->GetVertices(povxStartOther, povxEndOther); diff --git a/Sources/Engine/Rendering/RenCache.cpp b/Sources/Engine/Rendering/RenCache.cpp index dfc631d..3b6fba0 100644 --- a/Sources/Engine/Rendering/RenCache.cpp +++ b/Sources/Engine/Rendering/RenCache.cpp @@ -779,23 +779,23 @@ CScreenPolygon *CRenderer::MakeScreenPolygon(CBrushPolygon &bpo) void CRenderer::AddPolygonToScene( CScreenPolygon *pspo) { // if the polygon is not falid or occluder and not selected - CBrushPolygon &bpo = *pspo->spo_pbpoBrushPolygon; - if( &bpo==NULL || ((bpo.bpo_ulFlags&BPOF_OCCLUDER) && (!(bpo.bpo_ulFlags&BPOF_SELECTED) || + CBrushPolygon *pbpo = pspo->spo_pbpoBrushPolygon; + if(pbpo==NULL || ((pbpo->bpo_ulFlags&BPOF_OCCLUDER) && (!(pbpo->bpo_ulFlags&BPOF_SELECTED) || _wrpWorldRenderPrefs.GetSelectionType()!=CWorldRenderPrefs::ST_POLYGONS))) { // do not add it to rendering return; } - CBrushSector &bsc = *bpo.bpo_pbscSector; + CBrushSector &bsc = *pbpo->bpo_pbscSector; ScenePolygon &sppo = pspo->spo_spoScenePolygon; const CViewVertex *pvvx0 = &re_avvxViewVertices[bsc.bsc_ivvx0]; - const INDEX ctVtx = bpo.bpo_apbvxTriangleVertices.Count(); + const INDEX ctVtx = pbpo->bpo_apbvxTriangleVertices.Count(); sppo.spo_iVtx0 = _avtxScene.Count(); GFXVertex3 *pvtx = _avtxScene.Push(ctVtx); // find vertex with nearest Z distance while copying vertices FLOAT fNearestZ = 123456789.0f; for( INDEX i=0; ibpo_apbvxTriangleVertices[i]; const INDEX iVtx = bsc.bsc_abvxVertices.Index(pbvx); const FLOAT3D &v = pvvx0[iVtx].vvx_vView; if( -v(3)bpo_aiTriangleElements.Count(); + sppo.spo_piElements = sppo.spo_ctElements ? &pbpo->bpo_aiTriangleElements[0] : NULL; _sfStats.IncrementCounter(CStatForm::SCI_SCENE_TRIANGLES, sppo.spo_ctElements/3); } diff --git a/Sources/Engine/World/WorldCSG.cpp b/Sources/Engine/World/WorldCSG.cpp index d69e846..1732afa 100644 --- a/Sources/Engine/World/WorldCSG.cpp +++ b/Sources/Engine/World/WorldCSG.cpp @@ -172,15 +172,15 @@ void CWorld::DoCSGOperation( AssureFPT_53(); // get relevant brush mips in each brush - CBrushMip &bmThis = *GetBrushMip(enThis); - CBrushMip &bmOther = *GetBrushMip(enOther); - if (&bmThis==NULL || &bmOther==NULL) { + CBrushMip *pbmThis = GetBrushMip(enThis); + CBrushMip *pbmOther = GetBrushMip(enOther); + if (pbmThis==NULL || pbmOther==NULL) { return; } // get open sector of the other brush to object CBrushSectorSelectionForCSG selbscOtherOpen; - bmOther.SelectOpenSector(selbscOtherOpen); + pbmOther->SelectOpenSector(selbscOtherOpen); CObject3D obOtherOpen; DOUBLEaabbox3D boxOtherOpen; woOther.CopySourceBrushSectorsToObject(enOther, selbscOtherOpen, plOther, @@ -193,7 +193,7 @@ void CWorld::DoCSGOperation( obOtherOpen.TurnPortalsToWalls(); // if there are any sectors in this brush - if (bmThis.bm_abscSectors.Count()>0) { + if (pbmThis->bm_abscSectors.Count()>0) { // move affected part of this brush to an object3d object CObject3D obThis; MoveTargetBrushPartToObject(enThis, boxOtherOpen, obThis); @@ -213,7 +213,7 @@ void CWorld::DoCSGOperation( // get closed sectors of the other brush to object CBrushSectorSelectionForCSG selbscOtherClosed; - bmOther.SelectClosedSectors(selbscOtherClosed); + pbmOther->SelectClosedSectors(selbscOtherClosed); CObject3D obOtherClosed; DOUBLEaabbox3D boxOtherClosed; woOther.CopySourceBrushSectorsToObject(enOther, selbscOtherClosed, plOther, @@ -224,7 +224,7 @@ void CWorld::DoCSGOperation( CObject3D obResult; // if there are any sectors in this brush - if (bmThis.bm_abscSectors.Count()>0) { + if (pbmThis->bm_abscSectors.Count()>0) { // move affected part of this brush to an object3d object CObject3D obThis; MoveTargetBrushPartToObject(enThis, boxOtherClosed, obThis); @@ -304,16 +304,16 @@ void CWorld::CSGRemove(CEntity &enThis, CWorld &woOther, CEntity &enOther, AssureFPT_53(); // get relevant brush mip in other brush - CBrushMip &bmOther = *GetBrushMip(enOther); - if (&bmOther==NULL) { + CBrushMip *pbmOther = GetBrushMip(enOther); + if (pbmOther==NULL) { return; } // if other brush has more than one sector - if (bmOther.bm_abscSectors.Count()>1) { + if (pbmOther->bm_abscSectors.Count()>1) { // join all sectors of the other brush together CBrushSectorSelection selbscOtherAll; - bmOther.SelectAllSectors(selbscOtherAll); + pbmOther->SelectAllSectors(selbscOtherAll); woOther.JoinSectors(selbscOtherAll); } @@ -380,15 +380,15 @@ void CWorld::SplitSectors(CEntity &enThis, CBrushSectorSelection &selbscSectorsT AssureFPT_53(); // get relevant brush mip in this brush - CBrushMip &bmThis = *GetBrushMip(enThis); - if (&bmThis==NULL) { + CBrushMip *pbmThis = GetBrushMip(enThis); + if (pbmThis==NULL) { _pfWorldEditingProfile.StopTimer(CWorldEditingProfile::PTI_CSGTOTAL); return; } // get relevant brush mip in other brush - CBrushMip &bmOther = *GetBrushMip(enOther); - if (&bmOther==NULL) { + CBrushMip *pbmOther = GetBrushMip(enOther); + if (pbmOther==NULL) { _pfWorldEditingProfile.StopTimer(CWorldEditingProfile::PTI_CSGTOTAL); return; } @@ -396,10 +396,10 @@ void CWorld::SplitSectors(CEntity &enThis, CBrushSectorSelection &selbscSectorsT /* Assure that the other brush has only one sector. */ // if other brush has more than one sector - if (bmOther.bm_abscSectors.Count()>1) { + if (pbmOther->bm_abscSectors.Count()>1) { // join all sectors of the other brush together CBrushSectorSelection selbscOtherAll; - bmOther.SelectAllSectors(selbscOtherAll); + pbmOther->SelectAllSectors(selbscOtherAll); woOther.JoinSectors(selbscOtherAll); } @@ -407,7 +407,7 @@ void CWorld::SplitSectors(CEntity &enThis, CBrushSectorSelection &selbscSectorsT // get the sector of the other brush to object CBrushSectorSelectionForCSG selbscOther; - bmOther.SelectAllSectors(selbscOther); + pbmOther->SelectAllSectors(selbscOther); CObject3D obOther; DOUBLEaabbox3D boxOther; woOther.CopySourceBrushSectorsToObject(enOther, selbscOther, plOther, @@ -416,7 +416,7 @@ void CWorld::SplitSectors(CEntity &enThis, CBrushSectorSelection &selbscSectorsT // if the selection is empty if (selbscSectorsToSplit.Count()==0) { // select all sectors near the splitting tool - bmThis.SelectSectorsInRange(selbscSectorsToSplit, DOUBLEtoFLOAT(boxOther)); + pbmThis->SelectSectorsInRange(selbscSectorsToSplit, DOUBLEtoFLOAT(boxOther)); } // for all sectors in the selection FOREACHINDYNAMICCONTAINER(selbscSectorsToSplit, CBrushSector, itbsc) { @@ -426,7 +426,7 @@ void CWorld::SplitSectors(CEntity &enThis, CBrushSectorSelection &selbscSectorsT } // update the bounding boxes of this brush - bmThis.bm_pbrBrush->CalculateBoundingBoxes(); + pbmThis->bm_pbrBrush->CalculateBoundingBoxes(); // find possible shadow layers near affected area FindShadowLayers(DOUBLEtoFLOAT(boxOther)); @@ -574,8 +574,8 @@ void CWorld::SplitPolygons(CEntity &enThis, CBrushPolygonSelection &selbpoPolygo _pfWorldEditingProfile.IncrementAveragingCounter(); // get relevant brush mip in other brush - CBrushMip &bmOther = *GetBrushMip(enOther); - if (&bmOther==NULL) { + CBrushMip *pbmOther = GetBrushMip(enOther); + if (pbmOther==NULL) { _pfWorldEditingProfile.StopTimer(CWorldEditingProfile::PTI_CSGTOTAL); return; } @@ -596,7 +596,7 @@ void CWorld::SplitPolygons(CEntity &enThis, CBrushPolygonSelection &selbpoPolygo // get the sector of the other brush to object CBrushSectorSelectionForCSG selbscOther; - bmOther.SelectAllSectors(selbscOther); + pbmOther->SelectAllSectors(selbscOther); CObject3D obOther; DOUBLEaabbox3D boxOther; woOther.CopySourceBrushSectorsToObject(enOther, selbscOther, plOther, diff --git a/Sources/EntitiesMP/Summoner.es b/Sources/EntitiesMP/Summoner.es index 5fa1ae9..02fe1c6 100755 --- a/Sources/EntitiesMP/Summoner.es +++ b/Sources/EntitiesMP/Summoner.es @@ -627,7 +627,7 @@ functions: while (iCount>0) { i++; - while (&*pen[i]==NULL) { + while (pen[i].get()==NULL) { i++; } iCount--; @@ -1337,17 +1337,17 @@ procedures: m_iGroup01Count = 0; pen = &m_penGroup01Template01; for (i=0; i