From d099084dd588d44c054248f396bf38a111479085 Mon Sep 17 00:00:00 2001 From: janwas Date: Wed, 2 May 2007 12:13:05 +0000 Subject: [PATCH] remove apparently no longer used files (contents are empty or commented out) This was SVN commit r5018. --- source/simulation/EntityMessage.h | 52 ------- source/simulation/EntityPredicate.h | 0 source/simulation/EntityProperties.cpp | 204 ------------------------- source/simulation/EntityProperties.h | 187 ----------------------- 4 files changed, 443 deletions(-) delete mode 100644 source/simulation/EntityMessage.h delete mode 100644 source/simulation/EntityPredicate.h delete mode 100644 source/simulation/EntityProperties.cpp delete mode 100644 source/simulation/EntityProperties.h diff --git a/source/simulation/EntityMessage.h b/source/simulation/EntityMessage.h deleted file mode 100644 index 3918daf016..0000000000 --- a/source/simulation/EntityMessage.h +++ /dev/null @@ -1,52 +0,0 @@ -// EntityMessage.h -// -// Mark Thompson mot20@cam.ac.uk / mark@wildfiregames.com -// -// Entity message structure. -// -// Usage: Message types are currently: EMSG_TICK: Sent once per sim frame. -// EMSG_INIT: When a new entity is instantiated. -// At map loading, do not issue this message immediately -// for each entity as it is loaded; instead, wait for all -// entities to be created, then issue this message to all -// of them simultaneously. -// EMSG_ORDER:To push a message into the entity's order queue - -/* -#ifndef MESSAGING_INCLUDED -#define MESSAGING_INCLUDED - -#include "EntityOrders.h" -#include "EntitySupport.h" - -struct CMessage -{ - enum EMessageType - { - EMSG_TICK, - EMSG_INIT, - EMSG_ORDER, - EMSG_DAMAGE - } type; - CMessage( EMessageType _type ) - { - type = _type; - } -}; - -struct CMessageOrder : public CMessage -{ - CMessageOrder( CEntityOrder& _order, bool _queue = false ) : CMessage( EMSG_ORDER ), order( _order ), queue( _queue ) {} - CEntityOrder order; - bool queue; -}; - -struct CMessageDamage : public CMessage -{ - CMessageDamage( HEntity _inflictor, CDamageType _damage ) : CMessage( EMSG_DAMAGE ), inflictor( inflictor ), damage( damage ) {} - HEntity inflictor; - CDamageType damage; -} - -#endif -*/ diff --git a/source/simulation/EntityPredicate.h b/source/simulation/EntityPredicate.h deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/source/simulation/EntityProperties.cpp b/source/simulation/EntityProperties.cpp deleted file mode 100644 index 76b2f3de2f..0000000000 --- a/source/simulation/EntityProperties.cpp +++ /dev/null @@ -1,204 +0,0 @@ -#include "precompiled.h" - -/* -#include "EntityProperties.h" -#include "EntityTemplateCollection.h" -#include "simulation/scripting/JSInterface_EntityTemplate.h" - -#undef new // to avoid confusing warnings - -void IBoundProperty::associate( IBoundPropertyOwner* owner, const CStrW& name ) -{ - m_owner = owner; - owner->m_properties[name] = this; - m_updateFn = NULL; -} - -void IBoundProperty::associate( IBoundPropertyOwner* owner, const CStrW& name, void (IBoundPropertyOwner::*updateFn)() ) -{ - m_owner = owner; - owner->m_properties[name] = this; - m_updateFn = updateFn; -} - -void IBoundProperty::fromjsval( const jsval value ) -{ - set( value ); - if( m_updateFn ) - (m_owner->*m_updateFn)(); -} - -// --- - - - -// --- - -void CBoundProperty::set( const jsval value ) -{ - try - { - m_data = ToPrimitive( value ); - m_inherited = false; - } - catch( ... ) - { - } -} - -jsval CBoundProperty::tojsval() -{ - return( INT_TO_JSVAL( m_data ) ); -} - -void CBoundProperty::set( const jsval value ) -{ - try - { - m_data = ToPrimitive( value ); - m_inherited = false; - } - catch( ... ) - { - } -} - -jsval CBoundProperty::tojsval() -{ - return( BOOLEAN_TO_JSVAL( m_data ) ); -} - -void CBoundProperty::set( const jsval value ) -{ - try - { - m_data = ToPrimitive( value ); - m_inherited = false; - } - catch( ... ) - { - } -} - -jsval CBoundProperty::tojsval() -{ - return( DOUBLE_TO_JSVAL( JS_NewDouble( g_ScriptingHost.getContext(), (jsdouble)m_data ) ) ); -} - -void CBoundObjectProperty::set( const jsval value ) -{ - try - { - m_String = g_ScriptingHost.ValueToString( value ); - m_inherited = false; - } - catch( ... ) - { - } -} - -jsval CBoundObjectProperty::tojsval() -{ - return( STRING_TO_JSVAL( JS_NewStringCopyZ( g_ScriptingHost.getContext(), m_String.c_str() ) ) ); -} - -void CBoundObjectProperty::set( const jsval value ) -{ - try - { - m_String = g_ScriptingHost.ValueToUCString( value ); - m_inherited = false; - } - catch( ... ) - { - } -} - -jsval CBoundObjectProperty::tojsval() -{ - return( STRING_TO_JSVAL( JS_NewUCStringCopyZ( g_ScriptingHost.getContext(), utf16().c_str() ) ) ); -} - -CBoundObjectProperty::CBoundObjectProperty() -{ - m_inherited = false; -} - -void CBoundObjectProperty::set( const jsval value ) -{ - JSObject* vector3d = JSVAL_TO_OBJECT( value ); - JSI_Vector3D::Vector3D_Info* v = NULL; - if( JSVAL_IS_OBJECT( value ) && ( v = (JSI_Vector3D::Vector3D_Info*)JS_GetInstancePrivate( g_ScriptingHost.getContext(), vector3d, &JSI_Vector3D::JSI_class, NULL ) ) ) - { - CVector3D* copy = v->vector; - X = copy->X; - Y = copy->Y; - Z = copy->Z; - m_inherited = false; - } - else - { - X = 0.0f; Y = 0.0f; Z = 0.0f; - } -} - -jsval CBoundObjectProperty::tojsval() -{ - JSObject* vector3d = JS_NewObject( g_ScriptingHost.getContext(), &JSI_Vector3D::JSI_class, NULL, NULL ); - JS_SetPrivate( g_ScriptingHost.getContext(), vector3d, new JSI_Vector3D::Vector3D_Info( this, m_owner, m_updateFn ) ); - return( OBJECT_TO_JSVAL( vector3d ) ); -} - -bool CBoundObjectProperty::rebuild( IBoundProperty* parent, bool triggerFn ) -{ - return( false ); -} - -//-- - -void CBoundObjectProperty::set( const jsval value ) -{ - switch( JS_TypeOfValue( g_ScriptingHost.GetContext(), value ) ) - { - case JSTYPE_STRING: - CompileScript( L"", g_ScriptingHost.ValueToUCString( value ) ); - m_inherited = false; - break; - case JSTYPE_FUNCTION: - Function = JS_ValueToFunction( g_ScriptingHost.GetContext(), value ); - m_inherited = false; - break; - } -} - -jsval CBoundObjectProperty::tojsval() -{ - if( Function ) - return( OBJECT_TO_JSVAL( JS_GetFunctionObject( Function ) ) ); - return( JSVAL_NULL ); -} - -//-- - -void CBoundProperty::set( const jsval value ) -{ - JSObject* baseEntity = JSVAL_TO_OBJECT( value ); - CEntityTemplate* base = NULL; - - if( JSVAL_IS_OBJECT( value ) && ( base = ToNative( g_ScriptingHost.GetContext(), baseEntity ) ) ) - { - m_data = base; - } - else - JS_ReportError( g_ScriptingHost.getContext(), "[EntityTemplate] Invalid reference" ); -} - -jsval CBoundProperty::tojsval() -{ - JSObject* baseEntity = m_data->GetScript(); - return( OBJECT_TO_JSVAL( baseEntity ) ); -} - - - -*/ diff --git a/source/simulation/EntityProperties.h b/source/simulation/EntityProperties.h deleted file mode 100644 index 81ec0aa1a2..0000000000 --- a/source/simulation/EntityProperties.h +++ /dev/null @@ -1,187 +0,0 @@ -// EntityProperties.h -// -// Mark Thompson mot20@cam.ac.uk / mark@wildfiregames.com -// -// Extended properties table, primarily intended for data-inheritable properties and those defined by JavaScript functions. -// -// Usage: These properties are accessed via functions in CEntity/CEntityTemplate -// - -// TODO: Fix the silent failures of the conversion functions: need to work out what to do in these cases. - -// Mark Thompson mot20@cam.ac.uk / mark@wildfiregames.com - -/* -#ifndef ENTITY_PROPERTIES_INCLUDED -#define ENTITY_PROPERTIES_INCLUDED - -#include "ps/CStr.h" -#include "maths/Vector3D.h" -#include "ScriptObject.h" - -#include "simulation/scripting/JSInterface_Entity.h" -#include "maths/scripting/JSInterface_Vector3D.h" - -#if !GCC_VERSION - - - -class IBoundPropertyOwner; -class CEntityTemplate; - -// Property interface - -class IBoundProperty -{ -protected: - IBoundPropertyOwner* m_owner; - void (IBoundPropertyOwner::*m_updateFn)(); - virtual void set( const jsval value ) = 0; -public: - void fromjsval( const jsval value ); - virtual jsval tojsval() = 0; - virtual bool rebuild( IBoundProperty* parent, bool triggerFn = true ) = 0; // Returns true if the rebuild changed the value of this property. - void associate( IBoundPropertyOwner* owner, const CStrW& name ); - void associate( IBoundPropertyOwner* owner, const CStrW& name, void (IBoundPropertyOwner::*updateFn)() ); - virtual ~IBoundProperty() {} -}; - -// Specialize at least: -// - jsval conversion functions (set, tojsval) - -// Generic primitive one: - -template class CBoundProperty : public IBoundProperty -{ - T m_data; - bool m_inherited; - -public: - CBoundProperty() { m_inherited = true; } - CBoundProperty( const T& copy ) { m_inherited = false; m_data = copy; } - operator T&() { return( m_data ); } - operator const T&() const { return( m_data ); } - T& operator=( const T& copy ) { m_inherited = false; return( m_data = copy ); } - - void set( const jsval value ); - jsval tojsval(); - bool rebuild( IBoundProperty* parent, bool triggerFn = true ) - { - if( m_inherited && parent ) - { - *this = *( (CBoundProperty*)parent ); - if( triggerFn && m_updateFn ) - (m_owner->*m_updateFn)(); - } - return( !m_inherited ); - } -}; - -// Generic class one: - -template class CBoundObjectProperty : public IBoundProperty, public T -{ - bool m_inherited; - -public: - CBoundObjectProperty() { m_inherited = true; } - CBoundObjectProperty( const T& copy ) : T( copy ) { m_inherited = false; } - - T& operator=( const T& copy ) - { - IBoundPropertyOwner* sv_owner = m_owner; - void (IBoundPropertyOwner::*sv_updateFn)() = m_updateFn; - - (T&)*this = copy; - - m_owner = sv_owner; - m_updateFn = sv_updateFn; - m_inherited = false; - - return( *this ); - } - void set( const jsval value ); - jsval tojsval(); - bool rebuild( IBoundProperty* parent, bool triggerFn = true ) - { - if( m_inherited && parent ) - { - // Save some properties so they won't be overwritten - IBoundPropertyOwner* sv_owner = m_owner; - void (IBoundPropertyOwner::*sv_updateFn)() = m_updateFn; - - *this = *( (CBoundObjectProperty*)parent ); - - m_owner = sv_owner; - m_updateFn = sv_updateFn; - m_inherited = true; - - if( triggerFn && m_updateFn ) - (m_owner->*m_updateFn)(); - } - return( !m_inherited ); - } -}; - -// And an explicit one: - -template<> class CBoundProperty : public IBoundProperty -{ - CEntityTemplate* m_data; - -public: - CBoundProperty() { m_data = NULL; } - CBoundProperty( CEntityTemplate* copy ) { m_data = copy; } - - operator CEntityTemplate*&() { return( m_data ); } - operator CEntityTemplate*() const { return( m_data ); } - CEntityTemplate*& operator=( CEntityTemplate* copy ) { return( m_data = copy ); } - - // Standard pointerish things - - CEntityTemplate& operator*() { return( *m_data ); } - CEntityTemplate* operator->() { return( m_data ); } - - void set( const jsval value ); - jsval tojsval(); - bool rebuild( IBoundProperty* parent, bool triggerFn = true ) - { - return( false ); // Can't inherit a CEntityTemplate* - } -}; - -// A jsval property -template<> class CBoundProperty : public IBoundProperty -{ - jsval m_data; - bool m_inherited; -public: - CBoundProperty() { m_data = JSVAL_NULL; m_inherited = true; RootJSVal(); } - CBoundProperty( const jsval value ) { set( value ); m_inherited = false; RootJSVal(); } - CBoundProperty( const CStrW& value ) - { - m_data = STRING_TO_JSVAL( JS_NewUCStringCopyZ( g_ScriptingHost.getContext(), value ) ); - RootJSVal(); - } - ~CBoundProperty() - { - UprootJSVal(); - } - void set( const jsval value ) { UprootJSVal(); m_data = value; m_inherited = false; RootJSVal(); } - jsval tojsval() { return( m_data ); } - bool rebuild( IBoundProperty* parent, bool triggerFn = true ) - { - if( m_inherited && parent ) - { - UprootJSVal(); - m_data = ( (CBoundProperty*)parent )->m_data; - RootJSVal(); - } - return( !m_inherited ); - } - void RootJSVal() { if( JSVAL_IS_GCTHING( m_data ) ) JS_AddRoot( g_ScriptingHost.GetContext(), &m_data ); } - void UprootJSVal() { if( JSVAL_IS_GCTHING( m_data ) ) JS_RemoveRoot( g_ScriptingHost.GetContext(), &m_data ); } -}; - -#endif -*/