From 40a7da782ea6f11410ccb6b98294db6d3d7ae703 Mon Sep 17 00:00:00 2001 From: janwas Date: Thu, 18 Sep 2008 11:31:12 +0000 Subject: [PATCH] warning fixes GameSetup.cpp: add support for new internal/public mod layout This was SVN commit r6393. --- source/collada/CommonConvert.cpp | 4 +-- source/collada/GeomReindex.cpp | 2 ++ source/collada/precompiled.h | 2 ++ source/gui/GUIRenderer.cpp | 2 +- source/network/NetMessage.cpp | 2 +- source/network/NetServer.cpp | 10 ++++---- source/ps/GameSetup/GameSetup.cpp | 25 ++++++++++--------- source/renderer/Renderer.cpp | 4 +-- source/scripting/SynchedJSObject.cpp | 2 +- .../atlas/AtlasUI/ActorViewer/ActorViewer.cpp | 12 +++++---- .../AtlasUI/General/VideoRecorder/FFmpeg.cpp | 10 ++++---- .../tools/atlas/AtlasUI/Misc/DLLInterface.cpp | 2 +- .../tools/atlas/AtlasUI/Misc/DLLInterface.h | 2 +- .../Sections/Environment/Environment.cpp | 6 +++-- .../ScenarioEditor/Sections/Object/Object.cpp | 2 +- .../Tools/Common/ObjectSettings.cpp | 2 +- .../Tools/Common/ObjectSettings.h | 4 +-- source/tools/atlas/GameInterface/GameLoop.cpp | 4 +-- .../GameInterface/Handlers/ObjectHandlers.cpp | 2 +- 19 files changed, 54 insertions(+), 45 deletions(-) diff --git a/source/collada/CommonConvert.cpp b/source/collada/CommonConvert.cpp index ccc4a5919d..6f32eb34de 100644 --- a/source/collada/CommonConvert.cpp +++ b/source/collada/CommonConvert.cpp @@ -91,7 +91,7 @@ void FColladaDocument::LoadFromText(const char *text) REQUIRE_SUCCESS(status); } -void FColladaDocument::ReadExtras(xmlNode* colladaNode) +void FColladaDocument::ReadExtras(xmlNode* UNUSED(colladaNode)) { // TODO: This was needed to recognise and load XSI models. // XSI support should be reintroduced some time, but this function @@ -341,7 +341,7 @@ MERGED_WEIGHTS: ; } -void FixSkeletonRoots(FCDControllerInstance& controllerInstance) +void FixSkeletonRoots(FCDControllerInstance& UNUSED(controllerInstance)) { // TODO: Need to reintroduce XSI support at some point #if 0 diff --git a/source/collada/GeomReindex.cpp b/source/collada/GeomReindex.cpp index 13a18afb2e..8b7de30f82 100644 --- a/source/collada/GeomReindex.cpp +++ b/source/collada/GeomReindex.cpp @@ -141,8 +141,10 @@ void ReindexGeometry(FCDGeometryPolygons* polys, FCDSkinController* skin) if (skin) { +#ifndef NDEBUG size_t numVertexPositions = sourcePosition->GetDataCount() / sourcePosition->GetStride(); assert(skin->GetInfluenceCount() == numVertexPositions); +#endif } uint32 stridePosition = sourcePosition->GetStride(); diff --git a/source/collada/precompiled.h b/source/collada/precompiled.h index a789769675..ea66dfb18b 100644 --- a/source/collada/precompiled.h +++ b/source/collada/precompiled.h @@ -43,4 +43,6 @@ extern void Log(int severity, const char* fmt, ...); #undef min #undef max +#define UNUSED(paramName) + #endif // INCLUDED_COLLADA_PRECOMPILED diff --git a/source/gui/GUIRenderer.cpp b/source/gui/GUIRenderer.cpp index f94e300874..894d94faea 100644 --- a/source/gui/GUIRenderer.cpp +++ b/source/gui/GUIRenderer.cpp @@ -410,7 +410,7 @@ void GUIRenderer::UpdateDrawCallCache(DrawCalls &Calls, CStr& SpriteName, CRect (void)ogl_tex_get_size(h, &t_w, &t_h, 0); float TexWidth = t_w, TexHeight = t_h; - int flags = 0; // assume no alpha on failure + size_t flags = 0; // assume no alpha on failure (void)ogl_tex_get_format(h, &flags, 0); Call.m_EnableBlending = (flags & TEX_ALPHA) != 0; diff --git a/source/network/NetMessage.cpp b/source/network/NetMessage.cpp index 0c67a09082..0674c7d7fb 100644 --- a/source/network/NetMessage.cpp +++ b/source/network/NetMessage.cpp @@ -67,7 +67,7 @@ u8* CNetMessage::Serialize( u8* pBuffer ) const // Serialize message type and its size *( ( NetMessageType* )pBuffer ) = m_Type; - *( ( uint* )( pBuffer + sizeof( NetMessageType ) ) ) = GetSerializedLength(); + *( ( size_t* )( pBuffer + sizeof( NetMessageType ) ) ) = GetSerializedLength(); return pBuffer + sizeof( NetMessageType ) + sizeof( uint ); } diff --git a/source/network/NetServer.cpp b/source/network/NetServer.cpp index d71c1fd04a..b0e29eb733 100644 --- a/source/network/NetServer.cpp +++ b/source/network/NetServer.cpp @@ -260,8 +260,8 @@ void CNetServer::SetupPlayer( CNetSession* pSession ) CPlayerSlot* pCurrSlot = m_GameAttributes->GetSlot( i ); if ( !pCurrSlot ) continue; - assignSlot.m_SlotID = pCurrSlot->GetSlotID(); - assignSlot.m_SessionID = pCurrSlot->GetSessionID(); + assignSlot.m_SlotID = (u32)pCurrSlot->GetSlotID(); + assignSlot.m_SessionID = (u32)pCurrSlot->GetSessionID(); switch ( pCurrSlot->GetAssignment() ) { case SLOT_CLOSED: @@ -800,7 +800,7 @@ void CNetServer::BuildPlayerConfigMessage( // Validare parameters if ( !pMessage || !pPlayer ) return; - pMessage->m_PlayerID = pPlayer->GetPlayerID(); + pMessage->m_PlayerID = (u32)pPlayer->GetPlayerID(); // Iterate through player properties and load them into message pPlayer->IterateSynchedProperties( PlayerConfigMessageCallback, pMessage ); @@ -900,7 +900,7 @@ void CNetServer::PlayerAttributeUpdate( CPlayerConfigMessage* pNewMessage = new CPlayerConfigMessage; if ( !pNewMessage ) return; - pNewMessage->m_PlayerID = pPlayer->GetPlayerID(); + pNewMessage->m_PlayerID = (u32)pPlayer->GetPlayerID(); pNewMessage->m_Values.resize( 1 ); pNewMessage->m_Values[ 0 ].m_Name = name; pNewMessage->m_Values[ 0 ].m_Value = newValue; @@ -1033,7 +1033,7 @@ void CNetServer::BuildPlayerSlotAssignmentMessage( // Validate parameters if ( !pMessage || !pPlayerSlot ) return; - pMessage->m_SlotID = pPlayerSlot->GetSlotID(); + pMessage->m_SlotID = (u32)pPlayerSlot->GetSlotID(); pMessage->m_SessionID = pPlayerSlot->GetSessionID(); switch ( pPlayerSlot->GetAssignment() ) diff --git a/source/ps/GameSetup/GameSetup.cpp b/source/ps/GameSetup/GameSetup.cpp index 9c68303be8..125f84eb20 100644 --- a/source/ps/GameSetup/GameSetup.cpp +++ b/source/ps/GameSetup/GameSetup.cpp @@ -524,6 +524,15 @@ static void InitScripting() } +static size_t ChooseCacheSize() +{ +#if OS_WIN + //const size_t overheadKiB = (wutil_WindowsVersion() >= WUTIL_VERSION_VISTA)? 1024 : 512; +#endif + return 96*MiB; +} + + static void InitVfs(const CmdLineArgs& args) { TIMER("InitVfs"); @@ -540,7 +549,8 @@ static void InitVfs(const CmdLineArgs& args) // the VFS prevents any accesses to files above this directory. path_SetRoot(args.GetArg0(), "../data"); - g_VFS = CreateVfs(96*MiB); + const size_t cacheSize = ChooseCacheSize(); + g_VFS = CreateVfs(cacheSize); g_VFS->Mount("screenshots/", "screenshots"); g_VFS->Mount("config/", "config"); @@ -552,27 +562,18 @@ static void InitVfs(const CmdLineArgs& args) // - we mount as archivable so that all files will be added to archive. // even though we write out XMBs here, they will eventually be read, // so putting them in an archive boosts performance. - // - // [hot: 16ms] g_VFS->Mount("cache/", "cache", VFS_MOUNT_ARCHIVABLE); std::vector mods = args.GetMultiple("mod"); mods.push_back("public"); if(!args.Has("onlyPublicFiles")) - mods.push_back("official"); + mods.push_back("internal"); for (size_t i = 0; i < mods.size(); ++i) { CStr path = "mods/" + mods[i]; size_t priority = i; - int flags = VFS_MOUNT_WATCH; - - // TODO: currently only archive 'official' - probably ought to archive - // all mods instead? - if (mods[i] == "official") - flags |= VFS_MOUNT_ARCHIVABLE; - - // [hot: 150ms for mods/official] + const int flags = VFS_MOUNT_WATCH|VFS_MOUNT_ARCHIVABLE; g_VFS->Mount("", path, flags, priority); } diff --git a/source/renderer/Renderer.cpp b/source/renderer/Renderer.cpp index 230cb419bd..9283b59b15 100644 --- a/source/renderer/Renderer.cpp +++ b/source/renderer/Renderer.cpp @@ -1494,7 +1494,7 @@ bool CRenderer::IsTextureTransparent(CTexture* texture) if (!texture) return false; Handle h=texture->GetHandle(); - int flags = 0; // assume no alpha on failure + size_t flags = 0; // assume no alpha on failure (void)ogl_tex_get_format(h, &flags, 0); return (flags & TEX_ALPHA) != 0; } @@ -1556,7 +1556,7 @@ int CRenderer::LoadAlphaMaps() // quick hack: we require plain RGB(A) format, so convert to that. // ideally the texture would be in uncompressed form; then this wouldn't // be necessary. -int flags; +size_t flags; ogl_tex_get_format(textures[i], &flags, 0); ogl_tex_transform_to(textures[i], flags & ~TEX_DXT); diff --git a/source/scripting/SynchedJSObject.cpp b/source/scripting/SynchedJSObject.cpp index 12eea823ab..076c4cc196 100644 --- a/source/scripting/SynchedJSObject.cpp +++ b/source/scripting/SynchedJSObject.cpp @@ -7,7 +7,7 @@ template <> CStrW ToNetString(const size_t &val) { - return CStrW(val); + return CStrW((unsigned long)val); } template <> diff --git a/source/tools/atlas/AtlasUI/ActorViewer/ActorViewer.cpp b/source/tools/atlas/AtlasUI/ActorViewer/ActorViewer.cpp index fcde2385f9..fd2a071e97 100644 --- a/source/tools/atlas/AtlasUI/ActorViewer/ActorViewer.cpp +++ b/source/tools/atlas/AtlasUI/ActorViewer/ActorViewer.cpp @@ -22,6 +22,8 @@ using namespace AtlasMessage; +const float M_PIf = 3.14159265f; + ////////////////////////////////////////////////////////////////////////// wxWindow* Tooltipped(wxWindow* window, const wxString& tip) @@ -37,7 +39,7 @@ class ActorCanvas : public Canvas public: ActorCanvas(wxWindow* parent, int* attribList) : Canvas(parent, attribList, wxBORDER_SUNKEN), - m_Distance(20.f), m_Angle(0.f), m_Elevation(M_PI/6.f), m_LastIsValid(false) + m_Distance(20.f), m_Angle(0.f), m_Elevation(M_PIf/6.f), m_LastIsValid(false) { } @@ -81,12 +83,12 @@ protected: m_LastX = evt.GetX(); m_LastY = evt.GetY(); - m_Angle += dx * M_PI/256.f * ScenarioEditor::GetSpeedModifier(); + m_Angle += dx * M_PIf/256.f * ScenarioEditor::GetSpeedModifier(); if (evt.ButtonIsDown(wxMOUSE_BTN_LEFT)) m_Distance += dy / 8.f * ScenarioEditor::GetSpeedModifier(); else // evt.ButtonIsDown(wxMOUSE_BTN_RIGHT)) - m_Elevation += dy * M_PI/256.f * ScenarioEditor::GetSpeedModifier(); + m_Elevation += dy * M_PIf/256.f * ScenarioEditor::GetSpeedModifier(); camera_changed = true; } @@ -266,8 +268,8 @@ ActorViewer::ActorViewer(wxWindow* parent) m_AnimationBox = new wxComboBox(sidePanel, ID_Animations, _T("Idle"), wxDefaultPosition, wxDefaultSize, animations); - m_EnvironmentSettings.sunelevation = 45 * M_PI/180; - m_EnvironmentSettings.sunrotation = 315 * M_PI/180; + m_EnvironmentSettings.sunelevation = 45 * M_PIf/180; + m_EnvironmentSettings.sunrotation = 315 * M_PIf/180; m_EnvironmentSettings.sunoverbrightness = 1.0f; m_EnvironmentSettings.suncolour = Colour(255, 255, 255); m_EnvironmentSettings.terraincolour = Colour(164, 164, 164); diff --git a/source/tools/atlas/AtlasUI/General/VideoRecorder/FFmpeg.cpp b/source/tools/atlas/AtlasUI/General/VideoRecorder/FFmpeg.cpp index d272c1cf84..8784982518 100644 --- a/source/tools/atlas/AtlasUI/General/VideoRecorder/FFmpeg.cpp +++ b/source/tools/atlas/AtlasUI/General/VideoRecorder/FFmpeg.cpp @@ -48,7 +48,7 @@ typedef __int32 int32_t; typedef __int64 int64_t; #endif -#define UNUSED(arg) +#define WXUNUSED(arg) extern "C" { #include "ffmpeg/avformat.h" @@ -274,7 +274,7 @@ struct VideoEncoderImpl frame_count++; } - void close_video(AVFormatContext *UNUSED(oc), AVStream *st) + void close_video(AVFormatContext *WXUNUSED(oc), AVStream *st) { avcodec_close(st->codec); av_free(picture->data[0]); @@ -289,7 +289,7 @@ struct VideoEncoderImpl ////////////////////////////////////////////////////////////////////////// -void log(void* UNUSED(v), int i, const char* format, va_list ap) +void log(void* WXUNUSED(v), int i, const char* format, va_list ap) { char buf[512]; vsnprintf(buf, sizeof(buf), format, ap); @@ -416,11 +416,11 @@ VideoEncoder::~VideoEncoder() #else // !USE_FFMPEG: -VideoEncoder::VideoEncoder(const wxString& filenameStr, int framerate, int bitrate, float duration, int width, int height) +VideoEncoder::VideoEncoder(const wxString& WXUNUSED(filenameStr), int WXUNUSED(framerate), int WXUNUSED(bitrate), float WXUNUSED(duration), int WXUNUSED(width), int WXUNUSED(height)) { } -void VideoEncoder::Frame(const unsigned char* buffer) +void VideoEncoder::Frame(const unsigned char* WXUNUSED(buffer)) { } diff --git a/source/tools/atlas/AtlasUI/Misc/DLLInterface.cpp b/source/tools/atlas/AtlasUI/Misc/DLLInterface.cpp index 00dfd4cf54..4f9f233701 100644 --- a/source/tools/atlas/AtlasUI/Misc/DLLInterface.cpp +++ b/source/tools/atlas/AtlasUI/Misc/DLLInterface.cpp @@ -104,7 +104,7 @@ ATLASDLLIMPEXP void Atlas_StartWindow(const wchar_t* type) #endif } -ATLASDLLIMPEXP void Atlas_DisplayError(const wchar_t* text, unsigned int WXUNUSED(flags)) +ATLASDLLIMPEXP void Atlas_DisplayError(const wchar_t* text, size_t WXUNUSED(flags)) { // This is called from the game thread. // wxLog appears to be thread-safe, so that's okay. diff --git a/source/tools/atlas/AtlasUI/Misc/DLLInterface.h b/source/tools/atlas/AtlasUI/Misc/DLLInterface.h index f41e0d86eb..ecbb640a38 100644 --- a/source/tools/atlas/AtlasUI/Misc/DLLInterface.h +++ b/source/tools/atlas/AtlasUI/Misc/DLLInterface.h @@ -10,7 +10,7 @@ ATLASDLLIMPEXP void Atlas_GLSwapBuffers(void* context); ATLASDLLIMPEXP void Atlas_NotifyEndOfFrame(); -ATLASDLLIMPEXP void Atlas_DisplayError(const wchar_t* text, unsigned int flags); +ATLASDLLIMPEXP void Atlas_DisplayError(const wchar_t* text, size_t flags); ATLASDLLIMPEXP void Atlas_ReportError(); diff --git a/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Environment/Environment.cpp b/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Environment/Environment.cpp index 218759cb36..3cde6f6016 100644 --- a/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Environment/Environment.cpp +++ b/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Environment/Environment.cpp @@ -12,6 +12,8 @@ using AtlasMessage::Shareable; static Observable g_EnvironmentSettings; +const float M_PIf = 3.14159265f; + ////////////////////////////////////////////////////////////////////////// class VariableSliderBox : public wxPanel @@ -204,8 +206,8 @@ EnvironmentSidebar::EnvironmentSidebar(ScenarioEditor& scenarioEditor, wxWindow* wxSizer* sunSizer = new wxGridSizer(2); m_MainSizer->Add(sunSizer, wxSizerFlags().Expand().Border(wxTOP, 8)); - sunSizer->Add(new VariableSliderBox(this, _("Sun rotation"), g_EnvironmentSettings.sunrotation, -M_PI, M_PI), wxSizerFlags().Expand()); - sunSizer->Add(new VariableSliderBox(this, _("Sun elevation"), g_EnvironmentSettings.sunelevation, -M_PI/2, M_PI/2), wxSizerFlags().Expand()); + sunSizer->Add(new VariableSliderBox(this, _("Sun rotation"), g_EnvironmentSettings.sunrotation, -M_PIf, M_PIf), wxSizerFlags().Expand()); + sunSizer->Add(new VariableSliderBox(this, _("Sun elevation"), g_EnvironmentSettings.sunelevation, -M_PIf/2, M_PIf/2), wxSizerFlags().Expand()); sunSizer->Add(new VariableSliderBox(this, _("Sun overbrightness"), g_EnvironmentSettings.sunoverbrightness, 1.0f, 3.0f), wxSizerFlags().Expand()); m_MainSizer->Add(new LightControl(this, wxSize(150, 150), g_EnvironmentSettings)); diff --git a/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Object/Object.cpp b/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Object/Object.cpp index ce02a20ee3..a0e26f2f87 100644 --- a/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Object/Object.cpp +++ b/source/tools/atlas/AtlasUI/ScenarioEditor/Sections/Object/Object.cpp @@ -145,7 +145,7 @@ private: void OnObjectSettingsChange(const ObjectSettings& settings) { - SetSelection(settings.GetPlayerID()); + SetSelection((long)settings.GetPlayerID()); } void OnSelect(wxCommandEvent& evt) diff --git a/source/tools/atlas/AtlasUI/ScenarioEditor/Tools/Common/ObjectSettings.cpp b/source/tools/atlas/AtlasUI/ScenarioEditor/Tools/Common/ObjectSettings.cpp index 4841dec4f3..afd05db776 100644 --- a/source/tools/atlas/AtlasUI/ScenarioEditor/Tools/Common/ObjectSettings.cpp +++ b/source/tools/atlas/AtlasUI/ScenarioEditor/Tools/Common/ObjectSettings.cpp @@ -11,7 +11,7 @@ ObjectSettings::ObjectSettings(Observable >& m_Conn = m_SelectedObjects.RegisterObserver(0, &ObjectSettings::OnSelectionChange, this); } -int ObjectSettings::GetPlayerID() const +size_t ObjectSettings::GetPlayerID() const { return m_PlayerID; } diff --git a/source/tools/atlas/AtlasUI/ScenarioEditor/Tools/Common/ObjectSettings.h b/source/tools/atlas/AtlasUI/ScenarioEditor/Tools/Common/ObjectSettings.h index 85dfae7384..b7ac846b52 100644 --- a/source/tools/atlas/AtlasUI/ScenarioEditor/Tools/Common/ObjectSettings.h +++ b/source/tools/atlas/AtlasUI/ScenarioEditor/Tools/Common/ObjectSettings.h @@ -19,7 +19,7 @@ class ObjectSettings public: ObjectSettings(Observable >& selectedObjects, int view); - int GetPlayerID() const; + size_t GetPlayerID() const; void SetPlayerID(int playerID); struct Group @@ -42,7 +42,7 @@ private: int m_View; // 0 = gaia, 1..inf = normal players - int m_PlayerID; + size_t m_PlayerID; // Set of user-chosen actor selections, potentially a superset of any single // actor's possible variants (since it doesn't get reset if you select diff --git a/source/tools/atlas/GameInterface/GameLoop.cpp b/source/tools/atlas/GameInterface/GameLoop.cpp index dd17137c09..1d1e36c225 100644 --- a/source/tools/atlas/GameInterface/GameLoop.cpp +++ b/source/tools/atlas/GameInterface/GameLoop.cpp @@ -32,7 +32,7 @@ void (*Atlas_SetMessagePasser)(MessagePasser*); void (*Atlas_GLSetCurrent)(void* cavas); void (*Atlas_GLSwapBuffers)(void* canvas); void (*Atlas_NotifyEndOfFrame)(); -void (*Atlas_DisplayError)(const wchar_t* text, unsigned int flags); +void (*Atlas_DisplayError)(const wchar_t* text, size_t flags); void (*Atlas_ReportError)(); namespace AtlasMessage { @@ -68,7 +68,7 @@ static const wchar_t* FindWindowName(const CmdLineArgs& args) return L"ScenarioEditor"; } -static ErrorReaction AtlasDisplayError(const wchar_t* text, int flags) +static ErrorReaction AtlasDisplayError(const wchar_t* text, size_t flags) { // TODO: after Atlas has been unloaded, don't do this Atlas_DisplayError(text, flags); diff --git a/source/tools/atlas/GameInterface/Handlers/ObjectHandlers.cpp b/source/tools/atlas/GameInterface/Handlers/ObjectHandlers.cpp index 1b479f8321..c60ae47e8f 100644 --- a/source/tools/atlas/GameInterface/Handlers/ObjectHandlers.cpp +++ b/source/tools/atlas/GameInterface/Handlers/ObjectHandlers.cpp @@ -144,7 +144,7 @@ QUERYHANDLER(GetObjectSettings) if (! unit) return; sObjectSettings settings; - settings.player = (int)unit->GetPlayerID(); + settings.player = unit->GetPlayerID(); // Get the unit's possible variants and selected variants std::vector > groups = unit->GetObject()->m_Base->GetVariantGroups();