1
0
forked from 0ad/0ad

GCC compatibility (fixed CStr.h case, got rid of a few warnings)

This was SVN commit r4581.
This commit is contained in:
Ykkrosh 2006-10-20 01:06:43 +00:00
parent b03c42d4f2
commit 1f268b17bb
11 changed files with 25 additions and 26 deletions

View File

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

View File

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

View File

@ -312,4 +312,4 @@ CNetMessage *CNetMessage::CreateProduceMessage( const CEntityList& entities, con

View File

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

View File

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

View File

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

View File

@ -127,7 +127,7 @@ void SkyManager::SetSkySet( const CStrW& newSet )
UnloadSkyTextures();
for( int i=0; i<ARRAY_SIZE(m_SkyTexture); i++ ) {
for( size_t i=0; i<ARRAY_SIZE(m_SkyTexture); i++ ) {
char filename[PATH_MAX];
snprintf(filename, ARRAY_SIZE(filename), "art/textures/skies/%s/%s.dds",
CStr8(m_SkySet).c_str(), IMAGE_NAMES[i]);

View File

@ -35,7 +35,7 @@ public:
static const size_t min_buckets = 16;
size_t operator() (const CVector2D& Key) const
{
return Key.x + Key.y*1024;
return (size_t)(Key.x + Key.y*1024.f);
}
bool operator() (const CVector2D& _Key1, const CVector2D& _Key2) const
{

View File

@ -823,7 +823,7 @@ jsval CEntity::RegisterOrderChange( JSContext* cx, uintN argc, jsval* argv )
float angle = acosf( up.dot(posDelta) );
//Find what section it is between and "deactivate" it
int sector = MAX( 0.0, findSector(m_base->m_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;
}

View File

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

View File

@ -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 <vector>
@ -107,4 +107,4 @@ public:
#endif //#ifndef SOUNDGROUP_H_
#endif //#ifndef SOUNDGROUP_H_