Fixed: Warnings with GCC

This commit is contained in:
kervala 2015-12-25 20:49:59 +01:00
parent 007e47120a
commit 5708a3997c
29 changed files with 213 additions and 205 deletions

View file

@ -574,7 +574,7 @@ namespace NLGUI
} }
std::vector<bool> _BlockLevelElement; std::vector<bool> _BlockLevelElement;
inline const bool isBlockLevelElement() const inline bool isBlockLevelElement() const
{ {
if (_BlockLevelElement.empty()) if (_BlockLevelElement.empty())
return false; return false;

View file

@ -244,26 +244,38 @@ inline bool fromString(const std::string &str, double &val) { bool ret = sscanf(
inline bool fromString(const std::string &str, bool &val) 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; val = true;
else }
if( str[ 0 ] == '0' ) else if (str[0] == '0')
{
val = false; val = false;
else
return false;
} }
else else
{ {
if( str == "true" )
val = true;
else
if( str == "false" )
val = false; val = false;
else
return false; return false;
} }
}
else
{
if (str == "true")
{
val = true;
}
else if (str == "false")
{
val = false;
}
else
{
val = false;
return false;
}
}
return true; return true;
} }

View file

@ -242,8 +242,6 @@ public:
{ {
T v; T v;
bool ret = NLMISC::fromString(val, v); bool ret = NLMISC::fromString(val, v);
// std::stringstream ss (val);
// ss >> v;
set (v); set (v);
return ret; return ret;
} }
@ -251,9 +249,6 @@ public:
virtual std::string toString (bool /* human */) const virtual std::string toString (bool /* human */) const
{ {
return NLMISC::toString(_Value); return NLMISC::toString(_Value);
// std::stringstream ss;
// ss << _Value;
// return ss.str();
} }
CVariable<T> &operator= (const T &val) CVariable<T> &operator= (const T &val)

View file

@ -313,7 +313,7 @@ public:
{ {
std::map<std::string, uint>::const_iterator it = ParamIndices.find(name); std::map<std::string, uint>::const_iterator it = ParamIndices.find(name);
if (it != ParamIndices.end()) return it->second; if (it != ParamIndices.end()) return it->second;
return ~0; return std::numeric_limits<uint>::max();
}; };
std::map<std::string, uint> ParamIndices; std::map<std::string, uint> ParamIndices;
@ -335,7 +335,7 @@ public:
{ {
std::map<std::string, uint>::const_iterator it = ParamIndices.find(name); std::map<std::string, uint>::const_iterator it = ParamIndices.find(name);
if (it != ParamIndices.end()) return it->second; if (it != ParamIndices.end()) return it->second;
return ~0; return std::numeric_limits<uint>::max();
}; };
std::map<std::string, uint> ParamIndices; std::map<std::string, uint> ParamIndices;

View file

@ -1671,7 +1671,7 @@ public:
{ {
std::map<std::string, uint>::const_iterator it = ParamIndices.find(name); std::map<std::string, uint>::const_iterator it = ParamIndices.find(name);
if (it != ParamIndices.end()) return it->second; if (it != ParamIndices.end()) return it->second;
return ~0; return std::numeric_limits<uint>::max();
}; };
std::map<std::string, uint> ParamIndices; std::map<std::string, uint> ParamIndices;
@ -1691,7 +1691,7 @@ public:
{ {
std::map<std::string, uint>::const_iterator it = ParamIndices.find(name); std::map<std::string, uint>::const_iterator it = ParamIndices.find(name);
if (it != ParamIndices.end()) return it->second; if (it != ParamIndices.end()) return it->second;
return ~0; return std::numeric_limits<uint>::max();
}; };
std::map<std::string, uint> ParamIndices; std::map<std::string, uint> ParamIndices;

View file

