diff --git a/source/graphics/Terrain.cpp b/source/graphics/Terrain.cpp index 225acb4f0c..01985de846 100644 --- a/source/graphics/Terrain.cpp +++ b/source/graphics/Terrain.cpp @@ -215,8 +215,8 @@ float CTerrain::getSlope(float x, float z) const float h11 = m_Heightmap[zi*m_MapSize + xi + m_MapSize + 1]; //Difference of highest point from lowest point - return MAX(MAX(h00, h01), MAX(h10, h11)) - - MIN(MIN(h00, h01), MIN(h10, h11)); + return std::max(std::max(h00, h01), std::max(h10, h11)) - + std::min(std::min(h00, h01), std::min(h10, h11)); } CVector2D CTerrain::getSlopeAngleFace( CEntity* entity ) const { diff --git a/source/maths/Noise.cpp b/source/maths/Noise.cpp index 22e563f298..fb8d6fdddc 100644 --- a/source/maths/Noise.cpp +++ b/source/maths/Noise.cpp @@ -51,8 +51,8 @@ float Noise2D::operator()(float x, float y) x *= freq; y *= freq; - int ix = floor(x); - int iy = floor(y); + int ix = (int)floor(x); + int iy = (int)floor(y); float fx = x - ix; float fy = y - iy; @@ -117,9 +117,9 @@ float Noise3D::operator()(float x, float y, float z) y *= freq; z *= vfreq; - int ix = floor(x); - int iy = floor(y); - int iz = floor(z); + int ix = (int)floor(x); + int iy = (int)floor(y); + int iz = (int)floor(z); float fx = x - ix; float fy = y - iy; diff --git a/source/network/NetMessage.cpp b/source/network/NetMessage.cpp index 0a63cd10dc..114f713ea3 100644 --- a/source/network/NetMessage.cpp +++ b/source/network/NetMessage.cpp @@ -312,4 +312,4 @@ CNetMessage *CNetMessage::CreateProduceMessage( const CEntityList& entities, con - \ No newline at end of file + diff --git a/source/network/SocketBase.cpp b/source/network/SocketBase.cpp index 1bb892e4d2..9dabddeaed 100644 --- a/source/network/SocketBase.cpp +++ b/source/network/SocketBase.cpp @@ -564,7 +564,6 @@ bool CSocketBase::ConnectError(CSocketBase *pSocket) CSocketInternal *pInt=pSocket->m_pInternal; uint buf; int res; - PS_RESULT connErr; if (pSocket->m_State==SS_CONNECT_STARTED) { @@ -597,7 +596,7 @@ bool CSocketBase::ConnectError(CSocketBase *pSocket) // will be held upon return. void CSocketBase::SocketWritable(CSocketBase *pSock) { - CSocketInternal *pInt=pSock->m_pInternal; + //CSocketInternal *pInt=pSock->m_pInternal; bool isConnectError=false; if (pSock->m_State != SS_CONNECTED) diff --git a/source/ps/Hotkey.cpp b/source/ps/Hotkey.cpp index df9578df82..dfcfc73a23 100644 --- a/source/ps/Hotkey.cpp +++ b/source/ps/Hotkey.cpp @@ -310,7 +310,7 @@ void loadHotkeys() if( !( *j & HOTKEY_NEGATION_FLAG ) ) allNegated = false; - debug_assert(it->mapsTo < ARRAY_SIZE(hotkeys)); + debug_assert((size_t)it->mapsTo < ARRAY_SIZE(hotkeys)); if( allNegated ) hotkeys[it->mapsTo] = true; @@ -467,7 +467,7 @@ InReaction hotkeyInputHandler( const SDL_Event_* ev ) if( it->mapsTo == HOTKEY_CONSOLE_TOGGLE ) isCapturable = false; // Because that would be silly. - debug_assert(it->mapsTo < ARRAY_SIZE(hotkeys)); + debug_assert((size_t)it->mapsTo < ARRAY_SIZE(hotkeys)); if( accept && !( isCapturable && consoleCapture ) ) { @@ -595,7 +595,7 @@ InReaction hotkeyInputHandler( const SDL_Event_* ev ) } } - debug_assert(it->mapsTo < ARRAY_SIZE(hotkeys)); + debug_assert((size_t)it->mapsTo < ARRAY_SIZE(hotkeys)); if( accept ) { diff --git a/source/ps/scripting/JSInterface_VFS.cpp b/source/ps/scripting/JSInterface_VFS.cpp index bb5c554593..9ade49c562 100644 --- a/source/ps/scripting/JSInterface_VFS.cpp +++ b/source/ps/scripting/JSInterface_VFS.cpp @@ -236,4 +236,4 @@ JSBool JSI_VFS::ArchiveBuilderCancel(JSContext* UNUSED(cx), JSObject* UNUSED(obj debug_assert( argc == 0 ); vfs_opt_auto_build_cancel(); return( JS_TRUE ); -} \ No newline at end of file +} diff --git a/source/renderer/SkyManager.cpp b/source/renderer/SkyManager.cpp index de2706e888..0cb8855879 100644 --- a/source/renderer/SkyManager.cpp +++ b/source/renderer/SkyManager.cpp @@ -127,7 +127,7 @@ void SkyManager::SetSkySet( const CStrW& newSet ) UnloadSkyTextures(); - for( int i=0; im_sectorDivs, angle, DEGTORAD(360.0f)) ); + int sector = std::max(0, findSector(m_base->m_sectorDivs, angle, DEGTORAD(360.0f))); m_sectorValues[sector]=false; return JS_TRUE; } diff --git a/source/simulation/Formation.cpp b/source/simulation/Formation.cpp index 1e14f39069..6b2272ce11 100644 --- a/source/simulation/Formation.cpp +++ b/source/simulation/Formation.cpp @@ -12,12 +12,12 @@ CFormation::CFormation() } bool CFormation::loadXML(const CStr& filename) { - CXeromyces XeroFile; + CXeromyces XeroFile; - if (XeroFile.Load(filename) != PSRETURN_OK) - return false; + if (XeroFile.Load(filename) != PSRETURN_OK) + return false; - #define EL(x) int el_##x = XeroFile.getElementID(#x) + #define EL(x) int el_##x = XeroFile.getElementID(#x) #define AT(x) int at_##x = XeroFile.getAttributeID(#x) EL(formation); EL(fl); @@ -49,8 +49,8 @@ bool CFormation::loadXML(const CStr& filename) #undef AT #undef EL - XMBElement Root = XeroFile.getRoot(); - if( Root.getNodeName() != el_formation ) + XMBElement Root = XeroFile.getRoot(); + if( Root.getNodeName() != el_formation ) { LOG( ERROR, LOG_CATEGORY, "CFormation::LoadXML: XML root was not \"Formation\" in file %s. Load failed.", filename.c_str() ); return( false ); @@ -206,4 +206,4 @@ void CFormation::AssignCategory(int order, CStr category) size_t off = category.find(temp); category.erase( off, temp.length() ); } -} \ No newline at end of file +} diff --git a/source/sound/SoundGroup.h b/source/sound/SoundGroup.h index e9ad3fca32..d5c028d3a0 100644 --- a/source/sound/SoundGroup.h +++ b/source/sound/SoundGroup.h @@ -46,7 +46,7 @@ Example SoundGroup.xml #include "lib/res/handle.h" -#include "ps/cstr.h" +#include "ps/CStr.h" #include "lib/res/sound/snd_mgr.h" #include @@ -107,4 +107,4 @@ public: -#endif //#ifndef SOUNDGROUP_H_ \ No newline at end of file +#endif //#ifndef SOUNDGROUP_H_