Fixed: Warnings with GCC

This commit is contained in:
kervala 2015-12-25 20:49:59 +01:00
parent 24b70023fd
commit 435000556b
29 changed files with 213 additions and 205 deletions

View file

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

View file

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

View file

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

View file

@ -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<T> &operator= (const T &val)

View file

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

View file

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

View file

@ -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<uint>::max())
{
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);
}
if (prog->getUniformIndex(CProgramIndex::ModelViewTranspose) != ~0)
if (prog->getUniformIndex(CProgramIndex::ModelViewTranspose) != std::numeric_limits<uint>::max())
{
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);
}
if (prog->getUniformIndex(CProgramIndex::Projection) != ~0)
if (prog->getUniformIndex(CProgramIndex::Projection) != std::numeric_limits<uint>::max())
{
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);
}
if (prog->getUniformIndex(CProgramIndex::ProjectionTranspose) != ~0)
if (prog->getUniformIndex(CProgramIndex::ProjectionTranspose) != std::numeric_limits<uint>::max())
{
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);
}
if (prog->getUniformIndex(CProgramIndex::ModelViewProjection) != ~0)
if (prog->getUniformIndex(CProgramIndex::ModelViewProjection) != std::numeric_limits<uint>::max())
{
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);
}
if (prog->getUniformIndex(CProgramIndex::ModelViewProjectionTranspose) != ~0)
if (prog->getUniformIndex(CProgramIndex::ModelViewProjectionTranspose) != std::numeric_limits<uint>::max())
{
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);
}
}
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));
}
@ -494,7 +494,7 @@ void CDriverGL::setUniformParams(TProgram program, CGPUProgramParams &params)
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<uint>::max()); // invalid parameter name
params.map(index, name);
}

View file

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

View file

@ -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<uint>::max())
{
if (m_Map.size() > index)
{

View file

@ -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<uint>::max());
m_Idx.RefineCenter = getUniformIndex("refineCenter");
nlassert(m_Idx.RefineCenter != ~0);
nlassert(m_Idx.RefineCenter != std::numeric_limits<uint>::max());
m_Idx.TileDist = getUniformIndex("tileDist");
nlassert(m_Idx.TileDist != ~0);
nlassert(m_Idx.TileDist != std::numeric_limits<uint>::max());
m_Idx.PZBModelPosition = getUniformIndex("pzbModelPosition");
nlassert(m_Idx.PZBModelPosition != ~0);
nlassert(m_Idx.PZBModelPosition != std::numeric_limits<uint>::max());
}
} // NL3D

View file

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

View file

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

View file

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

View file

@ -301,15 +301,15 @@ public:
CPixelProgram::buildInfo();
m_OVRIndices.LensCenter = getUniformIndex("cLensCenter");
nlassert(m_OVRIndices.LensCenter != ~0);
nlassert(m_OVRIndices.LensCenter != std::numeric_limits<uint>::max());
m_OVRIndices.ScreenCenter = getUniformIndex("cScreenCenter");
nlassert(m_OVRIndices.ScreenCenter != ~0);
nlassert(m_OVRIndices.ScreenCenter != std::numeric_limits<uint>::max());
m_OVRIndices.Scale = getUniformIndex("cScale");
nlassert(m_OVRIndices.Scale != ~0);
nlassert(m_OVRIndices.Scale != std::numeric_limits<uint>::max());
m_OVRIndices.ScaleIn = getUniformIndex("cScaleIn");
nlassert(m_OVRIndices.ScaleIn != ~0);
nlassert(m_OVRIndices.ScaleIn != std::numeric_limits<uint>::max());
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; }

View file