@ -332,58 +332,58 @@ bool CDriverGL::setUniformDriver(TProgram program)
{ {
if (features.DriverFlags & CProgramFeatures::Matrices) if (features.DriverFlags & CProgramFeatures::Matrices)
{ {
if (prog->getUniformIndex(CProgramIndex::ModelView) != ~0) if (prog->getUniformIndex(CProgramIndex::ModelView) != std::numeric_limits<uint>::max())
{ {
setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ModelView), ModelView, Identity); setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ModelView), ModelView, Identity);
} }
if (prog->getUniformIndex(CProgramIndex::ModelViewInverse) != ~0) if (prog->getUniformIndex(CProgramIndex::ModelViewInverse) != std::numeric_limits<uint>::max())
{ {
setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ModelViewInverse), ModelView, Inverse); setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ModelViewInverse), ModelView, Inverse);
} }
if (prog->getUniformIndex(CProgramIndex::ModelViewTranspose) != ~0) if (prog->getUniformIndex(CProgramIndex::ModelViewTranspose) != std::numeric_limits<uint>::max())
{ {
setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ModelViewTranspose), ModelView, Transpose); setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ModelViewTranspose), ModelView, Transpose);
} }
if (prog->getUniformIndex(CProgramIndex::ModelViewInverseTranspose) != ~0) if (prog->getUniformIndex(CProgramIndex::ModelViewInverseTranspose) != std::numeric_limits<uint>::max())
{ {
setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ModelViewInverseTranspose), ModelView, InverseTranspose); setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ModelViewInverseTranspose), ModelView, InverseTranspose);
} }
if (prog->getUniformIndex(CProgramIndex::Projection) != ~0) if (prog->getUniformIndex(CProgramIndex::Projection) != std::numeric_limits<uint>::max())
{ {
setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::Projection), Projection, Identity); setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::Projection), Projection, Identity);
} }
if (prog->getUniformIndex(CProgramIndex::ProjectionInverse) != ~0) if (prog->getUniformIndex(CProgramIndex::ProjectionInverse) != std::numeric_limits<uint>::max())
{ {
setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ProjectionInverse), Projection, Inverse); setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ProjectionInverse), Projection, Inverse);
} }
if (prog->getUniformIndex(CProgramIndex::ProjectionTranspose) != ~0) if (prog->getUniformIndex(CProgramIndex::ProjectionTranspose) != std::numeric_limits<uint>::max())
{ {
setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ProjectionTranspose), Projection, Transpose); setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ProjectionTranspose), Projection, Transpose);
} }
if (prog->getUniformIndex(CProgramIndex::ProjectionInverseTranspose) != ~0) if (prog->getUniformIndex(CProgramIndex::ProjectionInverseTranspose) != std::numeric_limits<uint>::max())
{ {
setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ProjectionInverseTranspose), Projection, InverseTranspose); setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ProjectionInverseTranspose), Projection, InverseTranspose);
} }
if (prog->getUniformIndex(CProgramIndex::ModelViewProjection) != ~0) if (prog->getUniformIndex(CProgramIndex::ModelViewProjection) != std::numeric_limits<uint>::max())
{ {
setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ModelViewProjection), ModelViewProjection, Identity); setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ModelViewProjection), ModelViewProjection, Identity);
} }
if (prog->getUniformIndex(CProgramIndex::ModelViewProjectionInverse) != ~0) if (prog->getUniformIndex(CProgramIndex::ModelViewProjectionInverse) != std::numeric_limits<uint>::max())
{ {
setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ModelViewProjectionInverse), ModelViewProjection, Inverse); setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ModelViewProjectionInverse), ModelViewProjection, Inverse);
} }
if (prog->getUniformIndex(CProgramIndex::ModelViewProjectionTranspose) != ~0) if (prog->getUniformIndex(CProgramIndex::ModelViewProjectionTranspose) != std::numeric_limits<uint>::max())
{ {
setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ModelViewProjectionTranspose), ModelViewProjection, Transpose); setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ModelViewProjectionTranspose), ModelViewProjection, Transpose);
} }
if (prog->getUniformIndex(CProgramIndex::ModelViewProjectionInverseTranspose) != ~0) if (prog->getUniformIndex(CProgramIndex::ModelViewProjectionInverseTranspose) != std::numeric_limits<uint>::max())
{ {
setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ModelViewProjectionInverseTranspose), ModelViewProjection, InverseTranspose); setUniformMatrix(program, prog->getUniformIndex(CProgramIndex::ModelViewProjectionInverseTranspose), ModelViewProjection, InverseTranspose);
} }
} }
if (features.DriverFlags & CProgramFeatures::Fog) if (features.DriverFlags & CProgramFeatures::Fog)
{ {
if (prog->getUniformIndex(CProgramIndex::Fog) != ~0) if (prog->getUniformIndex(CProgramIndex::Fog) != std::numeric_limits<uint>::max())
{ {
setUniformFog(program, prog->getUniformIndex(CProgramIndex::Fog)); setUniformFog(program, prog->getUniformIndex(CProgramIndex::Fog));
} }
@ -494,7 +494,7 @@ void CDriverGL::setUniformParams(TProgram program, CGPUProgramParams &params)
const std::string &name = params.getNameByOffset(offset); const std::string &name = params.getNameByOffset(offset);
nlassert(!name.empty()); // missing both parameter name and index, code error nlassert(!name.empty()); // missing both parameter name and index, code error
uint index = prog->getUniformIndex(name.c_str()); uint index = prog->getUniformIndex(name.c_str());
nlassert(index != ~0); // invalid parameter name nlassert(index != std::numeric_limits<uint>::max()); // invalid parameter name
params.map(index, name); params.map(index, name);
} }

View file

