mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-24 15:11:56 +00:00
Combat code, some scripting, broken network, and fixed some bugs.
This was SVN commit r1301.
This commit is contained in:
@@ -33,9 +33,9 @@ template<> JSObject* ToScript<CBaseEntity*>( CBaseEntity** Native )
|
||||
return( ToScript<CBaseEntity>( *Native ) );
|
||||
}
|
||||
|
||||
// CObjectEntry*
|
||||
// CObjectEntry
|
||||
|
||||
template<> bool ToPrimitive<CObjectEntry*>( JSContext* cx, jsval v, CObjectEntry*& Storage )
|
||||
template<> bool ToPrimitive<CObjectEntry>( JSContext* cx, jsval v, CObjectEntry*& Storage )
|
||||
{
|
||||
CStrW ActorName;
|
||||
if( !ToPrimitive<CStrW>( cx, v, ActorName ) )
|
||||
@@ -44,7 +44,7 @@ template<> bool ToPrimitive<CObjectEntry*>( JSContext* cx, jsval v, CObjectEntry
|
||||
return( true );
|
||||
}
|
||||
|
||||
template<> jsval ToJSVal<CObjectEntry*>( CObjectEntry*& Native )
|
||||
template<> jsval ToJSVal<CObjectEntry>( CObjectEntry*& Native )
|
||||
{
|
||||
if( !Native )
|
||||
return( ToJSVal<CStrW>( CStrW( L"[No actor]" ) ) );
|
||||
@@ -80,19 +80,19 @@ template<> bool ToPrimitive<CScriptObject>( JSContext* cx, jsval v, CScriptObjec
|
||||
return( true );
|
||||
}
|
||||
|
||||
// i32
|
||||
// int
|
||||
|
||||
template<> jsval ToJSVal<i32>( const i32& Native )
|
||||
template<> jsval ToJSVal<int>( const int& Native )
|
||||
{
|
||||
return( INT_TO_JSVAL( Native ) );
|
||||
}
|
||||
|
||||
template<> jsval ToJSVal<i32>( i32& Native )
|
||||
template<> jsval ToJSVal<int>( int& Native )
|
||||
{
|
||||
return( INT_TO_JSVAL( Native ) );
|
||||
}
|
||||
|
||||
template<> bool ToPrimitive<i32>( JSContext* cx, jsval v, i32& Storage )
|
||||
template<> bool ToPrimitive<int>( JSContext* cx, jsval v, int& Storage )
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -105,6 +105,33 @@ template<> bool ToPrimitive<i32>( JSContext* cx, jsval v, i32& Storage )
|
||||
return( true );
|
||||
}
|
||||
|
||||
// uint
|
||||
|
||||
template<> jsval ToJSVal<uint>( const uint& Native )
|
||||
{
|
||||
return( INT_TO_JSVAL( Native ) );
|
||||
}
|
||||
|
||||
template<> jsval ToJSVal<uint>( uint& Native )
|
||||
{
|
||||
return( INT_TO_JSVAL( Native ) );
|
||||
}
|
||||
|
||||
template<> bool ToPrimitive<uint>( JSContext* cx, jsval v, uint& Storage )
|
||||
{
|
||||
try
|
||||
{
|
||||
int t = g_ScriptingHost.ValueToInt( v );
|
||||
if( t < 0 ) return( false );
|
||||
Storage = t;
|
||||
}
|
||||
catch( PSERROR_Scripting_ConversionFailed )
|
||||
{
|
||||
return( false );
|
||||
}
|
||||
return( true );
|
||||
}
|
||||
|
||||
// double
|
||||
|
||||
template<> jsval ToJSVal<double>( const double& Native )
|
||||
|
||||
Reference in New Issue
Block a user