warning fixes

GameSetup.cpp: add support for new internal/public mod layout

This was SVN commit r6393.
This commit is contained in:
janwas 2008-09-18 11:31:12 +00:00
parent c4654fd8fa
commit 40a7da782e
19 changed files with 54 additions and 45 deletions

View File

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

View File

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

View File

@ -43,4 +43,6 @@ extern void Log(int severity, const char* fmt, ...);
#undef min
#undef max
#define UNUSED(paramName)
#endif // INCLUDED_COLLADA_PRECOMPILED

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -7,7 +7,7 @@
template <>
CStrW ToNetString(const size_t &val)
{
return CStrW(val);
return CStrW((unsigned long)val);
}
template <>

View File

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

View File

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

View File

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

View File

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

View File

@ -12,6 +12,8 @@ using AtlasMessage::Shareable;
static Observable<AtlasMessage::sEnvironmentSettings> 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));

View File

@ -145,7 +145,7 @@ private:
void OnObjectSettingsChange(const ObjectSettings& settings)
{
SetSelection(settings.GetPlayerID());
SetSelection((long)settings.GetPlayerID());
}
void OnSelect(wxCommandEvent& evt)

View File

@ -11,7 +11,7 @@ ObjectSettings::ObjectSettings(Observable<std::vector<AtlasMessage::ObjectID> >&
m_Conn = m_SelectedObjects.RegisterObserver(0, &ObjectSettings::OnSelectionChange, this);
}
int ObjectSettings::GetPlayerID() const
size_t ObjectSettings::GetPlayerID() const
{
return m_PlayerID;
}

View File

@ -19,7 +19,7 @@ class ObjectSettings
public:
ObjectSettings(Observable<std::vector<AtlasMessage::ObjectID> >& 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

View File

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

View File

@ -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<std::vector<CStr> > groups = unit->GetObject()->m_Base->GetVariantGroups();