GCC/Linux build fixes

This was SVN commit r6107.
This commit is contained in:
Ykkrosh 2008-06-25 23:01:13 +00:00
parent 129f923cf5
commit 10237a66c7
12 changed files with 62 additions and 54 deletions

View File

@ -42,9 +42,9 @@ static float m_scaleX, m_scaleY;
static unsigned int ScaleColor(unsigned int color, float x)
{
unsigned int r = unsigned int(float(color & 0xff) * x);
unsigned int g = unsigned int(float((color>>8) & 0xff) * x);
unsigned int b = unsigned int(float((color>>16) & 0xff) * x);
unsigned int r = unsigned(float(color & 0xff) * x);
unsigned int g = unsigned(float((color>>8) & 0xff) * x);
unsigned int b = unsigned(float((color>>16) & 0xff) * x);
return (0xff000000 | r | g<<8 | b<<16);
}

View File

@ -120,7 +120,7 @@ uintptr_t os_cpu_SetThreadAffinityMask(uintptr_t processorMask)
}
LibError cpu_CallByEachCPU(OsCpuCallback cb, uintptr_t cbData)
LibError os_cpu_CallByEachCPU(OsCpuCallback cb, uintptr_t cbData)
{
for(size_t processor = 0; processor < os_cpu_NumProcessors(); processor++)
{

View File

@ -26,7 +26,7 @@ void sys_display_msgw(const wchar_t* caption, const wchar_t* msg)
fwprintf(stderr, L"%ls: %ls\n", caption, msg);
}
ErrorReaction sys_display_error(const wchar_t* text, size_t flags)
ErrorReaction sys_display_error(const wchar_t* text, int flags)
{
printf("%ls\n\n", text);

View File

@ -255,8 +255,10 @@ const u8 *_nm::Deserialize(const u8 *pos, const u8 *end) \
#define START_NMT_CLASS(_nm, _tp) \
START_NMT_CLASS_DERIVED(CNetMessage, _nm, _tp)
//#define START_NMT_CLASS_DERIVED(_base, _nm, _tp) \
// { _tp, Deserialize##_nm },
/*
#define START_NMT_CLASS_DERIVED(_base, _nm, _tp) \
{ _tp, Deserialize##_nm },
*/
#define START_NMT_CLASS_DERIVED(_base, _nm, _tp)

View File

@ -10,7 +10,7 @@
#include "precompiled.h"
#include "NetClient.h"
#include "NetJsEvents.h"
#include "network.h"
#include "Network.h"
#include "NetServer.h"
#include "scripting/DOMEvent.h"
#include "scripting/JSConversions.h"
@ -160,33 +160,33 @@ bool CNetClient::SetupSession( CNetSession* pSession )
pContext->pSession = pSession;
// Setup transitions for session
pSession->AddTransition( NCS_CONNECT, ( uint )NMT_SERVER_HANDSHAKE, NCS_HANDSHAKE, &OnHandshake, pContext );
pSession->AddTransition( NCS_CONNECT, ( uint )NMT_SERVER_HANDSHAKE, NCS_HANDSHAKE, (void*)&OnHandshake, pContext );
pSession->AddTransition( NCS_HANDSHAKE, ( uint )NMT_ERROR, NCS_CONNECT, &OnError, pContext );
pSession->AddTransition( NCS_HANDSHAKE, ( uint )NMT_SERVER_HANDSHAKE_RESPONSE, NCS_AUTHENTICATE, &OnHandshake, pContext );
pSession->AddTransition( NCS_HANDSHAKE, ( uint )NMT_ERROR, NCS_CONNECT, (void*)&OnError, pContext );
pSession->AddTransition( NCS_HANDSHAKE, ( uint )NMT_SERVER_HANDSHAKE_RESPONSE, NCS_AUTHENTICATE, (void*)&OnHandshake, pContext );
pSession->AddTransition( NCS_AUTHENTICATE, ( uint )NMT_ERROR, NCS_CONNECT, &OnError, pContext );
pSession->AddTransition( NCS_AUTHENTICATE, ( uint )NMT_AUTHENTICATE_RESULT, NCS_PREGAME, &OnAuthenticate, pContext );
pSession->AddTransition( NCS_AUTHENTICATE, ( uint )NMT_ERROR, NCS_CONNECT, (void*)&OnError, pContext );
pSession->AddTransition( NCS_AUTHENTICATE, ( uint )NMT_AUTHENTICATE_RESULT, NCS_PREGAME, (void*)&OnAuthenticate, pContext );
pSession->AddTransition( NCS_PREGAME, ( uint )NMT_ERROR, NCS_CONNECT, &OnError, pContext );
pSession->AddTransition( NCS_PREGAME, ( uint )NMT_GAME_SETUP, NCS_PREGAME, &OnPreGame, pContext );
pSession->AddTransition( NCS_PREGAME, ( uint )NMT_ASSIGN_PLAYER_SLOT, NCS_PREGAME, &OnPreGame, pContext );
pSession->AddTransition( NCS_PREGAME, ( uint )NMT_PLAYER_CONFIG, NCS_PREGAME, &OnPreGame, pContext );
pSession->AddTransition( NCS_PREGAME, ( uint )NMT_PLAYER_JOIN, NCS_PREGAME, &OnPlayerJoin, pContext );
pSession->AddTransition( NCS_PREGAME, ( uint )NMT_GAME_START, NCS_INGAME, &OnStartGame, pContext );
pSession->AddTransition( NCS_PREGAME, ( uint )NMT_ERROR, NCS_CONNECT, (void*)&OnError, pContext );
pSession->AddTransition( NCS_PREGAME, ( uint )NMT_GAME_SETUP, NCS_PREGAME, (void*)&OnPreGame, pContext );
pSession->AddTransition( NCS_PREGAME, ( uint )NMT_ASSIGN_PLAYER_SLOT, NCS_PREGAME, (void*)&OnPreGame, pContext );
pSession->AddTransition( NCS_PREGAME, ( uint )NMT_PLAYER_CONFIG, NCS_PREGAME, (void*)&OnPreGame, pContext );
pSession->AddTransition( NCS_PREGAME, ( uint )NMT_PLAYER_JOIN, NCS_PREGAME, (void*)&OnPlayerJoin, pContext );
pSession->AddTransition( NCS_PREGAME, ( uint )NMT_GAME_START, NCS_INGAME, (void*)&OnStartGame, pContext );
pSession->AddTransition( NCS_INGAME, ( uint )NMT_CHAT, NCS_INGAME, &OnChat, pContext );
pSession->AddTransition( NCS_INGAME, ( uint )NMT_GOTO, NCS_INGAME, &OnInGame, pContext );
pSession->AddTransition( NCS_INGAME, ( uint )NMT_PATROL, NCS_INGAME, &OnInGame, pContext );
pSession->AddTransition( NCS_INGAME, ( uint )NMT_ADD_WAYPOINT, NCS_INGAME, &OnInGame, pContext );
pSession->AddTransition( NCS_INGAME, ( uint )NMT_GENERIC, NCS_INGAME, &OnInGame, pContext );
pSession->AddTransition( NCS_INGAME, ( uint )NMT_PRODUCE, NCS_INGAME, &OnInGame, pContext );
pSession->AddTransition( NCS_INGAME, ( uint )NMT_PLACE_OBJECT, NCS_INGAME, &OnInGame, pContext );
pSession->AddTransition( NCS_INGAME, ( uint )NMT_RUN, NCS_INGAME, &OnInGame, pContext );
pSession->AddTransition( NCS_INGAME, ( uint )NMT_NOTIFY_REQUEST, NCS_INGAME, &OnInGame, pContext );
pSession->AddTransition( NCS_INGAME, ( uint )NMT_FORMATION_GOTO, NCS_INGAME, &OnInGame, pContext );
pSession->AddTransition( NCS_INGAME, ( uint )NMT_FORMATION_GENERIC, NCS_INGAME, &OnInGame, pContext );
pSession->AddTransition( NCS_INGAME, ( uint )NMT_END_COMMAND_BATCH, NCS_INGAME, &OnInGame, pContext );
pSession->AddTransition( NCS_INGAME, ( uint )NMT_CHAT, NCS_INGAME, (void*)&OnChat, pContext );
pSession->AddTransition( NCS_INGAME, ( uint )NMT_GOTO, NCS_INGAME, (void*)&OnInGame, pContext );
pSession->AddTransition( NCS_INGAME, ( uint )NMT_PATROL, NCS_INGAME, (void*)&OnInGame, pContext );
pSession->AddTransition( NCS_INGAME, ( uint )NMT_ADD_WAYPOINT, NCS_INGAME, (void*)&OnInGame, pContext );
pSession->AddTransition( NCS_INGAME, ( uint )NMT_GENERIC, NCS_INGAME, (void*)&OnInGame, pContext );
pSession->AddTransition( NCS_INGAME, ( uint )NMT_PRODUCE, NCS_INGAME, (void*)&OnInGame, pContext );
pSession->AddTransition( NCS_INGAME, ( uint )NMT_PLACE_OBJECT, NCS_INGAME, (void*)&OnInGame, pContext );
pSession->AddTransition( NCS_INGAME, ( uint )NMT_RUN, NCS_INGAME, (void*)&OnInGame, pContext );
pSession->AddTransition( NCS_INGAME, ( uint )NMT_NOTIFY_REQUEST, NCS_INGAME, (void*)&OnInGame, pContext );
pSession->AddTransition( NCS_INGAME, ( uint )NMT_FORMATION_GOTO, NCS_INGAME, (void*)&OnInGame, pContext );
pSession->AddTransition( NCS_INGAME, ( uint )NMT_FORMATION_GENERIC, NCS_INGAME, (void*)&OnInGame, pContext );
pSession->AddTransition( NCS_INGAME, ( uint )NMT_END_COMMAND_BATCH, NCS_INGAME, (void*)&OnInGame, pContext );
// Set first state
pSession->SetFirstState( NCS_CONNECT );

View File

@ -125,26 +125,26 @@ bool CNetServer::SetupSession( CNetSession* pSession )
pContext->pSession = pSession;
// Setup transitions for session
pSession->AddTransition( NSS_HANDSHAKE, ( uint )NMT_ERROR, NSS_HANDSHAKE, &OnError, pContext );
pSession->AddTransition( NSS_HANDSHAKE, ( uint )NMT_CLIENT_HANDSHAKE, NSS_AUTHENTICATE, &OnHandshake, pContext );
pSession->AddTransition( NSS_AUTHENTICATE, ( uint )NMT_ERROR, NSS_AUTHENTICATE, &OnError, pContext );
pSession->AddTransition( NSS_AUTHENTICATE, ( uint )NMT_AUTHENTICATE, NSS_PREGAME, &OnAuthenticate, pContext );
pSession->AddTransition( NSS_AUTHENTICATE, ( uint )NMT_APP_PREGAME, NSS_PREGAME, &OnPreGame, pContext );
pSession->AddTransition( NSS_AUTHENTICATE, ( uint )NMT_APP_OBSERVER, NSS_INGAME, &OnChat, pContext );
pSession->AddTransition( NSS_PREGAME, ( uint )NMT_CHAT, NSS_INGAME, &OnInGame, pContext );
pSession->AddTransition( NSS_INGAME, ( uint )NMT_ERROR, NSS_INGAME, &OnError, pContext );
pSession->AddTransition( NSS_INGAME, ( uint )NMT_CHAT, NSS_INGAME, &OnChat, pContext );
pSession->AddTransition( NSS_INGAME, ( uint )NMT_GOTO, NSS_INGAME, &OnInGame, pContext );
pSession->AddTransition( NSS_INGAME, ( uint )NMT_PATROL, NSS_INGAME, &OnInGame, pContext );
pSession->AddTransition( NSS_INGAME, ( uint )NMT_ADD_WAYPOINT, NSS_INGAME, &OnInGame, pContext );
pSession->AddTransition( NSS_INGAME, ( uint )NMT_GENERIC, NSS_INGAME, &OnInGame, pContext );
pSession->AddTransition( NSS_INGAME, ( uint )NMT_PRODUCE, NSS_INGAME, &OnInGame, pContext );
pSession->AddTransition( NSS_INGAME, ( uint )NMT_PLACE_OBJECT, NSS_INGAME, &OnInGame, pContext );
pSession->AddTransition( NSS_INGAME, ( uint )NMT_RUN, NSS_INGAME, &OnInGame, pContext );
pSession->AddTransition( NSS_INGAME, ( uint )NMT_NOTIFY_REQUEST, NSS_INGAME, &OnInGame, pContext );
pSession->AddTransition( NSS_INGAME, ( uint )NMT_FORMATION_GOTO, NSS_INGAME, &OnInGame, pContext );
pSession->AddTransition( NSS_INGAME, ( uint )NMT_FORMATION_GENERIC, NSS_INGAME, &OnInGame, pContext );
pSession->AddTransition( NSS_INGAME, ( uint )NMT_END_COMMAND_BATCH, NSS_INGAME, &OnInGame, pContext );
pSession->AddTransition( NSS_HANDSHAKE, ( uint )NMT_ERROR, NSS_HANDSHAKE, (void*)&OnError, pContext );
pSession->AddTransition( NSS_HANDSHAKE, ( uint )NMT_CLIENT_HANDSHAKE, NSS_AUTHENTICATE, (void*)&OnHandshake, pContext );
pSession->AddTransition( NSS_AUTHENTICATE, ( uint )NMT_ERROR, NSS_AUTHENTICATE, (void*)&OnError, pContext );
pSession->AddTransition( NSS_AUTHENTICATE, ( uint )NMT_AUTHENTICATE, NSS_PREGAME, (void*)&OnAuthenticate, pContext );
pSession->AddTransition( NSS_AUTHENTICATE, ( uint )NMT_APP_PREGAME, NSS_PREGAME, (void*)&OnPreGame, pContext );
pSession->AddTransition( NSS_AUTHENTICATE, ( uint )NMT_APP_OBSERVER, NSS_INGAME, (void*)&OnChat, pContext );
pSession->AddTransition( NSS_PREGAME, ( uint )NMT_CHAT, NSS_INGAME, (void*)&OnInGame, pContext );
pSession->AddTransition( NSS_INGAME, ( uint )NMT_ERROR, NSS_INGAME, (void*)&OnError, pContext );
pSession->AddTransition( NSS_INGAME, ( uint )NMT_CHAT, NSS_INGAME, (void*)&OnChat, pContext );
pSession->AddTransition( NSS_INGAME, ( uint )NMT_GOTO, NSS_INGAME, (void*)&OnInGame, pContext );
pSession->AddTransition( NSS_INGAME, ( uint )NMT_PATROL, NSS_INGAME, (void*)&OnInGame, pContext );
pSession->AddTransition( NSS_INGAME, ( uint )NMT_ADD_WAYPOINT, NSS_INGAME, (void*)&OnInGame, pContext );
pSession->AddTransition( NSS_INGAME, ( uint )NMT_GENERIC, NSS_INGAME, (void*)&OnInGame, pContext );
pSession->AddTransition( NSS_INGAME, ( uint )NMT_PRODUCE, NSS_INGAME, (void*)&OnInGame, pContext );
pSession->AddTransition( NSS_INGAME, ( uint )NMT_PLACE_OBJECT, NSS_INGAME, (void*)&OnInGame, pContext );
pSession->AddTransition( NSS_INGAME, ( uint )NMT_RUN, NSS_INGAME, (void*)&OnInGame, pContext );
pSession->AddTransition( NSS_INGAME, ( uint )NMT_NOTIFY_REQUEST, NSS_INGAME, (void*)&OnInGame, pContext );
pSession->AddTransition( NSS_INGAME, ( uint )NMT_FORMATION_GOTO, NSS_INGAME, (void*)&OnInGame, pContext );
pSession->AddTransition( NSS_INGAME, ( uint )NMT_FORMATION_GENERIC, NSS_INGAME, (void*)&OnInGame, pContext );
pSession->AddTransition( NSS_INGAME, ( uint )NMT_END_COMMAND_BATCH, NSS_INGAME, (void*)&OnInGame, pContext );
// Set first state
pSession->SetFirstState( NSS_HANDSHAKE );

View File

@ -158,7 +158,7 @@ CScriptEvent::CScriptEvent( const CStrW& Type, size_t TypeCode, bool Cancelable,
m_Type = Type; m_TypeCode = TypeCode;
m_Cancelable = Cancelable; m_Cancelled = false;
m_Blockable = Blockable; m_Blocked = false;
m_Timestamp = (long)( timer_Time() * 1000.0 );
m_Timestamp = (size_t)( timer_Time() * 1000.0 );
}
void CScriptEvent::ScriptingInit()

View File

@ -105,7 +105,7 @@ public:
bool m_Blockable;
// Timestamp (milliseconds since epoch (start of game?))
long m_Timestamp;
size_t m_Timestamp;
// Event type string
CStrW m_Type;

View File

@ -130,8 +130,8 @@ template<> bool ToPrimitive<size_t>( JSContext* cx, jsval v, unsigned& Storage )
return true;
}
/* (See comment in JSConversions.h)
// ssize_t
template<> jsval ToJSVal<ssize_t>( const ssize_t& Native )
{
return( INT_TO_JSVAL( (int)Native ) );
@ -149,6 +149,7 @@ template<> bool ToPrimitive<ssize_t>( JSContext* cx, jsval v, ssize_t& Storage )
Storage = (ssize_t)tmp;
return ok == JS_TRUE;
}
*/
#if ARCH_AMD64

View File

@ -125,9 +125,12 @@ template<> jsval ToJSVal<unsigned>( const unsigned& Native );
template<> jsval ToJSVal<unsigned>( unsigned& Native );
// ssize_t
/* PT: Disabled this since it breaks the GCC build (conflicting with int) - this
might break the build on Windows instead. TODO: find out and clean this up.
template<> bool ToPrimitive<ssize_t>( JSContext* cx, jsval v, ssize_t& Storage );
template<> jsval ToJSVal<ssize_t>( const ssize_t& Native );
template<> jsval ToJSVal<ssize_t>( ssize_t& Native );
*/
// size_t
template<> bool ToPrimitive<size_t>( JSContext* cx, jsval v, size_t& Storage );

View File

@ -6,6 +6,7 @@
#include "Collision.h"
#include "Entity.h"
#include "ps/Overlay.h"
#include "ps/Game.h"
#include "ps/World.h"
#include "graphics/TextureEntry.h"

View File

@ -12,6 +12,7 @@
#include "ps/GameSetup/Config.h"
#include "lib/ogl.h"