From 8dda998ea51b2dcce094a00f308b63324da33b96 Mon Sep 17 00:00:00 2001 From: kervala Date: Fri, 25 Dec 2015 20:52:18 +0100 Subject: [PATCH] Merged with develop --- code/nel/include/nel/3d/particle_system.h | 4 +- code/nel/include/nel/gui/group_html.h | 2 +- code/nel/include/nel/misc/string_common.h | 26 +++-- code/nel/include/nel/misc/variable.h | 5 - .../src/3d/driver/direct3d/driver_direct3d.h | 4 +- code/nel/src/3d/driver/opengl/driver_opengl.h | 4 +- .../driver/opengl/driver_opengl_uniform.cpp | 28 ++--- code/nel/src/3d/fxaa.cpp | 2 +- code/nel/src/3d/gpu_program_params.cpp | 2 +- code/nel/src/3d/landscapevb_allocator.cpp | 8 +- code/nel/src/3d/meshvp_per_pixel_light.cpp | 6 +- code/nel/src/3d/particle_system.cpp | 102 +++++++++--------- code/nel/src/3d/render_trav.cpp | 14 +-- code/nel/src/3d/stereo_ovr.cpp | 10 +- code/nel/src/3d/vegetable_manager.cpp | 26 ++--- code/nel/src/3d/water_shape.cpp | 16 +-- code/nel/src/gui/group_editbox_decor.cpp | 34 +++--- code/nel/src/gui/group_html.cpp | 2 +- code/nel/src/gui/group_table.cpp | 12 ++- code/nel/src/gui/interface_group.cpp | 60 +++++------ code/nel/src/ligo/primitive_class.cpp | 2 +- code/nel/src/misc/p_thread.cpp | 3 +- .../misc/crash_report/crash_report_widget.cpp | 4 +- code/ryzom/client/src/cdb_synchronised.cpp | 2 +- code/ryzom/client/src/decal.cpp | 12 +-- code/ryzom/client/src/ground_fx_manager.cpp | 4 +- .../src/interface_v3/action_handler_game.cpp | 10 +- .../client/src/r2/displayer_visual_group.cpp | 4 +- .../tools/client/client_config_qt/config.cpp | 10 +- 29 files changed, 213 insertions(+), 205 deletions(-) diff --git a/code/nel/include/nel/3d/particle_system.h b/code/nel/include/nel/3d/particle_system.h index 68f67ae6d..7255cfec9 100644 --- a/code/nel/include/nel/3d/particle_system.h +++ b/code/nel/include/nel/3d/particle_system.h @@ -992,8 +992,8 @@ public: * NB : the system should be restarted for this to work correctly * The default is true */ - void enableEmitThreshold(bool enabled = true) { _EmitThreshold = enabled; } - bool isEmitThresholdEnabled() const { return _EmitThreshold; } + void enableEmitThreshold(bool enabled = true) { _EmitThreshold = enabled; } + bool isEmitThresholdEnabled() const { return _EmitThreshold; } // activate // deactivate all emitters in the system void activateEmitters(bool active); diff --git a/code/nel/include/nel/gui/group_html.h b/code/nel/include/nel/gui/group_html.h index fb2f5b372..314e07548 100644 --- a/code/nel/include/nel/gui/group_html.h +++ b/code/nel/include/nel/gui/group_html.h @@ -574,7 +574,7 @@ namespace NLGUI } std::vector _BlockLevelElement; - inline const bool isBlockLevelElement() const + inline bool isBlockLevelElement() const { if (_BlockLevelElement.empty()) return false; diff --git a/code/nel/include/nel/misc/string_common.h b/code/nel/include/nel/misc/string_common.h index a5fb43eb1..f71759eae 100644 --- a/code/nel/include/nel/misc/string_common.h +++ b/code/nel/include/nel/misc/string_common.h @@ -244,25 +244,37 @@ inline bool fromString(const std::string &str, double &val) { bool ret = sscanf( inline bool fromString(const std::string &str, bool &val) { - if( str.length() == 1 ) + if (str.length() == 1) { - if( str[ 0 ] == '1' ) + if (str[0] == '1') + { val = true; - else - if( str[ 0 ] == '0' ) + } + else if (str[0] == '0') + { val = false; + } else + { + val = false; return false; + } } else { - if( str == "true" ) + if (str == "true") + { val = true; - else - if( str == "false" ) + } + else if (str == "false") + { val = false; + } else + { + val = false; return false; + } } return true; diff --git a/code/nel/include/nel/misc/variable.h b/code/nel/include/nel/misc/variable.h index fa4ccd19c..439165127 100644 --- a/code/nel/include/nel/misc/variable.h +++ b/code/nel/include/nel/misc/variable.h @@ -242,8 +242,6 @@ public: { T v; bool ret = NLMISC::fromString(val, v); -// std::stringstream ss (val); -// ss >> v; set (v); return ret; } @@ -251,9 +249,6 @@ public: virtual std::string toString (bool /* human */) const { return NLMISC::toString(_Value); -// std::stringstream ss; -// ss << _Value; -// return ss.str(); } CVariable &operator= (const T &val) diff --git a/code/nel/src/3d/driver/direct3d/driver_direct3d.h b/code/nel/src/3d/driver/direct3d/driver_direct3d.h index 4dd215c9b..c497230aa 100644 --- a/code/nel/src/3d/driver/direct3d/driver_direct3d.h +++ b/code/nel/src/3d/driver/direct3d/driver_direct3d.h @@ -313,7 +313,7 @@ public: { std::map::const_iterator it = ParamIndices.find(name); if (it != ParamIndices.end()) return it->second; - return ~0; + return std::numeric_limits::max(); }; std::map ParamIndices; @@ -335,7 +335,7 @@ public: { std::map::const_iterator it = ParamIndices.find(name); if (it != ParamIndices.end()) return it->second; - return ~0; + return std::numeric_limits::max(); }; std::map ParamIndices; diff --git a/code/nel/src/3d/driver/opengl/driver_opengl.h b/code/nel/src/3d/driver/opengl/driver_opengl.h index cb4b00b46..68e6b0edf 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl.h +++ b/code/nel/src/3d/driver/opengl/driver_opengl.h @@ -1671,7 +1671,7 @@ public: { std::map::const_iterator it = ParamIndices.find(name); if (it != ParamIndices.end()) return it->second; - return ~0; + return std::numeric_limits::max(); }; std::map ParamIndices; @@ -1691,7 +1691,7 @@ public: { std::map::const_iterator it = ParamIndices.find(name); if (it != ParamIndices.end()) return it->second; - return ~0; + return std::numeric_limits::max(); }; std::map ParamIndices; diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_uniform.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_uniform.cpp index bb9acbecd..f981ae3ba 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_uniform.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_uniform.cpp @@ -332,58 +332,58 @@ bool CDriverGL::setUniformDriver(TProgram program) { if (features.DriverFlags & CProgramFeatures::Matrices) { - if (prog->getUniformIndex(CProgramIndex::ModelView) != ~0) + if (prog->getUniformIndex(CProgramIndex::ModelView) != std::numeric_limits::max()) { setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ModelView), ModelView, Identity); } - if (prog->getUniformIndex(CProgramIndex::ModelViewInverse) != ~0) + if (prog->getUniformIndex(CProgramIndex::ModelViewInverse) != std::numeric_limits::max()) { setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ModelViewInverse), ModelView, Inverse); } - if (prog->getUniformIndex(CProgramIndex::ModelViewTranspose) != ~0) + if (prog->getUniformIndex(CProgramIndex::ModelViewTranspose) != std::numeric_limits::max()) { setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ModelViewTranspose), ModelView, Transpose); } - if (prog->getUniformIndex(CProgramIndex::ModelViewInverseTranspose) != ~0) + if (prog->getUniformIndex(CProgramIndex::ModelViewInverseTranspose) != std::numeric_limits::max()) { setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ModelViewInverseTranspose), ModelView, InverseTranspose); } - if (prog->getUniformIndex(CProgramIndex::Projection) != ~0) + if (prog->getUniformIndex(CProgramIndex::Projection) != std::numeric_limits::max()) { setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::Projection), Projection, Identity); } - if (prog->getUniformIndex(CProgramIndex::ProjectionInverse) != ~0) + if (prog->getUniformIndex(CProgramIndex::ProjectionInverse) != std::numeric_limits::max()) { setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ProjectionInverse), Projection, Inverse); } - if (prog->getUniformIndex(CProgramIndex::ProjectionTranspose) != ~0) + if (prog->getUniformIndex(CProgramIndex::ProjectionTranspose) != std::numeric_limits::max()) { setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ProjectionTranspose), Projection, Transpose); } - if (prog->getUniformIndex(CProgramIndex::ProjectionInverseTranspose) != ~0) + if (prog->getUniformIndex(CProgramIndex::ProjectionInverseTranspose) != std::numeric_limits::max()) { setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ProjectionInverseTranspose), Projection, InverseTranspose); } - if (prog->getUniformIndex(CProgramIndex::ModelViewProjection) != ~0) + if (prog->getUniformIndex(CProgramIndex::ModelViewProjection) != std::numeric_limits::max()) { setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ModelViewProjection), ModelViewProjection, Identity); } - if (prog->getUniformIndex(CProgramIndex::ModelViewProjectionInverse) != ~0) + if (prog->getUniformIndex(CProgramIndex::ModelViewProjectionInverse) != std::numeric_limits::max()) { setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ModelViewProjectionInverse), ModelViewProjection, Inverse); } - if (prog->getUniformIndex(CProgramIndex::ModelViewProjectionTranspose) != ~0) + if (prog->getUniformIndex(CProgramIndex::ModelViewProjectionTranspose) != std::numeric_limits::max()) { setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ModelViewProjectionTranspose), ModelViewProjection, Transpose); } - if (prog->getUniformIndex(CProgramIndex::ModelViewProjectionInverseTranspose) != ~0) + if (prog->getUniformIndex(CProgramIndex::ModelViewProjectionInverseTranspose) != std::numeric_limits::max()) { setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ModelViewProjectionInverseTranspose), ModelViewProjection, InverseTranspose); } } if (features.DriverFlags & CProgramFeatures::Fog) { - if (prog->getUniformIndex(CProgramIndex::Fog) != ~0) + if (prog->getUniformIndex(CProgramIndex::Fog) != std::numeric_limits::max()) { setUniformFog(program, prog->getUniformIndex(CProgramIndex::Fog)); } @@ -494,7 +494,7 @@ void CDriverGL::setUniformParams(TProgram program, CGPUProgramParams ¶ms) const std::string &name = params.getNameByOffset(offset); nlassert(!name.empty()); // missing both parameter name and index, code error uint index = prog->getUniformIndex(name.c_str()); - nlassert(index != ~0); // invalid parameter name + nlassert(index != std::numeric_limits::max()); // invalid parameter name params.map(index, name); } diff --git a/code/nel/src/3d/fxaa.cpp b/code/nel/src/3d/fxaa.cpp index 89d1c59cd..8f074287c 100644 --- a/code/nel/src/3d/fxaa.cpp +++ b/code/nel/src/3d/fxaa.cpp @@ -54,7 +54,7 @@ namespace { } /* anonymous namespace */ -CFXAA::CFXAA(NL3D::UDriver *driver) : m_Driver(driver), m_PP(NULL), m_VP(NULL), m_Width(~0), m_Height(~0) +CFXAA::CFXAA(NL3D::UDriver *driver) : m_Driver(driver), m_VP(NULL), m_PP(NULL), m_Width(~0), m_Height(~0) { nldebug("3D: Create FXAA"); diff --git a/code/nel/src/3d/gpu_program_params.cpp b/code/nel/src/3d/gpu_program_params.cpp index e196154f8..144c9a22d 100644 --- a/code/nel/src/3d/gpu_program_params.cpp +++ b/code/nel/src/3d/gpu_program_params.cpp @@ -545,7 +545,7 @@ size_t CGPUProgramParams::getOffset(const std::string &name) const void CGPUProgramParams::freeOffset(size_t offset) { uint index = getIndexByOffset(offset); - if (index != ~0) + if (index != std::numeric_limits::max()) { if (m_Map.size() > index) { diff --git a/code/nel/src/3d/landscapevb_allocator.cpp b/code/nel/src/3d/landscapevb_allocator.cpp index 51714b88d..43c38ab64 100644 --- a/code/nel/src/3d/landscapevb_allocator.cpp +++ b/code/nel/src/3d/landscapevb_allocator.cpp @@ -665,13 +665,13 @@ CVertexProgramLandscape::CVertexProgramLandscape(CLandscapeVBAllocator::TType ty void CVertexProgramLandscape::buildInfo() { m_Idx.ProgramConstants0 = getUniformIndex("programConstants0"); - nlassert(m_Idx.ProgramConstants0 != ~0); + nlassert(m_Idx.ProgramConstants0 != std::numeric_limits::max()); m_Idx.RefineCenter = getUniformIndex("refineCenter"); - nlassert(m_Idx.RefineCenter != ~0); + nlassert(m_Idx.RefineCenter != std::numeric_limits::max()); m_Idx.TileDist = getUniformIndex("tileDist"); - nlassert(m_Idx.TileDist != ~0); + nlassert(m_Idx.TileDist != std::numeric_limits::max()); m_Idx.PZBModelPosition = getUniformIndex("pzbModelPosition"); - nlassert(m_Idx.PZBModelPosition != ~0); + nlassert(m_Idx.PZBModelPosition != std::numeric_limits::max()); } } // NL3D diff --git a/code/nel/src/3d/meshvp_per_pixel_light.cpp b/code/nel/src/3d/meshvp_per_pixel_light.cpp index 816c20f3b..9c5285bbd 100644 --- a/code/nel/src/3d/meshvp_per_pixel_light.cpp +++ b/code/nel/src/3d/meshvp_per_pixel_light.cpp @@ -461,17 +461,17 @@ void CVertexProgramPerPixelLight::buildInfo() } else { - m_Idx.ViewerPos = ~0; + m_Idx.ViewerPos = std::numeric_limits::max(); } } else { // TODO_VP_GLSL } - nlassert(m_Idx.StrongestLight != ~0); + nlassert(m_Idx.StrongestLight != std::numeric_limits::max()); if (m_FeaturesLighted.SupportSpecular) { - nlassert(m_Idx.ViewerPos != ~0); + nlassert(m_Idx.ViewerPos !=std::numeric_limits::max()); } } diff --git a/code/nel/src/3d/particle_system.cpp b/code/nel/src/3d/particle_system.cpp index f6060640b..34b75d427 100644 --- a/code/nel/src/3d/particle_system.cpp +++ b/code/nel/src/3d/particle_system.cpp @@ -101,57 +101,57 @@ const float PSDefaultMaxViewDist = 300.f; * Constructor */ CParticleSystem::CParticleSystem() : _Driver(NULL), - _FontGenerator(NULL), - _FontManager(NULL), - _UserCoordSystemInfo(NULL), - _Date(0), - _LastUpdateDate(-1), - _CurrEditedElementLocated(NULL), - _CurrEditedElementIndex(0), - _Scene(NULL), - _TimeThreshold(0.15f), - _SystemDate(0.f), - _MaxNbIntegrations(2), - _LODRatio(0.5f), - _OneMinusCurrentLODRatio(0), - _MaxViewDist(PSDefaultMaxViewDist), - _MaxDistLODBias(0.05f), - _InvMaxViewDist(1.f / PSDefaultMaxViewDist), - _InvCurrentViewDist(1.f / PSDefaultMaxViewDist), - _AutoLODEmitRatio(0.f), - _DieCondition(none), - _DelayBeforeDieTest(-1.f), - _NumWantedTris(0), - _AnimType(AnimInCluster), - _UserParamGlobalValue(NULL), - _BypassGlobalUserParam(0), - _PresetBehaviour(UserBehaviour), - _AutoLODStartDistPercent(0.1f), - _AutoLODDegradationExponent(1), - _ColorAttenuationScheme(NULL), - _GlobalColor(NLMISC::CRGBA::White), - _GlobalColorLighted(NLMISC::CRGBA::White), - _LightingColor(NLMISC::CRGBA::White), - _UserColor(NLMISC::CRGBA::White), - _ComputeBBox(true), - _BBoxTouched(true), - _AccurateIntegration(true), - _CanSlowDown(true), - _DestroyModelWhenOutOfRange(false), - _DestroyWhenOutOfFrustum(false), - _Sharing(false), - _AutoLOD(false), - _KeepEllapsedTimeForLifeUpdate(false), - _AutoLODSkipParticles(false), - _EnableLoadBalancing(true), - _EmitThreshold(true), - _BypassIntegrationStepLimit(false), - _ForceGlobalColorLighting(false), - _AutoComputeDelayBeforeDeathTest(true), - _AutoCount(false), - _HiddenAtCurrentFrame(true), - _HiddenAtPreviousFrame(true) - + _FontGenerator(NULL), + _FontManager(NULL), + _UserCoordSystemInfo(NULL), + _Date(0), + _LastUpdateDate(-1), + _CurrEditedElementLocated(NULL), + _CurrEditedElementLocatedBindable(NULL), + _CurrEditedElementIndex(0), + _Scene(NULL), + _TimeThreshold(0.15f), + _SystemDate(0.f), + _MaxNbIntegrations(2), + _LODRatio(0.5f), + _OneMinusCurrentLODRatio(0), + _MaxViewDist(PSDefaultMaxViewDist), + _MaxDistLODBias(0.05f), + _InvMaxViewDist(1.f / PSDefaultMaxViewDist), + _InvCurrentViewDist(1.f / PSDefaultMaxViewDist), + _AutoLODEmitRatio(0.f), + _DieCondition(none), + _DelayBeforeDieTest(-1.f), + _NumWantedTris(0), + _AnimType(AnimInCluster), + _UserParamGlobalValue(NULL), + _BypassGlobalUserParam(0), + _PresetBehaviour(UserBehaviour), + _ColorAttenuationScheme(NULL), + _GlobalColor(NLMISC::CRGBA::White), + _GlobalColorLighted(NLMISC::CRGBA::White), + _LightingColor(NLMISC::CRGBA::White), + _UserColor(NLMISC::CRGBA::White), + _ComputeBBox(true), + _BBoxTouched(true), + _AccurateIntegration(true), + _CanSlowDown(true), + _DestroyModelWhenOutOfRange(false), + _DestroyWhenOutOfFrustum(false), + _Sharing(false), + _AutoLOD(false), + _KeepEllapsedTimeForLifeUpdate(false), + _AutoLODSkipParticles(false), + _EnableLoadBalancing(true), + _EmitThreshold(true), + _BypassIntegrationStepLimit(false), + _ForceGlobalColorLighting(false), + _AutoComputeDelayBeforeDeathTest(true), + _AutoCount(false), + _HiddenAtCurrentFrame(true), + _HiddenAtPreviousFrame(true), + _AutoLODStartDistPercent(0.1f), + _AutoLODDegradationExponent(1) { NL_PS_FUNC_MAIN(CParticleSystem_CParticleSystem) std::fill(_UserParam, _UserParam + MaxPSUserParam, 0.0f); diff --git a/code/nel/src/3d/render_trav.cpp b/code/nel/src/3d/render_trav.cpp index 026e80e9c..0a9aa7a5f 100644 --- a/code/nel/src/3d/render_trav.cpp +++ b/code/nel/src/3d/render_trav.cpp @@ -797,7 +797,7 @@ void CRenderTrav::beginVPLightSetup(CVertexProgramLighted *program, const CMatr for(; iidxLighted().Diffuse[i] != ~0) + if (program->idxLighted().Diffuse[i] != std::numeric_limits::max()) { Driver->setUniform4f(IDriver::VertexProgram, program->idxLighted().Diffuse[i], 0.f, 0.f, 0.f, 0.f); } @@ -813,7 +813,7 @@ void CRenderTrav::beginVPLightSetup(CVertexProgramLighted *program, const CMatr for(; iidxLighted().Specular[i] != ~0) + if (program->idxLighted().Specular[i] != std::numeric_limits::max()) { Driver->setUniform4f(IDriver::VertexProgram, program->idxLighted().Specular[i], 0.f, 0.f, 0.f, 0.f); } @@ -1215,14 +1215,14 @@ void CVertexProgramLighted::buildInfo() // etc } - nlassert(m_IdxLighted.Diffuse[0] != ~0); + nlassert(m_IdxLighted.Diffuse[0] != std::numeric_limits::max()); if (m_FeaturesLighted.SupportSpecular) { - nlassert(m_IdxLighted.Specular[0] != ~0); - nlassert(m_IdxLighted.EyePosition != ~0); + nlassert(m_IdxLighted.Specular[0] != std::numeric_limits::max()); + nlassert(m_IdxLighted.EyePosition != std::numeric_limits::max()); } - nlassert(m_IdxLighted.DirOrPos[0] != ~0); - nlassert(m_IdxLighted.DiffuseAlpha != ~0); + nlassert(m_IdxLighted.DirOrPos[0] != std::numeric_limits::max()); + nlassert(m_IdxLighted.DiffuseAlpha != std::numeric_limits::max()); } // generates the lighting part of a vertex program, nelvp profile diff --git a/code/nel/src/3d/stereo_ovr.cpp b/code/nel/src/3d/stereo_ovr.cpp index 073490dc0..f4b910bc6 100644 --- a/code/nel/src/3d/stereo_ovr.cpp +++ b/code/nel/src/3d/stereo_ovr.cpp @@ -301,15 +301,15 @@ public: CPixelProgram::buildInfo(); m_OVRIndices.LensCenter = getUniformIndex("cLensCenter"); - nlassert(m_OVRIndices.LensCenter != ~0); + nlassert(m_OVRIndices.LensCenter != std::numeric_limits::max()); m_OVRIndices.ScreenCenter = getUniformIndex("cScreenCenter"); - nlassert(m_OVRIndices.ScreenCenter != ~0); + nlassert(m_OVRIndices.ScreenCenter != std::numeric_limits::max()); m_OVRIndices.Scale = getUniformIndex("cScale"); - nlassert(m_OVRIndices.Scale != ~0); + nlassert(m_OVRIndices.Scale != std::numeric_limits::max()); m_OVRIndices.ScaleIn = getUniformIndex("cScaleIn"); - nlassert(m_OVRIndices.ScaleIn != ~0); + nlassert(m_OVRIndices.ScaleIn != std::numeric_limits::max()); m_OVRIndices.HmdWarpParam = getUniformIndex("cHmdWarpParam"); - nlassert(m_OVRIndices.HmdWarpParam != ~0); + nlassert(m_OVRIndices.HmdWarpParam != std::numeric_limits::max()); } inline const COVRIndices &ovrIndices() { return m_OVRIndices; } diff --git a/code/nel/src/3d/vegetable_manager.cpp b/code/nel/src/3d/vegetable_manager.cpp index ba44a766f..640d5e77f 100644 --- a/code/nel/src/3d/vegetable_manager.cpp +++ b/code/nel/src/3d/vegetable_manager.cpp @@ -670,33 +670,33 @@ public: virtual void buildInfo() { m_Idx.ProgramConstants0 = getUniformIndex("programConstants0"); - nlassert(m_Idx.ProgramConstants0 != ~0); + nlassert(m_Idx.ProgramConstants0 != std::numeric_limits::max()); m_Idx.DirectionalLight = getUniformIndex("directionalLight"); - nlassert(m_Idx.DirectionalLight != ~0); + nlassert(m_Idx.DirectionalLight != std::numeric_limits::max()); m_Idx.ViewCenter = getUniformIndex("viewCenter"); - nlassert(m_Idx.ViewCenter != ~0); + nlassert(m_Idx.ViewCenter != std::numeric_limits::max()); m_Idx.NegInvTransDist = getUniformIndex("negInvTransDist"); - nlassert(m_Idx.NegInvTransDist != ~0); + nlassert(m_Idx.NegInvTransDist != std::numeric_limits::max()); m_Idx.AngleAxis = getUniformIndex("angleAxis"); - nlassert(m_Idx.AngleAxis != ~0); + nlassert(m_Idx.AngleAxis != std::numeric_limits::max()); m_Idx.Wind = getUniformIndex("wind"); - nlassert(m_Idx.Wind != ~0); + nlassert(m_Idx.Wind != std::numeric_limits::max()); m_Idx.CosCoeff0 = getUniformIndex("cosCoeff0"); - nlassert(m_Idx.CosCoeff0 != ~0); + nlassert(m_Idx.CosCoeff0 != std::numeric_limits::max()); m_Idx.CosCoeff1 = getUniformIndex("cosCoeff1"); - nlassert(m_Idx.CosCoeff1 != ~0); + nlassert(m_Idx.CosCoeff1 != std::numeric_limits::max()); m_Idx.CosCoeff2 = getUniformIndex("cosCoeff2"); - nlassert(m_Idx.CosCoeff2 != ~0); + nlassert(m_Idx.CosCoeff2 != std::numeric_limits::max()); m_Idx.QuatConstants = getUniformIndex("quatConstants"); - nlassert(m_Idx.QuatConstants != ~0); + nlassert(m_Idx.QuatConstants != std::numeric_limits::max()); m_Idx.PiConstants = getUniformIndex("piConstants"); - nlassert(m_Idx.PiConstants != ~0); + nlassert(m_Idx.PiConstants != std::numeric_limits::max()); m_Idx.LUTSize = getUniformIndex("lutSize"); - nlassert(m_Idx.LUTSize != ~0); + nlassert(m_Idx.LUTSize != std::numeric_limits::max()); for (uint i = 0; i < NL3D_VEGETABLE_VP_LUT_SIZE; ++i) { m_Idx.LUT[i] = getUniformIndex(NLMISC::toString("lut[%i]", i)); - nlassert(m_Idx.LUT[i] != ~0); + nlassert(m_Idx.LUT[i] != std::numeric_limits::max()); } } const CIdx &idx() const { return m_Idx; } diff --git a/code/nel/src/3d/water_shape.cpp b/code/nel/src/3d/water_shape.cpp index 5c675b12b..f5e26b8d7 100644 --- a/code/nel/src/3d/water_shape.cpp +++ b/code/nel/src/3d/water_shape.cpp @@ -125,23 +125,23 @@ CVertexProgramWaterVPNoWave::CVertexProgramWaterVPNoWave(bool diffuse) void CVertexProgramWaterVPNoWave::buildInfo() { m_Idx.BumpMap0Scale = getUniformIndex("bumpMap0Scale"); - nlassert(m_Idx.BumpMap0Scale != ~0); + nlassert(m_Idx.BumpMap0Scale != std::numeric_limits::max()); m_Idx.BumpMap0Offset = getUniformIndex("bumpMap0Offset"); - nlassert(m_Idx.BumpMap0Offset != ~0); + nlassert(m_Idx.BumpMap0Offset != std::numeric_limits::max()); m_Idx.BumpMap1Scale = getUniformIndex("bumpMap1Scale"); - nlassert(m_Idx.BumpMap1Scale != ~0); + nlassert(m_Idx.BumpMap1Scale != std::numeric_limits::max()); m_Idx.BumpMap1Offset = getUniformIndex("bumpMap1Offset"); - nlassert(m_Idx.BumpMap1Offset != ~0); + nlassert(m_Idx.BumpMap1Offset != std::numeric_limits::max()); m_Idx.ObserverHeight = getUniformIndex("observerHeight"); - nlassert(m_Idx.ObserverHeight != ~0); + nlassert(m_Idx.ObserverHeight != std::numeric_limits::max()); m_Idx.ScaleReflectedRay = getUniformIndex("scaleReflectedRay"); - nlassert(m_Idx.ScaleReflectedRay != ~0); + nlassert(m_Idx.ScaleReflectedRay != std::numeric_limits::max()); if (m_Diffuse) { m_Idx.DiffuseMapVector0 = getUniformIndex("diffuseMapVector0"); - nlassert(m_Idx.DiffuseMapVector0 != ~0); + nlassert(m_Idx.DiffuseMapVector0 != std::numeric_limits::max()); m_Idx.DiffuseMapVector1 = getUniformIndex("diffuseMapVector1"); - nlassert(m_Idx.DiffuseMapVector1 != ~0); + nlassert(m_Idx.DiffuseMapVector1 != std::numeric_limits::max()); } } diff --git a/code/nel/src/gui/group_editbox_decor.cpp b/code/nel/src/gui/group_editbox_decor.cpp index ae31513de..07e07ddf3 100644 --- a/code/nel/src/gui/group_editbox_decor.cpp +++ b/code/nel/src/gui/group_editbox_decor.cpp @@ -41,39 +41,39 @@ namespace NLGUI EBDPrivate() { - for( int i = 0; i < TCOUNT; i++ ) + for(sint i = 0; i < TCOUNT; ++i) { - _Textures.push_back( new CViewBitmap( CViewBase::TCtorParam() ) ); + _Textures.push_back(new CViewBitmap( CViewBase::TCtorParam())); } } ~EBDPrivate() { - for( int i = 0; i < _Textures.size(); i++ ) - delete _Textures[ i ]; + for(uint i = 0; i < _Textures.size(); ++i) + delete _Textures[i]; _Textures.clear(); } void draw() { - for( int i = 0; i < _Textures.size(); i++ ) + for(uint i = 0; i < _Textures.size(); ++i) { - CViewBitmap *bm = _Textures[ i ]; + CViewBitmap *bm = _Textures[i]; bm->draw(); } } void updateCoords() { - for( int i = 0; i < _Textures.size(); i++ ) + for(uint i = 0; i < _Textures.size(); ++i) { - CViewBitmap *bm = _Textures[ i ]; + CViewBitmap *bm = _Textures[i]; bm->fitTexture(); } // W and H parameters depend on the sizes of the other textures // Negative sizes mean that the sizes are that much smaller than the parent - sint32 w,h; + sint32 w, h; h = _Textures[ TL ]->getHReal() + _Textures[ BL ]->getHReal(); h *= -1; _Textures[ L ]->setH( h ); @@ -97,22 +97,22 @@ namespace NLGUI _Textures[ BG ]->setW( w ); _Textures[ BG ]->setH( h ); - for( int i = 0; i < _Textures.size(); i++ ) + for(uint i = 0; i < _Textures.size(); ++i) { - CViewBitmap *bm = _Textures[ i ]; + CViewBitmap *bm = _Textures[i]; bm->updateCoords(); } } void setup( CInterfaceGroup *parent ) { - for( int i = 0; i < _Textures.size(); i++ ) + for(uint i = 0; i < _Textures.size(); ++i) { - CViewBitmap *bm = _Textures[ i ]; - bm->setParent( parent ); - bm->setParentPos( parent ); - bm->setParentSize( parent ); - bm->setEditorSelectable( false ); + CViewBitmap *bm = _Textures[i]; + bm->setParent(parent); + bm->setParentPos(parent); + bm->setParentSize(parent); + bm->setEditorSelectable(false); } _Textures[ TL ]->setPosRef( Hotspot_TL ); diff --git a/code/nel/src/gui/group_html.cpp b/code/nel/src/gui/group_html.cpp index d432efb01..7e56ce506 100644 --- a/code/nel/src/gui/group_html.cpp +++ b/code/nel/src/gui/group_html.cpp @@ -5370,7 +5370,7 @@ namespace NLGUI { const uint bolder[] = {400, 400, 400, 700, 700, 900, 900, 900, 900}; uint index = getFontWeight() / 100 + 1; - clamp(index, 1, 9); + clamp(index, 1u, 9u); weight = bolder[index-1]; } else diff --git a/code/nel/src/gui/group_table.cpp b/code/nel/src/gui/group_table.cpp index 2ce6a70fc..c762fb15d 100644 --- a/code/nel/src/gui/group_table.cpp +++ b/code/nel/src/gui/group_table.cpp @@ -715,7 +715,7 @@ namespace NLGUI // *** Get the column sizes, we need to know min for the table uint i; - uint column = 0; + sint column = 0; _Columns.clear (); for (i=0; i<_Cells.size(); i++) { @@ -800,14 +800,16 @@ namespace NLGUI if (_Columns[column].WidthWanted > _Columns[column].Width) _Columns[column].Width = _Columns[column].WidthWanted; - if (cell->ColSpan > 1) { + if (cell->ColSpan > 1) + { // copy this info to all spanned columns, create new columns as needed uint newsize = column + cell->ColSpan - 1; if (newsize >= _Columns.size()) _Columns.resize(newsize+1); - for(uint span = 0; span < cell->ColSpan -1; span++){ - column++; + for(sint span = 0; span < cell->ColSpan -1; ++span) + { + ++column; _Columns[column].Width = std::max(_Columns[column].Width, _Columns[column-1].Width); _Columns[column].WidthMax = std::max(_Columns[column].WidthMax, _Columns[column-1].WidthMax); _Columns[column].TableRatio = std::max(_Columns[column].TableRatio, _Columns[column-1].TableRatio); @@ -1033,7 +1035,7 @@ namespace NLGUI if (cell->TableColumnIndex > 0) { // we have active rowspan, must add up 'skipped' columns - for( ; columnTableColumnIndex; column++) + for( ; columnTableColumnIndex; ++column) currentX += _Columns[column].Width + padding*2 + CellSpacing; } diff --git a/code/nel/src/gui/interface_group.cpp b/code/nel/src/gui/interface_group.cpp index 6318bf61a..5f4366981 100644 --- a/code/nel/src/gui/interface_group.cpp +++ b/code/nel/src/gui/interface_group.cpp @@ -2546,13 +2546,13 @@ namespace NLGUI (*itr)->onWidgetDeleted( e ); } - void CInterfaceGroup::moveBy( sint32 x, sint32 y ) + void CInterfaceGroup::moveBy(sint32 x, sint32 y) { - CInterfaceElement::moveBy( x, y ); + CInterfaceElement::moveBy(x, y); - for( int i = 0; i < _EltOrder.size(); i++ ) + for(uint i = 0; i < _EltOrder.size(); ++i) { - CViewBase *v = _EltOrder[ i ]; + CViewBase *v = _EltOrder[i]; v->updateCoords(); } } @@ -2566,26 +2566,26 @@ namespace NLGUI std::string oldId; // Reparent children - for( sint32 i = 0; i < _EltOrder.size(); i++ ) + for(uint i = 0; i < _EltOrder.size(); ++i) { - CInterfaceElement *e = _EltOrder[ i ]; + CInterfaceElement *e = _EltOrder[i]; oldId = e->getId(); - e->setW( e->getWReal() ); - e->setH( e->getHReal() ); - e->setSizeRef( "" ); + e->setW(e->getWReal()); + e->setH(e->getHReal()); + e->setSizeRef(""); - e->setParent( p ); + e->setParent(p); - e->setParentPos( p ); - e->setParentSize( p ); - e->alignTo( p ); + e->setParentPos(p); + e->setParentSize(p); + e->alignTo(p); - p->addElement( e ); - e->setIdRecurse( e->getShortId() ); + p->addElement(e); + e->setIdRecurse(e->getShortId()); - CWidgetManager::getInstance()->onWidgetMoved( oldId, e->getId() ); + CWidgetManager::getInstance()->onWidgetMoved(oldId, e->getId()); } _EltOrder.clear(); @@ -2603,29 +2603,29 @@ namespace NLGUI sint32 maxx = std::numeric_limits< sint32 >::min(); sint32 maxy = std::numeric_limits< sint32 >::min(); - sint32 tlx,tly,brx,bry; + sint32 tlx, tly, brx, bry; // Find the min and max coordinates of the elements - for( int i = 0; i < _EltOrder.size(); i++ ) + for(uint i = 0; i < _EltOrder.size(); ++i) { - CViewBase *v = _EltOrder[ i ]; + CViewBase *v = _EltOrder[i]; - v->getHSCoords( Hotspot_TL, tlx, tly ); - v->getHSCoords( Hotspot_BR, brx, bry ); + v->getHSCoords(Hotspot_TL, tlx, tly); + v->getHSCoords(Hotspot_BR, brx, bry); - if( tlx < minx ) + if (tlx < minx) minx = tlx; - if( brx > maxx ) + if (brx > maxx) maxx = brx; - if( bry < miny ) + if (bry < miny) miny = bry; - if( tly > maxy ) + if (tly > maxy) maxy = tly; } // Set the position and the width and height based on these coords - setW( maxx - minx ); - setH( maxy - miny ); + setW(maxx - minx); + setH(maxy - miny); _WReal = getW(); _HReal = getH(); _XReal = minx; @@ -2634,10 +2634,10 @@ namespace NLGUI void CInterfaceGroup::alignElements() { - for( int i = 0; i < _EltOrder.size(); i++ ) + for(uint i = 0; i < _EltOrder.size(); ++i) { - CViewBase *v = _EltOrder[ i ]; - v->alignTo( this ); + CViewBase *v = _EltOrder[i]; + v->alignTo(this); } } diff --git a/code/nel/src/ligo/primitive_class.cpp b/code/nel/src/ligo/primitive_class.cpp index 2d7c6070d..2b32cadec 100644 --- a/code/nel/src/ligo/primitive_class.cpp +++ b/code/nel/src/ligo/primitive_class.cpp @@ -346,7 +346,7 @@ bool CPrimitiveClass::read (xmlNodePtr primitiveNode, // Lookup parameter.WidgetHeight = 100; - int temp; + int temp = 0; if (ReadInt ("WIDGET_HEIGHT", temp, paramNode)) parameter.WidgetHeight = (uint)temp; diff --git a/code/nel/src/misc/p_thread.cpp b/code/nel/src/misc/p_thread.cpp index e71f56611..778270d17 100644 --- a/code/nel/src/misc/p_thread.cpp +++ b/code/nel/src/misc/p_thread.cpp @@ -148,7 +148,7 @@ void CPThread::start() } bool detach_old_thread = false; - pthread_t old_thread_handle; + pthread_t old_thread_handle = _ThreadHandle; if (_State != ThreadStateNone) { if (_State == ThreadStateRunning) @@ -159,7 +159,6 @@ void CPThread::start() throw EThread("Starting a thread that is already started, existing thread will continue running, this should not happen"); } detach_old_thread = true; - old_thread_handle = _ThreadHandle; } if (pthread_create(&_ThreadHandle, _StackSize != 0 ? &tattr : NULL, ProxyFunc, this) != 0) diff --git a/code/nel/tools/misc/crash_report/crash_report_widget.cpp b/code/nel/tools/misc/crash_report/crash_report_widget.cpp index 218b3545c..80ad0df3d 100644 --- a/code/nel/tools/misc/crash_report/crash_report_widget.cpp +++ b/code/nel/tools/misc/crash_report/crash_report_widget.cpp @@ -56,9 +56,9 @@ CCrashReportWidget::~CCrashReportWidget() void CCrashReportWidget::setup( const std::vector< std::pair< std::string, std::string > > ¶ms ) { - for( int i = 0; i < params.size(); i++ ) + for(uint i = 0; i < params.size(); ++i) { - const std::pair< std::string, std::string > &p = params[ i ]; + const std::pair< std::string, std::string > &p = params[i]; const std::string &k = p.first; const std::string &v = p.second; diff --git a/code/ryzom/client/src/cdb_synchronised.cpp b/code/ryzom/client/src/cdb_synchronised.cpp index 2ad3022cf..c8f3c4a44 100644 --- a/code/ryzom/client/src/cdb_synchronised.cpp +++ b/code/ryzom/client/src/cdb_synchronised.cpp @@ -57,7 +57,7 @@ uint32 NbDatabaseChanges = 0; // CCDBSynchronised // //----------------------------------------------- -CCDBSynchronised::CCDBSynchronised() : _InitInProgress(true), _InitDeltaReceived(0), CCDBManager( "SERVER", NB_CDB_BANKS ) +CCDBSynchronised::CCDBSynchronised() : CCDBManager("SERVER", NB_CDB_BANKS), _InitInProgress(true), _InitDeltaReceived(0) { } diff --git a/code/ryzom/client/src/decal.cpp b/code/ryzom/client/src/decal.cpp index 1454d9f59..ec8063d87 100644 --- a/code/ryzom/client/src/decal.cpp +++ b/code/ryzom/client/src/decal.cpp @@ -125,17 +125,17 @@ public: virtual void buildInfo() { m_Idx.WorldToUV0 = getUniformIndex("worldToUV0"); - nlassert(m_Idx.WorldToUV0 != ~0); + nlassert(m_Idx.WorldToUV0 != std::numeric_limits::max()); m_Idx.WorldToUV1 = getUniformIndex("worldToUV1"); - nlassert(m_Idx.WorldToUV1 != ~0); + nlassert(m_Idx.WorldToUV1 != std::numeric_limits::max()); m_Idx.RefCamDist = getUniformIndex("refCamDist"); - nlassert(m_Idx.RefCamDist != ~0); + nlassert(m_Idx.RefCamDist != std::numeric_limits::max()); m_Idx.DistScaleBias = getUniformIndex("distScaleBias"); - nlassert(m_Idx.DistScaleBias != ~0); + nlassert(m_Idx.DistScaleBias != std::numeric_limits::max()); m_Idx.Diffuse = getUniformIndex("diffuse"); - nlassert(m_Idx.Diffuse != ~0); + nlassert(m_Idx.Diffuse != std::numeric_limits::max()); m_Idx.BlendScale = getUniformIndex("blendScale"); - nlassert(m_Idx.BlendScale != ~0); + nlassert(m_Idx.BlendScale != std::numeric_limits::max()); } inline const CIdx &idx() const { return m_Idx; } private: diff --git a/code/ryzom/client/src/ground_fx_manager.cpp b/code/ryzom/client/src/ground_fx_manager.cpp index c0650a38e..aaadd257b 100644 --- a/code/ryzom/client/src/ground_fx_manager.cpp +++ b/code/ryzom/client/src/ground_fx_manager.cpp @@ -881,8 +881,8 @@ NLMISC_COMMAND(gfxAdd, "gfxAdd", "<>") break; } } - int category = 0; - uint32 form; + sint category = 0; + uint32 form = 0; if (args.size() == 1) { if (fromString(args[0], category)) diff --git a/code/ryzom/client/src/interface_v3/action_handler_game.cpp b/code/ryzom/client/src/interface_v3/action_handler_game.cpp index 76b28f827..445e95097 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_game.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_game.cpp @@ -3055,17 +3055,17 @@ public: if (pCB) { - uint maxAnisotropic = Driver->getAnisotropicFilterMaximum(); + sint maxAnisotropic = (sint)Driver->getAnisotropicFilterMaximum(); pCB->resetTexts(); pCB->addText(CI18N::get("uigcFxAnisotropicFilterNone")); - uint anisotropic = 2; + sint anisotropic = 2; uint i = 1; while (anisotropic <= maxAnisotropic) { - pCB->addText(ucstring(NLMISC::toString("%ux", anisotropic))); + pCB->addText(ucstring(NLMISC::toString("%dx", anisotropic))); if (ClientCfg.AnisotropicFilter == anisotropic) nAnisotropic = i; @@ -3522,14 +3522,14 @@ class CHandlerGameConfigApply : public IActionHandler if (nAnisotropic >= 0) { - uint anisotropic = 0; + sint anisotropic = 0; // compute the real anisotropic value if (nAnisotropic > 0) { anisotropic = 2; - for(size_t i = 1; i < nAnisotropic; ++i) + for(sint i = 1; i < nAnisotropic; ++i) { anisotropic <<= 1; } diff --git a/code/ryzom/client/src/r2/displayer_visual_group.cpp b/code/ryzom/client/src/r2/displayer_visual_group.cpp index da0ac31c5..2f10f9512 100644 --- a/code/ryzom/client/src/r2/displayer_visual_group.cpp +++ b/code/ryzom/client/src/r2/displayer_visual_group.cpp @@ -54,7 +54,7 @@ namespace R2 class CCtrlPolygonSelectable : public CCtrlPolygon, public IDisplayerUIHandle { public: - CCtrlPolygonSelectable( CViewBase::TCtorParam ¶m, CInstance &instance) : Instance(instance), CCtrlPolygon( param ) {} + CCtrlPolygonSelectable( CViewBase::TCtorParam ¶m, CInstance &instance) : CCtrlPolygon(param), Instance(instance) {} // from IDisplayerUIHandle virtual CInstance &getDisplayedInstance() { return Instance; } // from IDisplayerUIHandle @@ -99,7 +99,7 @@ protected: class CCtrlQuadSelectable : public CCtrlQuad, public IDisplayerUIHandle { public: - CCtrlQuadSelectable( CViewBase::TCtorParam ¶m, CInstance &instance, uint edgeIndex) : Instance(instance), EdgeIndex(edgeIndex), CCtrlQuad( param ){} + CCtrlQuadSelectable( CViewBase::TCtorParam ¶m, CInstance &instance, uint edgeIndex) : CCtrlQuad(param), Instance(instance), EdgeIndex(edgeIndex) {} // from IDisplayerUIHandle virtual CInstance &getDisplayedInstance() { return Instance; } // from IDisplayerUIHandle diff --git a/code/ryzom/tools/client/client_config_qt/config.cpp b/code/ryzom/tools/client/client_config_qt/config.cpp index 55854862f..0d41db0cd 100644 --- a/code/ryzom/tools/client/client_config_qt/config.cpp +++ b/code/ryzom/tools/client/client_config_qt/config.cpp @@ -83,11 +83,11 @@ void CConfig::revertToDefault() NLMISC::CConfigFile::CVar *src = dcf.getVarPtr( dst->Name ); if( ( src != NULL ) && !dst->Root && - ( ( src->Type == NLMISC::CConfigFile::CVar::T_INT ) && ( dst->Type == NLMISC::CConfigFile::CVar::T_INT ) || - ( src->Type == NLMISC::CConfigFile::CVar::T_REAL ) && ( dst->Type == NLMISC::CConfigFile::CVar::T_INT ) || - ( src->Type == NLMISC::CConfigFile::CVar::T_INT ) && ( dst->Type == NLMISC::CConfigFile::CVar::T_REAL ) || - ( src->Type == NLMISC::CConfigFile::CVar::T_REAL ) && ( dst->Type == NLMISC::CConfigFile::CVar::T_REAL ) || - ( src->Type == NLMISC::CConfigFile::CVar::T_STRING ) && ( dst->Type == NLMISC::CConfigFile::CVar::T_STRING ) ) ) + ( (( src->Type == NLMISC::CConfigFile::CVar::T_INT ) && ( dst->Type == NLMISC::CConfigFile::CVar::T_INT )) || + (( src->Type == NLMISC::CConfigFile::CVar::T_REAL ) && ( dst->Type == NLMISC::CConfigFile::CVar::T_INT )) || + (( src->Type == NLMISC::CConfigFile::CVar::T_INT ) && ( dst->Type == NLMISC::CConfigFile::CVar::T_REAL )) || + (( src->Type == NLMISC::CConfigFile::CVar::T_REAL ) && ( dst->Type == NLMISC::CConfigFile::CVar::T_REAL )) || + (( src->Type == NLMISC::CConfigFile::CVar::T_STRING ) && ( dst->Type == NLMISC::CConfigFile::CVar::T_STRING )) ) ) { if( src->Type == NLMISC::CConfigFile::CVar::T_INT )