Merge pull request #54 from DanielGibson/fix-warnings-rebase

cherry-picked fixes by emlai, fix compilation again
This commit is contained in:
Ryan C. Gordon 2016-05-29 19:12:37 -04:00
commit aced26829a
30 changed files with 120 additions and 141 deletions

View File

@ -110,8 +110,6 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS} -DNDEBUG=1 -D_NDEBUG=1 -Os -fno-unsafe-math-optimizations")
# TODO fix these warnings
# !!! FIXME: turn a bunch of these off, this is just for now. I hope. --ryan.
add_compile_options(-Wno-sign-compare)
add_compile_options(-Wno-switch)
add_compile_options(-Wno-char-subscripts)
add_compile_options(-Wno-unknown-pragmas)
@ -123,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()

View File

@ -173,16 +173,14 @@ BOOL CAnimData::IsAutoFreed(void)
// Reference counting functions
void CAnimData::AddReference(void)
{
if (this!=NULL) {
ASSERT(this!=NULL);
MarkUsed();
}
}
void CAnimData::RemReference(void)
{
if (this!=NULL) {
ASSERT(this!=NULL);
RemReference_internal();
}
}
void CAnimData::RemReference_internal(void)

View File

@ -44,9 +44,7 @@ CConsole::CConsole(void)
// Destructor.
CConsole::~CConsole(void)
{
if (this==NULL) {
return;
}
ASSERT(this!=NULL);
if (con_fLog!=NULL) {
fclose(con_fLog);
con_fLog = NULL;
@ -102,25 +100,19 @@ void CConsole::Initialize(const CTFileName &fnmLog, INDEX ctCharsPerLine, INDEX
// Get current console buffer.
const char *CConsole::GetBuffer(void)
{
if (this==NULL) {
return "";
}
ASSERT(this!=NULL);
return con_strBuffer+(con_ctLines-con_ctLinesPrinted)*(con_ctCharsPerLine+1);
}
INDEX CConsole::GetBufferSize(void)
{
if (this==NULL) {
return 1;
}
ASSERT(this!=NULL);
return (con_ctCharsPerLine+1)*con_ctLines+1;
}
// Discard timing info for last lines
void CConsole::DiscardLastLineTimes(void)
{
if (this==NULL) {
return;
}
ASSERT(this!=NULL);
for(INDEX i=0; i<con_ctLines; i++) {
con_atmLines[i] = -10000.0f;
}
@ -129,9 +121,7 @@ void CConsole::DiscardLastLineTimes(void)
// Get number of lines newer than given time
INDEX CConsole::NumberOfLinesAfter(TIME tmLast)
{
if (this==NULL) {
return 0;
}
ASSERT(this!=NULL);
// clamp console variable
con_iLastLines = Clamp( con_iLastLines, 0, (INDEX)CONSOLE_MAXLASTLINES);
// find number of last console lines to be displayed on screen
@ -146,9 +136,7 @@ INDEX CConsole::NumberOfLinesAfter(TIME tmLast)
// Get one of last lines
CTString CConsole::GetLastLine(INDEX iLine)
{
if (this==NULL) {
return "";
}
ASSERT(this!=NULL);
if (iLine>=con_ctLinesPrinted) {
return "";
}
@ -166,9 +154,7 @@ CTString CConsole::GetLastLine(INDEX iLine)
// clear one given line in buffer
void CConsole::ClearLine(INDEX iLine)
{
if (this==NULL) {
return;
}
ASSERT(this!=NULL);
// line must be valid
ASSERT(iLine>=0 && iLine<con_ctLines);
// get start of line
@ -183,9 +169,7 @@ void CConsole::ClearLine(INDEX iLine)
// scroll buffer up, discarding lines at the start
void CConsole::ScrollBufferUp(INDEX ctLines)
{
if (this==NULL) {
return;
}
ASSERT(this!=NULL);
ASSERT(ctLines>0 && ctLines<con_ctLines);
// move buffer up
memmove(
@ -207,9 +191,7 @@ void CConsole::ScrollBufferUp(INDEX ctLines)
// Add a line of text to console
void CConsole::PutString(const char *strString)
{
if (this==NULL) {
return;
}
ASSERT(this!=NULL);
// synchronize access to console
CTSingleLock slConsole(&con_csConsole, TRUE);
@ -265,9 +247,7 @@ void CConsole::PutString(const char *strString)
// Close console log file buffers (call only when force-exiting!)
void CConsole::CloseLog(void)
{
if (this==NULL) {
return;
}
ASSERT(this!=NULL);
if (con_fLog!=NULL) {
fclose(con_fLog);
}

View File

@ -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;
}

View File

@ -2036,10 +2036,7 @@ static CStaticStackArray<CSentEvent> _aseSentEvents; // delayed events
/* Send an event to this entity. */
void CEntity::SendEvent(const CEntityEvent &ee)
{
if (this==NULL) {
ASSERT(FALSE);
return;
}
ASSERT(this!=NULL);
CSentEvent &se = _aseSentEvents.Push();
se.se_penEntity = this;
se.se_peeEvent = ((CEntityEvent&)ee).MakeCopy(); // discard const qualifier

View File

@ -688,25 +688,24 @@ 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; }
/////////////////////////////////////////////////////////////////////
// Reference counting functions
inline void CEntity::AddReference(void) {
if (this!=NULL) {
ASSERT(this!=NULL);
ASSERT(en_ctReferences>=0);
en_ctReferences++;
}
};
inline void CEntity::RemReference(void) {
if (this!=NULL) {
ASSERT(this!=NULL);
ASSERT(en_ctReferences>0);
en_ctReferences--;
if(en_ctReferences==0) {
delete this;
}
}
};
/*

View File

@ -64,14 +64,12 @@ CEntityClass::~CEntityClass(void)
/////////////////////////////////////////////////////////////////////
// Reference counting functions
void CEntityClass::AddReference(void) {
if (this!=NULL) {
ASSERT(this!=NULL);
MarkUsed();
}
};
void CEntityClass::RemReference(void) {
if (this!=NULL) {
ASSERT(this!=NULL);
_pEntityClassStock->Release(this);
}
};
/*

View File

@ -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;
};

View File

@ -99,7 +99,7 @@ void CFontData::Read_t( CTStream *inFile) // throw char *
SetCharSpacing(+1);
SetLineSpacing(+1);
SetSpaceWidth(0.5f);
fd_fcdFontCharData[' '].fcd_pixStart = 0;
fd_fcdFontCharData[(int)' '].fcd_pixStart = 0;
}
void CFontData::Write_t( CTStream *outFile) // throw char *
@ -201,7 +201,7 @@ void CFontData::Make_t( const CTFileName &fnTexture, PIX pixCharWidth, PIX pixCh
iLetter++; // skip carriage return
}
// set default space width
fd_fcdFontCharData[' '].fcd_pixStart = 0;
fd_fcdFontCharData[(int)' '].fcd_pixStart = 0;
SetSpaceWidth(0.5f);
// all done

View File

@ -71,7 +71,7 @@ public:
inline void SetFixedWidth(void) { fd_bFixedWidth = TRUE; };
inline void SetVariableWidth(void) { fd_bFixedWidth = FALSE; };
inline void SetSpaceWidth( FLOAT fWidthRatio) { // relative to char cell width (1/2 is default)
fd_fcdFontCharData[' '].fcd_pixEnd = (PIX)(fd_pixCharWidth*fWidthRatio); }
fd_fcdFontCharData[(int)' '].fcd_pixEnd = (PIX)(fd_pixCharWidth*fWidthRatio); }
void Read_t( CTStream *inFile); // throw char *
void Write_t( CTStream *outFile); // throw char *

View File

@ -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;

View File

@ -1115,10 +1115,10 @@ void CObjectPolygon::JoinContinuingEdges(CDynamicArray<CObjectEdge> &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<CObjectEdge> &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);

View File

@ -655,7 +655,8 @@ extern void FreeUnusedStock(void)
*/
void CNetworkTimerHandler::HandleTimer(void)
{
if (this==NULL || _bTempNetwork) {
ASSERT(this!=NULL);
if (_bTempNetwork) {
return; // this can happen during NET_MakeDefaultState_t()!
}
// enable stream handling during timer
@ -902,7 +903,8 @@ void CNetworkLibrary::Init(const CTString &strGameID)
*/
void CNetworkLibrary::AddTimerHandler(void)
{
if (this==NULL || _bTempNetwork) {
ASSERT(this!=NULL);
if (_bTempNetwork) {
return; // this can happen during NET_MakeDefaultState_t()!
}
_pTimer->AddHandler(&ga_thTimerHandler);
@ -912,7 +914,8 @@ void CNetworkLibrary::AddTimerHandler(void)
*/
void CNetworkLibrary::RemoveTimerHandler(void)
{
if (this==NULL || _bTempNetwork) {
ASSERT(this!=NULL);
if (_bTempNetwork) {
return; // this can happen during NET_MakeDefaultState_t()!
}
_pTimer->RemHandler(&ga_thTimerHandler);
@ -1390,7 +1393,8 @@ void CNetworkLibrary::TogglePause(void)
// test if game is paused
BOOL CNetworkLibrary::IsPaused(void)
{
if (this==NULL || _bTempNetwork) {
ASSERT(this!=NULL);
if (_bTempNetwork) {
return TRUE; // this can happen during NET_MakeDefaultState_t()!
}
return ga_sesSessionState.ses_bPause;
@ -1427,7 +1431,8 @@ void CNetworkLibrary::SetLocalPause(BOOL bPause)
BOOL CNetworkLibrary::GetLocalPause(void)
{
if (this==NULL || _bTempNetwork) {
ASSERT(this!=NULL);
if (_bTempNetwork) {
return TRUE; // this can happen during NET_MakeDefaultState_t()!
}
return ga_bLocalPause;
@ -2033,7 +2038,8 @@ void CNetworkLibrary::SendActionsToServer(void)
*/
void CNetworkLibrary::TimerLoop(void)
{
if (this==NULL || _bTempNetwork) {
ASSERT(this!=NULL);
if (_bTempNetwork) {
return; // this can happen during NET_MakeDefaultState_t()!
}
_pfNetworkProfile.StartTimer(CNetworkProfile::PTI_TIMERLOOP);

View File

@ -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; i<ctVtx; i++) {
CBrushVertex *pbvx = bpo.bpo_apbvxTriangleVertices[i];
CBrushVertex *pbvx = pbpo->bpo_apbvxTriangleVertices[i];
const INDEX iVtx = bsc.bsc_abvxVertices.Index(pbvx);
const FLOAT3D &v = pvvx0[iVtx].vvx_vView;
if( -v(3)<fNearestZ) fNearestZ = -v(3); // inverted because of negative sign
@ -809,8 +809,8 @@ void CRenderer::AddPolygonToScene( CScreenPolygon *pspo)
// all done
sppo.spo_ctVtx = ctVtx;
sppo.spo_ctElements = bpo.bpo_aiTriangleElements.Count();
sppo.spo_piElements = sppo.spo_ctElements ? &bpo.bpo_aiTriangleElements[0] : NULL;
sppo.spo_ctElements = pbpo->bpo_aiTriangleElements.Count();
sppo.spo_piElements = sppo.spo_ctElements ? &pbpo->bpo_aiTriangleElements[0] : NULL;
_sfStats.IncrementCounter(CStatForm::SCI_SCENE_TRIANGLES, sppo.spo_ctElements/3);
}

View File

@ -252,16 +252,14 @@ SLONG CSoundData::GetUsedMemory(void)
// Add one reference
void CSoundData::AddReference(void)
{
if (this!=NULL) {
ASSERT(this!=NULL);
MarkUsed();
}
}
// Remove one reference
void CSoundData::RemReference(void)
{
if (this!=NULL) {
ASSERT(this!=NULL);
_pSoundStock->Release(this);
}
}

View File

@ -1233,6 +1233,7 @@ BOOL CSoundLibrary::SetEnvironment( INDEX iEnvNo, FLOAT fEnvSize/*=0*/)
// mute all sounds (erase playing buffer(s) and supress mixer)
void CSoundLibrary::Mute(void)
{
ASSERT(this!=NULL);
// stop all IFeel effects
IFeel_StopEffect(NULL);
@ -1244,7 +1245,7 @@ void CSoundLibrary::Mute(void)
#ifdef PLATFORM_WIN32
// erase direct sound buffer (waveout will shut-up by itself), but skip if there's no more sound library
if( this==NULL || !sl_bUsingDirectSound) return;
if(!sl_bUsingDirectSound) return;
// synchronize access to sounds
CTSingleLock slSounds(&sl_csSound, TRUE);

View File

@ -936,10 +936,11 @@ void CWorld::TriangularizeForVertices( CBrushVertexSelection &selVertex)
// add this entity to prediction
void CEntity::AddToPrediction(void)
{
// this function may be called even for NULLs - so ignore it
if (this==NULL) {
return;
}
// this function may be called even for NULLs - TODO: fix those cases
// (The compiler is free to assume that "this" is never NULL and optimize
// based on that assumption. For example, an "if (this==NULL) {...}" could
// be optimized away completely.)
ASSERT(this!=NULL);
// if already added
if (en_ulFlags&ENF_WILLBEPREDICTED) {
// do nothing

View File

@ -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,

View File

@ -344,7 +344,7 @@ functions:
GetNormalComponent( vDistance/fDistance, vHitNormal, ese.vDirection);
FLOAT fLength = ese.vDirection.Length();
fLength = Clamp( fLength*3, 1.0f, 3.0f);
fDistance = Clamp( log10(fDistance), 0.5f, 2.0f);
fDistance = Clamp( log10f(fDistance), 0.5f, 2.0f);
ese.vStretch = FLOAT3D( fDistance, fLength*fDistance, 1.0f);
SpawnEffect(vHitPoint, ese);
}

View File

@ -35,8 +35,9 @@ CPathNode::~CPathNode(void)
// get name of this node
const CTString &CPathNode::GetName(void)
{
ASSERT(this!=NULL);
static CTString strNone="<none>";
if (this==NULL || pn_pnmMarker==NULL) {
if (pn_pnmMarker==NULL) {
return strNone;
} else {
return pn_pnmMarker->GetName();
@ -46,7 +47,8 @@ const CTString &CPathNode::GetName(void)
// get link with given index or null if no more (for iteration along the graph)
CPathNode *CPathNode::GetLink(INDEX i)
{
if (this==NULL || pn_pnmMarker==NULL) {
ASSERT(this!=NULL);
if (pn_pnmMarker==NULL) {
ASSERT(FALSE);
return NULL;
}

View File

@ -4588,7 +4588,7 @@ void TeleportPlayer(enum WorldLinkType EwltType)
TIME tmLevelTime = _pTimer->CurrentTick()-m_tmLevelStarted;
m_psLevelStats.ps_tmTime = tmLevelTime;
m_psGameStats.ps_tmTime += tmLevelTime;
FLOAT fTimeDelta = ClampDn(floor(m_tmEstTime)-floor(tmLevelTime), 0.0f);
FLOAT fTimeDelta = ClampDn(floorf(m_tmEstTime)-floorf(tmLevelTime), 0.0f);
m_iTimeScore = floor(fTimeDelta*100.0f);
m_psLevelStats.ps_iScore+=m_iTimeScore;
m_psGameStats.ps_iScore+=m_iTimeScore;

View File

@ -386,7 +386,7 @@ void SpawnHitTypeEffect(CEntity *pen, enum BulletHitType bhtType, BOOL bSound, F
GetNormalComponent( vDistance/fDistance, vHitNormal, ese.vDirection);
FLOAT fLength = ese.vDirection.Length();
fLength = Clamp( fLength*3, 1.0f, 3.0f);
fDistance = Clamp( log10(fDistance), 0.5f, 2.0f);
fDistance = Clamp( log10f(fDistance), 0.5f, 2.0f);
ese.vStretch = FLOAT3D( fDistance, fLength*fDistance, 1.0f);
try
{

View File

@ -527,7 +527,7 @@ void Particles_ViewerLocal(CEntity *penView)
break;
default:
ASSERT("Unknown environment particle type!");
ASSERTALWAYS("Unknown environment particle type!");
break;
}
// for those EPHs that are not rendered, clear possible

View File

@ -50,8 +50,9 @@ CPathNode::~CPathNode(void)
// get name of this node
const CTString &CPathNode::GetName(void)
{
ASSERT(this!=NULL);
static CTString strNone="<none>";
if (this==NULL || pn_pnmMarker==NULL) {
if (pn_pnmMarker==NULL) {
return strNone;
} else {
return pn_pnmMarker->GetName();
@ -61,10 +62,7 @@ const CTString &CPathNode::GetName(void)
// get link with given index or null if no more (for iteration along the graph)
CPathNode *CPathNode::GetLink(INDEX i)
{
if (this==NULL || pn_pnmMarker==NULL) {
ASSERT(FALSE);
return NULL;
}
ASSERT(this!=NULL && pn_pnmMarker!=NULL);
CNavigationMarker *pnm = pn_pnmMarker->GetLink(i);
if (pnm==NULL) {
return NULL;

View File

@ -99,7 +99,7 @@ functions:
} else if (m_gtType==GT_COMMANDER) {
return &eiGruntSoldier;
} else {
ASSERT("Unknown grunt type!");
ASSERTALWAYS("Unknown grunt type!");
return NULL;
}
};

View File

@ -280,7 +280,7 @@ functions:
} else if (m_gtType==GT_COMMANDER) {
return &eiGruntSoldier;
} else {
ASSERT("Unknown grunt type!");
ASSERTALWAYS("Unknown grunt type!");
return NULL;
}
};

View File

@ -5381,7 +5381,7 @@ functions:
TIME tmLevelTime = _pTimer->CurrentTick()-m_tmLevelStarted;
m_psLevelStats.ps_tmTime = tmLevelTime;
m_psGameStats.ps_tmTime += tmLevelTime;
FLOAT fTimeDelta = ClampDn(floor(m_tmEstTime)-floor(tmLevelTime), 0.0f);
FLOAT fTimeDelta = ClampDn(floorf(m_tmEstTime)-floorf(tmLevelTime), 0.0f);
m_iTimeScore = (INDEX) floor(fTimeDelta*100.0f);
m_psLevelStats.ps_iScore+=m_iTimeScore;
m_psGameStats.ps_iScore+=m_iTimeScore;

View File

@ -3442,7 +3442,7 @@ functions:
return (WeaponType)i;
}
}
ASSERT("Non-existant weapon in remap array!");
ASSERTALWAYS("Non-existant weapon in remap array!");
return (WeaponType)0;
}

View File

@ -618,7 +618,7 @@ functions:
pen = &m_penGroup03Template01;
iCount = IRnd()%m_iGroup03Count+1;
} else {
ASSERT("Invalid group!");
ASSERTALWAYS("Invalid group!");
iCount = 0; // DG: this should have a deterministic value in case this happens after all!
}
ASSERT(iCount>0);
@ -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<SUMMONER_TEMP_PER_GROUP; i++) {
if (&*pen[i]!=NULL) { m_iGroup01Count++; }
if (pen[i].get()!=NULL) { m_iGroup01Count++; }
}
m_iGroup02Count = 0;
pen = &m_penGroup02Template01;
for (i=0; i<SUMMONER_TEMP_PER_GROUP; i++) {
if (&*pen[i]!=NULL) { m_iGroup02Count++; }
if (pen[i].get()!=NULL) { m_iGroup02Count++; }
}
m_iGroup03Count = 0;
pen = &m_penGroup03Template01;
for (i=0; i<SUMMONER_TEMP_PER_GROUP; i++) {
if (&*pen[i]!=NULL) { m_iGroup03Count++; }
if (pen[i].get()!=NULL) { m_iGroup03Count++; }
}
if (!DoSafetyChecks()) {

View File

@ -69,7 +69,7 @@ INDEX CDlgPgInfoAttachingPlacement::GetCurrentAttachingPlacement(void)
void CDlgPgInfoAttachingPlacement::SetPlacementReferenceVertex(INDEX iCenter, INDEX iFront, INDEX iUp)
{
// patch for calling before page is refreshed
if(this == NULL) return;
ASSERT(this!=NULL);
CModelerView *pModelerView = CModelerView::GetActiveView();
if(pModelerView == NULL) return;
CModelerDoc* pDoc = pModelerView->GetDocument();