From 23866079be7ab8987d8f61ee20f58a6828679b77 Mon Sep 17 00:00:00 2001 From: kervala Date: Wed, 25 May 2016 23:18:11 +0200 Subject: [PATCH] Changed: Replace size() comparisons by empty() --- code/nel/include/nel/3d/zone.h | 2 +- code/nel/include/nel/misc/cdb.h | 2 +- code/nel/src/3d/driver.cpp | 12 ++++----- code/nel/src/3d/dru.cpp | 4 +-- code/nel/src/3d/landscape.cpp | 2 +- code/nel/src/3d/landscapevb_allocator.cpp | 2 +- code/nel/src/3d/mesh.cpp | 18 ++++++------- code/nel/src/3d/mesh_morpher.cpp | 7 ++--- code/nel/src/3d/mesh_mrm.cpp | 26 +++++++++---------- code/nel/src/3d/mesh_mrm_skin.cpp | 2 +- code/nel/src/3d/mesh_mrm_skin_template.cpp | 6 ++--- code/nel/src/3d/mesh_mrm_skinned.cpp | 14 +++++----- code/nel/src/3d/mrm_builder.cpp | 2 +- code/nel/src/3d/patch.cpp | 5 ++-- code/nel/src/3d/patch_render.cpp | 2 +- code/nel/src/3d/patchdlm_context.cpp | 4 +-- code/nel/src/3d/ps_face.cpp | 6 ++--- code/nel/src/3d/ps_mesh.cpp | 4 +-- code/nel/src/3d/quad_effect.cpp | 2 +- code/nel/src/3d/shadow_map_manager.cpp | 2 +- code/nel/src/3d/texture_dlm.cpp | 4 +-- code/nel/src/3d/tile_bank.cpp | 4 +-- .../src/3d/vegetable_blend_layer_model.cpp | 2 +- code/nel/src/3d/vegetable_manager.cpp | 10 +++---- code/nel/src/3d/vegetablevb_allocator.cpp | 2 +- code/nel/src/3d/water_model.cpp | 2 +- code/nel/src/3d/zone.cpp | 10 ++++--- code/nel/src/3d/zone_lighter.cpp | 2 +- code/nel/src/gui/group_header.cpp | 2 +- code/nel/src/gui/group_tab.cpp | 4 +-- code/nel/src/gui/interface_parser.cpp | 2 +- code/nel/src/ligo/primitive.cpp | 2 +- code/nel/src/misc/cdb_branch.cpp | 2 +- code/nel/src/misc/polygon.cpp | 2 +- code/nel/src/misc/system_utils.cpp | 2 +- code/nel/src/net/admin.cpp | 4 +-- code/nel/src/net/buf_sock.cpp | 4 +-- code/nel/src/net/login_client.cpp | 4 +-- code/nel/src/net/naming_client.cpp | 6 ++--- code/nel/src/net/service.cpp | 2 +- .../sound/driver/openal/sound_driver_al.cpp | 4 +-- .../nel/src/sound/driver/openal/source_al.cpp | 4 +-- .../driver/xaudio2/sound_driver_xaudio2.cpp | 6 ++--- code/ryzom/client/src/commands.cpp | 6 ++--- .../src/interface_v3/action_handler_help.cpp | 2 +- .../src/interface_v3/action_phrase_faber.cpp | 3 ++- .../client/src/interface_v3/dbctrl_sheet.cpp | 4 +-- .../client/src/interface_v3/group_map.cpp | 2 +- .../src/interface_v3/interface_manager.cpp | 6 ++--- .../src/interface_v3/sphrase_manager.cpp | 10 +++---- code/ryzom/client/src/login.cpp | 2 +- code/ryzom/client/src/login_patch.h | 2 +- code/ryzom/client/src/movie_shooter.cpp | 2 +- code/ryzom/client/src/net_manager.cpp | 2 +- code/ryzom/client/src/r2/editor.cpp | 2 +- code/ryzom/client/src/r2/tool_pick.cpp | 6 ++--- .../src/game_share/scenario_entry_points.cpp | 2 +- 57 files changed, 133 insertions(+), 128 deletions(-) diff --git a/code/nel/include/nel/3d/zone.h b/code/nel/include/nel/3d/zone.h index 9c60013a8..4aaaea53b 100644 --- a/code/nel/include/nel/3d/zone.h +++ b/code/nel/include/nel/3d/zone.h @@ -163,7 +163,7 @@ public: /** There is (OrderS/2+1) * (OrderT/2+1) tiles light influence. * It indicates which static pointLight influence each corner of a TessBlock (block of 2*2 tiles). * - * If size()==0, suppose no light influence. but CZone::retrieve() always return a + * If empty(), suppose no light influence. but CZone::retrieve() always return a * size() == (OrderS/2+1) * (OrderT/2+1). * * They are stored in line first order, from S=0 to 1, and T=0 to 1. diff --git a/code/nel/include/nel/misc/cdb.h b/code/nel/include/nel/misc/cdb.h index bc02dc85b..4a6e65097 100644 --- a/code/nel/include/nel/misc/cdb.h +++ b/code/nel/include/nel/misc/cdb.h @@ -120,7 +120,7 @@ public: */ std::string toString() const { - if (_Ids.size()==0) return std::string(""); + if (_Ids.empty()) return std::string(""); std::string str=_Ids[0]; for (unsigned i=1; i<_Ids.size(); i++) str +=std::string(":")+ _Ids[i]; diff --git a/code/nel/src/3d/driver.cpp b/code/nel/src/3d/driver.cpp index 9bd23f815..3ba0178f2 100644 --- a/code/nel/src/3d/driver.cpp +++ b/code/nel/src/3d/driver.cpp @@ -50,14 +50,14 @@ IDriver::~IDriver() { CSynchronized::CAccessor access(&_SyncTexDrvInfos); TTexDrvInfoPtrMap &rTexDrvInfos = access.value(); - nlassert( rTexDrvInfos.size() == 0 ); + nlassert(rTexDrvInfos.empty()); } - nlassert(_TexDrvShares.size()==0); - nlassert(_MatDrvInfos.size()==0); - nlassert(_VBDrvInfos.size()==0); - nlassert(_IBDrvInfos.size()==0); - nlassert(_GPUPrgDrvInfos.size()==0); + nlassert(_TexDrvShares.empty()); + nlassert(_MatDrvInfos.empty()); + nlassert(_VBDrvInfos.empty()); + nlassert(_IBDrvInfos.empty()); + nlassert(_GPUPrgDrvInfos.empty()); } diff --git a/code/nel/src/3d/dru.cpp b/code/nel/src/3d/dru.cpp index bb86d8b84..fd3e77404 100644 --- a/code/nel/src/3d/dru.cpp +++ b/code/nel/src/3d/dru.cpp @@ -528,7 +528,7 @@ void CDRU::drawTrianglesUnlit(const NLMISC::CTriangleUV *trilist, sint ntris, // *************************************************************************** void CDRU::drawTrianglesUnlit(const std::vector &trilist, CMaterial &mat, IDriver& driver) { - if(trilist.size()==0) + if(trilist.empty()) return; CDRU::drawTrianglesUnlit( &(*trilist.begin()), (uint)trilist.size(), mat, driver); @@ -570,7 +570,7 @@ void CDRU::drawLinesUnlit(const NLMISC::CLine *linelist, sint nlines, CMateria // *************************************************************************** void CDRU::drawLinesUnlit(const std::vector &linelist, CMaterial &mat, IDriver& driver) { - if(linelist.size()==0) + if(linelist.empty()) return; CDRU::drawLinesUnlit( &(*linelist.begin()), (sint)linelist.size(), mat, driver); } diff --git a/code/nel/src/3d/landscape.cpp b/code/nel/src/3d/landscape.cpp index ccdeabc34..d588fa424 100644 --- a/code/nel/src/3d/landscape.cpp +++ b/code/nel/src/3d/landscape.cpp @@ -2859,7 +2859,7 @@ void CLandscape::setupAutomaticLightDir(const CVector &lightDir) // *************************************************************************** CVector CLandscape::getHeightFieldDeltaZ(float x, float y) const { - if(_HeightField.ZPatchs.size()==0) + if(_HeightField.ZPatchs.empty()) return CVector::Null; // map to _HeightField coordinates. diff --git a/code/nel/src/3d/landscapevb_allocator.cpp b/code/nel/src/3d/landscapevb_allocator.cpp index 43c38ab64..c6815ea05 100644 --- a/code/nel/src/3d/landscapevb_allocator.cpp +++ b/code/nel/src/3d/landscapevb_allocator.cpp @@ -134,7 +134,7 @@ void CLandscapeVBAllocator::resetReallocation() uint CLandscapeVBAllocator::allocateVertex() { // if no more free, allocate. - if( _VertexFreeMemory.size()==0 ) + if( _VertexFreeMemory.empty() ) { // enlarge capacity. uint newResize; diff --git a/code/nel/src/3d/mesh.cpp b/code/nel/src/3d/mesh.cpp index a533632c5..0d3095182 100644 --- a/code/nel/src/3d/mesh.cpp +++ b/code/nel/src/3d/mesh.cpp @@ -52,7 +52,7 @@ namespace NL3D static NLMISC::CAABBoxExt makeBBox(const std::vector &Vertices) { NLMISC::CAABBox ret; - nlassert(Vertices.size()); + nlassert(!Vertices.empty()); ret.setCenter(Vertices[0]); for(sint i=0;i<(sint)Vertices.size();i++) { @@ -167,7 +167,7 @@ void CMeshGeom::build (CMesh::CMeshBuild &m, uint numMaxMaterial) sint i; // Empty geometry? - if(m.Vertices.size()==0 || m.Faces.size()==0) + if(m.Vertices.empty() || m.Faces.empty()) { _VBuffer.setNumVertices(0); _VBuffer.setName("CMeshGeom"); @@ -436,7 +436,7 @@ void CMeshGeom::build (CMesh::CMeshBuild &m, uint numMaxMaterial) } // Set the vertex buffer preferred memory - bool avoidVBHard= _Skinned || ( _MeshMorpher && _MeshMorpher->BlendShapes.size()>0 ); + bool avoidVBHard= _Skinned || ( _MeshMorpher && !_MeshMorpher->BlendShapes.empty() ); _VBuffer.setPreferredMemory (avoidVBHard?CVertexBuffer::RAMPreferred:CVertexBuffer::StaticPreferred, false); // End!! @@ -638,7 +638,7 @@ void CMeshGeom::render(IDriver *drv, CTransformShape *trans, float polygonCount, for(uint mb=0;mb<_MatrixBlocks.size();mb++) { CMatrixBlock &mBlock= _MatrixBlocks[mb]; - if(mBlock.RdrPass.size()==0) + if(mBlock.RdrPass.empty()) continue; // Global alpha ? @@ -790,7 +790,7 @@ void CMeshGeom::renderSkin(CTransformShape *trans, float alphaMRM) for(uint mb=0;mb<_MatrixBlocks.size();mb++) { CMatrixBlock &mBlock= _MatrixBlocks[mb]; - if(mBlock.RdrPass.size()==0) + if(mBlock.RdrPass.empty()) continue; // Render all pass. @@ -840,7 +840,7 @@ void CMeshGeom::renderSimpleWithMaterial(IDriver *drv, const CMatrix &worldMatri for(uint mb=0;mb<_MatrixBlocks.size();mb++) { CMatrixBlock &mBlock= _MatrixBlocks[mb]; - if(mBlock.RdrPass.size()==0) + if(mBlock.RdrPass.empty()) continue; // Render all pass. @@ -998,10 +998,10 @@ void CMeshGeom::compileRunTime() _PreciseClipping= _BBox.getRadius() >= NL3D_MESH_PRECISE_CLIP_THRESHOLD; // Support MeshBlockRendering only if not skinned/meshMorphed. - bool supportMeshBlockRendering= !_Skinned && _MeshMorpher->BlendShapes.size()==0; + bool supportMeshBlockRendering= !_Skinned && _MeshMorpher->BlendShapes.empty(); // true only if one matrix block, and at least one rdrPass. - supportMeshBlockRendering= supportMeshBlockRendering && _MatrixBlocks.size()==1 && _MatrixBlocks[0].RdrPass.size()>0; + supportMeshBlockRendering= supportMeshBlockRendering && _MatrixBlocks.size()==1 && !_MatrixBlocks[0].RdrPass.empty(); if (supportMeshBlockRendering && _MeshVertexProgram) { supportMeshBlockRendering = supportMeshBlockRendering && _MeshVertexProgram->supportMeshBlockRendering(); @@ -1021,7 +1021,7 @@ void CMeshGeom::compileRunTime() if(supportMBRPerMaterial) _SupportMBRFlags|= MBRSortPerMaterial; - bool avoidVBHard= _Skinned || ( _MeshMorpher && _MeshMorpher->BlendShapes.size()>0 ); + bool avoidVBHard= _Skinned || ( _MeshMorpher && !_MeshMorpher->BlendShapes.empty() ); _VBuffer.setPreferredMemory (avoidVBHard?CVertexBuffer::RAMPreferred:CVertexBuffer::StaticPreferred, false); } diff --git a/code/nel/src/3d/mesh_morpher.cpp b/code/nel/src/3d/mesh_morpher.cpp index 4d7ed8255..39f44a130 100644 --- a/code/nel/src/3d/mesh_morpher.cpp +++ b/code/nel/src/3d/mesh_morpher.cpp @@ -407,9 +407,10 @@ void CMeshMorpher::updateRawSkin (CVertexBuffer *vbOri, rFactor*= 0.01f; uint32 numVertices= (uint32)rBS.VertRefs.size(); // don't know why, but cases happen where deltaNorm not empty while deltaPos is - bool hasPos= rBS.deltaPos.size()>0; - bool hasNorm= rBS.deltaNorm.size()>0; - bool hasUV= rBS.deltaUV.size()>0; + bool hasPos = !rBS.deltaPos.empty(); + bool hasNorm = !rBS.deltaNorm.empty(); + bool hasUV = !rBS.deltaUV.empty(); + for (j = 0; j < numVertices; ++j) { // Get the vertex Index in the VBufferFinal diff --git a/code/nel/src/3d/mesh_mrm.cpp b/code/nel/src/3d/mesh_mrm.cpp index 999b3b62d..e5b61c966 100644 --- a/code/nel/src/3d/mesh_mrm.cpp +++ b/code/nel/src/3d/mesh_mrm.cpp @@ -180,7 +180,7 @@ void CMeshMRMGeom::CLod::optimizeTriangleOrder() static NLMISC::CAABBoxExt makeBBox(const std::vector &Vertices) { NLMISC::CAABBox ret; - nlassert(Vertices.size()); + nlassert(!Vertices.empty()); ret.setCenter(Vertices[0]); for(sint i=0;i<(sint)Vertices.size();i++) { @@ -236,7 +236,7 @@ void CMeshMRMGeom::build(CMesh::CMeshBuild &m, std::vector uint numMaxMaterial, const CMRMParameters ¶ms) { // Empty geometry? - if(m.Vertices.size()==0 || m.Faces.size()==0) + if(m.Vertices.empty() || m.Faces.empty()) { _VBufferFinal.setNumVertices(0); _VBufferFinal.reserve(0); @@ -308,7 +308,7 @@ void CMeshMRMGeom::build(CMesh::CMeshBuild &m, std::vector _LevelDetail.MaxFaceUsed= 0; _LevelDetail.MinFaceUsed= 0; // Count of primitive block - if(_Lods.size()>0) + if (!_Lods.empty()) { uint pb; // Compute MinFaces. @@ -469,7 +469,7 @@ void CMeshMRMGeom::applyGeomorph(std::vector &geoms, float alpha void CMeshMRMGeom::applyGeomorphWithVBHardPtr(std::vector &geoms, float alphaLod, uint8 *vertexDestPtr) { // no geomorphs? quit. - if(geoms.size()==0) + if(geoms.empty()) return; clamp(alphaLod, 0.f, 1.f); @@ -900,7 +900,7 @@ inline sint CMeshMRMGeom::chooseLod(float alphaMRM, float &alphaLod) void CMeshMRMGeom::render(IDriver *drv, CTransformShape *trans, float polygonCount, uint32 rdrFlags, float globalAlpha) { nlassert(drv); - if(_Lods.size()==0) + if(_Lods.empty()) return; @@ -922,7 +922,7 @@ void CMeshMRMGeom::render(IDriver *drv, CTransformShape *trans, float polygonCou // Render the choosen Lod. CLod &lod= _Lods[numLod]; - if(lod.RdrPass.size()==0) + if(lod.RdrPass.empty()) return; @@ -1104,7 +1104,7 @@ void CMeshMRMGeom::renderSkin(CTransformShape *trans, float alphaMRM) { H_AUTO( NL3D_MeshMRMGeom_renderSkin ); - if(_Lods.size()==0) + if(_Lods.empty()) return; @@ -1126,7 +1126,7 @@ void CMeshMRMGeom::renderSkin(CTransformShape *trans, float alphaMRM) // Render the choosen Lod. CLod &lod= _Lods[numLod]; - if(lod.RdrPass.size()==0) + if(lod.RdrPass.empty()) return; @@ -1295,7 +1295,7 @@ sint CMeshMRMGeom::renderSkinGroupGeom(CMeshMRMInstance *mi, float alphaMRM, uin // Render the choosen Lod. CLod &lod= _Lods[numLod]; - if(lod.RdrPass.size()==0) + if(lod.RdrPass.empty()) // return no vertices added return 0; @@ -1942,7 +1942,7 @@ void CMeshMRMGeom::loadFirstLod(NLMISC::IStream &f) // If empty MRM, quit. - if(_LodInfos.size()==0) + if(_LodInfos.empty()) return; /* If the version is <4, then SkinWeights are serialised per Lod. @@ -2431,7 +2431,7 @@ void CMeshMRMGeom::compileRunTime() _PreciseClipping= _BBox.getRadius() >= NL3D_MESH_PRECISE_CLIP_THRESHOLD; // Compute if can support SkinGrouping rendering - if(_Lods.size()==0 || !_Skinned) + if(_Lods.empty() || !_Skinned) { _SupportSkinGrouping= false; _SupportShadowSkinGrouping= false; @@ -2451,7 +2451,7 @@ void CMeshMRMGeom::compileRunTime() } // Support MeshBlockRendering only if not skinned/meshMorphed. - _SupportMeshBlockRendering= !_Skinned && _MeshMorpher.BlendShapes.size()==0; + _SupportMeshBlockRendering= !_Skinned && _MeshMorpher.BlendShapes.empty(); // \todo yoyo: support later MeshVertexProgram _SupportMeshBlockRendering= _SupportMeshBlockRendering && _MeshVertexProgram==NULL; @@ -3367,7 +3367,7 @@ void CMeshMRMGeom::updateRawSkinNormal(bool enabled, CMeshMRMInstance *mi, sint // Case of MeshMorpher //======== - if(_MeshMorpher.BlendShapes.size()>0) + if(!_MeshMorpher.BlendShapes.empty()) { skinLod.VertexRemap.resize((uint32)vertexFinalRemap.size()); diff --git a/code/nel/src/3d/mesh_mrm_skin.cpp b/code/nel/src/3d/mesh_mrm_skin.cpp index 23ff04fee..7bba5d370 100644 --- a/code/nel/src/3d/mesh_mrm_skin.cpp +++ b/code/nel/src/3d/mesh_mrm_skin.cpp @@ -55,7 +55,7 @@ namespace NL3D void CMeshMRMGeom::applySkin(CLod &lod, const CSkeletonModel *skeleton) { nlassert(_Skinned); - if(_SkinWeights.size()==0) + if(_SkinWeights.empty()) return; // get vertexPtr. diff --git a/code/nel/src/3d/mesh_mrm_skin_template.cpp b/code/nel/src/3d/mesh_mrm_skin_template.cpp index 4a9e11106..63a0b67e8 100644 --- a/code/nel/src/3d/mesh_mrm_skin_template.cpp +++ b/code/nel/src/3d/mesh_mrm_skin_template.cpp @@ -380,7 +380,7 @@ static void applyArraySkinTangentSpaceT(uint numMatrixes, uint32 *infPtr, CMesh: void CMeshMRMGeom::applySkinWithNormal(CLod &lod, const CSkeletonModel *skeleton) { nlassert(_Skinned); - if(_SkinWeights.size()==0) + if(_SkinWeights.empty()) return; // get vertexPtr / normalOff. @@ -446,7 +446,7 @@ void CMeshMRMGeom::applySkinWithTangentSpace(CLod &lod, const CSkeletonModel *sk uint tangentSpaceTexCoord) { nlassert(_Skinned); - if(_SkinWeights.size()==0) + if(_SkinWeights.empty()) return; // get vertexPtr / normalOff / tangent space offset. @@ -1468,7 +1468,7 @@ void CMeshMRMGeom::applyArrayRawSkinNormal4(CRawVertexNormalSkin4 *src, uint8 * void CMeshMRMGeom::applyRawSkinWithNormal(CLod &lod, CRawSkinNormalCache &rawSkinLod, const CSkeletonModel *skeleton, uint8 *vbHard, float alphaLod) { nlassert(_Skinned); - if(_SkinWeights.size()==0) + if(_SkinWeights.empty()) return; // Some assert diff --git a/code/nel/src/3d/mesh_mrm_skinned.cpp b/code/nel/src/3d/mesh_mrm_skinned.cpp index 6af29bf73..11a1b41fc 100644 --- a/code/nel/src/3d/mesh_mrm_skinned.cpp +++ b/code/nel/src/3d/mesh_mrm_skinned.cpp @@ -160,7 +160,7 @@ void CMeshMRMSkinnedGeom::CLod::buildPrimitiveBlock(uint renderPass, const CInde static NLMISC::CAABBoxExt makeBBox(const std::vector &Vertices) { NLMISC::CAABBox ret; - nlassert(Vertices.size()); + nlassert(!Vertices.empty()); ret.setCenter(Vertices[0]); for(sint i=0;i<(sint)Vertices.size();i++) { @@ -211,7 +211,7 @@ void CMeshMRMSkinnedGeom::build(CMesh::CMeshBuild &m, uint numMaxMaterial, const CMRMParameters ¶ms) { // Empty geometry? - if(m.Vertices.size()==0 || m.Faces.size()==0) + if(m.Vertices.empty() || m.Faces.empty()) { _VBufferFinal.clear(); _Lods.clear(); @@ -261,7 +261,7 @@ void CMeshMRMSkinnedGeom::build(CMesh::CMeshBuild &m, _LevelDetail.MaxFaceUsed= 0; _LevelDetail.MinFaceUsed= 0; // Count of primitive block - if(_Lods.size()>0) + if(!_Lods.empty()) { uint pb; // Compute MinFaces. @@ -421,7 +421,7 @@ void CMeshMRMSkinnedGeom::applyGeomorph(std::vector &geoms, floa void CMeshMRMSkinnedGeom::applyGeomorphWithVBHardPtr(std::vector &geoms, float alphaLod) { // no geomorphs? quit. - if(geoms.size()==0) + if(geoms.empty()) return; clamp(alphaLod, 0.f, 1.f); @@ -579,7 +579,7 @@ inline sint CMeshMRMSkinnedGeom::chooseLod(float alphaMRM, float &alphaLod) void CMeshMRMSkinnedGeom::render(IDriver *drv, CTransformShape *trans, float polygonCount, uint32 rdrFlags, float globalAlpha) { nlassert(drv); - if(_Lods.size()==0) + if(_Lods.empty()) return; @@ -597,7 +597,7 @@ void CMeshMRMSkinnedGeom::render(IDriver *drv, CTransformShape *trans, float pol // Render the choosen Lod. CLod &lod= _Lods[numLod]; - if(lod.RdrPass.size()==0) + if(lod.RdrPass.empty()) return; @@ -757,7 +757,7 @@ sint CMeshMRMSkinnedGeom::renderSkinGroupGeom(CMeshMRMSkinnedInstance *mi, float // Render the choosen Lod. CLod &lod= _Lods[numLod]; - if(lod.RdrPass.size()==0) + if(lod.RdrPass.empty()) // return no vertices added return 0; diff --git a/code/nel/src/3d/mrm_builder.cpp b/code/nel/src/3d/mrm_builder.cpp index 1002436d7..3035aa78b 100644 --- a/code/nel/src/3d/mrm_builder.cpp +++ b/code/nel/src/3d/mrm_builder.cpp @@ -3119,7 +3119,7 @@ bool CMRMBuilder::buildMRMSewingMeshes(const CMesh::CMeshBuild &mbuild, uint nWa { nlassert(nWantedLods>=1); nlassert(divisor>=1); - if(mbuild.Interfaces.size()==0) + if(mbuild.Interfaces.empty()) return false; // must have same size if(mbuild.InterfaceLinks.size()!=mbuild.Vertices.size()) diff --git a/code/nel/src/3d/patch.cpp b/code/nel/src/3d/patch.cpp index 799e5b8a3..4b0253ead 100644 --- a/code/nel/src/3d/patch.cpp +++ b/code/nel/src/3d/patch.cpp @@ -604,7 +604,8 @@ void CPatch::addRefTessBlocks() uint i; TessBlockRefCount++; - if(TessBlocks.size()==0) + + if (TessBlocks.empty()) { // Allocate the tessblocks. //========== @@ -1629,7 +1630,7 @@ void CPatch::serial(NLMISC::IStream &f) // then just copy to TileColors. TileColors.resize(tmpArray.size()); - if(TileColors.size()>0) + if(!TileColors.empty()) { memcpy(&TileColors[0], &tmpArray[0], TileColors.size()*sizeof(CTileColor)); } diff --git a/code/nel/src/3d/patch_render.cpp b/code/nel/src/3d/patch_render.cpp index bc74648d3..ee916a3fe 100644 --- a/code/nel/src/3d/patch_render.cpp +++ b/code/nel/src/3d/patch_render.cpp @@ -1452,7 +1452,7 @@ void CPatch::computeSoftwareGeomorphAndAlpha() // Need only to fill CTessVertex, so do it only for FarVertices // Hence Geomorph is done twice on edges of patches!!. // If not too near for precise, fast compute of geomorph. - if( TessBlocks.size()==0 ) + if( TessBlocks.empty() ) { // Just update all vertices of master block. computeGeomorphVertexList(MasterBlock.FarVertexList); diff --git a/code/nel/src/3d/patchdlm_context.cpp b/code/nel/src/3d/patchdlm_context.cpp index 53d580e66..f7d2236e8 100644 --- a/code/nel/src/3d/patchdlm_context.cpp +++ b/code/nel/src/3d/patchdlm_context.cpp @@ -540,7 +540,7 @@ bool CPatchDLMContext::generate(CPatch *patch, CTextureDLM *textureDLM, CPatch #ifndef NL_DLM_TILE_RES // retrieve patch tileColor pointer. - nlassert(_Patch->TileColors.size()>0); + nlassert(!_Patch->TileColors.empty()); CTileColor *tileColor= &_Patch->TileColors[0]; // skip 1 tiles colors per column and per row @@ -898,7 +898,7 @@ void CPatchDLMContext::compileLighting(TCompileType compType, CRGBA modulateCt if(! (_IsSrcTextureFullBlack && _IsDstTextureFullBlack) ) { // if lightMap allocated - if(_LightMap.size()>0 && _DLMTexture) + if(!_LightMap.empty() && _DLMTexture) { // If the srcTexture is full black (ie no pointLight influence touch it), if(_IsSrcTextureFullBlack) diff --git a/code/nel/src/3d/ps_face.cpp b/code/nel/src/3d/ps_face.cpp index 63909287d..e87459acf 100644 --- a/code/nel/src/3d/ps_face.cpp +++ b/code/nel/src/3d/ps_face.cpp @@ -226,7 +226,7 @@ void CPSFace::step(TPSProcessPass pass) else if (pass == PSMotion) { - if (_PrecompBasis.size()) // do we use precomputed basis ? + if (!_PrecompBasis.empty()) // do we use precomputed basis ? { // rotate all precomputed basis for (CPSVector< CPlaneBasisPair >::V::iterator it = _PrecompBasis.begin(); it != _PrecompBasis.end(); ++it) @@ -394,7 +394,7 @@ void CPSFace::deleteElement(uint32 index) NL_PS_FUNC(CPSFace_deleteElement) CPSQuad::deleteElement(index); deletePlaneBasisElement(index); - if (_PrecompBasis.size()) // do we use precomputed basis ? + if (!_PrecompBasis.empty()) // do we use precomputed basis ? { // replace ourself by the last element... _IndexInPrecompBasis[index] = _IndexInPrecompBasis[_Owner->getSize() - 1]; @@ -407,7 +407,7 @@ void CPSFace::resize(uint32 size) NL_PS_FUNC(CPSFace_resize) nlassert(size < (1 << 16)); resizePlaneBasis(size); - if (_PrecompBasis.size()) // do we use precomputed basis ? + if (!_PrecompBasis.empty()) // do we use precomputed basis ? { _IndexInPrecompBasis.resize(size); } diff --git a/code/nel/src/3d/ps_mesh.cpp b/code/nel/src/3d/ps_mesh.cpp index f473a79ee..5002f0054 100644 --- a/code/nel/src/3d/ps_mesh.cpp +++ b/code/nel/src/3d/ps_mesh.cpp @@ -1994,7 +1994,7 @@ void CPSConstraintMesh::deleteElement(uint32 index) deleteSizeElement(index); deletePlaneBasisElement(index); // TODO : avoid code cuplication with CPSFace ... - if (_PrecompBasis.size()) // do we use precomputed basis ? + if (!_PrecompBasis.empty()) // do we use precomputed basis ? { // replace ourself by the last element... _IndexInPrecompBasis[index] = _IndexInPrecompBasis[_Owner->getSize() - 1]; @@ -2011,7 +2011,7 @@ void CPSConstraintMesh::resize(uint32 size) resizeSize(size); resizePlaneBasis(size); // TODO : avoid code cuplication with CPSFace ... - if (_PrecompBasis.size()) // do we use precomputed basis ? + if (!_PrecompBasis.empty()) // do we use precomputed basis ? { _IndexInPrecompBasis.resize(size); } diff --git a/code/nel/src/3d/quad_effect.cpp b/code/nel/src/3d/quad_effect.cpp index 8b40a786c..a6c75c99d 100644 --- a/code/nel/src/3d/quad_effect.cpp +++ b/code/nel/src/3d/quad_effect.cpp @@ -229,7 +229,7 @@ void CQuadEffect::processPoly(const TPoint2DVect &poly static TRasters rDest; float currY; makeRasters(poly, quadWidth, quadHeight, rDest, currY); - if (dest.size()) + if (!dest.empty()) { TRasters::const_iterator it, endIt = rDest.end(); for (it = rDest.begin(); it != endIt; ++it) diff --git a/code/nel/src/3d/shadow_map_manager.cpp b/code/nel/src/3d/shadow_map_manager.cpp index 0c9f7ba8b..e3f8fde99 100644 --- a/code/nel/src/3d/shadow_map_manager.cpp +++ b/code/nel/src/3d/shadow_map_manager.cpp @@ -705,7 +705,7 @@ void CShadowMapManager::renderProject(CScene *scene) } driver->activeVertexBuffer (CopyQuads); - if (_ShadowCasters.size()>0) + if (!_ShadowCasters.empty()) { // get the transform to compute shadow map. CTransform *sc= _ShadowCasters[0]; diff --git a/code/nel/src/3d/texture_dlm.cpp b/code/nel/src/3d/texture_dlm.cpp index 2c8603859..3e7695936 100644 --- a/code/nel/src/3d/texture_dlm.cpp +++ b/code/nel/src/3d/texture_dlm.cpp @@ -119,7 +119,7 @@ bool CTextureDLM::canCreateLightMap(uint w, uint h) return true; // If empty, test if there is an empty block. - return _EmptyBlocks.size()>0; + return !_EmptyBlocks.empty(); } @@ -166,7 +166,7 @@ bool CTextureDLM::createLightMap(uint w, uint h, uint &x, uint &y) if(_FreeBlocks[lMapType]==NULL) { // list is empty => allocate a block from _EmptyBlocks. - nlassert(_EmptyBlocks.size()>0); + nlassert(!_EmptyBlocks.empty()); // pop a block from empty list CBlock *block= &_Blocks[_EmptyBlocks.back()]; diff --git a/code/nel/src/3d/tile_bank.cpp b/code/nel/src/3d/tile_bank.cpp index 4c1ba1c23..d4e26ab06 100644 --- a/code/nel/src/3d/tile_bank.cpp +++ b/code/nel/src/3d/tile_bank.cpp @@ -108,7 +108,7 @@ void CTileBank::serial(NLMISC::IStream &f) throw(NLMISC::EStream) if (f.isReading()) { // Checks - nlassert (_DisplacementMap.size()>0); + nlassert (!_DisplacementMap.empty()); // Set first empty _DisplacementMap[0].setEmpty (); @@ -543,7 +543,7 @@ CTileNoiseMap *CTileBank::getTileNoiseMap (uint tileNumber, uint tileSubNoise) } } - if (_DisplacementMap.size()==0 || _DisplacementMap[0]._TileNoiseMap) + if (_DisplacementMap.empty() || _DisplacementMap[0]._TileNoiseMap) return NULL; // Checks diff --git a/code/nel/src/3d/vegetable_blend_layer_model.cpp b/code/nel/src/3d/vegetable_blend_layer_model.cpp index a1df0d89d..44754add2 100644 --- a/code/nel/src/3d/vegetable_blend_layer_model.cpp +++ b/code/nel/src/3d/vegetable_blend_layer_model.cpp @@ -71,7 +71,7 @@ void CVegetableBlendLayerModel::render(IDriver *driver) nlassert(VegetableManager); - if(SortBlocks.size()==0) + if(SortBlocks.empty()) return; // Setup VegetableManager renderState (like pre-setuped material) diff --git a/code/nel/src/3d/vegetable_manager.cpp b/code/nel/src/3d/vegetable_manager.cpp index 640d5e77f..e479a5e62 100644 --- a/code/nel/src/3d/vegetable_manager.cpp +++ b/code/nel/src/3d/vegetable_manager.cpp @@ -1019,12 +1019,12 @@ void CVegetableManager::reserveIgCompile(CVegetableInstanceGroup *ig, const CV { CVegetableInstanceGroup::CVegetableRdrPass &vegetRdrPass= ig->_RdrPass[rdrPass]; nlassert(vegetRdrPass.TriangleIndices.getNumIndexes()==0); - nlassert(vegetRdrPass.TriangleLocalIndices.size()==0); - nlassert(vegetRdrPass.Vertices.size()==0); - nlassert(vegetRdrPass.LightedInstances.size()==0); + nlassert(vegetRdrPass.TriangleLocalIndices.empty()); + nlassert(vegetRdrPass.Vertices.empty()); + nlassert(vegetRdrPass.LightedInstances.empty()); } // Do the same for all quadrants of the zsort rdrPass. - nlassert(ig->_TriangleQuadrantOrderArray.size()==0); + nlassert(ig->_TriangleQuadrantOrderArray.empty()); nlassert(ig->_TriangleQuadrantOrderNumTriangles==0); @@ -2553,7 +2553,7 @@ bool CVegetableManager::updateLightingIGPart() } CVegetableInstanceGroup::CVegetableRdrPass &vegetRdrPass= _ULRootIg->_RdrPass[_ULCurrentIgRdrPass]; - // if all instances are processed for this pass (especially if size()==0 !!) + // if all instances are processed for this pass (especially if empty() !!) if(_ULCurrentIgInstance>= vegetRdrPass.LightedInstances.size()) { // skip to the next rdrPass. diff --git a/code/nel/src/3d/vegetablevb_allocator.cpp b/code/nel/src/3d/vegetablevb_allocator.cpp index 29a03b51d..f5c833d8a 100644 --- a/code/nel/src/3d/vegetablevb_allocator.cpp +++ b/code/nel/src/3d/vegetablevb_allocator.cpp @@ -186,7 +186,7 @@ bool CVegetableVBAllocator::exceedMaxVertexInBufferHard(uint numAddVerts) cons uint CVegetableVBAllocator::allocateVertex() { // if no more free, allocate. - if( _VertexFreeMemory.size()==0 ) + if( _VertexFreeMemory.empty() ) { // enlarge capacity. uint newResize; diff --git a/code/nel/src/3d/water_model.cpp b/code/nel/src/3d/water_model.cpp index fb53100cb..e6ae132e1 100644 --- a/code/nel/src/3d/water_model.cpp +++ b/code/nel/src/3d/water_model.cpp @@ -500,7 +500,7 @@ void CWaterModel::traverseRender() sint startY; projPoly.computeBorders(rasters, startY); - if (rasters.size()) + if (!rasters.empty()) { //===========================// // perform Water animation // diff --git a/code/nel/src/3d/zone.cpp b/code/nel/src/3d/zone.cpp index c601f0fa4..263c61539 100644 --- a/code/nel/src/3d/zone.cpp +++ b/code/nel/src/3d/zone.cpp @@ -1126,7 +1126,7 @@ void CZone::refineAll() { nlassert(Compiled); - if(Patchs.size()==0) + if(Patchs.empty()) return; // DO NOT do a forceNoRenderClip(), to avoid big allocation of Near/Far VB vertices in driver. @@ -1150,7 +1150,7 @@ void CZone::averageTesselationVertices() { nlassert(Compiled); - if(Patchs.size()==0) + if(Patchs.empty()) return; // averageTesselationVertices of ALL patchs. @@ -1250,8 +1250,10 @@ void CZone::resetRenderFarAndDeleteVBFV() void CZone::forceMergeAtTileLevel() { CPatch *pPatch=0; - if(Patchs.size()>0) + + if (!Patchs.empty()) pPatch= &(*Patchs.begin()); + for(sint n=(sint)Patchs.size();n>0;n--, pPatch++) { pPatch->forceMergeAtTileLevel(); @@ -1446,7 +1448,7 @@ void CZone::applyHeightField(const CLandscape &landScape) vector patchs; // no patch, do nothing. - if(Patchs.size()==0) + if(Patchs.empty()) return; // 0. Unpack patchs to Bezier Patchs. diff --git a/code/nel/src/3d/zone_lighter.cpp b/code/nel/src/3d/zone_lighter.cpp index f5549e66a..c70ad0ba2 100644 --- a/code/nel/src/3d/zone_lighter.cpp +++ b/code/nel/src/3d/zone_lighter.cpp @@ -3113,7 +3113,7 @@ void CZoneLighter::addWaterShape(CWaterShape *shape, const NLMISC::CMatrix &MT) // *********************************************************** void CZoneLighter::makeQuadGridFromWaterShapes(NLMISC::CAABBox zoneBBox) { - if (!_WaterShapes.size()) return; + if (_WaterShapes.empty()) return; NLMISC::CAABBox tmpBox; diff --git a/code/nel/src/gui/group_header.cpp b/code/nel/src/gui/group_header.cpp index d166b539b..908aa183e 100644 --- a/code/nel/src/gui/group_header.cpp +++ b/code/nel/src/gui/group_header.cpp @@ -159,7 +159,7 @@ namespace NLGUI } // resize H - if(entries.size()>0) + if (!entries.empty()) { CInterfaceGroup *colEnclosing = entries[0]->getTargetColumn(); if (colEnclosing && !colEnclosing->getGroups().empty()) diff --git a/code/nel/src/gui/group_tab.cpp b/code/nel/src/gui/group_tab.cpp index ca876c25e..69ccce046 100644 --- a/code/nel/src/gui/group_tab.cpp +++ b/code/nel/src/gui/group_tab.cpp @@ -262,7 +262,7 @@ namespace NLGUI { tabB->setId(string("tab") + NLMISC::toString(_Buttons.size())); - if(_Buttons.size()==0) + if(_Buttons.empty()) { tabB->setParentPos(NULL); tabB->setParentPosRef(Hotspot_TL); @@ -453,7 +453,7 @@ namespace NLGUI // *************************************************************************** void CGroupTab::updateFirstTabButton() { - if(!_HideOutTabs || (_Selection<0) || (_Buttons.size()==0) || (_Parent->getWReal()<0) + if(!_HideOutTabs || (_Selection<0) || _Buttons.empty() || (_Parent->getWReal()<0) || _FirstTabIndex>=(sint)_Buttons.size()) return; diff --git a/code/nel/src/gui/interface_parser.cpp b/code/nel/src/gui/interface_parser.cpp index 739e807c8..068d827bf 100644 --- a/code/nel/src/gui/interface_parser.cpp +++ b/code/nel/src/gui/interface_parser.cpp @@ -193,7 +193,7 @@ namespace NLGUI xmlKeepBlanksDefault(0); //parse all interface files and build a single xml document xmlNodePtr globalEnclosing; - nlassert (strings.size()); + nlassert (!strings.empty()); CIXml read; string nextFileName; static const char *SCRIPT_AS_STRING = "