@ -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<uint>::max());
m_Idx.DirectionalLight = getUniformIndex("directionalLight");
nlassert(m_Idx.DirectionalLight != ~0);
nlassert(m_Idx.DirectionalLight != std::numeric_limits<uint>::max());
m_Idx.ViewCenter = getUniformIndex("viewCenter");
nlassert(m_Idx.ViewCenter != ~0);
nlassert(m_Idx.ViewCenter != std::numeric_limits<uint>::max());
m_Idx.NegInvTransDist = getUniformIndex("negInvTransDist");
nlassert(m_Idx.NegInvTransDist != ~0);
nlassert(m_Idx.NegInvTransDist != std::numeric_limits<uint>::max());
m_Idx.AngleAxis = getUniformIndex("angleAxis");
nlassert(m_Idx.AngleAxis != ~0);
nlassert(m_Idx.AngleAxis != std::numeric_limits<uint>::max());
m_Idx.Wind = getUniformIndex("wind");
nlassert(m_Idx.Wind != ~0);
nlassert(m_Idx.Wind != std::numeric_limits<uint>::max());
m_Idx.CosCoeff0 = getUniformIndex("cosCoeff0");
nlassert(m_Idx.CosCoeff0 != ~0);
nlassert(m_Idx.CosCoeff0 != std::numeric_limits<uint>::max());
m_Idx.CosCoeff1 = getUniformIndex("cosCoeff1");
nlassert(m_Idx.CosCoeff1 != ~0);
nlassert(m_Idx.CosCoeff1 != std::numeric_limits<uint>::max());
m_Idx.CosCoeff2 = getUniformIndex("cosCoeff2");
nlassert(m_Idx.CosCoeff2 != ~0);
nlassert(m_Idx.CosCoeff2 != std::numeric_limits<uint>::max());
m_Idx.QuatConstants = getUniformIndex("quatConstants");
nlassert(m_Idx.QuatConstants != ~0);
nlassert(m_Idx.QuatConstants != std::numeric_limits<uint>::max());
m_Idx.PiConstants = getUniformIndex("piConstants");
nlassert(m_Idx.PiConstants != ~0);
nlassert(m_Idx.PiConstants != std::numeric_limits<uint>::max());
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)
{
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; }

View file

@ -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<uint>::max());
m_Idx.BumpMap0Offset = getUniformIndex("bumpMap0Offset");
nlassert(m_Idx.BumpMap0Offset != ~0);
nlassert(m_Idx.BumpMap0Offset != std::numeric_limits<uint>::max());
m_Idx.BumpMap1Scale = getUniformIndex("bumpMap1Scale");
nlassert(m_Idx.BumpMap1Scale != ~0);
nlassert(m_Idx.BumpMap1Scale != std::numeric_limits<uint>::max());
m_Idx.BumpMap1Offset = getUniformIndex("bumpMap1Offset");
nlassert(m_Idx.BumpMap1Offset != ~0);
nlassert(m_Idx.BumpMap1Offset != std::numeric_limits<uint>::max());
m_Idx.ObserverHeight = getUniformIndex("observerHeight");
nlassert(m_Idx.ObserverHeight != ~0);
nlassert(m_Idx.ObserverHeight != std::numeric_limits<uint>::max());
m_Idx.ScaleReflectedRay = getUniformIndex("scaleReflectedRay");
nlassert(m_Idx.ScaleReflectedRay != ~0);
nlassert(m_Idx.ScaleReflectedRay != std::numeric_limits<uint>::max());
if (m_Diffuse)
{
m_Idx.DiffuseMapVector0 = getUniformIndex("diffuseMapVector0");
nlassert(m_Idx.DiffuseMapVector0 != ~0);
nlassert(m_Idx.DiffuseMapVector0 != std::numeric_limits<uint>::max());
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()
{
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 );

View file

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

View file

@ -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( ; column<cell->TableColumnIndex; column++)
for( ; column<cell->TableColumnIndex; ++column)
currentX += _Columns[column].Width + padding*2 + CellSpacing;
}

View file

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

View file

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

View file

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

View file

@ -56,9 +56,9 @@ CCrashReportWidget::~CCrashReportWidget()
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 &v = p.second;

View file

@ -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)
{
}

View file

@ -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<uint>::max());
m_Idx.WorldToUV1 = getUniformIndex("worldToUV1");
nlassert(m_Idx.WorldToUV1 != ~0);
nlassert(m_Idx.WorldToUV1 != std::numeric_limits<uint>::max());
m_Idx.RefCamDist = getUniformIndex("refCamDist");
nlassert(m_Idx.RefCamDist != ~0);
nlassert(m_Idx.RefCamDist != std::numeric_limits<uint>::max());
m_Idx.DistScaleBias = getUniformIndex("distScaleBias");
nlassert(m_Idx.DistScaleBias != ~0);
nlassert(m_Idx.DistScaleBias != std::numeric_limits<uint>::max());
m_Idx.Diffuse = getUniformIndex("diffuse");
nlassert(m_Idx.Diffuse != ~0);
nlassert(m_Idx.Diffuse != std::numeric_limits<uint>::max());
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; }
private:

View file

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

View file

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

View file

@ -54,7 +54,7 @@ namespace R2
class CCtrlPolygonSelectable : public CCtrlPolygon, public IDisplayerUIHandle
{
public:
CCtrlPolygonSelectable( CViewBase::TCtorParam &param, CInstance &instance) : Instance(instance), CCtrlPolygon( param ) {}
CCtrlPolygonSelectable( CViewBase::TCtorParam &param, 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 &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
virtual CInstance &getDisplayedInstance() { return Instance; }
// from IDisplayerUIHandle

View file

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