From 75f2f9fd5f7b49a1ba9a251ba75e785400cb028e Mon Sep 17 00:00:00 2001 From: Ykkrosh Date: Tue, 7 Nov 2006 13:28:03 +0000 Subject: [PATCH] Avoid some warnings on GCC This was SVN commit r4623. --- source/graphics/scripting/JSInterface_Camera.cpp | 2 +- source/gui/MiniMap.cpp | 7 ++++--- source/lib/sysdep/dir_watch.h | 2 +- source/lib/sysdep/snd.cpp | 2 +- source/renderer/PatchRData.cpp | 4 ++++ .../atlas/GameInterface/Handlers/EnvironmentHandlers.cpp | 6 ++++-- 6 files changed, 15 insertions(+), 8 deletions(-) diff --git a/source/graphics/scripting/JSInterface_Camera.cpp b/source/graphics/scripting/JSInterface_Camera.cpp index d1f5f5b90c..98747c8603 100644 --- a/source/graphics/scripting/JSInterface_Camera.cpp +++ b/source/graphics/scripting/JSInterface_Camera.cpp @@ -220,7 +220,7 @@ JSBool JSI_Camera::lookAt( JSContext* cx, JSObject* obj, uint argc, jsval* argv, JSU_REQUIRE_PARAM_RANGE(2, 3); cameraInfo->m_sv_Position = GETVECTOR( argv[0] ); - cameraInfo->m_sv_Orientation = ( GETVECTOR( argv[1] ) - GETVECTOR( argv[0] ) ); + cameraInfo->m_sv_Orientation = GETVECTOR( argv[1] ) - cameraInfo->m_sv_Position; cameraInfo->m_sv_Orientation.Normalize(); if( argc == 2 ) diff --git a/source/gui/MiniMap.cpp b/source/gui/MiniMap.cpp index 0742b92f5d..87fcc8b83e 100644 --- a/source/gui/MiniMap.cpp +++ b/source/gui/MiniMap.cpp @@ -116,7 +116,8 @@ void CMiniMap::SetCameraPos() CVector3D CamOrient=m_Camera->m_Orientation.GetTranslation(); //get center point of screen - int x = (int)g_Renderer.GetWidth()/2.f, y = (int)g_Renderer.GetHeight()/2.f; + int x = g_Renderer.GetWidth()/2; + int y = g_Renderer.GetHeight()/2; CVector3D ScreenMiddle=m_Camera->GetWorldCoordinates(x,y); //Get Vector required to go from camera position to ScreenMiddle @@ -167,8 +168,8 @@ void CMiniMap::FireWorldClickEvent(uint button, int clicks) NMT_Run, -1, NULL, - Destination.x, - Destination.y); + (int)Destination.x, + (int)Destination.y); } // render view rect : John M. Mena diff --git a/source/lib/sysdep/dir_watch.h b/source/lib/sysdep/dir_watch.h index 3085b3f45a..27fadbf08b 100644 --- a/source/lib/sysdep/dir_watch.h +++ b/source/lib/sysdep/dir_watch.h @@ -31,4 +31,4 @@ extern LibError dir_cancel_watch(intptr_t watch); extern LibError dir_get_changed_file(char* fn); -#endif // #ifndef DIR_WATCH_H__ \ No newline at end of file +#endif // #ifndef DIR_WATCH_H__ diff --git a/source/lib/sysdep/snd.cpp b/source/lib/sysdep/snd.cpp index d92924d81e..8af8444677 100644 --- a/source/lib/sysdep/snd.cpp +++ b/source/lib/sysdep/snd.cpp @@ -40,4 +40,4 @@ void snd_detect() SAFE_STRCPY(snd_card, "Unknown"); SAFE_STRCPY(snd_drv_ver, "Unknown"); #endif -} \ No newline at end of file +} diff --git a/source/renderer/PatchRData.cpp b/source/renderer/PatchRData.cpp index de24ee45f4..d1f9cf1325 100644 --- a/source/renderer/PatchRData.cpp +++ b/source/renderer/PatchRData.cpp @@ -546,6 +546,10 @@ void CPatchRData::RenderBlends() // setup data pointers u32 stride=sizeof(SBlendVertex); + // ((GCC warns about offsetof: SBlendVertex contains a CVector3D which has + // a constructor, and so is not a POD type, and so offsetof is theoretically + // invalid - see http://gcc.gnu.org/ml/gcc/2003-11/msg00281.html - but it + // doesn't seem to be worth changing this code since it works anyway.)) glVertexPointer(3,GL_FLOAT,stride,base+offsetof(SBlendVertex,m_Position)); glColorPointer(4,GL_UNSIGNED_BYTE,stride,base+offsetof(SBlendVertex,m_LOSColor)); diff --git a/source/tools/atlas/GameInterface/Handlers/EnvironmentHandlers.cpp b/source/tools/atlas/GameInterface/Handlers/EnvironmentHandlers.cpp index de1c1e5a1e..4175eeb007 100644 --- a/source/tools/atlas/GameInterface/Handlers/EnvironmentHandlers.cpp +++ b/source/tools/atlas/GameInterface/Handlers/EnvironmentHandlers.cpp @@ -25,7 +25,8 @@ sEnvironmentSettings GetSettings() s.watermurkiness = wm->m_Murkiness; s.waterreflectiontintstrength = wm->m_ReflectionTintStrength; -#define COLOUR(A, B) A = Colour(B.r*255, B.g*255, B.b*255) + // CColor colours +#define COLOUR(A, B) A = Colour((int)(B.r*255), (int)(B.g*255), (int)(B.b*255)) COLOUR(s.watercolour, wm->m_WaterColor); COLOUR(s.watertint, wm->m_WaterTint); COLOUR(s.waterreflectiontint, wm->m_ReflectionTint); @@ -39,7 +40,8 @@ sEnvironmentSettings GetSettings() s.skyset = g_Renderer.GetSkyManager()->GetSkySet(); -#define COLOUR(A, B) A = Colour(B.X*255, B.Y*255, B.Z*255) + // RGBColor (CVector3D) colours +#define COLOUR(A, B) A = Colour((int)(B.X*255), (int)(B.Y*255), (int)(B.Z*255)) COLOUR(s.suncolour, g_LightEnv.m_SunColor); COLOUR(s.terraincolour, g_LightEnv.m_TerrainAmbientColor); COLOUR(s.unitcolour, g_LightEnv.m_UnitsAmbientColor);