diff --git a/source/graphics/MeshManager.h b/source/graphics/MeshManager.h index eed4af686f..08e4400585 100755 --- a/source/graphics/MeshManager.h +++ b/source/graphics/MeshManager.h @@ -1,7 +1,7 @@ #ifndef __H_MESHMANAGER_H__ #define __H_MESHMANAGER_H__ -#include "singleton.h" +#include "Singleton.h" #include "graphics/ModelDef.h" #define g_MeshManager CMeshManager::GetSingleton() @@ -20,4 +20,4 @@ private: mesh_map m_MeshMap; }; -#endif \ No newline at end of file +#endif diff --git a/source/lib/detect.cpp b/source/lib/detect.cpp index d52adf5059..3c10950be5 100755 --- a/source/lib/detect.cpp +++ b/source/lib/detect.cpp @@ -119,7 +119,7 @@ int cpu_smp = -1; // are there actually multiple physical processors, // not only logical hyperthreaded CPUs? relevant for wtime. -inline void get_cpu_info() +void get_cpu_info() { #ifdef _WIN32 win_get_cpu_info(); @@ -138,9 +138,14 @@ inline void get_cpu_info() char snd_card[SND_CARD_LEN]; char snd_drv_ver[SND_DRV_VER_LEN]; -inline void get_snd_info() +void get_snd_info() { #ifdef _WIN32 win_get_snd_info(); +#else + // At least reset the values for unhandled platforms. Should perhaps do + // something like storing the OpenAL version or similar. + strcpy(snd_card, "Unknown"); + strcpy(snd_drv_ver, "Unknown"); #endif } diff --git a/source/lib/res/snd.cpp b/source/lib/res/snd.cpp index 2a2c516dd0..ddb98be621 100755 --- a/source/lib/res/snd.cpp +++ b/source/lib/res/snd.cpp @@ -882,7 +882,7 @@ static void hsd_list_free_all() static void SndData_init(SndData* sd, va_list args) { - sd->is_stream = va_arg(args, bool); + sd->is_stream = va_arg(args, int); } static void SndData_dtor(SndData* sd) @@ -1003,7 +1003,7 @@ static Handle snd_data_load(const char* const fn, const bool stream) // (both references would read from the same file handle). const uint flags = stream? RES_UNIQUE : 0; - return h_alloc(H_SndData, fn, flags, stream); + return h_alloc(H_SndData, fn, flags, (int)stream); } diff --git a/source/scripting/JSSerialization.h b/source/scripting/JSSerialization.h index c85acf806a..9db93f1510 100755 --- a/source/scripting/JSSerialization.h +++ b/source/scripting/JSSerialization.h @@ -2,7 +2,7 @@ // // Mark Thompson (mark@wildfiregames.com / mot20@cam.ac.uk) -#include "Serialization.h" +#include "Network/Serialization.h" #include "JSConversions.h" #include "CStr.h" @@ -131,4 +131,4 @@ public: } return( buffer ); } -}; \ No newline at end of file +}; diff --git a/source/scripting/ScriptableObject.h b/source/scripting/ScriptableObject.h index cb04f0edbf..f84e7e01c5 100755 --- a/source/scripting/ScriptableObject.h +++ b/source/scripting/ScriptableObject.h @@ -48,6 +48,13 @@ public: bool m_AllowsInheritance; bool m_Inherited; bool m_Intrinsic; + + // This is to make sure that all the fields are initialized at construction + inline IJSProperty(): + m_AllowsInheritance(true), + m_Inherited(true), + m_Intrinsic(true) + {} virtual jsval Get( JSContext* cx ) = 0; virtual void Set( JSContext* cx, jsval Value ) = 0; diff --git a/source/simulation/BaseEntity.cpp b/source/simulation/BaseEntity.cpp index 9ab5872ffb..e75a9dff64 100755 --- a/source/simulation/BaseEntity.cpp +++ b/source/simulation/BaseEntity.cpp @@ -30,7 +30,7 @@ CBaseEntity::CBaseEntity() // Initialize, make life a little easier on the scriptors m_speed = m_turningRadius = m_meleeRange = m_meleeRangeMin = 0.0f; - m_extant = true; m_corpse = NULL; + m_extant = true; m_corpse = CStrW(); m_bound_type = CBoundingObject::BOUND_NONE; m_bound_circle = NULL; @@ -226,6 +226,7 @@ void CBaseEntity::XMLLoadProperty( const CXeromyces& XeroFile, const XMBElement& XMBAttribute Attribute = AttributeSet.item( AttributeID ); CStrW AttributeName = PropertyName + CStr8( XeroFile.getAttributeString( Attribute.Name ) ); Existing = HasProperty( AttributeName ); + if( Existing ) { Existing->Set( ToJSVal( Attribute.Value ) ); @@ -253,7 +254,7 @@ void CBaseEntity::XMLLoadProperty( const CXeromyces& XeroFile, const XMBElement& void CBaseEntity::ScriptingInit() { - AddMethod( "toString", 0 ); + AddMethod( "toString", 0 ); CJSObject::ScriptingInit( "EntityTemplate" ); } diff --git a/source/simulation/Entity.cpp b/source/simulation/Entity.cpp index 127d0f56dc..d01d4964f0 100755 --- a/source/simulation/Entity.cpp +++ b/source/simulation/Entity.cpp @@ -587,12 +587,12 @@ void CEntity::renderSelectionOutline( float alpha ) void CEntity::ScriptingInit() { - AddMethod( "toString", 0 ); - AddMethod( "order", 1 ); - AddMethod( "orderQueued", 1 ); - AddMethod( "kill", 0 ); - AddMethod( "damage", 1 ); - AddMethod( "isIdle", 0 ); + AddMethod( "toString", 0 ); + AddMethod( "order", 1 ); + AddMethod( "orderQueued", 1 ); + AddMethod( "kill", 0 ); + AddMethod( "damage", 1 ); + AddMethod( "isIdle", 0 ); CJSObject::ScriptingInit( "Entity", Construct, 2 ); } @@ -745,7 +745,8 @@ bool CEntity::Damage( JSContext* cx, uintN argc, jsval* argv ) if( argc >= 3 ) { - Damage( CDamageType( ToPrimitive( argv[0] ), ToPrimitive( argv[1] ), ToPrimitive( argv[2] ) ), inflictor ); + CDamageType dmgType( ToPrimitive( argv[0] ), ToPrimitive( argv[1] ), ToPrimitive( argv[2] ) ); + Damage( dmgType, inflictor ); return( true ); } @@ -762,8 +763,10 @@ bool CEntity::Damage( JSContext* cx, uintN argc, jsval* argv ) float dmgN; if( !ToPrimitive( cx, argv[0], dmgN ) ) return( false ); + + CDamageType dmgType( dmgN ); - Damage( CDamageType( dmgN ), inflictor ); + Damage( dmgType, inflictor ); return( true ); } diff --git a/source/simulation/Entity.h b/source/simulation/Entity.h index 66ab33ad41..d975a6210b 100755 --- a/source/simulation/Entity.h +++ b/source/simulation/Entity.h @@ -116,7 +116,7 @@ public: private: CEntity( CBaseEntity* base, CVector3D position, float orientation ); - EGotoSituation processGotoHelper( CEntityOrder* current, size_t timestep_milli, HEntity& collide ); + /*EGotoSituation*/ uint processGotoHelper( CEntityOrder* current, size_t timestep_milli, HEntity& collide ); bool processAttackMelee( CEntityOrder* current, size_t timestep_milli ); bool processAttackMeleeNoPathing( CEntityOrder* current, size_t timestep_milli ); bool processGotoNoPathing( CEntityOrder* current, size_t timestep_milli ); diff --git a/source/simulation/EntityMessage.h b/source/simulation/EntityMessage.h index f81f313720..3918daf016 100755 --- a/source/simulation/EntityMessage.h +++ b/source/simulation/EntityMessage.h @@ -49,4 +49,4 @@ struct CMessageDamage : public CMessage } #endif -*/ \ No newline at end of file +*/ diff --git a/source/simulation/EntityStateProcessing.cpp b/source/simulation/EntityStateProcessing.cpp index f7b5f2116b..b5e9a55c7e 100755 --- a/source/simulation/EntityStateProcessing.cpp +++ b/source/simulation/EntityStateProcessing.cpp @@ -25,7 +25,7 @@ enum EGotoSituation // Does all the shared processing for line-of-sight gotos -EGotoSituation CEntity::processGotoHelper( CEntityOrder* current, size_t timestep_millis, HEntity& collide ) +uint CEntity::processGotoHelper( CEntityOrder* current, size_t timestep_millis, HEntity& collide ) { float timestep=timestep_millis/1000.0f; diff --git a/source/simulation/EntitySupport.h b/source/simulation/EntitySupport.h index b918e68a57..e3942972f0 100755 --- a/source/simulation/EntitySupport.h +++ b/source/simulation/EntitySupport.h @@ -1,7 +1,6 @@ // Supporting data types for CEntity and related class CEntityManager; -enum EGotoSituation; class CDamageType : public CJSObject { diff --git a/source/simulation/EventHandlers.cpp b/source/simulation/EventHandlers.cpp index 5479165dfc..590b83d9cb 100755 --- a/source/simulation/EventHandlers.cpp +++ b/source/simulation/EventHandlers.cpp @@ -42,4 +42,4 @@ CEventOrderTransition::CEventOrderTransition( int orderPrevious, int orderCurren AddProperty( L"orderCurrent", &m_orderCurrent ); AddProperty( L"target", m_target ); AddProperty( L"position", m_worldPosition ); -} \ No newline at end of file +} diff --git a/source/simulation/PathfindEngine.cpp b/source/simulation/PathfindEngine.cpp index 8181bc1b28..4f95d7c84f 100755 --- a/source/simulation/PathfindEngine.cpp +++ b/source/simulation/PathfindEngine.cpp @@ -32,4 +32,4 @@ void CPathfindEngine::requestMeleeAttackPath( HEntity entity, HEntity target ) it->m_data[0].entity = target; } } -} \ No newline at end of file +} diff --git a/source/sound/JSI_Sound.cpp b/source/sound/JSI_Sound.cpp index 97438af6f2..ddae3cc6cc 100755 --- a/source/sound/JSI_Sound.cpp +++ b/source/sound/JSI_Sound.cpp @@ -109,4 +109,4 @@ JSBool JSI_Sound::Construct( JSContext* cx, JSObject* obj, unsigned int argc, js *rval = OBJECT_TO_JSVAL( newObject->GetScript() ); return( JS_TRUE ); -} \ No newline at end of file +}