diff --git a/source/graphics/GameView.cpp b/source/graphics/GameView.cpp index d43bb48888..16c69713e5 100644 --- a/source/graphics/GameView.cpp +++ b/source/graphics/GameView.cpp @@ -1,45 +1,41 @@ - - #include "precompiled.h" -#include "Terrain.h" -#include "renderer/Renderer.h" #include "GameView.h" -#include "ps/Game.h" -#include "Camera.h" -#include "ps/Interact.h" -#include "maths/Matrix3D.h" -#include "maths/MathUtil.h" -#include "renderer/Renderer.h" -#include "Terrain.h" -#include "LightEnv.h" -#include "HFTracer.h" -#include "TextureManager.h" -#include "ObjectManager.h" -#include "simulation/LOSManager.h" -#include "simulation/EntityOrders.h" -#include "maths/Bound.h" -#include "ps/Pyrogenesis.h" -#include "ps/Hotkey.h" -#include "ps/ConfigDB.h" -#include "ps/Loader.h" -#include "ps/Profile.h" -#include "ps/LoaderThunks.h" -#include "ps/Globals.h" -#include "renderer/WaterManager.h" -#include "renderer/SkyManager.h" -#include "graphics/UnitManager.h" +#include "graphics/Camera.h" +#include "graphics/HFTracer.h" +#include "graphics/LightEnv.h" +#include "graphics/Model.h" +#include "graphics/ObjectManager.h" #include "graphics/Patch.h" - -#include "maths/Quaternion.h" -#include "Unit.h" -#include "Model.h" -#include "simulation/Projectile.h" - +#include "graphics/Terrain.h" +#include "graphics/TextureManager.h" +#include "graphics/Unit.h" +#include "graphics/UnitManager.h" #include "lib/input.h" #include "lib/lib.h" #include "lib/timer.h" +#include "maths/Bound.h" +#include "maths/MathUtil.h" +#include "maths/Matrix3D.h" +#include "maths/Quaternion.h" +#include "ps/ConfigDB.h" +#include "ps/Game.h" +#include "ps/Globals.h" +#include "ps/Hotkey.h" +#include "ps/Interact.h" +#include "ps/Loader.h" +#include "ps/LoaderThunks.h" +#include "ps/Profile.h" +#include "ps/Pyrogenesis.h" +#include "renderer/Renderer.h" +#include "renderer/Renderer.h" +#include "renderer/SkyManager.h" +#include "renderer/WaterManager.h" +#include "simulation/Entity.h" +#include "simulation/EntityOrders.h" +#include "simulation/LOSManager.h" +#include "simulation/Projectile.h" float g_MaxZoomHeight=350.0f; //note: Max terrain height is this minus YMinOffset float g_YMinOffset=15.0f; diff --git a/source/graphics/GameView.h b/source/graphics/GameView.h index a92d55d367..4ae857e7b2 100644 --- a/source/graphics/GameView.h +++ b/source/graphics/GameView.h @@ -7,7 +7,6 @@ extern float g_YMinOffset; #include "Camera.h" #include "CinemaTrack.h" -#include "ModelDef.h" #include "maths/Vector3D.h" #include "LightEnv.h" #include "scripting/ScriptableObject.h" diff --git a/source/pch/atlas/precompiled.h b/source/pch/atlas/precompiled.h index fa04605c7e..18a6cda481 100644 --- a/source/pch/atlas/precompiled.h +++ b/source/pch/atlas/precompiled.h @@ -2,4 +2,11 @@ // Atlas-specific PCH: +#if HAVE_PCH + #include "tools/atlas/GameInterface/Messages.h" +#include "ps/CStr.h" +#include "ps/Errors.h" +#include "graphics/GameView.h" + +#endif // HAVE_PCH diff --git a/source/pch/engine/precompiled.h b/source/pch/engine/precompiled.h index d12173bda0..3b7df3c568 100644 --- a/source/pch/engine/precompiled.h +++ b/source/pch/engine/precompiled.h @@ -4,6 +4,8 @@ #include "ps/Pyrogenesis.h" // MICROLOG and old error system +#if HAVE_PCH + // some other external libraries that are used in several places: // .. CStr is included very frequently, so a reasonable amount of time is // saved by including it here. (~10% in a full rebuild, as of r2365) @@ -11,3 +13,5 @@ #include "scripting/SpiderMonkey.h" #include #include + +#endif // HAVE_PCH diff --git a/source/ps/CConsole.cpp b/source/ps/CConsole.cpp index f01fbc8eb6..baa48bbe06 100644 --- a/source/ps/CConsole.cpp +++ b/source/ps/CConsole.cpp @@ -17,6 +17,7 @@ #include "ps/Network/Server.h" #include "ps/Pyrogenesis.h" #include "scripting/ScriptingHost.h" +#include "simulation/Entity.h" CConsole* g_Console = 0; diff --git a/source/ps/Interact.cpp b/source/ps/Interact.cpp index 9709da4a13..604c988368 100644 --- a/source/ps/Interact.cpp +++ b/source/ps/Interact.cpp @@ -1,12 +1,14 @@ #include "precompiled.h" -#include "CConsole.h" -#include "Game.h" -#include "Hotkey.h" #include "Interact.h" + +#include "ps/CConsole.h" +#include "ps/Game.h" +#include "ps/Hotkey.h" #include "graphics/GameView.h" #include "graphics/HFTracer.h" #include "graphics/Model.h" +#include "graphics/ModelDef.h" #include "graphics/Terrain.h" #include "graphics/Unit.h" #include "graphics/UnitManager.h" @@ -20,11 +22,15 @@ #include "ps/Network/NetMessage.h" #include "ps/Player.h" #include "ps/VFSUtil.h" +#include "ps/World.h" #include "renderer/Renderer.h" #include "scripting/GameEvents.h" #include "simulation/BaseEntityCollection.h" #include "simulation/BoundingObjects.h" +#include "simulation/Collision.h" +#include "simulation/Entity.h" #include "simulation/EntityFormation.h" +#include "simulation/EntityManager.h" #include "simulation/FormationManager.h" #include "simulation/Simulation.h" diff --git a/source/ps/Interact.h b/source/ps/Interact.h index b6b6f1617a..0cf1207102 100644 --- a/source/ps/Interact.h +++ b/source/ps/Interact.h @@ -9,15 +9,15 @@ #include #include "Singleton.h" -#include "simulation/Entity.h" -#include "simulation/EntityManager.h" -#include "simulation/EntityMessage.h" -#include "simulation/Collision.h" -#include "simulation/Scheduler.h" -#include "graphics/Camera.h" +#include "simulation/EntityHandles.h" +#include "ps/Vector2D.h" #include "lib/input.h" #include "lib/res/handle.h" +class CVector3D; +class CUnit; +class CBoundingObject; + #define MAX_BOOKMARKS 10 #define MAX_GROUPS 20 diff --git a/source/ps/Network/JSEvents.h b/source/ps/Network/JSEvents.h index b2a9211f57..493af92f69 100644 --- a/source/ps/Network/JSEvents.h +++ b/source/ps/Network/JSEvents.h @@ -2,6 +2,7 @@ #define _Network_JSEvents_H #include "ServerSession.h" +#include "scripting/DOMEvent.h" enum ENetworkJSEvents { diff --git a/source/ps/Player.h b/source/ps/Player.h index e4ccf811b9..b0ab1ef3b9 100644 --- a/source/ps/Player.h +++ b/source/ps/Player.h @@ -5,9 +5,9 @@ #include "scripting/SynchedJSObject.h" #include "scripting/ScriptableObject.h" #include "scripting/ScriptCustomTypes.h" -#include "simulation/EntityHandles.h" class CNetMessage; +class HEntity; typedef SColour SPlayerColour; diff --git a/source/ps/scripting/JSInterface_Selection.cpp b/source/ps/scripting/JSInterface_Selection.cpp index 22d2c8e939..c0a71f7c47 100644 --- a/source/ps/scripting/JSInterface_Selection.cpp +++ b/source/ps/scripting/JSInterface_Selection.cpp @@ -6,6 +6,7 @@ #include "JSInterface_Selection.h" #include "ps/scripting/JSCollection.h" #include "ps/Interact.h" +#include "simulation/Entity.h" JSBool JSI_Selection::getSelection( JSContext* UNUSED(cx), JSObject* UNUSED(obj), jsval UNUSED(id), jsval* vp ) diff --git a/source/scripting/ScriptableComplex.cpp b/source/scripting/ScriptableComplex.cpp index d696e1fbc4..613e0f6df9 100644 --- a/source/scripting/ScriptableComplex.cpp +++ b/source/scripting/ScriptableComplex.cpp @@ -1,6 +1,8 @@ #include "precompiled.h" #include "ScriptableComplex.h" +#include "lib/allocators.h" + // suballocator for CJSComplex.m_Properties elements static Bucket bucket; // HACK: it needs to be created/destroyed; since there is no diff --git a/source/scripting/ScriptableComplex.h b/source/scripting/ScriptableComplex.h index 84e48a0f47..891181a9f6 100644 --- a/source/scripting/ScriptableComplex.h +++ b/source/scripting/ScriptableComplex.h @@ -7,8 +7,6 @@ #include "simulation/ScriptObject.h" #include "JSConversions.h" -#include "lib/allocators.h" - #include #ifndef SCRIPTABLE_COMPLEX_INCLUDED diff --git a/source/simulation/Aura.cpp b/source/simulation/Aura.cpp index 569dc6bee8..9c77b9628c 100644 --- a/source/simulation/Aura.cpp +++ b/source/simulation/Aura.cpp @@ -1,9 +1,11 @@ #include "precompiled.h" -#include "Aura.h" -#include "EntityManager.h" -#include -using namespace std; +#include "Aura.h" + +#include "EntityManager.h" +#include "Entity.h" + +#include CAura::CAura( JSContext* cx, CEntity* source, CStrW& name, float radius, size_t tickRate, JSObject* handler ) : m_cx(cx), m_source(source), m_name(name), m_radius(radius), m_handler(handler), @@ -19,13 +21,13 @@ CAura::~CAura() void CAura::Update( size_t timestep ) { - vector inRange; + std::vector inRange; CVector3D pos = m_source->m_position; g_EntityManager.GetInRange( pos.X, pos.Z, m_radius, inRange ); - vector prevInfluenced, curInfluenced, entered, exited; + std::vector prevInfluenced, curInfluenced, entered, exited; - for( vector::iterator it = m_influenced.begin(); it != m_influenced.end(); it++ ) + for( std::vector::iterator it = m_influenced.begin(); it != m_influenced.end(); it++ ) { CEntity* ent = *it; if( ent->m_extant ) @@ -36,7 +38,7 @@ void CAura::Update( size_t timestep ) m_influenced.clear(); - for( vector::iterator it = inRange.begin(); it != inRange.end(); it++ ) + for( std::vector::iterator it = inRange.begin(); it != inRange.end(); it++ ) { CEntity* ent = *it; if(ent != m_source) @@ -59,11 +61,11 @@ void CAura::Update( size_t timestep ) if( JS_GetUCProperty( m_cx, m_handler, enterName16.c_str(), enterName16.length(), &enterFunction ) && enterFunction != JSVAL_VOID) { - back_insert_iterator > ins( entered ); + std::back_insert_iterator > ins( entered ); set_difference( curInfluenced.begin(), curInfluenced.end(), prevInfluenced.begin(), prevInfluenced.end(), ins ); - for( vector::iterator it = entered.begin(); it != entered.end(); it++ ) + for( std::vector::iterator it = entered.begin(); it != entered.end(); it++ ) { argv[0] = OBJECT_TO_JSVAL( (*it)->GetScript() ); JS_CallFunctionValue( m_cx, m_handler, enterFunction, 1, argv, &rval ); @@ -78,11 +80,11 @@ void CAura::Update( size_t timestep ) if( JS_GetUCProperty( m_cx, m_handler, exitName16.c_str(), exitName16.length(), &exitFunction ) && exitFunction != JSVAL_VOID ) { - back_insert_iterator > ins( exited ); + std::back_insert_iterator > ins( exited ); set_difference( prevInfluenced.begin(), prevInfluenced.end(), curInfluenced.begin(), curInfluenced.end(), ins ); - for( vector::iterator it = exited.begin(); it != exited.end(); it++ ) + for( std::vector::iterator it = exited.begin(); it != exited.end(); it++ ) { argv[0] = OBJECT_TO_JSVAL( (*it)->GetScript() ); JS_CallFunctionValue( m_cx, m_handler, exitFunction, 1, argv, &rval ); @@ -101,7 +103,7 @@ void CAura::Update( size_t timestep ) if( JS_GetUCProperty( m_cx, m_handler, tickName16.c_str(), tickName16.length(), &tickFunction ) && tickFunction != JSVAL_VOID ) { - for( vector::iterator it = curInfluenced.begin(); it != curInfluenced.end(); it++ ) + for( std::vector::iterator it = curInfluenced.begin(); it != curInfluenced.end(); it++ ) { argv[0] = OBJECT_TO_JSVAL( (*it)->GetScript() ); JS_CallFunctionValue( m_cx, m_handler, tickFunction, 1, argv, &rval ); @@ -124,7 +126,7 @@ void CAura::RemoveAll() && exitFunction != JSVAL_VOID ) { // Call the exit function on everything in our influence - for( vector::iterator it = m_influenced.begin(); it != m_influenced.end(); it++ ) + for( std::vector::iterator it = m_influenced.begin(); it != m_influenced.end(); it++ ) { CEntity* ent = *it; if( ent->m_extant ) diff --git a/source/simulation/Aura.h b/source/simulation/Aura.h index e37643b5c3..99bc4a2ffe 100644 --- a/source/simulation/Aura.h +++ b/source/simulation/Aura.h @@ -1,9 +1,10 @@ -#include "Entity.h" -#include "EntityHandles.h" - #ifndef __AURA_H__ #define __AURA_H__ +#include "EntityHandles.h" + +class CEntity; + class CAura { public: diff --git a/source/simulation/BaseTech.h b/source/simulation/BaseTech.h index b863a66b90..5476173158 100644 --- a/source/simulation/BaseTech.h +++ b/source/simulation/BaseTech.h @@ -6,7 +6,7 @@ #define BASETECH_INCLUDED #include -#include "scripting/ScriptableComplex.h" +#include "scripting/ScriptableObject.h" class CStr; class XMBElement; diff --git a/source/simulation/Entity.h b/source/simulation/Entity.h index 52e88e46bd..9173f30c1d 100644 --- a/source/simulation/Entity.h +++ b/source/simulation/Entity.h @@ -33,9 +33,9 @@ #include "EntityOrders.h" #include "EntityHandles.h" #include "EntityMessage.h" -#include "EventHandlers.h" #include "ScriptObject.h" #include "EntitySupport.h" +#include "scripting/DOMEvent.h" class CAura; class CBaseEntity; diff --git a/source/simulation/EntityFormation.cpp b/source/simulation/EntityFormation.cpp index daf5c6e1ed..b44c18a0c4 100644 --- a/source/simulation/EntityFormation.cpp +++ b/source/simulation/EntityFormation.cpp @@ -1,5 +1,8 @@ #include "precompiled.h" + #include "EntityFormation.h" + +#include "Entity.h" #include "BaseFormationCollection.h" #include "FormationManager.h" #include "Simulation.h" diff --git a/source/simulation/EntityFormation.h b/source/simulation/EntityFormation.h index fa35c05a0f..78508e37eb 100644 --- a/source/simulation/EntityFormation.h +++ b/source/simulation/EntityFormation.h @@ -8,11 +8,11 @@ #define ENTITYFORMATION_INCLUDED #include "BaseFormation.h" -#include "EntitySupport.h" #include "ps/Vector2D.h" class CVector2D; class CEntity; +struct CEntityList; struct SClassSet; class CEntityFormation diff --git a/source/simulation/FormationManager.cpp b/source/simulation/FormationManager.cpp index 7dd6ab4966..2284953f6e 100644 --- a/source/simulation/FormationManager.cpp +++ b/source/simulation/FormationManager.cpp @@ -5,6 +5,7 @@ #include "ps/CStr.h" #include "BaseFormation.h" #include "EntityFormation.h" +#include "EventHandlers.h" #include "ps/Vector2D.h" diff --git a/source/simulation/ProductionQueue.cpp b/source/simulation/ProductionQueue.cpp index c1270fe976..1d47c9f78e 100644 --- a/source/simulation/ProductionQueue.cpp +++ b/source/simulation/ProductionQueue.cpp @@ -1,6 +1,8 @@ #include "precompiled.h" #include "ProductionQueue.h" #include "EntityManager.h" +#include "EventHandlers.h" +#include "Entity.h" #include using namespace std; diff --git a/source/simulation/ProductionQueue.h b/source/simulation/ProductionQueue.h index 64721212e8..2e90ac876f 100644 --- a/source/simulation/ProductionQueue.h +++ b/source/simulation/ProductionQueue.h @@ -1,10 +1,12 @@ -#include "Entity.h" -#include "EntityHandles.h" -#include - #ifndef __PRODUCTIONQUEUE_H__ #define __PRODUCTIONQUEUE_H__ +#include "EntityHandles.h" +#include "scripting/ScriptableObject.h" +#include + +class CEntity; + class CProductionItem : public CJSObject { public: diff --git a/source/simulation/ScriptObject.cpp b/source/simulation/ScriptObject.cpp index f313060846..3c0aab8d2a 100644 --- a/source/simulation/ScriptObject.cpp +++ b/source/simulation/ScriptObject.cpp @@ -111,7 +111,7 @@ bool CScriptObject::DispatchEvent( JSObject* Context, CScriptEvent* evt ) return( evt->m_Blocked ); } -void CScriptObject::Compile( CStrW FileNameTag, CStrW FunctionBody ) +void CScriptObject::Compile( const CStrW& FileNameTag, const CStrW& FunctionBody ) { if( Function ) JS_RemoveRoot( g_ScriptingHost.GetContext(), &Function ); diff --git a/source/simulation/ScriptObject.h b/source/simulation/ScriptObject.h index 53e61af673..115ed105d3 100644 --- a/source/simulation/ScriptObject.h +++ b/source/simulation/ScriptObject.h @@ -6,11 +6,8 @@ #ifndef SCRIPTOBJECT_INCLUDED #define SCRIPTOBJECT_INCLUDED -#include "ps/CStr.h" -#include "scripting/ScriptingHost.h" -#include "EntityHandles.h" -#include "simulation/scripting/JSInterface_Entity.h" -#include "scripting/DOMEvent.h" +class CStrW; +class CScriptEvent; class CScriptObject { @@ -31,7 +28,7 @@ public: // Initialize in various ways: from a JS function, a string to be compiled, or a jsval containing either. void SetFunction( JSFunction* _Function ); void SetJSVal( jsval v ); - void Compile( CStrW FileNameTag, CStrW FunctionBody ); + void Compile( const CStrW& FileNameTag, const CStrW& FunctionBody ); inline bool Defined() {