@ -54,7 +54,7 @@ namespace {
} /* anonymous 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"); nldebug("3D: Create FXAA");

View file

@ -545,7 +545,7 @@ size_t CGPUProgramParams::getOffset(const std::string &name) const
void CGPUProgramParams::freeOffset(size_t offset) void CGPUProgramParams::freeOffset(size_t offset)
{ {
uint index = getIndexByOffset(offset); uint index = getIndexByOffset(offset);
if (index != ~0) if (index != std::numeric_limits<uint>::max())
{ {
if (m_Map.size() > index) if (m_Map.size() > index)
{ {

View file

@ -665,13 +665,13 @@ CVertexProgramLandscape::CVertexProgramLandscape(CLandscapeVBAllocator::TType ty
void CVertexProgramLandscape::buildInfo() void CVertexProgramLandscape::buildInfo()
{ {
m_Idx.ProgramConstants0 = getUniformIndex("programConstants0"); m_Idx.ProgramConstants0 = getUniformIndex("programConstants0");
nlassert(m_Idx.ProgramConstants0 != ~0); nlassert(m_Idx.ProgramConstants0 != std::numeric_limits<uint>::max());
m_Idx.RefineCenter = getUniformIndex("refineCenter"); m_Idx.RefineCenter = getUniformIndex("refineCenter");
nlassert(m_Idx.RefineCenter != ~0); nlassert(m_Idx.RefineCenter != std::numeric_limits<uint>::max());
m_Idx.TileDist = getUniformIndex("tileDist"); m_Idx.TileDist = getUniformIndex("tileDist");
nlassert(m_Idx.TileDist != ~0); nlassert(m_Idx.TileDist != std::numeric_limits<uint>::max());
m_Idx.PZBModelPosition = getUniformIndex("pzbModelPosition"); m_Idx.PZBModelPosition = getUniformIndex("pzbModelPosition");
nlassert(m_Idx.PZBModelPosition != ~0); nlassert(m_Idx.PZBModelPosition != std::numeric_limits<uint>::max());
} }
} // NL3D } // NL3D

View file

@ -461,17 +461,17 @@ void CVertexProgramPerPixelLight::buildInfo()
} }
else else
{ {
m_Idx.ViewerPos = ~0; m_Idx.ViewerPos = std::numeric_limits<uint>::max();
} }
} }
else else
{ {
// TODO_VP_GLSL // TODO_VP_GLSL
} }
nlassert(m_Idx.StrongestLight != ~0); nlassert(m_Idx.StrongestLight != std::numeric_limits<uint>::max());
if (m_FeaturesLighted.SupportSpecular) if (m_FeaturesLighted.SupportSpecular)
{ {
nlassert(m_Idx.ViewerPos != ~0); nlassert(m_Idx.ViewerPos !=std::numeric_limits<uint>::max());
} }
} }

View file

@ -107,6 +107,7 @@ CParticleSystem::CParticleSystem() : _Driver(NULL),
_Date(0), _Date(0),
_LastUpdateDate(-1), _LastUpdateDate(-1),
_CurrEditedElementLocated(NULL), _CurrEditedElementLocated(NULL),
_CurrEditedElementLocatedBindable(NULL),
_CurrEditedElementIndex(0), _CurrEditedElementIndex(0),
_Scene(NULL), _Scene(NULL),
_TimeThreshold(0.15f), _TimeThreshold(0.15f),
@ -126,8 +127,6 @@ CParticleSystem::CParticleSystem() : _Driver(NULL),
_UserParamGlobalValue(NULL), _UserParamGlobalValue(NULL),
_BypassGlobalUserParam(0), _BypassGlobalUserParam(0),
_PresetBehaviour(UserBehaviour), _PresetBehaviour(UserBehaviour),
_AutoLODStartDistPercent(0.1f),
_AutoLODDegradationExponent(1),
_ColorAttenuationScheme(NULL), _ColorAttenuationScheme(NULL),
_GlobalColor(NLMISC::CRGBA::White), _GlobalColor(NLMISC::CRGBA::White),
_GlobalColorLighted(NLMISC::CRGBA::White), _GlobalColorLighted(NLMISC::CRGBA::White),
@ -150,8 +149,9 @@ CParticleSystem::CParticleSystem() : _Driver(NULL),
_AutoComputeDelayBeforeDeathTest(true), _AutoComputeDelayBeforeDeathTest(true),
_AutoCount(false), _AutoCount(false),
_HiddenAtCurrentFrame(true), _HiddenAtCurrentFrame(true),
_HiddenAtPreviousFrame(true) _HiddenAtPreviousFrame(true),
_AutoLODStartDistPercent(0.1f),
_AutoLODDegradationExponent(1)
{ {
NL_PS_FUNC_MAIN(CParticleSystem_CParticleSystem) NL_PS_FUNC_MAIN(CParticleSystem_CParticleSystem)
std::fill(_UserParam, _UserParam + MaxPSUserParam, 0.0f); std::fill(_UserParam, _UserParam + MaxPSUserParam, 0.0f);

View file

@ -797,7 +797,7 @@ void CRenderTrav::beginVPLightSetup(CVertexProgramLighted *program, const CMatr
for(; i<MaxVPLight; i++) for(; i<MaxVPLight; i++)
{ {
_VPLightDiffuse[i] = CRGBA::Black; _VPLightDiffuse[i] = CRGBA::Black;
if (program->idxLighted().Diffuse[i] != ~0) if (program->idxLighted().Diffuse[i] != std::numeric_limits<uint>::max())
{ {
Driver->setUniform4f(IDriver::VertexProgram, program->idxLighted().Diffuse[i], 0.f, 0.f, 0.f, 0.f); 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(; i<MaxVPLight; i++) for(; i<MaxVPLight; i++)
{ {
_VPLightSpecular[i]= CRGBA::Black; _VPLightSpecular[i]= CRGBA::Black;
if (program->idxLighted().Specular[i] != ~0) if (program->idxLighted().Specular[i] != std::numeric_limits<uint>::max())
{ {
Driver->setUniform4f(IDriver::VertexProgram, program->idxLighted().Specular[i], 0.f, 0.f, 0.f, 0.f); Driver->setUniform4f(IDriver::VertexProgram, program->idxLighted().Specular[i], 0.f, 0.f, 0.f, 0.f);
} }
@ -1215,14 +1215,14 @@ void CVertexProgramLighted::buildInfo()
// etc // etc
} }
nlassert(m_IdxLighted.Diffuse[0] != ~0); nlassert(m_IdxLighted.Diffuse[0] != std::numeric_limits<uint>::max());
if (m_FeaturesLighted.SupportSpecular) if (m_FeaturesLighted.SupportSpecular)
{ {
nlassert(m_IdxLighted.Specular[0] != ~0); nlassert(m_IdxLighted.Specular[0] != std::numeric_limits<uint>::max());
nlassert(m_IdxLighted.EyePosition != ~0); nlassert(m_IdxLighted.EyePosition != std::numeric_limits<uint>::max());
} }
nlassert(m_IdxLighted.DirOrPos[0] != ~0); nlassert(m_IdxLighted.DirOrPos[0] != std::numeric_limits<uint>::max());
nlassert(m_IdxLighted.DiffuseAlpha != ~0); nlassert(m_IdxLighted.DiffuseAlpha != std::numeric_limits<uint>::max());
} }
// generates the lighting part of a vertex program, nelvp profile // generates the lighting part of a vertex program, nelvp profile

View file

@ -301,15 +301,15 @@ public:
CPixelProgram::buildInfo(); CPixelProgram::buildInfo();
m_OVRIndices.LensCenter = getUniformIndex("cLensCenter"); m_OVRIndices.LensCenter = getUniformIndex("cLensCenter");
nlassert(m_OVRIndices.LensCenter != ~0); nlassert(m_OVRIndices.LensCenter != std::numeric_limits<uint>::max());
m_OVRIndices.ScreenCenter = getUniformIndex("cScreenCenter"); m_OVRIndices.ScreenCenter = getUniformIndex("cScreenCenter");
nlassert(m_OVRIndices.ScreenCenter != ~0); nlassert(m_OVRIndices.ScreenCenter != std::numeric_limits<uint>::max());
m_OVRIndices.Scale = getUniformIndex("cScale"); m_OVRIndices.Scale = getUniformIndex("cScale");
nlassert(m_OVRIndices.Scale != ~0); nlassert(m_OVRIndices.Scale != std::numeric_limits<uint>::max());
m_OVRIndices.ScaleIn = getUniformIndex("cScaleIn"); m_OVRIndices.ScaleIn = getUniformIndex("cScaleIn");
nlassert(m_OVRIndices.ScaleIn != ~0); nlassert(m_OVRIndices.ScaleIn != std::numeric_limits<uint>::max());
m_OVRIndices.HmdWarpParam = getUniformIndex("cHmdWarpParam"); m_OVRIndices.HmdWarpParam = getUniformIndex("cHmdWarpParam");
nlassert(m_OVRIndices.HmdWarpParam != ~0); nlassert(m_OVRIndices.HmdWarpParam != std::numeric_limits<uint>::max());
} }
inline const COVRIndices &ovrIndices() { return m_OVRIndices; } inline const COVRIndices &ovrIndices() { return m_OVRIndices; }

View file

@ -670,33 +670,33 @@ public:
virtual void buildInfo() virtual void buildInfo()
{ {
m_Idx.ProgramConstants0 = getUniformIndex("programConstants0"); m_Idx.ProgramConstants0 = getUniformIndex("programConstants0");
nlassert(m_Idx.ProgramConstants0 != ~0); nlassert(m_Idx.ProgramConstants0 != std::numeric_limits<uint>::max());
m_Idx.DirectionalLight = getUniformIndex("directionalLight"); m_Idx.DirectionalLight = getUniformIndex("directionalLight");
nlassert(m_Idx.DirectionalLight != ~0); nlassert(m_Idx.DirectionalLight != std::numeric_limits<uint>::max());
m_Idx.ViewCenter = getUniformIndex("viewCenter"); m_Idx.ViewCenter = getUniformIndex("viewCenter");
nlassert(m_Idx.ViewCenter != ~0); nlassert(m_Idx.ViewCenter != std::numeric_limits<uint>::max());
m_Idx.NegInvTransDist = getUniformIndex("negInvTransDist"); m_Idx.NegInvTransDist = getUniformIndex("negInvTransDist");
nlassert(m_Idx.NegInvTransDist != ~0); nlassert(m_Idx.NegInvTransDist != std::numeric_limits<uint>::max());
m_Idx.AngleAxis = getUniformIndex("angleAxis"); m_Idx.AngleAxis = getUniformIndex("angleAxis");
nlassert(m_Idx.AngleAxis != ~0); nlassert(m_Idx.AngleAxis != std::numeric_limits<uint>::max());
m_Idx.Wind = getUniformIndex("wind"); m_Idx.Wind = getUniformIndex("wind");
nlassert(m_Idx.Wind != ~0); nlassert(m_Idx.Wind != std::numeric_limits<uint>::max());
m_Idx.CosCoeff0 = getUniformIndex("cosCoeff0"); m_Idx.CosCoeff0 = getUniformIndex("cosCoeff0");
nlassert(m_Idx.CosCoeff0 != ~0); nlassert(m_Idx.CosCoeff0 != std::numeric_limits<uint>::max());
m_Idx.CosCoeff1 = getUniformIndex("cosCoeff1"); m_Idx.CosCoeff1 = getUniformIndex("cosCoeff1");
nlassert(m_Idx.CosCoeff1 != ~0); nlassert(m_Idx.CosCoeff1 != std::numeric_limits<uint>::max());
m_Idx.CosCoeff2 = getUniformIndex("cosCoeff2"); m_Idx.CosCoeff2 = getUniformIndex("cosCoeff2");
nlassert(m_Idx.CosCoeff2 != ~0); nlassert(m_Idx.CosCoeff2 != std::numeric_limits<uint>::max());
m_Idx.QuatConstants = getUniformIndex("quatConstants"); m_Idx.QuatConstants = getUniformIndex("quatConstants");
nlassert(m_Idx.QuatConstants != ~0); nlassert(m_Idx.QuatConstants != std::numeric_limits<uint>::max());
m_Idx.PiConstants = getUniformIndex("piConstants"); m_Idx.PiConstants = getUniformIndex("piConstants");
nlassert(m_Idx.PiConstants != ~0); nlassert(m_Idx.PiConstants != std::numeric_limits<uint>::max());
m_Idx.LUTSize = getUniformIndex("lutSize"); m_Idx.LUTSize = getUniformIndex("lutSize");
nlassert(m_Idx.LUTSize != ~0); nlassert(m_Idx.LUTSize != std::numeric_limits<uint>::max());
for (uint i = 0; i < NL3D_VEGETABLE_VP_LUT_SIZE; ++i) for (uint i = 0; i < NL3D_VEGETABLE_VP_LUT_SIZE; ++i)
{ {
m_Idx.LUT[i] = getUniformIndex(NLMISC::toString("lut[%i]", 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<uint>::max());
} }
} }
const CIdx &idx() const { return m_Idx; } const CIdx &idx() const { return m_Idx; }

View file

@ -125,23 +125,23 @@ CVertexProgramWaterVPNoWave::CVertexProgramWaterVPNoWave(bool diffuse)
void CVertexProgramWaterVPNoWave::buildInfo() void CVertexProgramWaterVPNoWave::buildInfo()
{ {
m_Idx.BumpMap0Scale = getUniformIndex("bumpMap0Scale"); m_Idx.BumpMap0Scale = getUniformIndex("bumpMap0Scale");
nlassert(m_Idx.BumpMap0Scale != ~0); nlassert(m_Idx.BumpMap0Scale != std::numeric_limits<uint>::max());
m_Idx.BumpMap0Offset = getUniformIndex("bumpMap0Offset"); m_Idx.BumpMap0Offset = getUniformIndex("bumpMap0Offset");
nlassert(m_Idx.BumpMap0Offset != ~0); nlassert(m_Idx.BumpMap0Offset != std::numeric_limits<uint>::max());
m_Idx.BumpMap1Scale = getUniformIndex("bumpMap1Scale"); m_Idx.BumpMap1Scale = getUniformIndex("bumpMap1Scale");
nlassert(m_Idx.BumpMap1Scale != ~0); nlassert(m_Idx.BumpMap1Scale != std::numeric_limits<uint>::max());
m_Idx.BumpMap1Offset = getUniformIndex("bumpMap1Offset"); m_Idx.BumpMap1Offset = getUniformIndex("bumpMap1Offset");
nlassert(m_Idx.BumpMap1Offset != ~0); nlassert(m_Idx.BumpMap1Offset != std::numeric_limits<uint>::max());
m_Idx.ObserverHeight = getUniformIndex("observerHeight"); m_Idx.ObserverHeight = getUniformIndex("observerHeight");
nlassert(m_Idx.ObserverHeight != ~0); nlassert(m_Idx.ObserverHeight != std::numeric_limits<uint>::max());
m_Idx.ScaleReflectedRay = getUniformIndex("scaleReflectedRay"); m_Idx.ScaleReflectedRay = getUniformIndex("scaleReflectedRay");
nlassert(m_Idx.ScaleReflectedRay != ~0); nlassert(m_Idx.ScaleReflectedRay != std::numeric_limits<uint>::max());
if (m_Diffuse) if (m_Diffuse)
{ {
m_Idx.DiffuseMapVector0 = getUniformIndex("diffuseMapVector0"); m_Idx.DiffuseMapVector0 = getUniformIndex("diffuseMapVector0");
nlassert(m_Idx.DiffuseMapVector0 != ~0); nlassert(m_Idx.DiffuseMapVector0 != std::numeric_limits<uint>::max());
m_Idx.DiffuseMapVector1 = getUniformIndex("diffuseMapVector1"); m_Idx.DiffuseMapVector1 = getUniformIndex("diffuseMapVector1");
nlassert(m_Idx.DiffuseMapVector1 != ~0); nlassert(m_Idx.DiffuseMapVector1 != std::numeric_limits<uint>::max());
} }
} }

View file

@ -41,39 +41,39 @@ namespace NLGUI
EBDPrivate() 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() ~EBDPrivate()
{ {
for( int i = 0; i < _Textures.size(); i++ ) for(uint i = 0; i < _Textures.size(); ++i)
delete _Textures[ i ]; delete _Textures[i];
_Textures.clear(); _Textures.clear();
} }
void draw() 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(); bm->draw();
} }
} }
void updateCoords() 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(); bm->fitTexture();
} }
// W and H parameters depend on the sizes of the other textures // 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 // 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 = _Textures[ TL ]->getHReal() + _Textures[ BL ]->getHReal();
h *= -1; h *= -1;
_Textures[ L ]->setH( h ); _Textures[ L ]->setH( h );
@ -97,22 +97,22 @@ namespace NLGUI
_Textures[ BG ]->setW( w ); _Textures[ BG ]->setW( w );
_Textures[ BG ]->setH( h ); _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(); bm->updateCoords();
} }
} }
void setup( CInterfaceGroup *parent ) void setup( CInterfaceGroup *parent )
{ {
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->setParent( parent ); bm->setParent(parent);
bm->setParentPos( parent ); bm->setParentPos(parent);
bm->setParentSize( parent ); bm->setParentSize(parent);
bm->setEditorSelectable( false ); bm->setEditorSelectable(false);
} }
_Textures[ TL ]->setPosRef( Hotspot_TL ); _Textures[ TL ]->setPosRef( Hotspot_TL );

View file

@ -5370,7 +5370,7 @@ namespace NLGUI
{ {
const uint bolder[] = {400, 400, 400, 700, 700, 900, 900, 900, 900}; const uint bolder[] = {400, 400, 400, 700, 700, 900, 900, 900, 900};
uint index = getFontWeight() / 100 + 1; uint index = getFontWeight() / 100 + 1;
clamp(index, 1, 9); clamp(index, 1u, 9u);
weight = bolder[index-1]; weight = bolder[index-1];
} }
else else

View file

@ -715,7 +715,7 @@ namespace NLGUI
// *** Get the column sizes, we need to know min for the table // *** Get the column sizes, we need to know min for the table
uint i; uint i;
uint column = 0; sint column = 0;
_Columns.clear (); _Columns.clear ();
for (i=0; i<_Cells.size(); i++) for (i=0; i<_Cells.size(); i++)
{ {
@ -800,14 +800,16 @@ namespace NLGUI
if (_Columns[column].WidthWanted > _Columns[column].Width) if (_Columns[column].WidthWanted > _Columns[column].Width)
_Columns[column].Width = _Columns[column].WidthWanted; _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 // copy this info to all spanned columns, create new columns as needed
uint newsize = column + cell->ColSpan - 1; uint newsize = column + cell->ColSpan - 1;
if (newsize >= _Columns.size()) if (newsize >= _Columns.size())
_Columns.resize(newsize+1); _Columns.resize(newsize+1);
for(uint span = 0; span < cell->ColSpan -1; span++){ for(sint span = 0; span < cell->ColSpan -1; ++span)
column++; {
++column;
_Columns[column].Width = std::max(_Columns[column].Width, _Columns[column-1].Width); _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].WidthMax = std::max(_Columns[column].WidthMax, _Columns[column-1].WidthMax);
_Columns[column].TableRatio = std::max(_Columns[column].TableRatio, _Columns[column-1].TableRatio); _Columns[column].TableRatio = std::max(_Columns[column].TableRatio, _Columns[column-1].TableRatio);
@ -1033,7 +1035,7 @@ namespace NLGUI
if (cell->TableColumnIndex > 0) if (cell->TableColumnIndex > 0)
{ {
// we have active rowspan, must add up 'skipped' columns // we have active rowspan, must add up 'skipped' columns
for( ; column<cell->TableColumnIndex; column++) for( ; column<cell->TableColumnIndex; ++column)
currentX += _Columns[column].Width + padding*2 + CellSpacing; currentX += _Columns[column].Width + padding*2 + CellSpacing;
} }

View file

@ -2546,13 +2546,13 @@ namespace NLGUI
(*itr)->onWidgetDeleted( e ); (*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(); v->updateCoords();
} }
} }
@ -2566,26 +2566,26 @@ namespace NLGUI
std::string oldId; std::string oldId;
// Reparent children // 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(); oldId = e->getId();
e->setW( e->getWReal() ); e->setW(e->getWReal());
e->setH( e->getHReal() ); e->setH(e->getHReal());
e->setSizeRef( "" ); e->setSizeRef("");
e->setParent( p ); e->setParent(p);
e->setParentPos( p ); e->setParentPos(p);
e->setParentSize( p ); e->setParentSize(p);
e->alignTo( p ); e->alignTo(p);
p->addElement( e ); p->addElement(e);
e->setIdRecurse( e->getShortId() ); e->setIdRecurse(e->getShortId());
CWidgetManager::getInstance()->onWidgetMoved( oldId, e->getId() ); CWidgetManager::getInstance()->onWidgetMoved(oldId, e->getId());
} }
_EltOrder.clear(); _EltOrder.clear();
@ -2603,29 +2603,29 @@ namespace NLGUI
sint32 maxx = std::numeric_limits< sint32 >::min(); sint32 maxx = std::numeric_limits< sint32 >::min();
sint32 maxy = 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 // 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_TL, tlx, tly);
v->getHSCoords( Hotspot_BR, brx, bry ); v->getHSCoords(Hotspot_BR, brx, bry);
if( tlx < minx ) if (tlx < minx)
minx = tlx; minx = tlx;
if( brx > maxx ) if (brx > maxx)
maxx = brx; maxx = brx;
if( bry < miny ) if (bry < miny)
miny = bry; miny = bry;
if( tly > maxy ) if (tly > maxy)
maxy = tly; maxy = tly;
} }
// Set the position and the width and height based on these coords // Set the position and the width and height based on these coords
setW( maxx - minx ); setW(maxx - minx);
setH( maxy - miny ); setH(maxy - miny);
_WReal = getW(); _WReal = getW();
_HReal = getH(); _HReal = getH();
_XReal = minx; _XReal = minx;
@ -2634,10 +2634,10 @@ namespace NLGUI
void CInterfaceGroup::alignElements() void CInterfaceGroup::alignElements()
{ {
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->alignTo( this ); v->alignTo(this);
} }
} }

View file

@ -346,7 +346,7 @@ bool CPrimitiveClass::read (xmlNodePtr primitiveNode,
// Lookup // Lookup
parameter.WidgetHeight = 100; parameter.WidgetHeight = 100;
int temp; int temp = 0;
if (ReadInt ("WIDGET_HEIGHT", temp, paramNode)) if (ReadInt ("WIDGET_HEIGHT", temp, paramNode))
parameter.WidgetHeight = (uint)temp; parameter.WidgetHeight = (uint)temp;

View file

@ -148,7 +148,7 @@ void CPThread::start()
} }
bool detach_old_thread = false; bool detach_old_thread = false;
pthread_t old_thread_handle; pthread_t old_thread_handle = _ThreadHandle;
if (_State != ThreadStateNone) if (_State != ThreadStateNone)
{ {
if (_State == ThreadStateRunning) 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"); throw EThread("Starting a thread that is already started, existing thread will continue running, this should not happen");
} }
detach_old_thread = true; detach_old_thread = true;
old_thread_handle = _ThreadHandle;
} }
if (pthread_create(&_ThreadHandle, _StackSize != 0 ? &tattr : NULL, ProxyFunc, this) != 0) if (pthread_create(&_ThreadHandle, _StackSize != 0 ? &tattr : NULL, ProxyFunc, this) != 0)

View file

@ -56,9 +56,9 @@ CCrashReportWidget::~CCrashReportWidget()
void CCrashReportWidget::setup( const std::vector< std::pair< std::string, std::string > > &params ) void CCrashReportWidget::setup( const std::vector< std::pair< std::string, std::string > > &params )
{ {
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 &k = p.first;
const std::string &v = p.second; const std::string &v = p.second;

View file

@ -57,7 +57,7 @@ uint32 NbDatabaseChanges = 0;
// CCDBSynchronised // CCDBSynchronised
// //
//----------------------------------------------- //-----------------------------------------------
CCDBSynchronised::CCDBSynchronised() : _InitInProgress(true), _InitDeltaReceived(0), CCDBManager( "SERVER", NB_CDB_BANKS ) CCDBSynchronised::CCDBSynchronised() : CCDBManager("SERVER", NB_CDB_BANKS), _InitInProgress(true), _InitDeltaReceived(0)
{ {
} }

View file

@ -125,17 +125,17 @@ public:
virtual void buildInfo() virtual void buildInfo()
{ {
m_Idx.WorldToUV0 = getUniformIndex("worldToUV0"); m_Idx.WorldToUV0 = getUniformIndex("worldToUV0");
nlassert(m_Idx.WorldToUV0 != ~0); nlassert(m_Idx.WorldToUV0 != std::numeric_limits<uint>::max());
m_Idx.WorldToUV1 = getUniformIndex("worldToUV1"); m_Idx.WorldToUV1 = getUniformIndex("worldToUV1");
nlassert(m_Idx.WorldToUV1 != ~0); nlassert(m_Idx.WorldToUV1 != std::numeric_limits<uint>::max());
m_Idx.RefCamDist = getUniformIndex("refCamDist"); m_Idx.RefCamDist = getUniformIndex("refCamDist");
nlassert(m_Idx.RefCamDist != ~0); nlassert(m_Idx.RefCamDist != std::numeric_limits<uint>::max());
m_Idx.DistScaleBias = getUniformIndex("distScaleBias"); m_Idx.DistScaleBias = getUniformIndex("distScaleBias");
nlassert(m_Idx.DistScaleBias != ~0); nlassert(m_Idx.DistScaleBias != std::numeric_limits<uint>::max());
m_Idx.Diffuse = getUniformIndex("diffuse"); m_Idx.Diffuse = getUniformIndex("diffuse");
nlassert(m_Idx.Diffuse != ~0); nlassert(m_Idx.Diffuse != std::numeric_limits<uint>::max());
m_Idx.BlendScale = getUniformIndex("blendScale"); m_Idx.BlendScale = getUniformIndex("blendScale");
nlassert(m_Idx.BlendScale != ~0); nlassert(m_Idx.BlendScale != std::numeric_limits<uint>::max());
} }
inline const CIdx &idx() const { return m_Idx; } inline const CIdx &idx() const { return m_Idx; }
private: private:

View file

@ -881,8 +881,8 @@ NLMISC_COMMAND(gfxAdd, "gfxAdd", "<>")
break; break;
} }
} }
int category = 0; sint category = 0;
uint32 form; uint32 form = 0;
if (args.size() == 1) if (args.size() == 1)
{ {
if (fromString(args[0], category)) if (fromString(args[0], category))

View file

@ -3055,17 +3055,17 @@ public:
if (pCB) if (pCB)
{ {
uint maxAnisotropic = Driver->getAnisotropicFilterMaximum(); sint maxAnisotropic = (sint)Driver->getAnisotropicFilterMaximum();
pCB->resetTexts(); pCB->resetTexts();
pCB->addText(CI18N::get("uigcFxAnisotropicFilterNone")); pCB->addText(CI18N::get("uigcFxAnisotropicFilterNone"));
uint anisotropic = 2; sint anisotropic = 2;
uint i = 1; uint i = 1;
while (anisotropic <= maxAnisotropic) while (anisotropic <= maxAnisotropic)
{ {
pCB->addText(ucstring(NLMISC::toString("%ux", anisotropic))); pCB->addText(ucstring(NLMISC::toString("%dx", anisotropic)));
if (ClientCfg.AnisotropicFilter == anisotropic) if (ClientCfg.AnisotropicFilter == anisotropic)
nAnisotropic = i; nAnisotropic = i;
@ -3522,14 +3522,14 @@ class CHandlerGameConfigApply : public IActionHandler
if (nAnisotropic >= 0) if (nAnisotropic >= 0)
{ {
uint anisotropic = 0; sint anisotropic = 0;
// compute the real anisotropic value // compute the real anisotropic value
if (nAnisotropic > 0) if (nAnisotropic > 0)
{ {
anisotropic = 2; anisotropic = 2;
for(size_t i = 1; i < nAnisotropic; ++i) for(sint i = 1; i < nAnisotropic; ++i)
{ {
anisotropic <<= 1; anisotropic <<= 1;
} }

View file

@ -54,7 +54,7 @@ namespace R2
class CCtrlPolygonSelectable : public CCtrlPolygon, public IDisplayerUIHandle class CCtrlPolygonSelectable : public CCtrlPolygon, public IDisplayerUIHandle
{ {
public: public:
CCtrlPolygonSelectable( CViewBase::TCtorParam &param, CInstance &instance) : Instance(instance), CCtrlPolygon( param ) {} CCtrlPolygonSelectable( CViewBase::TCtorParam &param, CInstance &instance) : CCtrlPolygon(param), Instance(instance) {}
// from IDisplayerUIHandle // from IDisplayerUIHandle
virtual CInstance &getDisplayedInstance() { return Instance; } virtual CInstance &getDisplayedInstance() { return Instance; }
// from IDisplayerUIHandle // from IDisplayerUIHandle
@ -99,7 +99,7 @@ protected:
class CCtrlQuadSelectable : public CCtrlQuad, public IDisplayerUIHandle class CCtrlQuadSelectable : public CCtrlQuad, public IDisplayerUIHandle
{ {
public: public:
CCtrlQuadSelectable( CViewBase::TCtorParam &param, CInstance &instance, uint edgeIndex) : Instance(instance), EdgeIndex(edgeIndex), CCtrlQuad( param ){} CCtrlQuadSelectable( CViewBase::TCtorParam &param, CInstance &instance, uint edgeIndex) : CCtrlQuad(param), Instance(instance), EdgeIndex(edgeIndex) {}
// from IDisplayerUIHandle // from IDisplayerUIHandle
virtual CInstance &getDisplayedInstance() { return Instance; } virtual CInstance &getDisplayedInstance() { return Instance; }
// from IDisplayerUIHandle // from IDisplayerUIHandle

View file

@ -83,11 +83,11 @@ void CConfig::revertToDefault()
NLMISC::CConfigFile::CVar *src = dcf.getVarPtr( dst->Name ); NLMISC::CConfigFile::CVar *src = dcf.getVarPtr( dst->Name );
if( ( src != NULL ) && !dst->Root && 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_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_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_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_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_STRING ) && ( dst->Type == NLMISC::CConfigFile::CVar::T_STRING )) ) )
{ {
if( src->Type == NLMISC::CConfigFile::CVar::T_INT ) if( src->Type == NLMISC::CConfigFile::CVar::T_INT )