From 31a540b35d916b2eb5ed9ed66f0f43cb5cc30704 Mon Sep 17 00:00:00 2001 From: kervala Date: Mon, 19 Dec 2016 13:15:25 +0100 Subject: [PATCH] Changed: Replace size() comparisons by empty() ones --HG-- branch : develop --- code/nel/include/nel/3d/cluster.h | 2 +- code/nel/include/nel/georges/load_form.h | 8 +++--- code/nel/include/nel/gui/interface_parser.h | 4 +-- code/nel/src/3d/clip_trav.cpp | 2 +- code/nel/src/3d/mesh.cpp | 4 +-- code/nel/src/3d/mesh_morpher.cpp | 26 +++++++++---------- code/nel/src/3d/mesh_mrm.cpp | 6 ++--- code/nel/src/3d/mesh_mrm_skinned.cpp | 2 +- code/nel/src/3d/point_light_named_array.cpp | 2 +- code/nel/src/3d/ps_located.cpp | 4 +-- code/nel/src/3d/ps_mesh.cpp | 8 +++--- code/nel/src/3d/scene_group.cpp | 8 +++--- code/nel/src/3d/shape_bank.cpp | 5 +--- code/nel/src/3d/text_context.cpp | 4 +-- code/nel/src/3d/tile_bank.cpp | 2 +- code/nel/src/3d/zone_lighter.cpp | 4 +-- code/nel/src/3d/zone_manager.cpp | 2 +- code/nel/src/gui/action_handler.cpp | 4 +-- code/nel/src/gui/group_frame.cpp | 2 +- code/nel/src/gui/group_html.cpp | 12 ++++----- code/nel/src/gui/group_list.cpp | 6 ++--- code/nel/src/gui/group_paragraph.cpp | 6 ++--- code/nel/src/gui/interface_expr_user_fct.cpp | 4 +-- code/nel/src/gui/interface_group.cpp | 8 +++--- code/nel/src/gui/interface_link.cpp | 2 +- code/nel/src/gui/interface_parser.cpp | 2 +- code/nel/src/gui/lua_ihm.cpp | 2 +- code/nel/src/gui/view_bitmap_combo.cpp | 2 +- code/nel/src/gui/view_renderer.cpp | 4 +-- code/nel/src/gui/view_text.cpp | 10 +++---- code/nel/src/gui/widget_manager.cpp | 2 +- code/nel/src/logic/logic_condition.cpp | 2 +- code/nel/src/misc/big_file.cpp | 4 +-- code/nel/src/misc/cdb_branch.cpp | 2 +- code/nel/src/misc/command.cpp | 2 +- code/nel/src/misc/common.cpp | 2 +- code/nel/src/misc/debug.cpp | 14 +++++----- code/nel/src/misc/hierarchical_timer.cpp | 2 +- code/nel/src/misc/polygon.cpp | 4 +-- code/nel/src/misc/stop_watch.cpp | 2 +- code/nel/src/misc/string_mapper.cpp | 2 +- code/nel/src/net/admin.cpp | 12 ++++----- code/nel/src/net/module_common.cpp | 4 +-- code/nel/src/net/naming_client.cpp | 2 +- code/nel/src/net/udp_sim_sock.cpp | 2 +- code/nel/src/net/varpath.cpp | 4 +-- code/nel/src/pacs/edge_quad.cpp | 2 +- code/nel/src/pacs/global_retriever.cpp | 2 +- code/nel/src/sound/audio_mixer_user.cpp | 4 +-- code/nel/src/sound/sound_bank.cpp | 2 +- code/nel/tools/3d/cluster_viewer/view_cs.cpp | 6 ++--- code/nel/tools/3d/lightmap_optimizer/main.cpp | 2 +- .../tools/3d/object_viewer/object_viewer.cpp | 2 +- .../3d/object_viewer/sound_anim_view.cpp | 2 +- .../3d/plugin_max/nel_export/nel_export.cpp | 2 +- .../nel_export/nel_export_collision.cpp | 2 +- .../3d/plugin_max/nel_mesh_lib/calc_lm.cpp | 4 +-- .../3d/plugin_max/nel_mesh_lib/calc_lm_rt.cpp | 2 +- .../nel_mesh_lib/export_mesh_interface.cpp | 2 +- .../plugin_max/nel_mesh_lib/export_scene.cpp | 4 +-- .../nel/tools/pacs/build_rbank/build_surf.cpp | 4 +-- code/ryzom/client/src/character_cl.cpp | 6 ++--- code/ryzom/client/src/commands.cpp | 18 ++++++------- code/ryzom/client/src/continent_manager.cpp | 2 +- .../client/src/continent_manager_build.h | 2 +- code/ryzom/client/src/door_manager.cpp | 2 +- .../src/interface_v3/action_handler_help.cpp | 4 +-- .../interface_v3/action_handler_phrase.cpp | 2 +- .../client/src/interface_v3/chat_window.cpp | 2 +- .../src/interface_v3/group_html_webig.cpp | 2 +- .../interface_v3/group_in_scene_bubble.cpp | 2 +- .../client/src/interface_v3/group_map.cpp | 8 +++--- .../client/src/interface_v3/guild_manager.cpp | 2 +- .../src/interface_v3/interface_3d_scene.cpp | 4 +-- .../src/interface_v3/interface_manager.cpp | 10 +++---- .../src/interface_v3/item_special_effect.cpp | 2 +- .../client/src/interface_v3/lua_ihm_ryzom.cpp | 4 +-- .../src/interface_v3/macrocmd_manager.cpp | 2 +- .../client/src/interface_v3/people_list.cpp | 2 +- code/ryzom/client/src/login.cpp | 12 ++++----- code/ryzom/client/src/login_patch.cpp | 4 +-- code/ryzom/client/src/login_xdelta.cpp | 4 +-- code/ryzom/client/src/npc_icon.cpp | 2 +- code/ryzom/client/src/r2/tool_pick.cpp | 2 +- code/ryzom/client/src/sheet_manager.cpp | 2 +- .../client/src/string_manager_client.cpp | 4 +-- .../src/game_share/server_edition_module.cpp | 6 ++--- code/ryzom/common/src/game_share/simlag.cpp | 2 +- .../client/ryzom_installer/src/configfile.cpp | 2 +- .../ryzom/tools/leveldesign/export/export.cpp | 12 ++++----- .../mission_compiler_lib/mission_compiler.cpp | 2 +- .../mission_compiler_lib/step_content.cpp | 6 ++--- .../mission_compiler_lib/steps.cpp | 2 +- .../world_editor/land_export_lib/export.cpp | 4 +-- .../world_editor/builder_zone.cpp | 22 ++++++++-------- .../world_editor/builder_zone_region.cpp | 12 ++++----- .../world_editor/world_editor/main_frm.cpp | 2 +- 97 files changed, 218 insertions(+), 221 deletions(-) diff --git a/code/nel/include/nel/3d/cluster.h b/code/nel/include/nel/3d/cluster.h index 552d7474a..b038a34c4 100644 --- a/code/nel/include/nel/3d/cluster.h +++ b/code/nel/include/nel/3d/cluster.h @@ -120,7 +120,7 @@ public: void setWorldMatrix (const NLMISC::CMatrix &WM); - bool isRoot() { return _LocalVolume.size() == 0; } + bool isRoot() { return _LocalVolume.empty(); } //\name Sound related. //@{ diff --git a/code/nel/include/nel/georges/load_form.h b/code/nel/include/nel/georges/load_form.h index 4aaab43d0..a927d21e0 100644 --- a/code/nel/include/nel/georges/load_form.h +++ b/code/nel/include/nel/georges/load_form.h @@ -385,7 +385,7 @@ void loadForm (const std::vector &sheetFilters, const std::string & } } - if(NeededToRecompute.size() > 0) + if(!NeededToRecompute.empty()) nlinfo ("%d seconds to recompute %d sheets", (uint32)(NLMISC::CTime::getLocalTime()-start)/1000, NeededToRecompute.size()); // free the georges loader if necessary @@ -748,7 +748,7 @@ void loadForm2(const std::vector &sheetFilters, const std::string & } } - if(NeededToRecompute.size() > 0) + if(!NeededToRecompute.empty()) nlinfo ("%d seconds to recompute %d sheets", (uint32)(NLMISC::CTime::getLocalTime()-start)/1000, NeededToRecompute.size()); // free the georges loader if necessary @@ -1304,7 +1304,7 @@ void loadFormNoPackedSheet (const std::vector &sheetFilters, std::m } } - if(NeededToRecompute.size() > 0) + if(!NeededToRecompute.empty()) nlinfo ("%d seconds to recompute %d sheets", (uint32)(NLMISC::CTime::getLocalTime()-start)/1000, NeededToRecompute.size()); // free the georges loader if necessary @@ -1393,7 +1393,7 @@ void loadFormNoPackedSheet2 (const std::vector &sheetFilters, std:: } } - if(NeededToRecompute.size() > 0) + if(!NeededToRecompute.empty()) nlinfo ("%d seconds to recompute %d sheets", (uint32)(NLMISC::CTime::getLocalTime()-start)/1000, NeededToRecompute.size()); // free the georges loader if necessary diff --git a/code/nel/include/nel/gui/interface_parser.h b/code/nel/include/nel/gui/interface_parser.h index 0a2d107fb..bfc951ce2 100644 --- a/code/nel/include/nel/gui/interface_parser.h +++ b/code/nel/include/nel/gui/interface_parser.h @@ -208,7 +208,7 @@ namespace NLGUI CInterfaceGroup *createGroupInstance(const std::string &templateName, const std::string &parentID, const std::pair *templateParams, uint numParams, bool updateLinks = true); CInterfaceGroup *createGroupInstance(const std::string &templateName, const std::string &parentID, std::vector > &templateParams, bool updateLinks = true) { - if (templateParams.size() > 0) + if (!templateParams.empty()) return createGroupInstance(templateName, parentID, &templateParams[0], (uint)templateParams.size(), updateLinks); else return createGroupInstance(templateName, parentID, NULL, 0, updateLinks); @@ -222,7 +222,7 @@ namespace NLGUI CInterfaceElement *createUIElement(const std::string &templateName, const std::string &parentID, const std::pair *templateParams, uint numParams, bool updateLinks /* = true */); CInterfaceElement *createUIElement(const std::string &templateName, const std::string &parentID, std::vector > &templateParams, bool updateLinks = true) { - if (templateParams.size() > 0) + if (!templateParams.empty()) return createUIElement(templateName, parentID, &templateParams[0], (uint)templateParams.size(), updateLinks); else return createUIElement(templateName, parentID, NULL, 0, updateLinks); diff --git a/code/nel/src/3d/clip_trav.cpp b/code/nel/src/3d/clip_trav.cpp index fc8fa4872..f26c84273 100644 --- a/code/nel/src/3d/clip_trav.cpp +++ b/code/nel/src/3d/clip_trav.cpp @@ -133,7 +133,7 @@ bool CClipTrav::fullSearch (vector& vCluster, const CVector& pos) if (pIG->_ClusterInstances[i]->isIn(pos)) vCluster.push_back (pIG->_ClusterInstances[i]); } - if (vCluster.size() > 0) + if (!vCluster.empty()) return true;*/ return true; diff --git a/code/nel/src/3d/mesh.cpp b/code/nel/src/3d/mesh.cpp index eddb86391..cd3109733 100644 --- a/code/nel/src/3d/mesh.cpp +++ b/code/nel/src/3d/mesh.cpp @@ -541,7 +541,7 @@ void CMeshGeom::render(IDriver *drv, CTransformShape *trans, float polygonCount, skeleton= mi->getSkeletonModel(); // The mesh must not be skinned for render() nlassert(!(_Skinned && mi->isSkinned() && skeleton)); - bool bMorphApplied = _MeshMorpher->BlendShapes.size() > 0; + bool bMorphApplied = !_MeshMorpher->BlendShapes.empty(); bool useTangentSpace = _MeshVertexProgram && _MeshVertexProgram->needTangentSpace(); @@ -733,7 +733,7 @@ void CMeshGeom::renderSkin(CTransformShape *trans, float alphaMRM) skeleton= mi->getSkeletonModel(); // must be skinned for renderSkin() nlassert(_Skinned && mi->isSkinned() && skeleton); - bool bMorphApplied = _MeshMorpher->BlendShapes.size() > 0; + bool bMorphApplied = !_MeshMorpher->BlendShapes.empty(); bool useTangentSpace = _MeshVertexProgram && _MeshVertexProgram->needTangentSpace(); diff --git a/code/nel/src/3d/mesh_morpher.cpp b/code/nel/src/3d/mesh_morpher.cpp index 4840f36a2..6d5d2dc73 100644 --- a/code/nel/src/3d/mesh_morpher.cpp +++ b/code/nel/src/3d/mesh_morpher.cpp @@ -105,7 +105,7 @@ void CMeshMorpher::update (std::vector *pBSFactor) if (_VBOri == NULL) return; - if (BlendShapes.size() == 0) + if (BlendShapes.empty()) return; if (_VBOri->getNumVertices() != _VBDst->getNumVertices()) @@ -164,21 +164,21 @@ void CMeshMorpher::update (std::vector *pBSFactor) // Modify Pos/Norm/TgSpace. //------------ if (_VBDst->getVertexFormat() & CVertexBuffer::PositionFlag) - if (rBS.deltaPos.size() > 0) + if (!rBS.deltaPos.empty()) { CVector *pV = dstvba.getVertexCoordPointer (vp); *pV += rBS.deltaPos[j] * rFactor; } if (_VBDst->getVertexFormat() & CVertexBuffer::NormalFlag) - if (rBS.deltaNorm.size() > 0) + if (!rBS.deltaNorm.empty()) { CVector *pV = dstvba.getNormalCoordPointer (vp); *pV += rBS.deltaNorm[j] * rFactor; } if (_UseTgSpace) - if (rBS.deltaTgSpace.size() > 0) + if (!rBS.deltaTgSpace.empty()) { CVector *pV = (CVector*)dstvba.getTexCoordPointer (vp, tgSpaceStage); *pV += rBS.deltaTgSpace[j] * rFactor; @@ -187,14 +187,14 @@ void CMeshMorpher::update (std::vector *pBSFactor) // Modify UV0 / Color //------------ if (_VBDst->getVertexFormat() & CVertexBuffer::TexCoord0Flag) - if (rBS.deltaUV.size() > 0) + if (!rBS.deltaUV.empty()) { CUV *pUV = dstvba.getTexCoordPointer (vp); *pUV += rBS.deltaUV[j] * rFactor; } if (_VBDst->getVertexFormat() & CVertexBuffer::PrimaryColorFlag) - if (rBS.deltaCol.size() > 0) + if (!rBS.deltaCol.empty()) { // todo hulud d3d vertex color RGBA / BGRA CRGBA *pRGBA = (CRGBA*)dstvba.getColorPointer (vp); @@ -224,7 +224,7 @@ void CMeshMorpher::updateSkinned (std::vector *pBSFactor) if (_VBOri == NULL) return; - if (BlendShapes.size() == 0) + if (BlendShapes.empty()) return; if (_VBOri->getNumVertices() != _VBDst->getNumVertices()) @@ -292,21 +292,21 @@ void CMeshMorpher::updateSkinned (std::vector *pBSFactor) // Modify Pos/Norm/TgSpace. //------------ if (_Vertices != NULL) - if (rBS.deltaPos.size() > 0) + if (!rBS.deltaPos.empty()) { CVector *pV = &(_Vertices->operator[](vp)); *pV += rBS.deltaPos[j] * rFactor; } if (_Normals != NULL) - if (rBS.deltaNorm.size() > 0) + if (!rBS.deltaNorm.empty()) { CVector *pV = &(_Normals->operator[](vp)); *pV += rBS.deltaNorm[j] * rFactor; } if (_UseTgSpace && _TgSpace != NULL) - if (rBS.deltaTgSpace.size() > 0) + if (!rBS.deltaTgSpace.empty()) { CVector *pV = &((*_TgSpace)[vp]); *pV += rBS.deltaTgSpace[j] * rFactor; @@ -315,14 +315,14 @@ void CMeshMorpher::updateSkinned (std::vector *pBSFactor) // Modify UV0 / Color //------------ if (_VBDst->getVertexFormat() & CVertexBuffer::TexCoord0Flag) - if (rBS.deltaUV.size() > 0) + if (!rBS.deltaUV.empty()) { CUV *pUV = dstvba.getTexCoordPointer (vp); *pUV += rBS.deltaUV[j] * rFactor; } if (_VBDst->getVertexFormat() & CVertexBuffer::PrimaryColorFlag) - if (rBS.deltaCol.size() > 0) + if (!rBS.deltaCol.empty()) { // todo hulud d3d vertex color RGBA / BGRA CRGBA *pRGBA = (CRGBA*)dstvba.getColorPointer (vp); @@ -371,7 +371,7 @@ void CMeshMorpher::updateRawSkin (CVertexBuffer *vbOri, if (vbOri == NULL) return; - if (BlendShapes.size() == 0) + if (BlendShapes.empty()) return; nlassert(vbOri->getVertexFormat() == (CVertexBuffer::PositionFlag | CVertexBuffer::NormalFlag |CVertexBuffer::TexCoord0Flag) ); diff --git a/code/nel/src/3d/mesh_mrm.cpp b/code/nel/src/3d/mesh_mrm.cpp index 64646ebc1..407d342b4 100644 --- a/code/nel/src/3d/mesh_mrm.cpp +++ b/code/nel/src/3d/mesh_mrm.cpp @@ -938,7 +938,7 @@ void CMeshMRMGeom::render(IDriver *drv, CTransformShape *trans, float polygonCou skeleton = mi->getSkeletonModel(); // The mesh must not be skinned for render() nlassert(!(_Skinned && mi->isSkinned() && skeleton)); - bool bMorphApplied = _MeshMorpher.BlendShapes.size() > 0; + bool bMorphApplied = !_MeshMorpher.BlendShapes.empty(); bool useTangentSpace = _MeshVertexProgram && _MeshVertexProgram->needTangentSpace(); @@ -1146,7 +1146,7 @@ void CMeshMRMGeom::renderSkin(CTransformShape *trans, float alphaMRM) skeleton = mi->getSkeletonModel(); // must be skinned for renderSkin() nlassert(_Skinned && mi->isSkinned() && skeleton); - bool bMorphApplied = _MeshMorpher.BlendShapes.size() > 0; + bool bMorphApplied = !_MeshMorpher.BlendShapes.empty(); bool useNormal= (_VBufferFinal.getVertexFormat() & CVertexBuffer::NormalFlag)!=0; bool useTangentSpace = _MeshVertexProgram && _MeshVertexProgram->needTangentSpace(); @@ -1312,7 +1312,7 @@ sint CMeshMRMGeom::renderSkinGroupGeom(CMeshMRMInstance *mi, float alphaMRM, uin skeleton = mi->getSkeletonModel(); // must be skinned for renderSkin() nlassert(_Skinned && mi->isSkinned() && skeleton); - bool bMorphApplied = _MeshMorpher.BlendShapes.size() > 0; + bool bMorphApplied = !_MeshMorpher.BlendShapes.empty(); bool useNormal= (_VBufferFinal.getVertexFormat() & CVertexBuffer::NormalFlag)!=0; nlassert(useNormal); diff --git a/code/nel/src/3d/mesh_mrm_skinned.cpp b/code/nel/src/3d/mesh_mrm_skinned.cpp index ebe50d3ec..a9d51a591 100644 --- a/code/nel/src/3d/mesh_mrm_skinned.cpp +++ b/code/nel/src/3d/mesh_mrm_skinned.cpp @@ -304,7 +304,7 @@ void CMeshMRMSkinnedGeom::build(CMesh::CMeshBuild &m, // No Blend Shapes //================================================ - nlassert (meshBuildMRM.BlendShapes.size() == 0); + nlassert (meshBuildMRM.BlendShapes.empty()); // Compact bone id and build a bone id names //================================================ diff --git a/code/nel/src/3d/point_light_named_array.cpp b/code/nel/src/3d/point_light_named_array.cpp index 460da282e..0c6c34cc9 100644 --- a/code/nel/src/3d/point_light_named_array.cpp +++ b/code/nel/src/3d/point_light_named_array.cpp @@ -96,7 +96,7 @@ void CPointLightNamedArray::build(const std::vector &pointLi // Regroup. // --------- _PointLightGroupMap.clear(); - if(_PointLights.size() > 0 ) + if (!_PointLights.empty()) { bool first= true; string precName; diff --git a/code/nel/src/3d/ps_located.cpp b/code/nel/src/3d/ps_located.cpp index 5f9920eda..82c385241 100644 --- a/code/nel/src/3d/ps_located.cpp +++ b/code/nel/src/3d/ps_located.cpp @@ -239,7 +239,7 @@ void CPSLocated::releaseAllRef() // If this happen, you can register with the registerDTorObserver // (observer pattern) // and override notifyTargetRemove to call releaseCollisionInfo - nlassert(_IntegrableForces.size() == 0); + nlassert(_IntegrableForces.empty()); nlassert(_NonIntegrableForceNbRefs == 0); CHECK_PS_INTEGRITY } @@ -839,7 +839,7 @@ CPSLocated::~CPSLocated() // If this happen, you can register with the registerDTorObserver // (observer pattern) // and override notifyTargetRemove to call releaseCollisionInfo - nlassert(_IntegrableForces.size() == 0); + nlassert(_IntegrableForces.empty()); nlassert(_NonIntegrableForceNbRefs == 0); // delete all bindable diff --git a/code/nel/src/3d/ps_mesh.cpp b/code/nel/src/3d/ps_mesh.cpp index 8a9429a7d..3331ac315 100644 --- a/code/nel/src/3d/ps_mesh.cpp +++ b/code/nel/src/3d/ps_mesh.cpp @@ -1234,7 +1234,7 @@ bool CPSConstraintMesh::update(std::vector *numVertsVect /*= NULL*/) uint numVerts = 0; uint8 uvRouting[CVertexBuffer::MaxStage]; - if (_MeshShapeFileName.size() == 0) + if (_MeshShapeFileName.empty()) { _MeshShapeFileName.resize(1); _MeshShapeFileName[0] = DummyShapeName; @@ -1386,7 +1386,7 @@ bool CPSConstraintMesh::update(std::vector *numVertsVect /*= NULL*/) _GlobalAnimDate = _Owner->getOwner()->getSystemDate(); _Touched = 0; _ValidBuild = ok ? 1 : 0; - nlassert(_Meshes.size() > 0); + nlassert(!_Meshes.empty()); return ok; @@ -1491,7 +1491,7 @@ void CPSConstraintMesh::serial(NLMISC::IStream &f) throw(NLMISC::EStream) { if (!f.isReading()) { - if (_MeshShapeFileName.size() > 0) + if (!_MeshShapeFileName.empty()) { f.serial(_MeshShapeFileName[0]); } @@ -1751,7 +1751,7 @@ void CPSConstraintMesh::draw(bool opaque) _Owner->incrementNbDrawnParticles(numToProcess); // for benchmark purpose - if (_PrecompBasis.size() == 0) /// do we deal with prerotated meshs ? + if (_PrecompBasis.empty()) /// do we deal with prerotated meshs ? { if (step == (1 << 16)) { diff --git a/code/nel/src/3d/scene_group.cpp b/code/nel/src/3d/scene_group.cpp index c060c4c5d..50e1f0171 100644 --- a/code/nel/src/3d/scene_group.cpp +++ b/code/nel/src/3d/scene_group.cpp @@ -753,7 +753,7 @@ bool CInstanceGroup::addToSceneWhenAllShapesLoaded (CScene& scene, IDriver *driv for (i = 0; i < _Instances.size(); ++i) if (_Instances[i] != NULL && !_InstancesInfos[i].DontAddToScene) { - if (_InstancesInfos[i].Clusters.size() > 0) + if (!_InstancesInfos[i].Clusters.empty()) { _Instances[i]->clipUnlinkFromAll(); for (j = 0; j < _InstancesInfos[i].Clusters.size(); ++j) @@ -812,7 +812,7 @@ bool CInstanceGroup::addToSceneWhenAllShapesLoaded (CScene& scene, IDriver *driv // Register the instanceGroup for light animation // ----------------- // If some PointLight to animate - if(_PointLightArray.getPointLights().size() > 0) + if(!_PointLightArray.getPointLights().empty()) scene.addInstanceGroupForLightAnimation(this); _AddToSceneState = StateAdded; @@ -1040,7 +1040,7 @@ bool CInstanceGroup::removeFromScene (CScene& scene) // UnRegister the instanceGroup for light animation // ----------------- // If some PointLight to animate - if(_PointLightArray.getPointLights().size() > 0) + if(!_PointLightArray.getPointLights().empty()) scene.removeInstanceGroupForLightAnimation(this); if (_AddRemoveInstance) @@ -1117,7 +1117,7 @@ void CInstanceGroup::setClusterSystemForInstances(CInstanceGroup *pIG) { _ClusterSystemForInstances = pIG; for (uint32 i = 0; i < _Instances.size(); ++i) - if (_Instances[i] && _InstancesInfos[i].Clusters.size() == 0) + if (_Instances[i] && _InstancesInfos[i].Clusters.empty()) _Instances[i]->setClusterSystem (_ClusterSystemForInstances); } diff --git a/code/nel/src/3d/shape_bank.cpp b/code/nel/src/3d/shape_bank.cpp index 1b34039eb..61a65c423 100644 --- a/code/nel/src/3d/shape_bank.cpp +++ b/code/nel/src/3d/shape_bank.cpp @@ -589,10 +589,7 @@ void CShapeBank::cancelLoadAsync (const std::string &shapeNameNotLwr) bool CShapeBank::isShapeWaiting () { - if (WaitingShapes.size() == 0) - return false; - else - return true; + return !WaitingShapes.empty(); } // *************************************************************************** diff --git a/code/nel/src/3d/text_context.cpp b/code/nel/src/3d/text_context.cpp index a28c3e7a1..8cee144ca 100644 --- a/code/nel/src/3d/text_context.cpp +++ b/code/nel/src/3d/text_context.cpp @@ -78,7 +78,7 @@ uint32 CTextContext::textPush (const char *format, ...) CComputedString csTmp; _CacheStrings.push_back (csTmp); - if (_CacheFreePlaces.size() == 0) + if (_CacheFreePlaces.empty()) _CacheFreePlaces.resize (1); _CacheFreePlaces[0] = (uint32)_CacheStrings.size()-1; _CacheNbFreePlaces = 1; @@ -104,7 +104,7 @@ uint32 CTextContext::textPush (const ucstring &str) CComputedString csTmp; _CacheStrings.push_back (csTmp); - if (_CacheFreePlaces.size() == 0) + if (_CacheFreePlaces.empty()) _CacheFreePlaces.resize (1); _CacheFreePlaces[0] = (uint32)_CacheStrings.size()-1; _CacheNbFreePlaces = 1; diff --git a/code/nel/src/3d/tile_bank.cpp b/code/nel/src/3d/tile_bank.cpp index e222f061f..1260f3972 100644 --- a/code/nel/src/3d/tile_bank.cpp +++ b/code/nel/src/3d/tile_bank.cpp @@ -441,7 +441,7 @@ void CTileBank::cleanUnusedData () // *************************************************************************** CTileNoiseMap *CTileBank::getTileNoiseMap (uint tileNumber, uint tileSubNoise) { - if (_DisplacementMap.size() == 0) + if (_DisplacementMap.empty()) { // it happens when serial a tile bank with version < 4 return NULL; diff --git a/code/nel/src/3d/zone_lighter.cpp b/code/nel/src/3d/zone_lighter.cpp index 78abf5a05..4e8b32430 100644 --- a/code/nel/src/3d/zone_lighter.cpp +++ b/code/nel/src/3d/zone_lighter.cpp @@ -2851,7 +2851,7 @@ bool CZoneLighter::isLightableShape(IShape &shape) void CZoneLighter::lightShapes(uint zoneID, const CLightDesc& description) { /// compute light for the lightable shapes in the given zone - if (_LightableShapes.size() == 0) return; + if (_LightableShapes.empty()) return; uint numShapePerThread = 1 + ((uint)_LightableShapes.size() / _ProcessCount); uint currShapeIndex = 0; @@ -3785,7 +3785,7 @@ uint CZoneLighter::getAPatch (uint process) nlassert(index < _PatchInfo.size()); - if (access.value().size() == 0) + if (access.value().empty()) // no more patches return 0xffffffff; diff --git a/code/nel/src/3d/zone_manager.cpp b/code/nel/src/3d/zone_manager.cpp index 1f9e61214..1ba32806d 100644 --- a/code/nel/src/3d/zone_manager.cpp +++ b/code/nel/src/3d/zone_manager.cpp @@ -214,7 +214,7 @@ bool CZoneManager::isWorkComplete (CZoneManager::SZoneManagerWork &rWork) // ------------------------------------------------------------------------------------------------ void CZoneManager::clear() { - nlassert(_LoadingZones.size() == 0); + nlassert(_LoadingZones.empty()); _LoadedZones.clear(); _RemovingZone = false; } diff --git a/code/nel/src/gui/action_handler.cpp b/code/nel/src/gui/action_handler.cpp index bbe7948cd..b43d37ded 100644 --- a/code/nel/src/gui/action_handler.cpp +++ b/code/nel/src/gui/action_handler.cpp @@ -69,7 +69,7 @@ namespace NLGUI string allparam = Params; skipBlankAtStart (allparam); string param = toLower (ParamName); - while (allparam.size() > 0) + while (!allparam.empty()) { std::string::size_type e = allparam.find('='); if (e == std::string::npos || e == 0) break; @@ -95,7 +95,7 @@ namespace NLGUI { string allparam = Params; skipBlankAtStart (allparam); - while (allparam.size() > 0) + while (!allparam.empty()) { std::string::size_type e = allparam.find('='); if (e == std::string::npos || e == 0) break; diff --git a/code/nel/src/gui/group_frame.cpp b/code/nel/src/gui/group_frame.cpp index 54412f229..747ca454e 100644 --- a/code/nel/src/gui/group_frame.cpp +++ b/code/nel/src/gui/group_frame.cpp @@ -149,7 +149,7 @@ namespace NLGUI } // The first type in display type struct is the default display type - if (_DispTypes.size() == 0) + if (_DispTypes.empty()) { SDisplayType dt; dt.Name = "default"; diff --git a/code/nel/src/gui/group_html.cpp b/code/nel/src/gui/group_html.cpp index 916b6a9e2..e6805df53 100644 --- a/code/nel/src/gui/group_html.cpp +++ b/code/nel/src/gui/group_html.cpp @@ -513,7 +513,7 @@ namespace NLGUI // redirect, get the location and try browse again // we cant use curl redirection because 'addHTTPGetParams()' must be called on new destination std::string location(_CurlWWW->getLocationHeader()); - if (location.size() > 0) + if (!location.empty()) { #ifdef LOG_DL nlwarning("(%s) request (%d) redirected to (len %d) '%s'", _Id.c_str(), _RedirectsRemaining, location.size(), location.c_str()); @@ -615,7 +615,7 @@ namespace NLGUI } RunningCurls = NewRunningCurls; #ifdef LOG_DL - if (RunningCurls > 0 || Curls.size() > 0) + if (RunningCurls > 0 || !Curls.empty()) nlwarning("(%s) RunningCurls %d, _Curls %d", _Id.c_str(), RunningCurls, Curls.size()); #endif } @@ -1628,7 +1628,7 @@ namespace NLGUI // Action handler parameters : "name=group_html_id|form=id_of_the_form|submit_button=button_name" string param = "name=" + getId() + "|form=" + toString (_Forms.size()-1) + "|submit_button=" + name + "|submit_button_type=submit"; - if (text.size() > 0) + if (!text.empty()) { // escape AH param separator string tmp = text; @@ -3805,7 +3805,7 @@ namespace NLGUI CUrlParser uri(url); - if (uri.hash.size() > 0) + if (!uri.hash.empty()) { // Anchor to scroll after page has loaded _UrlFragment = uri.hash; @@ -3951,7 +3951,7 @@ namespace NLGUI void CGroupHTML::registerAnchor(CInterfaceElement* elm) { - if (_AnchorName.size() > 0) + if (!_AnchorName.empty()) { for(uint32 i=0; i < _AnchorName.size(); ++i) { @@ -5123,7 +5123,7 @@ namespace NLGUI #endif // create markup for image downloads - if (type.find("image/") == 0 && content.size() > 0) + if (type.find("image/") == 0 && !content.empty()) { try { diff --git a/code/nel/src/gui/group_list.cpp b/code/nel/src/gui/group_list.cpp index c0502577b..f08bba10c 100644 --- a/code/nel/src/gui/group_list.cpp +++ b/code/nel/src/gui/group_list.cpp @@ -1063,7 +1063,7 @@ namespace NLGUI { // update the list size sint32 newH = _H + child->getH(); - if (_Elements.size() > 0) + if (!_Elements.empty()) newH += _Space; _H = newH; @@ -1077,7 +1077,7 @@ namespace NLGUI { // Update the list coords sint32 newW = _W + child->getW(); - if (_Elements.size() > 0) + if (!_Elements.empty()) newW += _Space; _W = newW; @@ -1412,7 +1412,7 @@ namespace NLGUI void CGroupList::onTextChanged() { - if( _Elements.size() == 0 ) + if( _Elements.empty() ) return; CElementInfo &e = _Elements[ 0 ]; diff --git a/code/nel/src/gui/group_paragraph.cpp b/code/nel/src/gui/group_paragraph.cpp index 7eaf11841..b0c8a8167 100644 --- a/code/nel/src/gui/group_paragraph.cpp +++ b/code/nel/src/gui/group_paragraph.cpp @@ -1212,7 +1212,7 @@ namespace NLGUI { // update the list size sint32 newH = _H + child->getH(); - if (_Elements.size() > 0) + if (!_Elements.empty()) newH += _Space; _H = newH; @@ -1226,7 +1226,7 @@ namespace NLGUI { // Update the list coords sint32 newW = _W + child->getW(); - if (_Elements.size() > 0) + if (!_Elements.empty()) newW += _Space; _W = newW; @@ -1456,7 +1456,7 @@ namespace NLGUI void CGroupParagraph::onTextChanged() { - if( _Elements.size() == 0 ) + if( _Elements.empty() ) return; CElementInfo &e = _Elements[ 0 ]; diff --git a/code/nel/src/gui/interface_expr_user_fct.cpp b/code/nel/src/gui/interface_expr_user_fct.cpp index 07e329feb..ac80efa05 100644 --- a/code/nel/src/gui/interface_expr_user_fct.cpp +++ b/code/nel/src/gui/interface_expr_user_fct.cpp @@ -210,7 +210,7 @@ namespace NLGUI static DECLARE_INTERFACE_USER_FCT(userFctIdentity) { - if (args.size() > 0) + if (!args.empty()) { result = args[0]; return true; @@ -354,7 +354,7 @@ namespace NLGUI static DECLARE_INTERFACE_USER_FCT(userFctStr) { - if (args.size() > 0) + if (!args.empty()) { ucstring res(""); for (uint32 i = 0; i < args.size(); ++i) diff --git a/code/nel/src/gui/interface_group.cpp b/code/nel/src/gui/interface_group.cpp index c0e7f6f17..fc75ae0db 100644 --- a/code/nel/src/gui/interface_group.cpp +++ b/code/nel/src/gui/interface_group.cpp @@ -1003,7 +1003,7 @@ namespace NLGUI { string idTmp = id, lidTmp = lid; // bool isFound = true; - while (idTmp.size() > 0) + while (!idTmp.empty()) { string tokid, toklid; @@ -1782,7 +1782,7 @@ namespace NLGUI { // bool bUnder = pChild->getViewsUnder (x, y, clipX, clipY, clipW, clipH, vVB); - // if (bUnder && (vICL.size() > 0)) + // if (bUnder && !vICL.empty()) // return true; } } @@ -1837,7 +1837,7 @@ namespace NLGUI { // bool bUnder = pChild->getCtrlsUnder (x, y, clipX, clipY, clipW, clipH, vICL); - // if (bUnder && (vICL.size() > 0)) + // if (bUnder && !vICL.empty()) // return true; } } @@ -1893,7 +1893,7 @@ namespace NLGUI { // bool bUnder = pChild->getGroupsUnder (x, y, clipX, clipY, clipW, clipH, vIGL); - // if (bUnder && (vICL.size() > 0)) + // if (bUnder && !vICL.empty()) // return true; } } diff --git a/code/nel/src/gui/interface_link.cpp b/code/nel/src/gui/interface_link.cpp index 612fa908e..4266797f4 100644 --- a/code/nel/src/gui/interface_link.cpp +++ b/code/nel/src/gui/interface_link.cpp @@ -668,7 +668,7 @@ namespace NLGUI { std::vector vTargets; splitLinkTargets(Target, pIG, vTargets); - if ((vTargets.size() > 0) && (vTargets[0].Elem)) + if (!vTargets.empty() && (vTargets[0].Elem)) { vTargets[0].affect(val); } diff --git a/code/nel/src/gui/interface_parser.cpp b/code/nel/src/gui/interface_parser.cpp index e038cb73e..63eb165e3 100644 --- a/code/nel/src/gui/interface_parser.cpp +++ b/code/nel/src/gui/interface_parser.cpp @@ -673,7 +673,7 @@ namespace NLGUI string NewProp; string RepProp; - while (LastProp.size() > 0) + while (!LastProp.empty()) { string::size_type diesPos = LastProp.find("#"); if (diesPos != string::npos) diff --git a/code/nel/src/gui/lua_ihm.cpp b/code/nel/src/gui/lua_ihm.cpp index 0951d973c..fed1340a0 100644 --- a/code/nel/src/gui/lua_ihm.cpp +++ b/code/nel/src/gui/lua_ihm.cpp @@ -1520,7 +1520,7 @@ namespace NLGUI CSString s = str; // Create table recursively (ex: 'game.TPVPClan' will check/create the table 'game' and 'game.TPVPClan') p = s.splitTo('.', true); - while (p.size() > 0) + while (!p.empty()) { if (path.empty() ) path = p; diff --git a/code/nel/src/gui/view_bitmap_combo.cpp b/code/nel/src/gui/view_bitmap_combo.cpp index 7ffe644b6..8fbc7609c 100644 --- a/code/nel/src/gui/view_bitmap_combo.cpp +++ b/code/nel/src/gui/view_bitmap_combo.cpp @@ -415,7 +415,7 @@ namespace NLGUI } } - if (_TexsId.size() == 0) + if (_TexsId.empty()) { for (i = 0; i < _Texs.size(); ++i) _TexsId.push_back(rVR.getTextureIdFromName(_Texs[i])); diff --git a/code/nel/src/gui/view_renderer.cpp b/code/nel/src/gui/view_renderer.cpp index 58aceb185..fc641d1cf 100644 --- a/code/nel/src/gui/view_renderer.cpp +++ b/code/nel/src/gui/view_renderer.cpp @@ -241,7 +241,7 @@ namespace NLGUI // *************************************************************************** NL3D::UTextContext* CViewRenderer::getTextContext(const std::string &name) { - if (name.size() > 0 && fonts.count(name) > 0) + if (!name.empty() && fonts.count(name) > 0) return fonts[name]; return textcontext; @@ -257,7 +257,7 @@ namespace NLGUI driver->deleteTextContext(fonts[name]); std::string fontFile = CPath::lookup(font, false); - if (fontFile.size() == 0) + if (fontFile.empty()) { nlwarning("Font file '%s' not found", font.c_str()); return false; diff --git a/code/nel/src/gui/view_text.cpp b/code/nel/src/gui/view_text.cpp index 06f46bf0c..e145db91c 100644 --- a/code/nel/src/gui/view_text.cpp +++ b/code/nel/src/gui/view_text.cpp @@ -898,7 +898,7 @@ namespace NLGUI if ((_MultiLine)&&(_Parent != NULL)) { // If never setuped, and if text is not empty - if (_Lines.size() == 0 && !_Text.empty()) + if (_Lines.empty() && !_Text.empty()) invalidateContent (); sint currentMaxW= getCurrentMultiLineMaxW(); @@ -986,7 +986,7 @@ namespace NLGUI // *** Draw multiline if ((_MultiLine)&&(_Parent != NULL)) { - if (_Lines.size() == 0) return; + if (_Lines.empty()) return; TextContext->setHotSpot (UTextContext::BottomLeft); TextContext->setShaded (_Shadow); @@ -1669,7 +1669,7 @@ namespace NLGUI { if (expandSpaces) { - nlassert(_Lines.size() > 0); + nlassert(!_Lines.empty()); nlassert(_Lines.back()->getNumWords() > 0); // Yoyo: if the line has tab, then don't justify @@ -1876,7 +1876,7 @@ namespace NLGUI } // Special case for multiline limited in number of lines - if ((_Lines.size() > 0) && (_MultiMaxLine > 0) && (_Lines.size() > _MultiMaxLine)) + if (!_Lines.empty() && (_MultiMaxLine > 0) && (_Lines.size() > _MultiMaxLine)) { while (_Lines.size() > _MultiMaxLine) { @@ -1905,7 +1905,7 @@ namespace NLGUI _H = std::max(_H, sint(_FontHeight * _MultiMinLine + (_MultiMinLine - 1) * _MultiLineSpace)); // Compute tooltips size - if (_Tooltips.size() > 0) + if (!_Tooltips.empty()) for (uint i=0 ; i<_Lines.size() ; ++i) { for (uint j=0 ; j<_Lines[i]->getNumWords() ; ++j) diff --git a/code/nel/src/gui/widget_manager.cpp b/code/nel/src/gui/widget_manager.cpp index 73c7098fe..972039b25 100644 --- a/code/nel/src/gui/widget_manager.cpp +++ b/code/nel/src/gui/widget_manager.cpp @@ -3334,7 +3334,7 @@ namespace NLGUI { const CProcAction &action = proc.Actions[i]; // test if the condition for the action is valid - if( action.CondBlocks.size() > 0 ) + if (!action.CondBlocks.empty()) { CInterfaceExprValue result; result.setBool( false ); diff --git a/code/nel/src/logic/logic_condition.cpp b/code/nel/src/logic/logic_condition.cpp index 2afe26ad6..ab6b22822 100644 --- a/code/nel/src/logic/logic_condition.cpp +++ b/code/nel/src/logic/logic_condition.cpp @@ -337,7 +337,7 @@ bool CLogicConditionNode::testLogic() } // if there's no subtree we assess the subtree is true - if( _Nodes.size() == 0 ) + if( _Nodes.empty() ) { return true; } diff --git a/code/nel/src/misc/big_file.cpp b/code/nel/src/misc/big_file.cpp index 100bc4d07..9713610cb 100644 --- a/code/nel/src/misc/big_file.cpp +++ b/code/nel/src/misc/big_file.cpp @@ -653,7 +653,7 @@ bool CBigFile::getFileInternal (const std::string &sFileName, BNP *&zeBnp, BNPFi } BNP &rbnp = _BNPs.find (zeBigFileName)->second; - if (rbnp.Files.size() == 0) + if (rbnp.Files.empty()) { return false; } @@ -746,7 +746,7 @@ char *CBigFile::getFileNamePtr(const std::string &sFileName, const std::string & { BNP &rbnp = _BNPs.find (bigfilenamealone)->second; vector::iterator itNBPFile; - if (rbnp.Files.size() == 0) + if (rbnp.Files.empty()) return NULL; string lwrFileName = toLower(sFileName); diff --git a/code/nel/src/misc/cdb_branch.cpp b/code/nel/src/misc/cdb_branch.cpp index 92631280c..a15eac930 100644 --- a/code/nel/src/misc/cdb_branch.cpp +++ b/code/nel/src/misc/cdb_branch.cpp @@ -210,7 +210,7 @@ void CCDBNodeBranch::init( xmlNodePtr node, IProgressCallback &progressCallBack, } else { - if ( _Nodes.size() > 0 ) + if (!_Nodes.empty()) for ( _IdBits=1; _Nodes.size() > unsigned(1<<_IdBits) ; _IdBits++ ) {} else _IdBits = 0; diff --git a/code/nel/src/misc/command.cpp b/code/nel/src/misc/command.cpp index 30e3defe2..a3d9d79ed 100644 --- a/code/nel/src/misc/command.cpp +++ b/code/nel/src/misc/command.cpp @@ -666,7 +666,7 @@ NLMISC_CATEGORISED_COMMAND(nel,help,"display help on a specific variable/command CCommandRegistry &cr = CCommandRegistry::getInstance(); // treat the case where we have no parameters - if (args.size() == 0) + if (args.empty()) { // display a list of all command categories log.displayNL("Help commands:"); diff --git a/code/nel/src/misc/common.cpp b/code/nel/src/misc/common.cpp index 2194a89db..31f289381 100644 --- a/code/nel/src/misc/common.cpp +++ b/code/nel/src/misc/common.cpp @@ -523,7 +523,7 @@ std::string timestampToHumanReadable(uint32 timestamp) uint32 fromHumanReadable (const std::string &str) { - if (str.size() == 0) + if (str.empty()) return 0; uint32 val; diff --git a/code/nel/src/misc/debug.cpp b/code/nel/src/misc/debug.cpp index 020416b01..c6d10b700 100644 --- a/code/nel/src/misc/debug.cpp +++ b/code/nel/src/misc/debug.cpp @@ -1504,7 +1504,7 @@ NLMISC_CATEGORISED_COMMAND(nel, displayMemlog, "displays the last N line of the { uint nbLines; - if (args.size() == 0) nbLines = 100; + if (args.empty()) nbLines = 100; else if (args.size() == 1) NLMISC::fromString(args[0], nbLines); else return false; @@ -1528,7 +1528,7 @@ NLMISC_CATEGORISED_COMMAND(nel, displayMemlog, "displays the last N line of the NLMISC_CATEGORISED_COMMAND(nel, resetFilters, "disable all filters on Nel loggers", "[debug|info|warning|error|assert]") { - if(args.size() == 0) + if(args.empty()) { DebugLog->resetFilters(); InfoLog->resetFilters(); @@ -1568,7 +1568,7 @@ NLMISC_CATEGORISED_COMMAND(nel, addNegativeFilterDebug, "add a negative filter o NLMISC_CATEGORISED_COMMAND(nel, removeFilterDebug, "remove a filter on DebugLog", "[]") { - if(args.size() == 0) + if(args.empty()) DebugLog->removeFilter(); else if(args.size() == 1) DebugLog->removeFilter( args[0].c_str() ); @@ -1578,7 +1578,7 @@ NLMISC_CATEGORISED_COMMAND(nel, removeFilterDebug, "remove a filter on DebugLog" NLMISC_CATEGORISED_COMMAND(nel, displayFilterDebug, "display filter on DebugLog", "") { - if(args.size() != 0) return false; + if(!args.empty()) return false; DebugLog->displayFilter(log); return true; } @@ -1599,7 +1599,7 @@ NLMISC_CATEGORISED_COMMAND(nel, addNegativeFilterInfo, "add a negative filter on NLMISC_CATEGORISED_COMMAND(nel, removeFilterInfo, "remove a filter on InfoLog", "[]") { - if(args.size() == 0) + if(args.empty()) InfoLog->removeFilter(); else if(args.size() == 1) InfoLog->removeFilter( args[0].c_str() ); @@ -1646,7 +1646,7 @@ NLMISC_CATEGORISED_COMMAND(nel, addNegativeFilterWarning, "add a negative filter NLMISC_CATEGORISED_COMMAND(nel, removeFilterWarning, "remove a filter on WarningLog", "[]") { - if(args.size() == 0) + if(args.empty()) WarningLog->removeFilter(); else if(args.size() == 1) WarningLog->removeFilter( args[0].c_str() ); @@ -1656,7 +1656,7 @@ NLMISC_CATEGORISED_COMMAND(nel, removeFilterWarning, "remove a filter on Warning NLMISC_CATEGORISED_COMMAND(nel, displayFilterWarning, "display filter on WarningLog", "") { - if(args.size() != 0) return false; + if(!args.empty()) return false; WarningLog->displayFilter(log); return true; } diff --git a/code/nel/src/misc/hierarchical_timer.cpp b/code/nel/src/misc/hierarchical_timer.cpp index 70fb98d9f..55eba958a 100644 --- a/code/nel/src/misc/hierarchical_timer.cpp +++ b/code/nel/src/misc/hierarchical_timer.cpp @@ -521,7 +521,7 @@ void CHTimer::displayByExecutionPath(CLog *log, TSortCriterion criterion, bool std::copy(currTimer->_Name, currTimer->_Name + (endIndex - startIndex), resultName.begin() + startIndex); } TNodeVect &execNodes = nodeMap[currTimer]; - if (execNodes.size() > 0) + if (!execNodes.empty()) { currNodeStats.buildFromNodes(&execNodes[0], (uint)execNodes.size(), _MsPerTick); currNodeStats.getStats(resultStats, displayEx, rootStats.TotalTime, _WantStandardDeviation); diff --git a/code/nel/src/misc/polygon.cpp b/code/nel/src/misc/polygon.cpp index 9388dbd45..16575073f 100644 --- a/code/nel/src/misc/polygon.cpp +++ b/code/nel/src/misc/polygon.cpp @@ -1999,7 +1999,7 @@ float CPolygon2D::sumDPAgainstLine(float a, float b, float c) const // ******************************************************************************* bool CPolygon2D::getNonNullSeg(uint &index) const { - nlassert(Vertices.size() > 0); + nlassert(!Vertices.empty()); float bestLength = 0.f; sint bestIndex = -1; for (uint k = 0; k < Vertices.size() - 1; ++k) @@ -2046,7 +2046,7 @@ void CPolygon2D::getLineEquation(uint index, float &a, float &b, float &c) cons // ******************************************************************************* bool CPolygon2D::intersect(const CPolygon2D &other) const { - nlassert(other.Vertices.size() > 0); + nlassert(!other.Vertices.empty()); uint nonNullSegIndex; /// get the orientation of this poly if (getNonNullSeg(nonNullSegIndex)) diff --git a/code/nel/src/misc/stop_watch.cpp b/code/nel/src/misc/stop_watch.cpp index 59b62150e..8da60d8ec 100644 --- a/code/nel/src/misc/stop_watch.cpp +++ b/code/nel/src/misc/stop_watch.cpp @@ -136,7 +136,7 @@ TMsDuration CStopWatch::getDuration() const */ TMsDuration CStopWatch::getPartialAverage() const { - if (_Queue.size() == 0) + if (_Queue.empty()) return (TMsDuration)0; else return (TMsDuration)(CTime::ticksToSecond( accumulate( _Queue.begin(), _Queue.end(), 0 ) / _Queue.size() ) * 1000.0); diff --git a/code/nel/src/misc/string_mapper.cpp b/code/nel/src/misc/string_mapper.cpp index 7177b062b..6e59f7bab 100644 --- a/code/nel/src/misc/string_mapper.cpp +++ b/code/nel/src/misc/string_mapper.cpp @@ -45,7 +45,7 @@ CStringMapper *CStringMapper::createLocalMapper() // **************************************************************************** TStringId CStringMapper::localMap(const std::string &str) { - if (str.size() == 0) + if (str.empty()) return 0; CAutoFastMutex automutex(&_Mutex); diff --git a/code/nel/src/net/admin.cpp b/code/nel/src/net/admin.cpp index 625523ea5..4389e0f34 100644 --- a/code/nel/src/net/admin.cpp +++ b/code/nel/src/net/admin.cpp @@ -782,13 +782,13 @@ void setInformation (const vector &alarms, const vector &graphup for (i = 0; i < alarms.size(); i+=3) { CVarPath shardvarpath (alarms[i]); - if(shardvarpath.Destination.size() == 0 || shardvarpath.Destination[0].second.empty()) + if(shardvarpath.Destination.empty() || shardvarpath.Destination[0].second.empty()) continue; CVarPath servervarpath (shardvarpath.Destination[0].second); - if(servervarpath.Destination.size() == 0 || servervarpath.Destination[0].second.empty()) + if(servervarpath.Destination.empty() || servervarpath.Destination[0].second.empty()) continue; CVarPath servicevarpath (servervarpath.Destination[0].second); - if(servicevarpath.Destination.size() == 0 || servicevarpath.Destination[0].second.empty()) + if(servicevarpath.Destination.empty() || servicevarpath.Destination[0].second.empty()) continue; string name = servicevarpath.Destination[0].second; @@ -817,13 +817,13 @@ void setInformation (const vector &alarms, const vector &graphup for (i = 0; i < graphupdate.size(); i+=2) { CVarPath shardvarpath (graphupdate[i]); - if(shardvarpath.Destination.size() == 0 || shardvarpath.Destination[0].second.empty()) + if(shardvarpath.Destination.empty() || shardvarpath.Destination[0].second.empty()) continue; CVarPath servervarpath (shardvarpath.Destination[0].second); - if(servervarpath.Destination.size() == 0 || servervarpath.Destination[0].second.empty()) + if(servervarpath.Destination.empty() || servervarpath.Destination[0].second.empty()) continue; CVarPath servicevarpath (servervarpath.Destination[0].second); - if(servicevarpath.Destination.size() == 0 || servicevarpath.Destination[0].second.empty()) + if(servicevarpath.Destination.empty() || servicevarpath.Destination[0].second.empty()) continue; string VarName = servicevarpath.Destination[0].second; diff --git a/code/nel/src/net/module_common.cpp b/code/nel/src/net/module_common.cpp index f16e1bfa9..aacf80a93 100644 --- a/code/nel/src/net/module_common.cpp +++ b/code/nel/src/net/module_common.cpp @@ -195,7 +195,7 @@ namespace NLNET vector parts; NLMISC::explode(name, string("."), parts); - if (name.size() > 0) + if (!name.empty()) { // at least one part in the name // check if sub ojbcct exist @@ -208,7 +208,7 @@ namespace NLNET sub = SubParams.back(); } - if (name.size() > 0) + if (!name.empty()) { // name is more deep, need to resurse parts.erase(parts.begin()); diff --git a/code/nel/src/net/naming_client.cpp b/code/nel/src/net/naming_client.cpp index a54fddaa0..7e2fd5ec9 100644 --- a/code/nel/src/net/naming_client.cpp +++ b/code/nel/src/net/naming_client.cpp @@ -128,7 +128,7 @@ void cbRegisterBroadcast (CMessage &msgin, TSockId /* from */, CCallbackNetBase std::vector addrs; CNamingClient::find (sid, addrs); - if (addrs.size() == 0) + if (addrs.empty()) { CNamingClient::RegisteredServicesMutex.enter (); CNamingClient::RegisteredServices.push_back (CNamingClient::CServiceEntry (name, sid, addr)); diff --git a/code/nel/src/net/udp_sim_sock.cpp b/code/nel/src/net/udp_sim_sock.cpp index c9fb73e97..fabb037d3 100644 --- a/code/nel/src/net/udp_sim_sock.cpp +++ b/code/nel/src/net/udp_sim_sock.cpp @@ -116,7 +116,7 @@ void CUdpSimSock::sendUDP (const uint8 *buffer, uint32& len, const CInetAddress CBufferizedOutPacket *bp = new CBufferizedOutPacket (&UdpSock, buffer, len, lag, addr); // duplicate the packet - if ((float)rand()/(float)(RAND_MAX)*100.0f < _OutPacketDisordering && _BufferizedOutPackets.size() > 0) + if ((float)rand()/(float)(RAND_MAX)*100.0f < _OutPacketDisordering && !_BufferizedOutPackets.empty()) { CBufferizedOutPacket *bp2 = _BufferizedOutPackets.back(); diff --git a/code/nel/src/net/varpath.cpp b/code/nel/src/net/varpath.cpp index 4fc52c341..857af5c64 100644 --- a/code/nel/src/net/varpath.cpp +++ b/code/nel/src/net/varpath.cpp @@ -181,8 +181,8 @@ void CVarPath::decode () bool CVarPath::isFinal () { - if(Destination.size() == 0) return true; - if(Destination[0].second.size() == 0) return true; + if(Destination.empty()) return true; + if(Destination[0].second.empty()) return true; return false; } diff --git a/code/nel/src/pacs/edge_quad.cpp b/code/nel/src/pacs/edge_quad.cpp index 1515af075..11053f09b 100644 --- a/code/nel/src/pacs/edge_quad.cpp +++ b/code/nel/src/pacs/edge_quad.cpp @@ -222,7 +222,7 @@ void CEdgeQuad::build(const CExteriorMesh &em, TCollisionSurfaceDescVector cd = (*pcd); - if (edges[i].Link != -1 && cd.size() > 0) + if (edges[i].Link != -1 && !cd.empty()) { nlwarning ("In NLPACS::CEdgeQuad::build()"); nlwarning ("ERROR: exterior edge %d with interior link crosses some surfaces", i); diff --git a/code/nel/src/pacs/global_retriever.cpp b/code/nel/src/pacs/global_retriever.cpp index 6dfc3a712..73691e19d 100644 --- a/code/nel/src/pacs/global_retriever.cpp +++ b/code/nel/src/pacs/global_retriever.cpp @@ -313,7 +313,7 @@ void NLPACS::CGlobalRetriever::getBorders(const CAABBox &sbox, std::vector 0) + if (!retriever.getFullOrderedChains().empty()) { const COrderedChain3f &ochain = retriever.getFullOrderedChain(entry.OChainId); diff --git a/code/nel/src/sound/audio_mixer_user.cpp b/code/nel/src/sound/audio_mixer_user.cpp index 58e171e0a..5a21650e0 100644 --- a/code/nel/src/sound/audio_mixer_user.cpp +++ b/code/nel/src/sound/audio_mixer_user.cpp @@ -2559,7 +2559,7 @@ void CAudioMixerUser::changeMaxTrack(uint maxTrack) else { vector non_erasable; - while (_Tracks.size() + non_erasable.size() > maxTrack && _Tracks.size() > 0) + while (_Tracks.size() + non_erasable.size() > maxTrack && !_Tracks.empty()) { CTrack *track = _Tracks.back(); _Tracks.pop_back(); @@ -2588,7 +2588,7 @@ void CAudioMixerUser::changeMaxTrack(uint maxTrack) non_erasable.push_back(track); } } - while (non_erasable.size() > 0) + while (!non_erasable.empty()) { // put non erasable back into track list _Tracks.push_back(non_erasable.back()); diff --git a/code/nel/src/sound/sound_bank.cpp b/code/nel/src/sound/sound_bank.cpp index 59330f3f8..ee00e1742 100644 --- a/code/nel/src/sound/sound_bank.cpp +++ b/code/nel/src/sound/sound_bank.cpp @@ -277,7 +277,7 @@ void CSoundBank::load(const std::string &packedSheetDir, bool packedSheetUpdate) maxShortId = first->second.Sound->getName().getShortId(); } ++maxShortId; // inc for size = last idx + 1 - if (container.size() == 0) + if (container.empty()) { nlwarning("NLSOUND: No sound sheets have been loaded, missing sound sheet directory or packed sound sheets file"); } diff --git a/code/nel/tools/3d/cluster_viewer/view_cs.cpp b/code/nel/tools/3d/cluster_viewer/view_cs.cpp index 9e4dc4f80..fa5485ca0 100644 --- a/code/nel/tools/3d/cluster_viewer/view_cs.cpp +++ b/code/nel/tools/3d/cluster_viewer/view_cs.cpp @@ -161,14 +161,14 @@ void LoadSceneScript (const char *ScriptName, CScene* pScene, vector &D { if (nLastNbPlus >= nNbPlus) for (int i = 0; i < ((nLastNbPlus-nNbPlus)+1); ++i) - if (pile.size() > 0) + if (!pile.empty()) pile.pop_back(); nLastNbPlus = nNbPlus; CInstanceGroup *father = pScene->getGlobalInstanceGroup(); - if (pile.size() > 0) + if (!pile.empty()) father = pile.back(); CInstanceGroup *ITemp = LoadInstanceGroup (nameIG); @@ -338,7 +338,7 @@ int main(int argc, char **argv) } ++itAcc; } - if ((vCluster.size() == 0) && (DispCS[0].pIG == pCurIG)) + if (vCluster.empty() && (DispCS[0].pIG == pCurIG)) { vCluster.push_back (pClipTrav->RootCluster); } diff --git a/code/nel/tools/3d/lightmap_optimizer/main.cpp b/code/nel/tools/3d/lightmap_optimizer/main.cpp index 077cc83b5..a84e797ad 100644 --- a/code/nel/tools/3d/lightmap_optimizer/main.cpp +++ b/code/nel/tools/3d/lightmap_optimizer/main.cpp @@ -644,7 +644,7 @@ int main(int nNbArg, char **ppArgs) } } - if (AllLightmapNames.size() == 0) + if (AllLightmapNames.empty()) continue; // Load all the lightmaps diff --git a/code/nel/tools/3d/object_viewer/object_viewer.cpp b/code/nel/tools/3d/object_viewer/object_viewer.cpp index 207404635..2835b9b42 100644 --- a/code/nel/tools/3d/object_viewer/object_viewer.cpp +++ b/code/nel/tools/3d/object_viewer/object_viewer.cpp @@ -2583,7 +2583,7 @@ void CObjectViewer::evalSoundTrack (float lastTime, float currentTime) for (uint i = 0; i < _ListInstance.size(); i++) { // Some animation in the list ? - if (_ListInstance[i]->Saved.PlayList.size() > 0) + if (!_ListInstance[i]->Saved.PlayList.empty()) { // Accumul time float startTime = 0; diff --git a/code/nel/tools/3d/object_viewer/sound_anim_view.cpp b/code/nel/tools/3d/object_viewer/sound_anim_view.cpp index af4326cd7..72591a4b4 100644 --- a/code/nel/tools/3d/object_viewer/sound_anim_view.cpp +++ b/code/nel/tools/3d/object_viewer/sound_anim_view.cpp @@ -298,7 +298,7 @@ void CSoundAnimView::refresh(BOOL update) CInstanceInfo *instanceInfo = _ObjView->getInstance(selected); // Some animation in the list ? - if (instanceInfo->Saved.PlayList.size() > 0) + if (!instanceInfo->Saved.PlayList.empty()) { // Accumul time float startTime = 0; diff --git a/code/nel/tools/3d/plugin_max/nel_export/nel_export.cpp b/code/nel/tools/3d/plugin_max/nel_export/nel_export.cpp index ee0b05c21..f0de21376 100644 --- a/code/nel/tools/3d/plugin_max/nel_export/nel_export.cpp +++ b/code/nel/tools/3d/plugin_max/nel_export/nel_export.cpp @@ -713,7 +713,7 @@ static INT_PTR CALLBACK CNelExportDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LP // Get the nodes std::vector vectNode; theCNelExport.getSelectedNode (vectNode); - if (vectNode.size() == 0) + if (vectNode.empty()) { ::MessageBox(hWnd, _T("No nodes selected"), _T("Error"), MB_OK|MB_ICONEXCLAMATION); return ret; diff --git a/code/nel/tools/3d/plugin_max/nel_export/nel_export_collision.cpp b/code/nel/tools/3d/plugin_max/nel_export/nel_export_collision.cpp index dd48e4487..8bfcf3e5d 100644 --- a/code/nel/tools/3d/plugin_max/nel_export/nel_export_collision.cpp +++ b/code/nel/tools/3d/plugin_max/nel_export/nel_export_collision.cpp @@ -43,7 +43,7 @@ bool CNelExport::exportCollision (const std::string &sPath, std::vector // ULONG SelectDir(HWND Parent, char* Title, char* Path); std::string path = std::string(sPath); - if (path.size() == 0 || path[path.size()-1] != '\\' && path[path.size()-1] != '/') + if (path.empty() || path[path.size()-1] != '\\' && path[path.size()-1] != '/') path.insert(path.end(), '/'); if (meshBuildList.empty()) return true; diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/calc_lm.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/calc_lm.cpp index 863b1b89b..5ccc223f9 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/calc_lm.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/calc_lm.cpp @@ -2063,7 +2063,7 @@ void sans_majuscule_au_debut_LinkToObjectAround (CMesh::CMeshBuild *pMB, CMeshBa } } - if (ivert.size() > 0) + if (!ivert.empty()) { // Get all faces that contains at least one shared vertex for (k = 0; k < wrt.vMB[i]->Faces.size(); ++k) @@ -2258,7 +2258,7 @@ bool CExportNel::calculateLM( CMesh::CMeshBuild *pZeMeshBuild, CMeshBase::CMeshB // Bubble sort pointer to the faces (Material sorting) ClearFaceWithNoLM( pMB, pMBB, AllFaces ); - if( AllFaces.size() == 0 ) + if( AllFaces.empty() ) { if (InfoLog) InfoLog->display("CalculateLM : %d ms\n", timeGetTime()-t); diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/calc_lm_rt.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/calc_lm_rt.cpp index 789c37b23..1a89c8d31 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/calc_lm_rt.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/calc_lm_rt.cpp @@ -246,7 +246,7 @@ CRGBAF CRTWorld::raytrace (NLMISC::CVector &vVertex, sint32 nLightNb, uint8& rtV RayOfLight.clip (t); - if (RayOfLight.Shapes.size() == 0) + if (RayOfLight.Shapes.empty()) return CRGBAF(0.0f, 0.0f, 0.0f, 0.0f); // Next selected element diff --git a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_mesh_interface.cpp b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_mesh_interface.cpp index 82eb42484..0cbd8fbe1 100644 --- a/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_mesh_interface.cpp +++ b/code/nel/tools/3d/plugin_max/nel_mesh_lib/export_mesh_interface.cpp @@ -648,7 +648,7 @@ static bool BuildMeshInterfaces(const char *cMaxFileName, std::vector& vectNode, v } // debug purpose : to remove - if (vClusters.size() > 0) - if (aIGArray[nNumIG].Clusters.size() == 0) + if (!vClusters.empty()) + if (aIGArray[nNumIG].Clusters.empty()) { nlwarning("ERROR: Object %s is not attached to any cluster\nbut his flag clusterize is set", tStrToUtf8(pNode->GetName()).c_str()); } diff --git a/code/nel/tools/pacs/build_rbank/build_surf.cpp b/code/nel/tools/pacs/build_rbank/build_surf.cpp index 10d4c6a19..7e873f15f 100644 --- a/code/nel/tools/pacs/build_rbank/build_surf.cpp +++ b/code/nel/tools/pacs/build_rbank/build_surf.cpp @@ -1420,7 +1420,7 @@ void NLPACS::CZoneTessellation::compile() bool force = false; - if (surf.Area < 30.0f && surf.Elements.size() > 0) + if (surf.Area < 30.0f && !surf.Elements.empty()) { uint i; CAABBox aabbox; @@ -1688,7 +1688,7 @@ CAABBox NLPACS::CZoneTessellation::computeBBox() const bool set = false; uint i; - if (_Vertices.size() == 0) + if (_Vertices.empty()) return zbox; zbox.setCenter(_Vertices[0]); diff --git a/code/ryzom/client/src/character_cl.cpp b/code/ryzom/client/src/character_cl.cpp index dcb75e95d..e1eee00b0 100644 --- a/code/ryzom/client/src/character_cl.cpp +++ b/code/ryzom/client/src/character_cl.cpp @@ -1503,7 +1503,7 @@ void CCharacterCL::updateVisualPropertyVpa(const NLMISC::TGameCycle &/* gameCycl // Retrieve the right sheet for clothes. _ClothesSheet = _Sheet; - if(_Sheet->IdAlternativeClothes.size() > 0) + if(!_Sheet->IdAlternativeClothes.empty()) { sint32 num = rnd.rand()%(_Sheet->IdAlternativeClothes.size()+1); if(num > 0) @@ -1531,7 +1531,7 @@ void CCharacterCL::updateVisualPropertyVpa(const NLMISC::TGameCycle &/* gameCycl else _HairColor = (sint8)altLookProp.Element.ColorHair%SheetMngr.nbHairColor(); // Hair Index - if(_Sheet->HairItemList.size() > 0) + if(!_Sheet->HairItemList.empty()) { sint32 num = rnd.rand()%_Sheet->HairItemList.size(); if(num>=0 && num <_BadHairIndex) @@ -10279,7 +10279,7 @@ NLMISC_COMMAND(pvpMode, "modify pvp mode", "[ ]") if (!playerTarget) return false; - if( args.size() == 0 ) + if (args.empty()) { uint16 pvpMode = playerTarget->getPvpMode(); string str; diff --git a/code/ryzom/client/src/commands.cpp b/code/ryzom/client/src/commands.cpp index 51e57373b..37c18d697 100644 --- a/code/ryzom/client/src/commands.cpp +++ b/code/ryzom/client/src/commands.cpp @@ -171,7 +171,7 @@ NLMISC_COMMAND(follow, "Follow the target", "") NLMISC_COMMAND(where, "Ask information on the position", "") { // Check parameters. - if(args.size() == 0) + if(args.empty()) { // Create the message and send. const string msgName = "COMMAND:WHERE"; CBitMemStream out; @@ -212,7 +212,7 @@ NLMISC_COMMAND(who, "Display all players currently in region","[]") { string customText; - if( args.size() > 0 ) + if (!args.empty()) { customText = args[0]; } @@ -738,7 +738,7 @@ NLMISC_COMMAND(bugReport, "Call the bug report tool with dump", " NLMISC_COMMAND(a, "Execute an admin command on you"," ") { - if(args.size() == 0) + if(args.empty()) return false; CBitMemStream out; @@ -782,7 +782,7 @@ NLMISC_COMMAND(a, "Execute an admin command on you"," ") NLMISC_COMMAND(b, "Execute an admin command on your target"," ") { - if(args.size() == 0) + if(args.empty()) return false; CBitMemStream out; @@ -873,7 +873,7 @@ NLMISC_COMMAND(boxes, "Show/Hide selection boxes", "[ : 0 to Hide, anythi #endif // FINAL_VERSION // Invert Current State - if(args.size() == 0) + if(args.empty()) { // Invert the current value. ClientCfg.DrawBoxes = !ClientCfg.DrawBoxes; @@ -1323,7 +1323,7 @@ NLMISC_COMMAND(setMissingDynstringText, "set text of missing dynamic string"," < NLMISC_COMMAND(ah, "Launch an action handler", " ") { - if (args.size() == 0) + if (args.empty()) return false; if (!ClientCfg.AllowDebugLua && toLower(args[0]) == "lua") @@ -2716,7 +2716,7 @@ NLMISC_COMMAND(particle, "Create a particule at the user position (play FireWork string fn; // Check parameters. - if(args.size() == 0) + if(args.empty()) { fn = "FireWorkA_with_sound.ps"; } @@ -5737,7 +5737,7 @@ NLMISC_COMMAND(em, "emote command", "") if( pIM ) { string emotePhrase; - if( args.size() > 0 ) + if (!args.empty()) { emotePhrase = args[0]; } @@ -5762,7 +5762,7 @@ NLMISC_COMMAND(guildmotd, "Set or see the guild message of the day"," 0 ) + if (!args.empty()) { gmotd = args[0]; } diff --git a/code/ryzom/client/src/continent_manager.cpp b/code/ryzom/client/src/continent_manager.cpp index ddc4bff89..fe9067a4f 100644 --- a/code/ryzom/client/src/continent_manager.cpp +++ b/code/ryzom/client/src/continent_manager.cpp @@ -396,7 +396,7 @@ void CContinentManager::select(const CVectorD &pos, NLMISC::IProgressCallback &p { CContinent *pCont = it->second; nlinfo("Looking into %s", pCont->SheetName.c_str()); - if (pCont->Zone.VPoints.size() > 0) // Patch because some continent have not been done yet + if (!pCont->Zone.VPoints.empty()) // Patch because some continent have not been done yet { if (pCont->Zone.contains(fPos)) { diff --git a/code/ryzom/client/src/continent_manager_build.h b/code/ryzom/client/src/continent_manager_build.h index 8c42140be..0f320588a 100644 --- a/code/ryzom/client/src/continent_manager_build.h +++ b/code/ryzom/client/src/continent_manager_build.h @@ -64,7 +64,7 @@ public: static NLMISC::CVector2f getZoneCenter(const NLLIGO::CPrimZone &z) { NLMISC::CVector2f vMin, vMax; - if (z.VPoints.size() == 0) + if (z.VPoints.empty()) return NLMISC::CVector2f(0,0); vMin = vMax = z.VPoints[0]; for (uint32 i = 1; i < z.VPoints.size(); ++i) diff --git a/code/ryzom/client/src/door_manager.cpp b/code/ryzom/client/src/door_manager.cpp index 14c4e889e..64b1d65a5 100644 --- a/code/ryzom/client/src/door_manager.cpp +++ b/code/ryzom/client/src/door_manager.cpp @@ -233,7 +233,7 @@ void CDoorManager::SDoor::checkToClose() } } - if (Entities.size() == 0) + if (Entities.empty()) close(); else open(); diff --git a/code/ryzom/client/src/interface_v3/action_handler_help.cpp b/code/ryzom/client/src/interface_v3/action_handler_help.cpp index 034af7317..be11191e0 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_help.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_help.cpp @@ -780,7 +780,7 @@ class CHandlerOpenTitleHelp : public IActionHandler if (pTU != NULL) { sSkillsNeeded = CI18N::get("uiTitleSkillHeader"); - if (pTU->SkillsNeeded.size() == 0 || reservedTitle) + if (pTU->SkillsNeeded.empty() || reservedTitle) { sSkillsNeeded += CI18N::get("uiTitleSkillNoNeed"); } @@ -821,7 +821,7 @@ class CHandlerOpenTitleHelp : public IActionHandler if (pTU != NULL) { sBricksNeeded = CI18N::get("uiTitleBrickHeader"); - if (pTU->BricksNeeded.size() == 0 || reservedTitle) + if (pTU->BricksNeeded.empty() || reservedTitle) { sBricksNeeded += CI18N::get("uiTitleBrickNoNeed"); } diff --git a/code/ryzom/client/src/interface_v3/action_handler_phrase.cpp b/code/ryzom/client/src/interface_v3/action_handler_phrase.cpp index 81fa09ef0..2faade900 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_phrase.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_phrase.cpp @@ -1656,7 +1656,7 @@ DECLARE_INTERFACE_CONSTANT(getPhraseBrickSelectionMax, CDBGroupBuildPhrase::MaxS // Get the UC name of a phraseId static DECLARE_INTERFACE_USER_FCT(getSPhraseName) { - if (args.size() > 0) + if (!args.empty()) { if(!args[0].toInteger()) return false; diff --git a/code/ryzom/client/src/interface_v3/chat_window.cpp b/code/ryzom/client/src/interface_v3/chat_window.cpp index 207f09aba..90b3d06a7 100644 --- a/code/ryzom/client/src/interface_v3/chat_window.cpp +++ b/code/ryzom/client/src/interface_v3/chat_window.cpp @@ -1265,7 +1265,7 @@ public: if (pEB == NULL) return; ucstring text = pEB->getInputString(); // If the line is empty, do nothing - if(text.size() == 0) + if(text.empty()) return; diff --git a/code/ryzom/client/src/interface_v3/group_html_webig.cpp b/code/ryzom/client/src/interface_v3/group_html_webig.cpp index 1b74233e7..58d27c851 100644 --- a/code/ryzom/client/src/interface_v3/group_html_webig.cpp +++ b/code/ryzom/client/src/interface_v3/group_html_webig.cpp @@ -190,7 +190,7 @@ struct CWebigNotificationThread : public NLMISC::IRunnable // Update the mail notification icon uint32 nbmail = 0; - if(notifs.size() > 0 && fromString(notifs[0], nbmail)) + if(!notifs.empty() && fromString(notifs[0], nbmail)) { //nlinfo("nb mail is a number %d", nbmail); CInterfaceManager *pIM = CInterfaceManager::getInstance(); diff --git a/code/ryzom/client/src/interface_v3/group_in_scene_bubble.cpp b/code/ryzom/client/src/interface_v3/group_in_scene_bubble.cpp index e964911c3..e9c7776c5 100644 --- a/code/ryzom/client/src/interface_v3/group_in_scene_bubble.cpp +++ b/code/ryzom/client/src/interface_v3/group_in_scene_bubble.cpp @@ -473,7 +473,7 @@ void CGroupInSceneBubbleManager::update () CGroupInSceneBubble *CGroupInSceneBubbleManager::newBubble (const ucstring &text) { - if (!text.empty() && _Bubbles.size ()) + if (!text.empty() && !_Bubbles.empty()) { // Get a bubble CGroupInSceneBubble *bubble = _Bubbles[_CurrentBubble]; diff --git a/code/ryzom/client/src/interface_v3/group_map.cpp b/code/ryzom/client/src/interface_v3/group_map.cpp index 554059be7..2fa37ddb1 100644 --- a/code/ryzom/client/src/interface_v3/group_map.cpp +++ b/code/ryzom/client/src/interface_v3/group_map.cpp @@ -1231,13 +1231,13 @@ void CGroupMap::checkCoords() NLGUI::CDBManager::getInstance()->getDbProp("UI:SAVE:RESPAWN_PT")->setValue32(_RespawnSelected); else if (_MapMode == MapMode_SpawnSquad) NLGUI::CDBManager::getInstance()->getDbProp("UI:TEMP:OUTPOST:SQUAD_RESPAWN_PT")->setValue32(_RespawnSelected); - if (_RespawnLM.size() > 0) + if (!_RespawnLM.empty()) _RespawnSelectedBitmap->setParentPos(_RespawnLM[_RespawnSelected]); } else { _RespawnSelected = getRespawnSelected(); - if (_RespawnLM.size() > 0) + if (!_RespawnLM.empty()) _RespawnSelectedBitmap->setParentPos(_RespawnLM[_RespawnSelected]); } } @@ -3030,7 +3030,7 @@ void CGroupMap::addRespawnPoints(const CRespawnPointsMsg &rpm) // Choose the good map ! (select the first respawn point and check for first matching bounding box map if (_MapMode != MapMode_Death) return; - if (_RespawnPos.size() == 0) return; + if (_RespawnPos.empty()) return; CWorldSheet *pWS = dynamic_cast(SheetMngr.get(CSheetId("ryzom.world"))); if (pWS == NULL) return; @@ -3113,7 +3113,7 @@ sint32 CGroupMap::getRespawnSelected() const //========================================================================================================= void CGroupMap::setRespawnSelected(sint32 nSpawnPointIndex) { - if (_RespawnPos.size() == 0) return; + if (_RespawnPos.empty()) return; if (nSpawnPointIndex < 0) return; if ((uint32)nSpawnPointIndex >= _RespawnPos.size()) return; CInterfaceManager *pIM = CInterfaceManager::getInstance(); diff --git a/code/ryzom/client/src/interface_v3/guild_manager.cpp b/code/ryzom/client/src/interface_v3/guild_manager.cpp index 1867ea927..8e6c0019a 100644 --- a/code/ryzom/client/src/interface_v3/guild_manager.cpp +++ b/code/ryzom/client/src/interface_v3/guild_manager.cpp @@ -409,7 +409,7 @@ void CGuildManager::update() } // Search for UserEntity to find our own grade - if ((UserEntity != NULL) && (_GuildMembers.size() > 0)) + if ((UserEntity != NULL) && (!_GuildMembers.empty())) { uint i; _Grade = EGSPD::CGuildGrade::Member; diff --git a/code/ryzom/client/src/interface_v3/interface_3d_scene.cpp b/code/ryzom/client/src/interface_v3/interface_3d_scene.cpp index 6d3d7d5fe..d3fd612c0 100644 --- a/code/ryzom/client/src/interface_v3/interface_3d_scene.cpp +++ b/code/ryzom/client/src/interface_v3/interface_3d_scene.cpp @@ -323,7 +323,7 @@ bool CInterface3DScene::parse (xmlNodePtr cur, CInterfaceGroup *parentGroup) } // If no camera create the default one - if (_Cameras.size() == 0) + if (_Cameras.empty()) { CInterface3DCamera *pCam = new CInterface3DCamera; _Cameras.push_back(pCam); @@ -494,7 +494,7 @@ void CInterface3DScene::draw () cam.lookAt (pos, pI3DCam->getTarget(), pI3DCam->getRoll() * (float) (NLMISC::Pi / 180)); uint i; - if (_IGs.size() > 0) + if (!_IGs.empty()) { for (i = 0; i < _Characters.size(); ++i) _Characters[i]->setClusterSystem (_IGs[_CurrentCS]->getIG()); diff --git a/code/ryzom/client/src/interface_v3/interface_manager.cpp b/code/ryzom/client/src/interface_v3/interface_manager.cpp index 45d9d5ebb..413b8bcc5 100644 --- a/code/ryzom/client/src/interface_v3/interface_manager.cpp +++ b/code/ryzom/client/src/interface_v3/interface_manager.cpp @@ -3169,7 +3169,7 @@ void CInterfaceManager::uninitEmotes() // reset the emotes menu CTextEmotListSheet *pTELS = dynamic_cast(SheetMngr.get(CSheetId("list.text_emotes"))); - if (pTELS != NULL && pTELS->TextEmotList.size() > 0) + if (pTELS != NULL && !pTELS->TextEmotList.empty()) { // get the emotes menu id string sPath = pTELS->TextEmotList[0].Path; @@ -3211,7 +3211,7 @@ void CInterfaceManager::updateEmotes() bool CInterfaceManager::CEmoteCmd::execute(const std::string &/* rawCommandString */, const vector &args, CLog &/* log */, bool /* quiet */, bool /* human */) { string customPhrase; - if( args.size() > 0 ) + if (!args.empty()) { customPhrase = args[0]; } @@ -3817,7 +3817,7 @@ bool CInterfaceManager::parseTokens(ucstring& ucstr) vector token_vector; vector param_vector; splitUCString(token_string, ucstring("."), token_vector); - if (token_vector.size() == 0) + if (token_vector.empty()) { // Wrong formatting; give up on this one. start_pos = end_pos; @@ -3827,7 +3827,7 @@ bool CInterfaceManager::parseTokens(ucstring& ucstr) if (token_vector.size() == 1) { splitUCString(token_subject, ucstring("/"), param_vector); - token_subject = (param_vector.size() > 0) ? param_vector[0] : ucstring(""); + token_subject = !param_vector.empty() ? param_vector[0] : ucstring(""); token_param = ucstring("name"); } else if (token_vector.size() > 1) @@ -3836,7 +3836,7 @@ bool CInterfaceManager::parseTokens(ucstring& ucstr) if (token_param.luabind_substr(0, 3) != ucstring("gs(")) { splitUCString(token_vector[1], ucstring("/"), param_vector); - token_param = (param_vector.size() > 0) ? param_vector[0] : ucstring(""); + token_param = !param_vector.empty() ? param_vector[0] : ucstring(""); } } diff --git a/code/ryzom/client/src/interface_v3/item_special_effect.cpp b/code/ryzom/client/src/interface_v3/item_special_effect.cpp index 178c1b3bd..5d696738a 100644 --- a/code/ryzom/client/src/interface_v3/item_special_effect.cpp +++ b/code/ryzom/client/src/interface_v3/item_special_effect.cpp @@ -60,7 +60,7 @@ void CItemSpecialEffectHelper::registerItemSpecialEffect(const string &name) // %r : real // %s : string p = s.splitTo('%', true); - while (p.size() > 0 && s.size() > 0) + while (!p.empty() && !s.empty()) { if (s[0] == 'p' || s[0] == 'n' || s[0] == 'r' || s[0] == 's') { diff --git a/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp b/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp index 3ecf011d7..4a06195ce 100644 --- a/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp +++ b/code/ryzom/client/src/interface_v3/lua_ihm_ryzom.cpp @@ -365,7 +365,7 @@ void CLuaIHMRyzom::createLuaEnumTable(CLuaState &ls, const std::string &str) // Create table recursively (ex: 'game.TPVPClan' will check/create the table 'game' and 'game.TPVPClan') p = s.splitTo('.', true); - while (p.size() > 0) + while (!p.empty()) { if (path.empty()) path = p; @@ -2917,7 +2917,7 @@ ucstring CLuaIHMRyzom::replacePvpEffectParam(const ucstring &str, sint32 paramet // Locate parameter and store it p = s.splitTo('%', true); - while (p.size() > 0 && s.size() > 0) + while (!p.empty() && !s.empty()) { if (s[0] == 'p' || s[0] == 'n' || s[0] == 'r') { diff --git a/code/ryzom/client/src/interface_v3/macrocmd_manager.cpp b/code/ryzom/client/src/interface_v3/macrocmd_manager.cpp index 8d4ccb4c5..fdb4f45c8 100644 --- a/code/ryzom/client/src/interface_v3/macrocmd_manager.cpp +++ b/code/ryzom/client/src/interface_v3/macrocmd_manager.cpp @@ -916,7 +916,7 @@ public: CAHManager::getInstance()->runActionHandler("new_macro_enter_name",NULL); // Check if macro has more than one command - if (pMCM->CurrentEditMacro.Commands.size() == 0) return; + if (pMCM->CurrentEditMacro.Commands.empty()) return; // Add a macro if (pMCM->CurrentEditMacroNb != -1) diff --git a/code/ryzom/client/src/interface_v3/people_list.cpp b/code/ryzom/client/src/interface_v3/people_list.cpp index 6d6355421..e8f2bc898 100644 --- a/code/ryzom/client/src/interface_v3/people_list.cpp +++ b/code/ryzom/client/src/interface_v3/people_list.cpp @@ -871,7 +871,7 @@ class CHandlerContactEntry : public IActionHandler if (pEB == NULL) return; ucstring text = pEB->getInputString(); // If the line is empty, do nothing - if(text.size() == 0) + if(text.empty()) return; // Parse any tokens in the text diff --git a/code/ryzom/client/src/login.cpp b/code/ryzom/client/src/login.cpp index e733670ac..36aaa2a54 100644 --- a/code/ryzom/client/src/login.cpp +++ b/code/ryzom/client/src/login.cpp @@ -302,9 +302,9 @@ void initCatDisplay() // Check is good now ask the player if he wants to apply the patch pPM->getInfoToDisp(InfoOnPatch); - if ((InfoOnPatch.NonOptCat.size() > 0) || - (InfoOnPatch.OptCat.size() > 0) || - (InfoOnPatch.ReqCat.size() > 0)) + if ((!InfoOnPatch.NonOptCat.empty()) || + (!InfoOnPatch.OptCat.empty()) || + (!InfoOnPatch.ReqCat.empty())) { createOptionalCatUI(); NLGUI::CDBManager::getInstance()->getDbProp("UI:VARIABLES:SCREEN")->setValue32(UI_VARIABLES_SCREEN_CATDISP); @@ -529,9 +529,9 @@ void loginMainLoop() AvailablePatchs = InfoOnPatch.getAvailablePatchsBitfield(); - if ((InfoOnPatch.NonOptCat.size() > 0) || - (InfoOnPatch.OptCat.size() > 0) || - (InfoOnPatch.ReqCat.size() > 0)) + if ((!InfoOnPatch.NonOptCat.empty()) || + (!InfoOnPatch.OptCat.empty()) || + (!InfoOnPatch.ReqCat.empty())) { LoginSM.pushEvent(CLoginStateMachine::ev_patch_needed); // createOptionalCatUI(); diff --git a/code/ryzom/client/src/login_patch.cpp b/code/ryzom/client/src/login_patch.cpp index 659844a57..cd7a6deaf 100644 --- a/code/ryzom/client/src/login_patch.cpp +++ b/code/ryzom/client/src/login_patch.cpp @@ -1315,7 +1315,7 @@ void CPatchManager::getServerFile (const std::string &name, bool bZipped, const std::string serverPath; std::string serverDisplayPath; - if (UsedServer >= 0 && PatchServers.size() > 0) + if (UsedServer >= 0 && !PatchServers.empty()) { // first use main patch servers serverPath = PatchServers[UsedServer].ServerPath; @@ -2202,7 +2202,7 @@ void CCheckThread::run () nlwarning(rDescFiles.getFile(i).getFileName().c_str()); pPM->getPatchFromDesc(ftp, rDescFiles.getFile(i), false); // add the file if there are some patches to apply, or if an already patched version was found in the unpack directory - if (ftp.Patches.size() > 0 || (IncludeBackgroundPatch && !ftp.SrcFileName.empty())) + if (!ftp.Patches.empty() || (IncludeBackgroundPatch && !ftp.SrcFileName.empty())) { pPM->FilesToPatch.push_back(ftp); sTranslate = CI18N::get("uiNeededPatches") + " " + toString (ftp.Patches.size()); diff --git a/code/ryzom/client/src/login_xdelta.cpp b/code/ryzom/client/src/login_xdelta.cpp index 70a6f7a48..c70304dc2 100644 --- a/code/ryzom/client/src/login_xdelta.cpp +++ b/code/ryzom/client/src/login_xdelta.cpp @@ -512,7 +512,7 @@ CXDeltaPatch::TApplyResult CXDeltaPatch::apply(const std::string &sFileToPatch, return ApplyResult_UnsupportedXDeltaFormat; } - if (_Ctrl.SourceInfo.size() == 0) + if (_Ctrl.SourceInfo.empty()) { errorMsg = "no source info"; return ApplyResult_Error; @@ -527,7 +527,7 @@ CXDeltaPatch::TApplyResult CXDeltaPatch::apply(const std::string &sFileToPatch, SXDeltaCtrl::SSourceInfo *pFromSource = NULL; // SXDeltaCtrl::SSourceInfo *pDataSource = NULL; - if (_Ctrl.SourceInfo.size() > 0) + if (!_Ctrl.SourceInfo.empty()) { SXDeltaCtrl::SSourceInfo &rInfo = _Ctrl.SourceInfo[0]; diff --git a/code/ryzom/client/src/npc_icon.cpp b/code/ryzom/client/src/npc_icon.cpp index bdc303c60..27c83526e 100644 --- a/code/ryzom/client/src/npc_icon.cpp +++ b/code/ryzom/client/src/npc_icon.cpp @@ -484,7 +484,7 @@ NLMISC_COMMAND(dumpNPCIconCache, "Display descriptions of NPCs", "") NLMISC_COMMAND(queryMissionGiverData, "Query mission giver data for the specified alias", "") { - if (args.size() == 0) + if (args.empty()) return false; uint32 alias; NLMISC::fromString(args[0], alias); diff --git a/code/ryzom/client/src/r2/tool_pick.cpp b/code/ryzom/client/src/r2/tool_pick.cpp index 835fcd8ea..972da9a3c 100644 --- a/code/ryzom/client/src/r2/tool_pick.cpp +++ b/code/ryzom/client/src/r2/tool_pick.cpp @@ -48,7 +48,7 @@ void CToolPick::setIgnoreInstances(const std::string & ignoreInstances) { //H_AUTO(R2_CToolPick_setIgnoreInstances) string allKind = ignoreInstances; - while (allKind.size() > 0) + while (!allKind.empty()) { std::string::size_type e = allKind.find(','); string tmp; diff --git a/code/ryzom/client/src/sheet_manager.cpp b/code/ryzom/client/src/sheet_manager.cpp index 3c902ed74..38a185d15 100644 --- a/code/ryzom/client/src/sheet_manager.cpp +++ b/code/ryzom/client/src/sheet_manager.cpp @@ -785,7 +785,7 @@ void CSheetManager::computeVS() if(it == ProcessedItem.end()) { uint itemNumber; - if(vs[visualSlot].Element.size() == 0) + if(vs[visualSlot].Element.empty()) itemNumber = 1; else itemNumber = vs[visualSlot].Element[vs[visualSlot].Element.size()-1].Index+1; diff --git a/code/ryzom/client/src/string_manager_client.cpp b/code/ryzom/client/src/string_manager_client.cpp index da2fef260..b4edce7e1 100644 --- a/code/ryzom/client/src/string_manager_client.cpp +++ b/code/ryzom/client/src/string_manager_client.cpp @@ -1612,7 +1612,7 @@ const ucchar *CStringManagerClient::getTitleLocalizedName(const ucstring &titleI { vector listInfos = getTitleInfos(titleId, women); - if (listInfos.size() > 0) + if (!listInfos.empty()) { _TitleWords.push_back(listInfos[0]); return _TitleWords.back().c_str(); @@ -1629,7 +1629,7 @@ vector CStringManagerClient::getTitleInfos(const ucstring &titleId, bo vector listInfos; splitUCString(titleId, ucstring("#"), listInfos); - if (listInfos.size() > 0) + if (!listInfos.empty()) { if (titleId[0] != '#') { diff --git a/code/ryzom/common/src/game_share/server_edition_module.cpp b/code/ryzom/common/src/game_share/server_edition_module.cpp index 8670716b0..b3e4c6b53 100644 --- a/code/ryzom/common/src/game_share/server_edition_module.cpp +++ b/code/ryzom/common/src/game_share/server_edition_module.cpp @@ -728,12 +728,12 @@ void CEditionSession::swap(CEditionSession& other) void CEditionSession::update(uint32 currentTime) { - if (getCurrentChars().size() == 0 && DateSinceNoPlayer == 0 ) + if (getCurrentChars().empty() && DateSinceNoPlayer == 0 ) { DateSinceNoPlayer = currentTime; } - if (getCurrentChars().size() != 0 && DateSinceNoPlayer != 0 ) + if (!getCurrentChars().empty() && DateSinceNoPlayer != 0 ) { DateSinceNoPlayer = 0; } @@ -1096,7 +1096,7 @@ public: } else { - if (tokens.size() == 0) + if (tokens.empty()) { } diff --git a/code/ryzom/common/src/game_share/simlag.cpp b/code/ryzom/common/src/game_share/simlag.cpp index ee637c95e..0468caa2b 100644 --- a/code/ryzom/common/src/game_share/simlag.cpp +++ b/code/ryzom/common/src/game_share/simlag.cpp @@ -159,7 +159,7 @@ void sendUDP (CUdpSock *client, const uint8 *packet, uint32 packetSize, const CI CBufferizedPacket *bp = new CBufferizedPacket (client, packet, packetSize, lag, addr); // duplicate the packet - if ((float)rand()/(float)(RAND_MAX)*100.0f < PacketDisordering && BufferizedPackets.size() > 0) + if ((float)rand()/(float)(RAND_MAX)*100.0f < PacketDisordering && !BufferizedPackets.empty()) { CBufferizedPacket *bp2 = BufferizedPackets.back(); diff --git a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp index f76ba4771..889dec9cb 100644 --- a/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp +++ b/code/ryzom/tools/client/ryzom_installer/src/configfile.cpp @@ -370,7 +370,7 @@ void CConfigFile::setDefaultProfileIndex(int index) bool CConfigFile::isRyzomInstallerConfigured() const { - return m_profiles.size() > 0; + return !m_profiles.isEmpty(); } QString CConfigFile::getInstallationDirectory() const diff --git a/code/ryzom/tools/leveldesign/export/export.cpp b/code/ryzom/tools/leveldesign/export/export.cpp index 0beddfcdb..f4085cf94 100644 --- a/code/ryzom/tools/leveldesign/export/export.cpp +++ b/code/ryzom/tools/leveldesign/export/export.cpp @@ -110,7 +110,7 @@ void CExport::delAllIGZoneUnderPoint (float fCellSize, CPrimPoint *pPoint, const void CExport::delAllIGZoneUnderPath (float fCellSize, CPrimPath *pPath, const string &sIGOutputDir) { if (pPath == NULL) return; - if (pPath->VPoints.size() == 0) return; + if (pPath->VPoints.empty()) return; uint32 i, j; CVector vMin, vMax; @@ -195,7 +195,7 @@ void CExport::delAllIGZoneUnderPath (float fCellSize, CPrimPath *pPath, const st void CExport::delAllIGZoneUnderPatat (float fCellSize, CPrimZone *pPatat, const string &sIGOutputDir) { if (pPatat == NULL) return; - if (pPatat->VPoints.size() == 0) return; + if (pPatat->VPoints.empty()) return; uint32 i, j; CVector vMin, vMax; @@ -294,7 +294,7 @@ bool CExport::isPatatNeedUpdate (float fCellSize, CPrimZone *pPatat, const strin CVector vMin, vMax; CTools::chdir (sIGOutputDir); - if (pPatat->VPoints.size() == 0) + if (pPatat->VPoints.empty()) return false; vMin = vMax = pPatat->VPoints[0]; for (i = 0; i < pPatat->VPoints.size(); ++i) @@ -394,7 +394,7 @@ bool CExport::isPathNeedUpdate (float fCellSize, CPrimPath *pPath, const string CVector vMin, vMax; CTools::chdir (sIGOutputDir); - if (pPath->VPoints.size() == 0) + if (pPath->VPoints.empty()) return false; vMin = vMax = pPath->VPoints[0]; for (i = 0; i < pPath->VPoints.size(); ++i) @@ -1245,7 +1245,7 @@ bool CExport::doExport (SExportOptions &opt, IExportCB *expCB, vectorsize() == 0)) + if ((selection != NULL) && (selection->empty())) { if (_ExportCB) _ExportCB->dispInfo ("Nothing to export"); @@ -1983,7 +1983,7 @@ void CExport::writeFloraIG (const string &LandFile, bool bTestForWriting) { sint32 i, j, k; - if (_FloraInsts.size() == 0) + if (_FloraInsts.empty()) return; CZoneRegion zoneRegion; diff --git a/code/ryzom/tools/leveldesign/mission_compiler_lib/mission_compiler.cpp b/code/ryzom/tools/leveldesign/mission_compiler_lib/mission_compiler.cpp index bc5cb6ad8..28d895f54 100644 --- a/code/ryzom/tools/leveldesign/mission_compiler_lib/mission_compiler.cpp +++ b/code/ryzom/tools/leveldesign/mission_compiler_lib/mission_compiler.cpp @@ -1358,7 +1358,7 @@ retry: vector parts; NLMISC::explode(*first, string("@"), parts, false); - if (parts.size() > 0) + if (!parts.empty()) name = parts[0]; if (parts.size() > 1) param = parts[1]; diff --git a/code/ryzom/tools/leveldesign/mission_compiler_lib/step_content.cpp b/code/ryzom/tools/leveldesign/mission_compiler_lib/step_content.cpp index 4751fbe4c..5ec77ceb9 100644 --- a/code/ryzom/tools/leveldesign/mission_compiler_lib/step_content.cpp +++ b/code/ryzom/tools/leveldesign/mission_compiler_lib/step_content.cpp @@ -3446,7 +3446,7 @@ public: { // crash : ai_instance_1 : ai_instance_2 : ... ret += "crash"; - nlassert(_AIInstances.size() > 0); + nlassert(!_AIInstances.empty()); for (i = 0; i < _AIInstances.size(); ++i) ret += " : " + _AIInstances[i]; ret += NL; @@ -3548,14 +3548,14 @@ public: uint32 i; string ret; - if (_GroupsToSpawn.size() > 0) + if (!_GroupsToSpawn.empty()) { for (i = 0; i < _GroupsToSpawn.size(); ++i) ret += "handle_release : " + _GroupsToSpawn[i] + NL; ret += NL; } - if (_AIInstances.size() > 0) + if (!_AIInstances.empty()) { ret += "crash"; for (i = 0; i < _AIInstances.size(); ++i) diff --git a/code/ryzom/tools/leveldesign/mission_compiler_lib/steps.cpp b/code/ryzom/tools/leveldesign/mission_compiler_lib/steps.cpp index 7ada1d1a8..f989fbd8a 100644 --- a/code/ryzom/tools/leveldesign/mission_compiler_lib/steps.cpp +++ b/code/ryzom/tools/leveldesign/mission_compiler_lib/steps.cpp @@ -553,7 +553,7 @@ public: // parse ai instance list vector vs = md.getPropertyArray(prim, "ai_instances", true, false); -/* if (vs.size() == 0) +/* if (vs..empty()) { string err = toString("crash block need at least one ai instance !"); throw EParseException(prim, err.c_str()); diff --git a/code/ryzom/tools/leveldesign/world_editor/land_export_lib/export.cpp b/code/ryzom/tools/leveldesign/world_editor/land_export_lib/export.cpp index 7b47bb88b..5ca22a303 100644 --- a/code/ryzom/tools/leveldesign/world_editor/land_export_lib/export.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/land_export_lib/export.cpp @@ -1234,7 +1234,7 @@ void CExport::transformZone (CZone &zeZone, sint32 nPosX, sint32 nPosY, uint8 nR zeZone.retrieve (PatchInfos, BorderVertices); - nlassert (BorderVertices.size() == 0); + nlassert (BorderVertices.empty()); CMatrix Transfo; Transfo.setRot (CQuat(CVector::K, (float)(nRot * Pi / 2.0f))); @@ -1445,7 +1445,7 @@ void CExport::transformZone (CZone &zeZone, sint32 nPosX, sint32 nPosY, uint8 nR zeZone.retrieve (PatchInfos, BorderVertices); - nlassert (BorderVertices.size() == 0); + nlassert (BorderVertices.empty()); CMatrix Transfo; Transfo.setRot (CQuat(CVector::K, (float)(nRot * Pi / 2.0f))); diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor/builder_zone.cpp b/code/ryzom/tools/leveldesign/world_editor/world_editor/builder_zone.cpp index 23a91a2cd..c380db296 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor/builder_zone.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor/builder_zone.cpp @@ -380,7 +380,7 @@ void CBuilderZone::calcMask() _MinY = _MinX = 1000000; _MaxY = _MaxX = -1000000; - if (_ZoneRegions.size() == 0) + if (_ZoneRegions.empty()) return; CWorldEditorDoc *doc = getDocument (); @@ -555,7 +555,7 @@ void CBuilderZone::updateToolsZone () _ToolsZone->getListCtrl()->addItem (pElt->getName()); } _ToolsZone->getListCtrl()->setImages (vIL); - if (_CurrentSelection.size() > 0) + if (!_CurrentSelection.empty()) { _ToolsZone->getListCtrl()->SetCurSel (0); _CurSelectedZone = 0; @@ -667,7 +667,7 @@ void CBuilderZone::newZone (bool bDisplay) void CBuilderZone::unload (uint32 pos) { uint32 i = 0; - if (_ZoneRegions.size() == 0) + if (_ZoneRegions.empty()) return; delete _ZoneRegions[pos]; @@ -684,7 +684,7 @@ void CBuilderZone::unload (uint32 pos) // --------------------------------------------------------------------------- void CBuilderZone::move (sint32 x, sint32 y) { - if (_ZoneRegions.size() == 0) + if (_ZoneRegions.empty()) return; _ZoneRegions[_ZoneRegionSelected]->move(x, y); } @@ -692,7 +692,7 @@ void CBuilderZone::move (sint32 x, sint32 y) // --------------------------------------------------------------------------- uint32 CBuilderZone::countZones () { - if (_ZoneRegions.size() == 0) + if (_ZoneRegions.empty()) return 0; return _ZoneRegions[_ZoneRegionSelected]->countZones (); } @@ -714,7 +714,7 @@ void CBuilderZone::snapshot (const std::string &fileName, uint sizeSource, bool // --------------------------------------------------------------------------- void CBuilderZone::snapshotCustom (const std::string &fileName, uint width, uint height, bool keepRatio, uint sizeSource, bool grayscale) { - if (_ZoneRegions.size() == 0) + if (_ZoneRegions.empty()) return; // Some bitmaps @@ -1434,12 +1434,12 @@ void CBuilderZone::add (const CVector &worldPos) sint32 y = (sint32)floor (worldPos.y / _Display->_CellSize); uint8 rot, flip; - if (_ZoneRegions.size() == 0) + if (_ZoneRegions.empty()) return; if (_RandomSelection) { - if (_CurrentSelection.size() > 0) + if (!_CurrentSelection.empty()) { uint32 nSel = (uint32)(NLMISC::frand (1.0) * _CurrentSelection.size()); NLMISC::clamp (nSel, (uint32)0, (uint32)(_CurrentSelection.size()-1)); @@ -1515,7 +1515,7 @@ void CBuilderZone::addTransition (const NLMISC::CVector &worldPos) sint32 y = (sint32)floor (worldPos.y / _Display->_CellSize); sint32 k; - if (_ZoneRegions.size() == 0) + if (_ZoneRegions.empty()) return; // Detect if we are in a transition square to switch @@ -1586,7 +1586,7 @@ void CBuilderZone::del (const CVector &worldPos) sint32 x = (sint32)floor (worldPos.x / _Display->_CellSize); sint32 y = (sint32)floor (worldPos.y / _Display->_CellSize); - if (_ZoneRegions.size() == 0) + if (_ZoneRegions.empty()) return; CBuilderZoneRegion *pBZR = _ZoneRegions[_ZoneRegionSelected]; @@ -1693,7 +1693,7 @@ uint8 CBuilderZone::getFlip (sint32 x, sint32 y) // --------------------------------------------------------------------------- CBuilderZoneRegion* CBuilderZone::getPtrCurZoneRegion () { - if (_ZoneRegions.size() == 0) + if (_ZoneRegions.empty()) return NULL; return _ZoneRegions[_ZoneRegionSelected]; } diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor/builder_zone_region.cpp b/code/ryzom/tools/leveldesign/world_editor/world_editor/builder_zone_region.cpp index 415e00f70..cbf3f7925 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor/builder_zone_region.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor/builder_zone_region.cpp @@ -1178,7 +1178,7 @@ void CBuilderZoneRegion::putTransitions (sint32 inX, sint32 inY, const SPiece &r _ZeBank->addAndSwitch ("size", "1x1"); vector vElts; _ZeBank->getSelection (vElts); - if (vElts.size() == 0) + if (vElts.empty()) return; sint32 nRan = (sint32)(NLMISC::frand((float)vElts.size())); NLMISC::clamp (nRan, (sint32)0, (sint32)(vElts.size()-1)); @@ -1446,7 +1446,7 @@ void CBuilderZoneRegion::updateTrans (sint32 x, sint32 y, CZoneBankElement *pElt _ZeBank->addAndSwitch ("size", "1x1"); vector vElts; _ZeBank->getSelection (vElts); - if (vElts.size() == 0) + if (vElts.empty()) return; sint32 nRan = (sint32)(NLMISC::frand((float)vElts.size())); NLMISC::clamp (nRan, (sint32)0, (sint32)(vElts.size()-1)); @@ -1478,7 +1478,7 @@ void CBuilderZoneRegion::updateTrans (sint32 x, sint32 y, CZoneBankElement *pElt _ZeBank->addOrSwitch ("transname", sMatA + "-" + sMatB); vector selection; _ZeBank->getSelection (selection); - if (selection.size() == 0) + if (selection.empty()) { string sTmp = sMatA; sMatA = sMatB; @@ -1488,7 +1488,7 @@ void CBuilderZoneRegion::updateTrans (sint32 x, sint32 y, CZoneBankElement *pElt _ZeBank->getSelection (selection); } - if (selection.size() == 0) + if (selection.empty()) return; // Convert the sharingCutEdges and SharingNames to the num and type of transition @@ -1569,7 +1569,7 @@ void CBuilderZoneRegion::updateTrans (sint32 x, sint32 y, CZoneBankElement *pElt _ZeBank->addAndSwitch ("transnum", NLMISC::toString(Trans.Num)); _ZeBank->getSelection (selection); - if (selection.size() > 0) + if (!selection.empty()) { if (pElt != NULL) { @@ -1650,7 +1650,7 @@ void CBuilderZoneRegion::tryPath (uint32 posA, uint32 posB, vector &vPat queue qNodes; qNodes.push (vNodes[posA]); - while (qNodes.size() > 0) + while (!qNodes.empty()) { SNode node = qNodes.front (); qNodes.pop (); diff --git a/code/ryzom/tools/leveldesign/world_editor/world_editor/main_frm.cpp b/code/ryzom/tools/leveldesign/world_editor/world_editor/main_frm.cpp index a791e54ae..c17d81198 100644 --- a/code/ryzom/tools/leveldesign/world_editor/world_editor/main_frm.cpp +++ b/code/ryzom/tools/leveldesign/world_editor/world_editor/main_frm.cpp @@ -4325,7 +4325,7 @@ void CMainFrame::OnMissionCompiler() } // write filenames to a temp file for the mission compiler - if (files.size() > 0) + if (!files.empty()) { // use system temp directory TCHAR tmpPath[MAX_PATH];