diff --git a/source/graphics/MapReader.cpp b/source/graphics/MapReader.cpp index b08b3cd064..521ca94653 100644 --- a/source/graphics/MapReader.cpp +++ b/source/graphics/MapReader.cpp @@ -7,8 +7,8 @@ #include "ps/Game.h" #include "ObjectManager.h" #include "simulation/Entity.h" -#include "simulation/BaseEntity.h" -#include "simulation/BaseEntityCollection.h" +#include "simulation/EntityTemplate.h" +#include "simulation/EntityTemplateCollection.h" #include "simulation/EntityManager.h" #include "ps/CLogger.h" #include "maths/MathUtil.h" @@ -533,7 +533,7 @@ int CXMLReader::ReadEntities(XMBElement parent, double end_time) debug_warn("Invalid map XML data"); } - CBaseEntity* base = g_EntityTemplateCollection.getTemplate( TemplateName, g_Game->GetPlayer(PlayerID) ); + CEntityTemplate* base = g_EntityTemplateCollection.getTemplate( TemplateName, g_Game->GetPlayer(PlayerID) ); if (! base) LOG(ERROR, LOG_CATEGORY, "Failed to load entity template '%ls'", TemplateName.c_str()); else diff --git a/source/graphics/MapWriter.cpp b/source/graphics/MapWriter.cpp index a214f5e208..eb61d75d29 100644 --- a/source/graphics/MapWriter.cpp +++ b/source/graphics/MapWriter.cpp @@ -24,8 +24,8 @@ #include "ps/XML/XMLWriter.h" #include "renderer/SkyManager.h" #include "renderer/WaterManager.h" -#include "simulation/BaseEntity.h" -#include "simulation/BaseEntityCollection.h" +#include "simulation/EntityTemplate.h" +#include "simulation/EntityTemplateCollection.h" #include "simulation/Entity.h" /////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/graphics/ObjectManager.cpp b/source/graphics/ObjectManager.cpp index 9008192dbe..7afc9b3045 100644 --- a/source/graphics/ObjectManager.cpp +++ b/source/graphics/ObjectManager.cpp @@ -10,7 +10,7 @@ #include "ObjectEntry.h" #include "simulation/Entity.h" #include "simulation/EntityManager.h" -#include "simulation/BaseEntity.h" +#include "simulation/EntityTemplate.h" #include "ps/Game.h" #include "Model.h" #include "Unit.h" diff --git a/source/graphics/ObjectManager.h b/source/graphics/ObjectManager.h index 571102313b..16d3ea6c30 100644 --- a/source/graphics/ObjectManager.h +++ b/source/graphics/ObjectManager.h @@ -8,7 +8,7 @@ #include "ObjectBase.h" class CObjectEntry; -class CBaseEntity; +class CEntityTemplate; class CMatrix3D; // access to sole CObjectManager object diff --git a/source/ps/GameSetup/GameSetup.cpp b/source/ps/GameSetup/GameSetup.cpp index ef8e6b5953..0372f6b0ef 100644 --- a/source/ps/GameSetup/GameSetup.cpp +++ b/source/ps/GameSetup/GameSetup.cpp @@ -46,7 +46,7 @@ #include "renderer/VertexBufferManager.h" #include "maths/MathUtil.h" -#include "simulation/BaseEntityCollection.h" +#include "simulation/EntityTemplateCollection.h" #include "simulation/FormationCollection.h" #include "simulation/TechnologyCollection.h" #include "simulation/Entity.h" @@ -59,8 +59,6 @@ #include "scripting/ScriptingHost.h" #include "scripting/GameEvents.h" -#include "simulation/scripting/JSInterface_Entity.h" -#include "simulation/scripting/JSInterface_BaseEntity.h" #include "maths/scripting/JSInterface_Vector3D.h" #include "graphics/scripting/JSInterface_Camera.h" #include "ps/scripting/JSInterface_Selection.h" @@ -489,7 +487,7 @@ static void InitScripting() // Register the JavaScript interfaces with the runtime CEntity::ScriptingInit(); - CBaseEntity::ScriptingInit(); + CEntityTemplate::ScriptingInit(); JSI_Sound::ScriptingInit(); CProfileNode::ScriptingInit(); @@ -1011,7 +1009,7 @@ void Init(int argc, char* argv[], uint flags) { TIMER("Init_entitiessection"); // This needs to be done after the renderer has loaded all its actors... - new CBaseEntityCollection; + new CEntityTemplateCollection; new CFormationCollection; new CTechnologyCollection; g_EntityFormationCollection.loadTemplates(); diff --git a/source/ps/Interact.cpp b/source/ps/Interact.cpp index 02229fed96..a3b4a16bd7 100644 --- a/source/ps/Interact.cpp +++ b/source/ps/Interact.cpp @@ -25,7 +25,7 @@ #include "ps/World.h" #include "renderer/Renderer.h" #include "scripting/GameEvents.h" -#include "simulation/BaseEntityCollection.h" +#include "simulation/EntityTemplateCollection.h" #include "simulation/BoundingObjects.h" #include "simulation/Collision.h" #include "simulation/Entity.h" @@ -1276,7 +1276,7 @@ bool isMouseoverType( CEntity* ev, void* UNUSED(userdata) ) std::vector::iterator it; for( it = g_Mouseover.m_mouseover.begin(); it < g_Mouseover.m_mouseover.end(); it++ ) { - if( it->isActive && ( (CBaseEntity*)it->entity->m_base == (CBaseEntity*)ev->m_base ) + if( it->isActive && ( (CEntityTemplate*)it->entity->m_base == (CEntityTemplate*)ev->m_base ) && ( it->entity->GetPlayer() == ev->GetPlayer() ) ) return( true ); } diff --git a/source/ps/Interact.h b/source/ps/Interact.h index 53c0475aa2..663738f433 100644 --- a/source/ps/Interact.h +++ b/source/ps/Interact.h @@ -16,7 +16,7 @@ class CVector3D; class CUnit; -class CBaseEntity; +class CEntityTemplate; class CBoundingObject; #define MAX_BOOKMARKS 10 @@ -155,7 +155,7 @@ struct CBuildingPlacer : public Singleton } CStrW m_templateName; - CBaseEntity* m_template; + CEntityTemplate* m_template; bool m_active; bool m_clicked; bool m_dragged; diff --git a/source/ps/World.cpp b/source/ps/World.cpp index aaa2c99b97..88bf13d02e 100644 --- a/source/ps/World.cpp +++ b/source/ps/World.cpp @@ -17,7 +17,7 @@ #include "ps/LoaderThunks.h" #include "ps/World.h" #include "renderer/Renderer.h" -#include "simulation/BaseEntityCollection.h" +#include "simulation/EntityTemplateCollection.h" #include "simulation/EntityManager.h" #include "simulation/EntityManager.h" #include "simulation/LOSManager.h" @@ -44,7 +44,7 @@ CWorld::CWorld(CGame *pGame): void CWorld::Initialize(CGameAttributes *pAttribs) { // TODO: Find a better way of handling these global things - ONCE(RegMemFun(CBaseEntityCollection::GetSingletonPtr(), &CBaseEntityCollection::loadTemplates, L"LoadTemplates", 15)); + ONCE(RegMemFun(CEntityTemplateCollection::GetSingletonPtr(), &CEntityTemplateCollection::loadTemplates, L"LoadTemplates", 15)); // Load the map, if one was specified if (pAttribs->m_MapFile.Length()) diff --git a/source/scripting/DOMEvent.h b/source/scripting/DOMEvent.h index d3276d618e..46ec7522e9 100644 --- a/source/scripting/DOMEvent.h +++ b/source/scripting/DOMEvent.h @@ -48,7 +48,7 @@ public: before = obj; } // Set target that will receive each event after it is processed. - // used by Entity and BaseEntity. + // used by Entity and EntityTemplate. inline void SetNextObject( IEventTarget* obj ) { after = obj; diff --git a/source/scripting/JSConversions.cpp b/source/scripting/JSConversions.cpp index 2b3e83d869..47458b621d 100644 --- a/source/scripting/JSConversions.cpp +++ b/source/scripting/JSConversions.cpp @@ -5,7 +5,7 @@ #include "maths/scripting/JSInterface_Vector3D.h" #include "ps/Parser.h" #include "ps/Player.h" -#include "simulation/BaseEntity.h" +#include "simulation/EntityTemplate.h" #include "lib/sysdep/sysdep.h" // finite #include @@ -38,20 +38,20 @@ template<> JSObject* ToScript( CPlayer** Native ) return( ToScript( *Native ) ); } -// CBaseEntity* +// CEntityTemplate* -template<> bool ToPrimitive( JSContext* cx, jsval v, CBaseEntity*& Storage ) +template<> bool ToPrimitive( JSContext* cx, jsval v, CEntityTemplate*& Storage ) { if( !JSVAL_IS_OBJECT( v ) || ( v == JSVAL_NULL ) ) return( false ); - CBaseEntity* Data = (CBaseEntity*)JS_GetInstancePrivate( cx, JSVAL_TO_OBJECT( v ), &CBaseEntity::JSI_class, NULL ); + CEntityTemplate* Data = (CEntityTemplate*)JS_GetInstancePrivate( cx, JSVAL_TO_OBJECT( v ), &CEntityTemplate::JSI_class, NULL ); if( !Data ) return( false ); Storage = Data; return( true ); } -template<> JSObject* ToScript( CBaseEntity** Native ) +template<> JSObject* ToScript( CEntityTemplate** Native ) { - return( ToScript( *Native ) ); + return( ToScript( *Native ) ); } // CVector3D diff --git a/source/scripting/JSConversions.h b/source/scripting/JSConversions.h index ce8722ea8d..f9986491fc 100644 --- a/source/scripting/JSConversions.h +++ b/source/scripting/JSConversions.h @@ -8,7 +8,7 @@ class CEntity; class HEntity; -class CBaseEntity; +class CEntityTemplate; class CStrW; class CScriptObject; class CObjectEntry; @@ -95,9 +95,9 @@ template<> CVector3D* ToNative( JSContext* cx, JSObject* obj ); template<> JSObject* ToScript( CVector3D* Native ); template<> jsval ToJSVal( const CVector3D& Native ); -// CBaseEntity -template<> bool ToPrimitive( JSContext* cx, jsval v, CBaseEntity*& Storage ); -template<> JSObject* ToScript( CBaseEntity** Native ); +// CEntityTemplate +template<> bool ToPrimitive( JSContext* cx, jsval v, CEntityTemplate*& Storage ); +template<> JSObject* ToScript( CEntityTemplate** Native ); // CObjectEntry template<> bool ToPrimitive( JSContext* cx, jsval v, CObjectEntry*& Storage ); diff --git a/source/scripting/ScriptGlue.cpp b/source/scripting/ScriptGlue.cpp index a9a35dabc2..6085604064 100644 --- a/source/scripting/ScriptGlue.cpp +++ b/source/scripting/ScriptGlue.cpp @@ -33,7 +33,7 @@ #include "renderer/Renderer.h" #include "renderer/SkyManager.h" #include "renderer/WaterManager.h" -#include "simulation/BaseEntityCollection.h" +#include "simulation/EntityTemplateCollection.h" #include "simulation/TechnologyCollection.h" #include "simulation/Entity.h" #include "simulation/EntityFormation.h" @@ -43,8 +43,6 @@ #include "simulation/LOSManager.h" #include "simulation/Scheduler.h" #include "simulation/Simulation.h" -#include "simulation/scripting/JSInterface_BaseEntity.h" -#include "simulation/scripting/JSInterface_Entity.h" #ifndef NO_GUI # include "gui/scripting/JSInterface_IGUIObject.h" @@ -192,7 +190,7 @@ JSBool getEntityTemplate( JSContext* cx, JSObject*, uint argc, jsval* argv, jsva return( JS_TRUE ); } - CBaseEntity* v = g_EntityTemplateCollection.getTemplate( templateName, player ); + CEntityTemplate* v = g_EntityTemplateCollection.getTemplate( templateName, player ); if( !v ) { JS_ReportError( cx, "No such template: %s", CStr8(templateName).c_str() ); diff --git a/source/simulation/Entity.cpp b/source/simulation/Entity.cpp index a6129005dd..c07739ea01 100644 --- a/source/simulation/Entity.cpp +++ b/source/simulation/Entity.cpp @@ -6,7 +6,7 @@ #include "Entity.h" #include "EntityManager.h" -#include "BaseEntityCollection.h" +#include "EntityTemplateCollection.h" #include "graphics/Unit.h" #include "Aura.h" #include "ProductionQueue.h" @@ -35,7 +35,7 @@ extern int g_xres, g_yres; #include using namespace std; -CEntity::CEntity( CBaseEntity* base, CVector3D position, float orientation, const std::set& actorSelections, CStrW building ) +CEntity::CEntity( CEntityTemplate* base, CVector3D position, float orientation, const std::set& actorSelections, CStrW building ) { ent_flags = 0; @@ -1395,9 +1395,9 @@ void CEntity::ScriptingInit() AddMethod("getRallyPoint", 0 ); AddClassProperty( L"traits.id.classes", (GetFn)&CEntity::getClassSet, (SetFn)&CEntity::setClassSet ); - AddClassProperty( L"template", (CBaseEntity* CEntity::*)&CEntity::m_base, false, (NotifyFn)&CEntity::loadBase ); + AddClassProperty( L"template", (CEntityTemplate* CEntity::*)&CEntity::m_base, false, (NotifyFn)&CEntity::loadBase ); - /* Anything inherited property MUST be added to BaseEntity.cpp as well */ + /* Anything inherited property MUST be added to EntityTemplate.cpp as well */ AddClassProperty( L"actions.move.speed_curr", &CEntity::m_speed ); AddClassProperty( L"actions.move.run.speed", &CEntity::m_runSpeed ); @@ -1468,14 +1468,14 @@ JSBool CEntity::Construct( JSContext* cx, JSObject* UNUSED(obj), uint argc, jsva CVector3D position; float orientation = (float)( PI * ( (double)( rand() & 0x7fff ) / (double)0x4000 ) ); - JSObject* jsBaseEntity = JSVAL_TO_OBJECT( argv[0] ); + JSObject* jsEntityTemplate = JSVAL_TO_OBJECT( argv[0] ); CStrW templateName; CPlayer* player = g_Game->GetPlayer( 0 ); - CBaseEntity* baseEntity = NULL; - if( JSVAL_IS_OBJECT( argv[0] ) ) // only set baseEntity if jsBaseEntity is a valid object - baseEntity = ToNative( cx, jsBaseEntity ); + CEntityTemplate* baseEntity = NULL; + if( JSVAL_IS_OBJECT( argv[0] ) ) // only set baseEntity if jsEntityTemplate is a valid object + baseEntity = ToNative( cx, jsEntityTemplate ); if( !baseEntity ) { @@ -1719,7 +1719,7 @@ jsval CEntity::GetSpawnPoint( JSContext* UNUSED(cx), uintN argc, jsval* argv ) float spawn_clearance = 2.0f; if( argc >= 1 ) { - CBaseEntity* be = ToNative( argv[0] ); + CEntityTemplate* be = ToNative( argv[0] ); if( be ) { switch( be->m_bound_type ) diff --git a/source/simulation/Entity.h b/source/simulation/Entity.h index 9e82a71d96..5448176893 100644 --- a/source/simulation/Entity.h +++ b/source/simulation/Entity.h @@ -37,13 +37,13 @@ #include "EntitySupport.h" #include "scripting/DOMEvent.h" -// JW: must be pulled in because CEntity no longer mirrors CBaseEntity exactly. +// JW: must be pulled in because CEntity no longer mirrors CEntityTemplate exactly. // some fields have been moved out of CEntity and are accessed via m_base, -// so CBaseEntity must be fully defined. -#include "BaseEntity.h" +// so CEntityTemplate must be fully defined. +#include "EntityTemplate.h" class CAura; -//class CBaseEntity; // see comment above +//class CEntityTemplate; // see comment above class CBoundingObject; class CPlayer; class CProductionQueue; @@ -94,7 +94,7 @@ public: CPlayer* m_player; // Intrinsic properties - CBaseEntity* m_base; + CEntityTemplate* m_base; // The class types this entity has SClassSet m_classes; @@ -234,7 +234,7 @@ public: std::vector m_sectorValues; - /* JW: these have all been 'moved' (1) into BaseEntity: + /* JW: these have all been 'moved' (1) into EntityTemplate: 1: were already present there, just removed from here int m_sectorDivs; @@ -274,7 +274,7 @@ public: private: - CEntity( CBaseEntity* base, CVector3D position, float orientation, const std::set& actorSelections, CStrW building = L"" ); + CEntity( CEntityTemplate* base, CVector3D position, float orientation, const std::set& actorSelections, CStrW building = L"" ); uint processGotoHelper( CEntityOrder* current, size_t timestep_milli, HEntity& collide ); diff --git a/source/simulation/EntityManager.cpp b/source/simulation/EntityManager.cpp index 7a82671139..af593ecdaa 100644 --- a/source/simulation/EntityManager.cpp +++ b/source/simulation/EntityManager.cpp @@ -2,7 +2,7 @@ #include "precompiled.h" #include "EntityManager.h" -#include "BaseEntityCollection.h" +#include "EntityTemplateCollection.h" #include "ps/ConfigDB.h" #include "ps/Profile.h" #include "graphics/Terrain.h" @@ -70,7 +70,7 @@ void CEntityManager::deleteAll() m_extant = true; } -HEntity CEntityManager::create( CBaseEntity* base, CVector3D position, float orientation, const std::set& actorSelections ) +HEntity CEntityManager::create( CEntityTemplate* base, CVector3D position, float orientation, const std::set& actorSelections ) { debug_assert( base ); if( !base ) @@ -95,7 +95,7 @@ HEntity CEntityManager::create( CBaseEntity* base, CVector3D position, float ori HEntity CEntityManager::create( CStrW templateName, CPlayer* player, CVector3D position, float orientation ) { - CBaseEntity* base = g_EntityTemplateCollection.getTemplate( templateName, player ); + CEntityTemplate* base = g_EntityTemplateCollection.getTemplate( templateName, player ); debug_assert( base ); if( !base ) return HEntity(); @@ -107,7 +107,7 @@ HEntity CEntityManager::create( CStrW templateName, CPlayer* player, CVector3D p HEntity CEntityManager::createFoundation( CStrW templateName, CPlayer* player, CVector3D position, float orientation ) { - CBaseEntity* base = g_EntityTemplateCollection.getTemplate( templateName, player ); + CEntityTemplate* base = g_EntityTemplateCollection.getTemplate( templateName, player ); debug_assert( base ); if( !base ) return HEntity(); @@ -117,7 +117,7 @@ HEntity CEntityManager::createFoundation( CStrW templateName, CPlayer* player, C if( base->m_foundation == L"" ) return create( base, position, orientation, selections ); // Entity has no foundation, so just create it - CBaseEntity* foundation = g_EntityTemplateCollection.getTemplate( base->m_foundation ); + CEntityTemplate* foundation = g_EntityTemplateCollection.getTemplate( base->m_foundation ); debug_assert( foundation ); if( !foundation ) return HEntity(); diff --git a/source/simulation/EntityManager.h b/source/simulation/EntityManager.h index bdb9994bdf..67c0acbc59 100644 --- a/source/simulation/EntityManager.h +++ b/source/simulation/EntityManager.h @@ -27,7 +27,7 @@ #include "ps/CStr.h" #include "maths/Vector3D.h" -class CBaseEntity; +class CEntityTemplate; #define MAX_HANDLES 4096 @@ -53,7 +53,7 @@ public: CEntityManager(); ~CEntityManager(); - HEntity create( CBaseEntity* base, CVector3D position, float orientation, + HEntity create( CEntityTemplate* base, CVector3D position, float orientation, const std::set& actorSelections ); HEntity create( CStrW templateName, CPlayer* player, CVector3D position, diff --git a/source/simulation/EntityProperties.cpp b/source/simulation/EntityProperties.cpp index 12948884bf..76b2f3de2f 100644 --- a/source/simulation/EntityProperties.cpp +++ b/source/simulation/EntityProperties.cpp @@ -2,8 +2,8 @@ /* #include "EntityProperties.h" -#include "BaseEntityCollection.h" -#include "simulation/scripting/JSInterface_BaseEntity.h" +#include "EntityTemplateCollection.h" +#include "simulation/scripting/JSInterface_EntityTemplate.h" #undef new // to avoid confusing warnings @@ -180,20 +180,20 @@ jsval CBoundObjectProperty::tojsval() //-- -void CBoundProperty::set( const jsval value ) +void CBoundProperty::set( const jsval value ) { JSObject* baseEntity = JSVAL_TO_OBJECT( value ); - CBaseEntity* base = NULL; + CEntityTemplate* base = NULL; - if( JSVAL_IS_OBJECT( value ) && ( base = ToNative( g_ScriptingHost.GetContext(), baseEntity ) ) ) + if( JSVAL_IS_OBJECT( value ) && ( base = ToNative( g_ScriptingHost.GetContext(), baseEntity ) ) ) { m_data = base; } else - JS_ReportError( g_ScriptingHost.getContext(), "[BaseEntity] Invalid reference" ); + JS_ReportError( g_ScriptingHost.getContext(), "[EntityTemplate] Invalid reference" ); } -jsval CBoundProperty::tojsval() +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 index fda1013740..7287ec7b11 100644 --- a/source/simulation/EntityProperties.h +++ b/source/simulation/EntityProperties.h @@ -4,7 +4,7 @@ // // Extended properties table, primarily intended for data-inheritable properties and those defined by JavaScript functions. // -// Usage: These properties are accessed via functions in CEntity/CBaseEntity +// 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. @@ -27,7 +27,7 @@ class IBoundPropertyOwner; -class CBaseEntity; +class CEntityTemplate; // Property interface @@ -125,28 +125,28 @@ public: // And an explicit one: -template<> class CBoundProperty : public IBoundProperty +template<> class CBoundProperty : public IBoundProperty { - CBaseEntity* m_data; + CEntityTemplate* m_data; public: CBoundProperty() { m_data = NULL; } - CBoundProperty( CBaseEntity* copy ) { m_data = copy; } + CBoundProperty( CEntityTemplate* copy ) { m_data = copy; } - operator CBaseEntity*&() { return( m_data ); } - operator CBaseEntity*() const { return( m_data ); } - CBaseEntity*& operator=( CBaseEntity* copy ) { return( 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 - CBaseEntity& operator*() { return( *m_data ); } - CBaseEntity* operator->() { return( m_data ); } + 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 CBaseEntity* + return( false ); // Can't inherit a CEntityTemplate* } }; diff --git a/source/simulation/EntityStateProcessing.cpp b/source/simulation/EntityStateProcessing.cpp index f66ac93a8d..a3ab69b653 100644 --- a/source/simulation/EntityStateProcessing.cpp +++ b/source/simulation/EntityStateProcessing.cpp @@ -3,7 +3,7 @@ #include "precompiled.h" #include "Entity.h" -#include "BaseEntity.h" +#include "EntityTemplate.h" #include "graphics/Model.h" #include "graphics/ObjectEntry.h" #include "graphics/SkeletonAnim.h" diff --git a/source/simulation/BaseEntity.cpp b/source/simulation/EntityTemplate.cpp similarity index 65% rename from source/simulation/BaseEntity.cpp rename to source/simulation/EntityTemplate.cpp index 571610cc8e..4ad6339b4d 100644 --- a/source/simulation/BaseEntity.cpp +++ b/source/simulation/EntityTemplate.cpp @@ -1,7 +1,7 @@ #include "precompiled.h" -#include "BaseEntity.h" -#include "BaseEntityCollection.h" +#include "EntityTemplate.h" +#include "EntityTemplateCollection.h" #include "graphics/ObjectManager.h" #include "ps/CStr.h" #include "ps/Player.h" @@ -11,9 +11,9 @@ #include "ps/CLogger.h" #define LOG_CATEGORY "entity" -STL_HASH_SET CBaseEntity::scriptsLoaded; +STL_HASH_SET CEntityTemplate::scriptsLoaded; -CBaseEntity::CBaseEntity( CPlayer* player ) +CEntityTemplate::CEntityTemplate( CPlayer* player ) { m_player = player; m_base = NULL; @@ -48,7 +48,7 @@ CBaseEntity::CBaseEntity( CPlayer* player ) m_bound_box = NULL; } -CBaseEntity::~CBaseEntity() +CEntityTemplate::~CEntityTemplate() { if( m_bound_box ) delete( m_bound_box ); @@ -56,7 +56,7 @@ CBaseEntity::~CBaseEntity() delete( m_bound_circle ); } -void CBaseEntity::loadBase() +void CEntityTemplate::loadBase() { // Don't bother if we're providing a replacement. if( m_bound_type == CBoundingObject::BOUND_NONE ) @@ -81,7 +81,7 @@ void CBaseEntity::loadBase() SetNextObject( m_base ); } -jsval CBaseEntity::getClassSet() +jsval CEntityTemplate::getClassSet() { STL_HASH_SET::iterator it; it = m_classes.m_Set.begin(); @@ -91,7 +91,7 @@ jsval CBaseEntity::getClassSet() return( ToJSVal( result ) ); } -void CBaseEntity::setClassSet( jsval value ) +void CEntityTemplate::setClassSet( jsval value ) { // Get the set that was passed in. CStr temp = ToPrimitive( value ); @@ -139,7 +139,7 @@ void CBaseEntity::setClassSet( jsval value ) rebuildClassSet(); } -void CBaseEntity::rebuildClassSet() +void CEntityTemplate::rebuildClassSet() { m_classes.Rebuild(); InheritorsList::iterator it; @@ -147,7 +147,7 @@ void CBaseEntity::rebuildClassSet() (*it)->rebuildClassSet(); } -bool CBaseEntity::loadXML( CStr filename ) +bool CEntityTemplate::loadXML( CStr filename ) { CXeromyces XeroFile; if (XeroFile.Load(filename) != PSRETURN_OK) @@ -178,7 +178,7 @@ bool CBaseEntity::loadXML( CStr filename ) if( Root.getNodeName() != el_entity ) { - LOG( ERROR, LOG_CATEGORY, "CBaseEntity::LoadXML: XML root was not \"Entity\" in file %s. Load failed.", filename.c_str() ); + LOG( ERROR, LOG_CATEGORY, "CEntityTemplate::LoadXML: XML root was not \"Entity\" in file %s. Load failed.", filename.c_str() ); return( false ); } @@ -191,7 +191,7 @@ bool CBaseEntity::loadXML( CStr filename ) // Load our parent, if we have one if( m_Base_Name.Length() ) { - CBaseEntity* base = g_EntityTemplateCollection.getTemplate( m_Base_Name, m_player ); + CEntityTemplate* base = g_EntityTemplateCollection.getTemplate( m_Base_Name, m_player ); if( base ) { m_base = base; @@ -307,7 +307,7 @@ bool CBaseEntity::loadXML( CStr filename ) JSFunction* fn = JS_ValueToFunction( g_ScriptingHost.GetContext(), fnval ); if( !fn ) { - LOG( ERROR, LOG_CATEGORY, "CBaseEntity::LoadXML: Function does not exist for event %hs in file %s. Load failed.", EventName.c_str(), filename.c_str() ); + LOG( ERROR, LOG_CATEGORY, "CEntityTemplate::LoadXML: Function does not exist for event %hs in file %s. Load failed.", EventName.c_str(), filename.c_str() ); break; } m_EventHandlers[eventID].SetFunction( fn ); @@ -338,7 +338,7 @@ bool CBaseEntity::loadXML( CStr filename ) return true; } -void CBaseEntity::XMLLoadProperty( const CXeromyces& XeroFile, const XMBElement& Source, CStrW BasePropertyName ) +void CEntityTemplate::XMLLoadProperty( const CXeromyces& XeroFile, const XMBElement& Source, CStrW BasePropertyName ) { // Add a property, put the node text into it. CStrW PropertyName = BasePropertyName + CStr8( XeroFile.getElementString( Source.getNodeName() ) ); @@ -347,7 +347,7 @@ void CBaseEntity::XMLLoadProperty( const CXeromyces& XeroFile, const XMBElement& if( Existing ) { if( !Existing->m_Intrinsic ) - LOG( WARNING, LOG_CATEGORY, "CBaseEntity::XMLAddProperty: %ls already defined for %ls. Property trees will be merged.", PropertyName.c_str(), m_Tag.c_str() ); + LOG( WARNING, LOG_CATEGORY, "CEntityTemplate::XMLAddProperty: %ls already defined for %ls. Property trees will be merged.", PropertyName.c_str(), m_Tag.c_str() ); Existing->Set( this, JSParseString( Source.getText() ) ); //Existing->m_Inherited = false; } @@ -401,72 +401,72 @@ void CBaseEntity::XMLLoadProperty( const CXeromyces& XeroFile, const XMBElement& // Scripting initialization -void CBaseEntity::ScriptingInit() +void CEntityTemplate::ScriptingInit() { - AddMethod( "toString", 0 ); + AddMethod( "toString", 0 ); - AddClassProperty( L"traits.id.classes", (GetFn)&CBaseEntity::getClassSet, (SetFn)&CBaseEntity::setClassSet ); + AddClassProperty( L"traits.id.classes", (GetFn)&CEntityTemplate::getClassSet, (SetFn)&CEntityTemplate::setClassSet ); - AddClassProperty( L"actions.move.speed_curr", &CBaseEntity::m_speed ); - AddClassProperty( L"actions.move.turningradius", &CBaseEntity::m_turningRadius ); - AddClassProperty( L"actions.move.run.speed", &CBaseEntity::m_runSpeed ); - AddClassProperty( L"actions.move.run.rangemin", &CBaseEntity::m_runMinRange ); - AddClassProperty( L"actions.move.run.range", &CBaseEntity::m_runMaxRange ); - AddClassProperty( L"actions.move.run.regen_rate", &CBaseEntity::m_runRegenRate ); - AddClassProperty( L"actions.move.run.decay_rate", &CBaseEntity::m_runDecayRate ); - AddClassProperty( L"actions.move.pass_through_allies", &CBaseEntity::m_passThroughAllies ); - AddClassProperty( L"actor", &CBaseEntity::m_actorName ); - AddClassProperty( L"traits.health.curr", &CBaseEntity::m_healthCurr ); - AddClassProperty( L"traits.health.max", &CBaseEntity::m_healthMax ); - AddClassProperty( L"traits.health.bar_height", &CBaseEntity::m_healthBarHeight ); - AddClassProperty( L"traits.health.bar_size", &CBaseEntity::m_healthBarSize ); - AddClassProperty( L"traits.health.bar_width", &CBaseEntity::m_healthBarWidth ); - AddClassProperty( L"traits.health.border_height", &CBaseEntity::m_healthBorderHeight); - AddClassProperty( L"traits.health.border_width", &CBaseEntity::m_healthBorderWidth ); - AddClassProperty( L"traits.health.border_name", &CBaseEntity::m_healthBorderName ); - AddClassProperty( L"traits.health.regen_rate", &CBaseEntity::m_healthRegenRate ); - AddClassProperty( L"traits.health.regen_start", &CBaseEntity::m_healthRegenStart ); - AddClassProperty( L"traits.health.decay_rate", &CBaseEntity::m_healthDecayRate ); - AddClassProperty( L"traits.stamina.curr", &CBaseEntity::m_staminaCurr ); - AddClassProperty( L"traits.stamina.max", &CBaseEntity::m_staminaMax ); - AddClassProperty( L"traits.stamina.bar_height", &CBaseEntity::m_staminaBarHeight ); - AddClassProperty( L"traits.stamina.bar_size", &CBaseEntity::m_staminaBarSize ); - AddClassProperty( L"traits.stamina.bar_width", &CBaseEntity::m_staminaBarWidth ); - AddClassProperty( L"traits.stamina.border_height", &CBaseEntity::m_staminaBorderHeight); - AddClassProperty( L"traits.stamina.border_width", &CBaseEntity::m_staminaBorderWidth ); - AddClassProperty( L"traits.stamina.border_name", &CBaseEntity::m_staminaBorderName ); - AddClassProperty( L"traits.rally.name", &CBaseEntity::m_rallyName ); - AddClassProperty( L"traits.rally.width", &CBaseEntity::m_rallyWidth ); - AddClassProperty( L"traits.rally.height", &CBaseEntity::m_rallyHeight ); - AddClassProperty( L"traits.flank_penalty.sectors", &CBaseEntity::m_sectorDivs ); - AddClassProperty( L"traits.pitch.sectors", &CBaseEntity::m_pitchDivs ); - AddClassProperty( L"traits.rank.width", &CBaseEntity::m_rankWidth ); - AddClassProperty( L"traits.rank.height", &CBaseEntity::m_rankHeight ); - AddClassProperty( L"traits.rank.name", &CBaseEntity::m_rankName ); - AddClassProperty( L"traits.minimap.type", &CBaseEntity::m_minimapType ); - AddClassProperty( L"traits.minimap.red", &CBaseEntity::m_minimapR ); - AddClassProperty( L"traits.minimap.green", &CBaseEntity::m_minimapG ); - AddClassProperty( L"traits.minimap.blue", &CBaseEntity::m_minimapB ); - AddClassProperty( L"traits.anchor.type", &CBaseEntity::m_anchorType ); - AddClassProperty( L"traits.anchor.conformx", &CBaseEntity::m_anchorConformX ); - AddClassProperty( L"traits.anchor.conformz", &CBaseEntity::m_anchorConformZ ); - AddClassProperty( L"traits.vision.los", &CBaseEntity::m_los ); - AddClassProperty( L"traits.vision.permanent", &CBaseEntity::m_permanent ); - AddClassProperty( L"traits.is_territory_centre", &CBaseEntity::m_isTerritoryCentre ); - AddClassProperty( L"traits.foundation", &CBaseEntity::m_foundation ); - AddClassProperty( L"traits.socket", &CBaseEntity::m_socket ); + AddClassProperty( L"actions.move.speed_curr", &CEntityTemplate::m_speed ); + AddClassProperty( L"actions.move.turningradius", &CEntityTemplate::m_turningRadius ); + AddClassProperty( L"actions.move.run.speed", &CEntityTemplate::m_runSpeed ); + AddClassProperty( L"actions.move.run.rangemin", &CEntityTemplate::m_runMinRange ); + AddClassProperty( L"actions.move.run.range", &CEntityTemplate::m_runMaxRange ); + AddClassProperty( L"actions.move.run.regen_rate", &CEntityTemplate::m_runRegenRate ); + AddClassProperty( L"actions.move.run.decay_rate", &CEntityTemplate::m_runDecayRate ); + AddClassProperty( L"actions.move.pass_through_allies", &CEntityTemplate::m_passThroughAllies ); + AddClassProperty( L"actor", &CEntityTemplate::m_actorName ); + AddClassProperty( L"traits.health.curr", &CEntityTemplate::m_healthCurr ); + AddClassProperty( L"traits.health.max", &CEntityTemplate::m_healthMax ); + AddClassProperty( L"traits.health.bar_height", &CEntityTemplate::m_healthBarHeight ); + AddClassProperty( L"traits.health.bar_size", &CEntityTemplate::m_healthBarSize ); + AddClassProperty( L"traits.health.bar_width", &CEntityTemplate::m_healthBarWidth ); + AddClassProperty( L"traits.health.border_height", &CEntityTemplate::m_healthBorderHeight); + AddClassProperty( L"traits.health.border_width", &CEntityTemplate::m_healthBorderWidth ); + AddClassProperty( L"traits.health.border_name", &CEntityTemplate::m_healthBorderName ); + AddClassProperty( L"traits.health.regen_rate", &CEntityTemplate::m_healthRegenRate ); + AddClassProperty( L"traits.health.regen_start", &CEntityTemplate::m_healthRegenStart ); + AddClassProperty( L"traits.health.decay_rate", &CEntityTemplate::m_healthDecayRate ); + AddClassProperty( L"traits.stamina.curr", &CEntityTemplate::m_staminaCurr ); + AddClassProperty( L"traits.stamina.max", &CEntityTemplate::m_staminaMax ); + AddClassProperty( L"traits.stamina.bar_height", &CEntityTemplate::m_staminaBarHeight ); + AddClassProperty( L"traits.stamina.bar_size", &CEntityTemplate::m_staminaBarSize ); + AddClassProperty( L"traits.stamina.bar_width", &CEntityTemplate::m_staminaBarWidth ); + AddClassProperty( L"traits.stamina.border_height", &CEntityTemplate::m_staminaBorderHeight); + AddClassProperty( L"traits.stamina.border_width", &CEntityTemplate::m_staminaBorderWidth ); + AddClassProperty( L"traits.stamina.border_name", &CEntityTemplate::m_staminaBorderName ); + AddClassProperty( L"traits.rally.name", &CEntityTemplate::m_rallyName ); + AddClassProperty( L"traits.rally.width", &CEntityTemplate::m_rallyWidth ); + AddClassProperty( L"traits.rally.height", &CEntityTemplate::m_rallyHeight ); + AddClassProperty( L"traits.flank_penalty.sectors", &CEntityTemplate::m_sectorDivs ); + AddClassProperty( L"traits.pitch.sectors", &CEntityTemplate::m_pitchDivs ); + AddClassProperty( L"traits.rank.width", &CEntityTemplate::m_rankWidth ); + AddClassProperty( L"traits.rank.height", &CEntityTemplate::m_rankHeight ); + AddClassProperty( L"traits.rank.name", &CEntityTemplate::m_rankName ); + AddClassProperty( L"traits.minimap.type", &CEntityTemplate::m_minimapType ); + AddClassProperty( L"traits.minimap.red", &CEntityTemplate::m_minimapR ); + AddClassProperty( L"traits.minimap.green", &CEntityTemplate::m_minimapG ); + AddClassProperty( L"traits.minimap.blue", &CEntityTemplate::m_minimapB ); + AddClassProperty( L"traits.anchor.type", &CEntityTemplate::m_anchorType ); + AddClassProperty( L"traits.anchor.conformx", &CEntityTemplate::m_anchorConformX ); + AddClassProperty( L"traits.anchor.conformz", &CEntityTemplate::m_anchorConformZ ); + AddClassProperty( L"traits.vision.los", &CEntityTemplate::m_los ); + AddClassProperty( L"traits.vision.permanent", &CEntityTemplate::m_permanent ); + AddClassProperty( L"traits.is_territory_centre", &CEntityTemplate::m_isTerritoryCentre ); + AddClassProperty( L"traits.foundation", &CEntityTemplate::m_foundation ); + AddClassProperty( L"traits.socket", &CEntityTemplate::m_socket ); - CJSComplex::ScriptingInit( "EntityTemplate" ); + CJSComplex::ScriptingInit( "EntityTemplate" ); } // Script-bound functions -JSObject* CBaseEntity::GetScriptExecContext( IEventTarget* target ) +JSObject* CEntityTemplate::GetScriptExecContext( IEventTarget* target ) { return( target->GetScriptExecContext( target ) ); } -jsval CBaseEntity::ToString( JSContext* cx, uintN UNUSED(argc), jsval* UNUSED(argv) ) +jsval CEntityTemplate::ToString( JSContext* cx, uintN UNUSED(argc), jsval* UNUSED(argv) ) { wchar_t buffer[256]; if( m_player == 0 ) diff --git a/source/simulation/BaseEntity.h b/source/simulation/EntityTemplate.h similarity index 92% rename from source/simulation/BaseEntity.h rename to source/simulation/EntityTemplate.h index e43761ff21..33dd0dd8c2 100644 --- a/source/simulation/BaseEntity.h +++ b/source/simulation/EntityTemplate.h @@ -1,4 +1,4 @@ -// BaseEntity.h +// EntityTemplate.h // // Mark Thompson mot20@cam.ac.uk / mark@wildfiregames.com // @@ -29,25 +29,25 @@ class CPlayer; -class CBaseEntity : public CJSComplex, public IEventTarget +class CEntityTemplate : public CJSComplex, public IEventTarget { public: CPlayer* m_player; // Which player this template is for, or null for the no-player template // used to read unmodified values for upgrades and such. - CBaseEntity( CPlayer* player ); - ~CBaseEntity(); + CEntityTemplate( CPlayer* player ); + ~CEntityTemplate(); // Load from XML bool loadXML( CStr filename ); // Load a tree of properties from an XML (XMB) node. void XMLLoadProperty( const CXeromyces& XeroFile, const XMBElement& Source, CStrW BasePropertyName ); // Base stats - CBaseEntity* m_base; + CEntityTemplate* m_base; //bool m_extant; // The unmodified, no-player version of this template - CBaseEntity* m_unmodified; + CEntityTemplate* m_unmodified; // The class types this entity has SClassSet m_classes; @@ -152,8 +152,8 @@ public: private: // squelch "unable to generate" warnings - CBaseEntity(const CBaseEntity& rhs); - const CBaseEntity& operator=(const CBaseEntity& rhs); + CEntityTemplate(const CEntityTemplate& rhs); + const CEntityTemplate& operator=(const CEntityTemplate& rhs); static STL_HASH_SET scriptsLoaded; }; diff --git a/source/simulation/BaseEntityCollection.cpp b/source/simulation/EntityTemplateCollection.cpp similarity index 72% rename from source/simulation/BaseEntityCollection.cpp rename to source/simulation/EntityTemplateCollection.cpp index 882a5d59e1..c42ff5b60a 100644 --- a/source/simulation/BaseEntityCollection.cpp +++ b/source/simulation/EntityTemplateCollection.cpp @@ -1,6 +1,6 @@ #include "precompiled.h" -#include "BaseEntityCollection.h" +#include "EntityTemplateCollection.h" #include "graphics/ObjectManager.h" #include "graphics/Model.h" #include "ps/CLogger.h" @@ -9,7 +9,7 @@ #define LOG_CATEGORY "entity" -void CBaseEntityCollection::LoadFile( const char* path ) +void CEntityTemplateCollection::LoadFile( const char* path ) { // Build the entity name -> filename mapping. This is done so that // the entity 'x' can be in units/x.xml, structures/x.xml, etc, and @@ -23,11 +23,11 @@ void CBaseEntityCollection::LoadFile( const char* path ) static void LoadFileThunk( const char* path, const DirEnt* UNUSED(ent), void* context ) { - CBaseEntityCollection* this_ = (CBaseEntityCollection*)context; + CEntityTemplateCollection* this_ = (CEntityTemplateCollection*)context; this_->LoadFile(path); } -int CBaseEntityCollection::loadTemplates() +int CEntityTemplateCollection::loadTemplates() { // Load all files in entities/ and its subdirectories. THROW_ERR( vfs_dir_enum( "entities/", VFS_DIR_RECURSIVE, "*.xml", @@ -35,7 +35,7 @@ int CBaseEntityCollection::loadTemplates() return 0; } -CBaseEntity* CBaseEntityCollection::getTemplate( CStrW name, CPlayer* player ) +CEntityTemplate* CEntityTemplateCollection::getTemplate( CStrW name, CPlayer* player ) { // Find player ID int id = ( player == 0 ? NULL_PLAYER : player->GetPlayerID() ); @@ -53,28 +53,28 @@ CBaseEntity* CBaseEntityCollection::getTemplate( CStrW name, CPlayer* player ) CStr path( filename_it->second ); // Try to load to the entity - CBaseEntity* newTemplate = new CBaseEntity( player ); + CEntityTemplate* newTemplate = new CEntityTemplate( player ); if( !newTemplate->loadXML( path ) ) { - LOG(ERROR, LOG_CATEGORY, "CBaseEntityCollection::loadTemplates(): Couldn't load template \"%s\"", path.c_str()); + LOG(ERROR, LOG_CATEGORY, "CEntityTemplateCollection::loadTemplates(): Couldn't load template \"%s\"", path.c_str()); delete newTemplate; return( NULL ); } - LOG(NORMAL, LOG_CATEGORY, "CBaseEntityCollection::loadTemplates(): Loaded template \"%s\"", path.c_str()); + LOG(NORMAL, LOG_CATEGORY, "CEntityTemplateCollection::loadTemplates(): Loaded template \"%s\"", path.c_str()); m_templates[id][name] = newTemplate; return newTemplate; } -void CBaseEntityCollection::getBaseEntityNames( std::vector& names ) +void CEntityTemplateCollection::getEntityTemplateNames( std::vector& names ) { for( templateFilenameMap::iterator it = m_templateFilenames.begin(); it != m_templateFilenames.end(); ++it ) if( ! (it->first.Length() > 8 && it->first.Left(8) == L"template")) names.push_back( it->first ); } -CBaseEntityCollection::~CBaseEntityCollection() +CEntityTemplateCollection::~CEntityTemplateCollection() { for( int id = 0; id < PS_MAX_PLAYERS + 2; id++ ) for( templateMap::iterator it = m_templates[id].begin(); it != m_templates[id].end(); ++it ) diff --git a/source/simulation/BaseEntityCollection.h b/source/simulation/EntityTemplateCollection.h similarity index 76% rename from source/simulation/BaseEntityCollection.h rename to source/simulation/EntityTemplateCollection.h index 1d2be12498..86f60d6875 100644 --- a/source/simulation/BaseEntityCollection.h +++ b/source/simulation/EntityTemplateCollection.h @@ -1,4 +1,4 @@ -// BaseEntityCollection.h +// EntityTemplateCollection.h // // Mark Thompson mot20@cam.ac.uk / mark@wildfiregames.com // @@ -23,30 +23,30 @@ #include "ps/CStr.h" #include "ps/Singleton.h" #include "graphics/ObjectEntry.h" -#include "BaseEntity.h" +#include "EntityTemplate.h" #include "ps/Game.h" -#define g_EntityTemplateCollection CBaseEntityCollection::GetSingleton() +#define g_EntityTemplateCollection CEntityTemplateCollection::GetSingleton() #define NULL_PLAYER (PS_MAX_PLAYERS+1) class CPlayer; -class CBaseEntityCollection : public Singleton +class CEntityTemplateCollection : public Singleton { - typedef STL_HASH_MAP templateMap; + typedef STL_HASH_MAP templateMap; typedef STL_HASH_MAP templateFilenameMap; templateMap m_templates[PS_MAX_PLAYERS + 2]; templateFilenameMap m_templateFilenames; public: - ~CBaseEntityCollection(); - CBaseEntity* getTemplate( CStrW entityType, CPlayer* player = 0 ); + ~CEntityTemplateCollection(); + CEntityTemplate* getTemplate( CStrW entityType, CPlayer* player = 0 ); int loadTemplates(); void LoadFile( const char* path ); // Create a list of the names of all base entities, excluding template_*, // for display in ScEd's entity-selection box. - void getBaseEntityNames( std::vector& names ); + void getEntityTemplateNames( std::vector& names ); }; #endif diff --git a/source/simulation/FormationCollection.h b/source/simulation/FormationCollection.h index 18fabc008b..1218268919 100644 --- a/source/simulation/FormationCollection.h +++ b/source/simulation/FormationCollection.h @@ -1,7 +1,7 @@ //FormationCollection.h //Andrew aka pyrolink: ajdecker1022@msn.com -//Nearly identical to BaseEntityCollection and associates i.e. BaseEntity, Entity. +//Nearly identical to EntityTemplateCollection and associates i.e. EntityTemplate, Entity. //This is the manager of the entity formation "templates" diff --git a/source/simulation/Technology.cpp b/source/simulation/Technology.cpp index a619013ea4..5f9f577130 100644 --- a/source/simulation/Technology.cpp +++ b/source/simulation/Technology.cpp @@ -7,7 +7,7 @@ #include "scripting/ScriptingHost.h" #include "ps/XML/Xeromyces.h" #include "ps/XML/XeroXMB.h" -#include "BaseEntity.h" +#include "EntityTemplate.h" #include "Entity.h" #include "ps/Player.h" diff --git a/source/simulation/TechnologyCollection.h b/source/simulation/TechnologyCollection.h index 3e9553b033..80db6ab908 100644 --- a/source/simulation/TechnologyCollection.h +++ b/source/simulation/TechnologyCollection.h @@ -1,5 +1,5 @@ //Andrew aka pyrolink - ajdecker1022@msn.com -//Manages the tech templates. More detail: see CFormation and CBaseEntity (collections) +//Manages the tech templates. More detail: see CFormation and CEntityTemplate (collections) #ifndef TECHNOLOGY_COLLECTION_INCLUDED diff --git a/source/simulation/scripting/JSInterface_BaseEntity.h b/source/simulation/scripting/JSInterface_BaseEntity.h deleted file mode 100644 index b8e6f00356..0000000000 --- a/source/simulation/scripting/JSInterface_BaseEntity.h +++ /dev/null @@ -1,30 +0,0 @@ -// JSInterface_BaseEntity.h -// -// An interface between CBaseEntity and the JavaScript class EntityTemplate -// -// Usage: Used when manipulating objects of class 'EntityTemplate' in JavaScript. -// -// Mark Thompson mot20@cam.ac.uk / mark@wildfiregames.com - -#include "scripting/ScriptingHost.h" - -#ifndef JSI_BASEENTITY_INCLUDED -#define JSI_BASEENTITY_INCLUDED - -/* -namespace JSI_BaseEntity -{ - JSBool toString( JSContext* cx, JSObject* obj, uintN argc, jsval* argv, jsval* rval ); - extern JSClass JSI_class; - extern JSPropertySpec JSI_props[]; - extern JSFunctionSpec JSI_methods[]; - JSBool addProperty( JSContext* cx, JSObject* obj, jsval id, jsval* vp ); - JSBool delProperty( JSContext* cx, JSObject* obj, jsval id, jsval* vp ); - JSBool getProperty( JSContext* cx, JSObject* obj, jsval id, jsval* vp ); - JSBool setProperty( JSContext* cx, JSObject* obj, jsval id, jsval* vp ); - void finalize( JSContext* cx, JSObject* obj ); - void init(); -} -*/ - -#endif diff --git a/source/simulation/scripting/JSInterface_Entity.h b/source/simulation/scripting/JSInterface_Entity.h deleted file mode 100644 index 3fa0031671..0000000000 --- a/source/simulation/scripting/JSInterface_Entity.h +++ /dev/null @@ -1,32 +0,0 @@ -// JSInterface_Entity.h -// -// The interface layer between JavaScript code and the actual CEntity object. -// -// Usage: Used when manipulating objects of class 'Entity' in JavaScript. -// -// Mark Thompson mot20@cam.ac.uk / mark@wildfiregames.com - -#include "scripting/ScriptingHost.h" - -#ifndef JSI_ENTITY_INCLUDED -#define JSI_ENTITY_INCLUDED - -/* -namespace JSI_Entity -{ - JSBool toString( JSContext* cx, JSObject* obj, uintN argc, jsval* argv, jsval* rval ); - JSBool order( JSContext* cx, JSObject* obj, uintN argc, jsval* argv, jsval* rval, bool queueOrder ); - JSBool orderSingle( JSContext* cx, JSObject* obj, uintN argc, jsval* argv, jsval* rval ); - JSBool orderQueued( JSContext* cx, JSObject* obj, uintN argc, jsval* argv, jsval* rval ); - extern JSClass JSI_class; - extern JSPropertySpec JSI_props[]; - extern JSFunctionSpec JSI_methods[]; - JSBool getProperty( JSContext* cx, JSObject* obj, jsval id, jsval* vp ); - JSBool setProperty( JSContext* cx, JSObject* obj, jsval id, jsval* vp ); - JSBool construct( JSContext* cx, JSObject* obj, uint argc, jsval* argv, jsval* rval ); - void finalize( JSContext* cx, JSObject* obj ); - void init(); -} -*/ - -#endif diff --git a/source/tools/atlas/GameInterface/Handlers/ObjectHandlers.cpp b/source/tools/atlas/GameInterface/Handlers/ObjectHandlers.cpp index 8f3ceaa489..fd42d71ac7 100644 --- a/source/tools/atlas/GameInterface/Handlers/ObjectHandlers.cpp +++ b/source/tools/atlas/GameInterface/Handlers/ObjectHandlers.cpp @@ -17,7 +17,7 @@ #include "ps/CLogger.h" #include "ps/Game.h" #include "ps/World.h" -#include "simulation/BaseEntityCollection.h" +#include "simulation/EntityTemplateCollection.h" #include "simulation/Entity.h" #include "simulation/EntityManager.h" @@ -35,10 +35,10 @@ QUERYHANDLER(GetObjectsList) std::vector objects; { std::vector names; - g_EntityTemplateCollection.getBaseEntityNames(names); + g_EntityTemplateCollection.getEntityTemplateNames(names); for (std::vector::iterator it = names.begin(); it != names.end(); ++it) { - //CBaseEntity* baseent = g_EntityTemplateCollection.getTemplate(*it); + //CEntityTemplate* baseent = g_EntityTemplateCollection.getTemplate(*it); sObjectsListItem e; e.id = L"(e) " + *it; e.name = *it; //baseent->m_Tag @@ -267,7 +267,7 @@ MESSAGEHANDLER(ObjectPreview) // Create new unit if (isEntity) { - CBaseEntity* base = g_EntityTemplateCollection.getTemplate(name); + CEntityTemplate* base = g_EntityTemplateCollection.getTemplate(name); if (base) // (ignore errors) { g_PreviewUnit = g_UnitMan.CreateUnit(base->m_actorName, NULL, selections); @@ -364,7 +364,7 @@ BEGIN_COMMAND(CreateObject) if (isEntity) { - CBaseEntity* base = g_EntityTemplateCollection.getTemplate(name); + CEntityTemplate* base = g_EntityTemplateCollection.getTemplate(name); if (! base) LOG(ERROR, LOG_CATEGORY, "Failed to load entity template '%ls'", name.c_str()); else