1
0
forked from 0ad/0ad

Premake: include precompiled.h in the project; set up dependencies for Atlas projects.

# Attempted to make compilation faster
by including as little as possible in some .h files, and moving it into
.cpp.
Fixed BaseTechCollection memory leak.

This was SVN commit r3992.
This commit is contained in:
Ykkrosh 2006-06-09 16:44:16 +00:00
parent e10fb780ca
commit d39a4fac21
38 changed files with 163 additions and 109 deletions

View File

@ -191,7 +191,7 @@ local function setup_static_lib_package (package_name, rel_source_dirs, extern_l
pch_dir = source_root.."pch/"..package_name.."/"
package.pchheader = "precompiled.h"
package.pchsource = "precompiled.cpp"
tinsert(package.files, pch_dir.."precompiled.cpp")
tinsert(package.files, { pch_dir.."precompiled.cpp", pch_dir.."precompiled.h" })
end
@ -433,6 +433,10 @@ local function setup_atlas_package(package_name, target_type, rel_source_dirs, r
package.pchsource = "stdafx.cpp"
end
if flags["depends"] then
listconcat(package.links, flags["depends"])
end
else -- Non-Windows, = Unix
-- TODO
end

View File

@ -29,6 +29,8 @@
#include "ps/Globals.h"
#include "renderer/WaterManager.h"
#include "renderer/SkyManager.h"
#include "graphics/UnitManager.h"
#include "graphics/Patch.h"
#include "maths/Quaternion.h"
#include "Unit.h"

View File

@ -6,12 +6,14 @@
#include "Unit.h"
#include "ps/Game.h"
#include "ObjectManager.h"
#include "simulation/Entity.h"
#include "simulation/BaseEntity.h"
#include "simulation/BaseEntityCollection.h"
#include "simulation/EntityManager.h"
#include "ps/CLogger.h"
#include "maths/MathUtil.h"
#include "Camera.h"
#include "graphics/Patch.h"
#include "Model.h"
#include "Terrain.h"

View File

@ -18,6 +18,8 @@
#include "ps/Loader.h"
#include "maths/MathUtil.h"
#include "graphics/Camera.h"
#include "ps/Player.h"
#include "graphics/Patch.h"
#include "ps/XML/XMLWriter.h"
#include "simulation/Entity.h"

View File

@ -14,6 +14,7 @@
#include "ParticleEmitter.h"
#include "lib/res/graphics/tex.h"
#include "lib/res/graphics/ogl_tex.h"
#include "graphics/Texture.h"
#include "ps/CLogger.h"
#include "ps/Loader.h"

View File

@ -9,22 +9,16 @@
#ifndef _PATCH_H
#define _PATCH_H
#include "MiniPatch.h"
#include "RenderableObject.h"
class CTerrain;
///////////////////////////////////////////////////////////////////////////////
// Terrain Constants:
//
// PATCH_SIZE: number of tiles in each patch
const int PATCH_SIZE = 16;
// CELL_SIZE: size of each tile in x and z
const int CELL_SIZE = 4;
// HEIGHT_SCALE: vertical scale of terrain - terrain has a coordinate range of
// 0 to 65536*HEIGHT_SCALE
const float HEIGHT_SCALE = 0.35f/256.0f;
#include "MiniPatch.h"
#include "RenderableObject.h"
class CTerrain;
///////////////////////////////////////////////////////////////////////////////
// CPatch: a single terrain patch, PATCH_SIZE tiles square

View File

@ -15,12 +15,13 @@
#include "renderer/WaterManager.h"
#include "simulation/EntityManager.h"
#include "simulation/Entity.h"
#include <string.h>
#include "Terrain.h"
#include "Patch.h"
#include "maths/MathUtil.h"
///////////////////////////////////////////////////////////////////////////////
// CTerrain constructor
CTerrain::CTerrain() : m_Heightmap(0), m_Patches(0), m_MapSize(0), m_MapSizePatches(0)
@ -74,6 +75,18 @@ bool CTerrain::Initialize(u32 size,const u16* data)
return true;
}
///////////////////////////////////////////////////////////////////////////////
bool CTerrain::isOnMap(const CVector2D& v) const
{
return isOnMap(v.x, v.y);
}
float CTerrain::getExactGroundLevel(const CVector2D& v) const
{
return getExactGroundLevel(v.x, v.y);
}
///////////////////////////////////////////////////////////////////////////////
// CalcPosition: calculate the world space position of the vertex at (i,j)
void CTerrain::CalcPosition(i32 i, i32 j, CVector3D& pos) const

View File

@ -10,10 +10,22 @@
#ifndef _TERRAIN_H
#define _TERRAIN_H
#include "Patch.h"
#include "maths/Vector3D.h"
#include "ps/Vector2D.h"
#include "simulation/Entity.h"
class CEntity;
class CPatch;
class CMiniPatch;
class CVector2D;
///////////////////////////////////////////////////////////////////////////////
// Terrain Constants:
//
// CELL_SIZE: size of each tile in x and z
const int CELL_SIZE = 4;
// HEIGHT_SCALE: vertical scale of terrain - terrain has a coordinate range of
// 0 to 65536*HEIGHT_SCALE
const float HEIGHT_SCALE = 0.35f/256.0f;
///////////////////////////////////////////////////////////////////////////////
// CTerrain: main terrain class; contains the heightmap describing elevation
@ -36,14 +48,16 @@ public:
// return number of patches along edge of the terrain
u32 GetPatchesPerSide() const { return m_MapSizePatches; }
inline bool isOnMap(float x, float z) const
bool isOnMap(float x, float z) const
{
return ((x >= 0.0f) && (x < (float)((m_MapSize-1) * CELL_SIZE)) && (z >= 0.0f) && (z < (float)((m_MapSize-1) * CELL_SIZE)));
return ((x >= 0.0f) && (x < (float)((m_MapSize-1) * CELL_SIZE))
&& (z >= 0.0f) && (z < (float)((m_MapSize-1) * CELL_SIZE)));
}
inline bool isOnMap(const CVector2D& v) const { return isOnMap(v.x, v.y); }
bool isOnMap(const CVector2D& v) const;
float getVertexGroundLevel(int i, int j) const;
float getExactGroundLevel(float x, float z) const;
inline float getExactGroundLevel(const CVector2D& v) const { return getExactGroundLevel(v.x, v.y); }
float getExactGroundLevel(const CVector2D& v) const;
float getSlope(float x, float z) const ;
//Find the slope of in X and Z axes depending on the way the entity is facing

View File

@ -1,26 +1,27 @@
#include "precompiled.h"
#include "gui/MiniMap.h"
#include "ps/Game.h"
#include <math.h>
#include "lib/ogl.h"
#include "renderer/Renderer.h"
#include "graphics/GameView.h"
#include "graphics/MiniPatch.h"
#include "graphics/Model.h"
#include "graphics/Terrain.h"
#include "graphics/TextureEntry.h"
#include "graphics/TextureManager.h"
#include "graphics/Unit.h"
#include "graphics/UnitManager.h"
#include "simulation/Entity.h"
#include "gui/MiniMap.h"
#include "lib/ogl.h"
#include "maths/Bound.h"
#include "graphics/Model.h"
#include "scripting/GameEvents.h"
#include "graphics/Terrain.h"
#include "ps/Profile.h"
#include "simulation/LOSManager.h"
#include "graphics/GameView.h"
#include "renderer/WaterManager.h"
#include "ps/Game.h"
#include "ps/Interact.h"
#include "ps/Network/NetMessage.h"
#include "ps/Profile.h"
#include "renderer/Renderer.h"
#include "renderer/WaterManager.h"
#include "scripting/GameEvents.h"
#include "simulation/Entity.h"
#include "simulation/LOSManager.h"
bool g_TerrainModified = false;

View File

@ -2,3 +2,4 @@
// Atlas-specific PCH:
#include "tools/atlas/GameInterface/Messages.h"

View File

@ -2,22 +2,21 @@
#include <wctype.h>
#include "CConsole.h"
#include "CLogger.h"
#include "Pyrogenesis.h"
#include "lib/lib.h"
#include "lib/ogl.h"
#include "lib/res/file/vfs.h"
#include "lib/res/graphics/unifont.h"
#include "lib/sysdep/sysdep.h"
#include "Hotkey.h"
#include "scripting/ScriptingHost.h"
#include "maths/MathUtil.h"
#include "ps/CLogger.h"
#include "ps/Globals.h"
#include "ps/Hotkey.h"
#include "ps/Interact.h"
#include "ps/Network/Client.h"
#include "ps/Network/Server.h"
#include "lib/res/file/vfs.h"
#include "Interact.h"
#include "ps/Globals.h"
#include "ps/Pyrogenesis.h"
#include "scripting/ScriptingHost.h"
CConsole* g_Console = 0;

View File

@ -15,9 +15,6 @@
#include <deque>
#include <map>
#include "lib/res/graphics/unifont.h"
#include "lib/ogl.h"
#include "lib/lib.h"
#include "CStr.h"
#include "lib/input.h"

View File

@ -11,6 +11,7 @@
#include "Loader.h"
#include "CStr.h"
#include "simulation/EntityManager.h"
#include "simulation/Entity.h"
#include "CConsole.h"
#include "ps/World.h"

View File

@ -788,6 +788,7 @@ void Shutdown()
delete &g_JSGameEvents;
delete &g_FormationManager;
delete &g_BaseTechCollection;
delete &g_EntityFormationCollection;
delete &g_EntityTemplateCollection;
TIMER_END("shutdown game scripting stuff");

View File

@ -1,29 +1,32 @@
#include "precompiled.h"
#include "Interact.h"
#include "renderer/Renderer.h"
#include "lib/input.h"
#include "CConsole.h"
#include "graphics/HFTracer.h"
#include "Game.h"
#include "Hotkey.h"
#include "Interact.h"
#include "graphics/GameView.h"
#include "graphics/HFTracer.h"
#include "graphics/Model.h"
#include "graphics/Terrain.h"
#include "graphics/Unit.h"
#include "graphics/UnitManager.h"
#include "gui/CGUI.h"
#include "gui/MiniMap.h"
#include "lib/input.h"
#include "lib/res/graphics/unifont.h"
#include "lib/timer.h"
#include "Game.h"
#include "simulation/Simulation.h"
#include "maths/MathUtil.h"
#include "ps/Globals.h"
#include "ps/VFSUtil.h"
#include "ps/Network/NetMessage.h"
#include "simulation/BoundingObjects.h"
#include "graphics/Unit.h"
#include "graphics/Model.h"
#include "ps/Player.h"
#include "ps/VFSUtil.h"
#include "renderer/Renderer.h"
#include "scripting/GameEvents.h"
#include "simulation/BaseEntityCollection.h"
#include "simulation/BoundingObjects.h"
#include "simulation/EntityFormation.h"
#include "simulation/FormationManager.h"
#include "scripting/GameEvents.h"
#include "graphics/UnitManager.h"
#include "maths/MathUtil.h"
#include "graphics/GameView.h"
#include "simulation/Simulation.h"
#include "ps/CLogger.h"
#define LOG_CATEGORY "world"

View File

@ -16,6 +16,7 @@
#include "simulation/Scheduler.h"
#include "graphics/Camera.h"
#include "lib/input.h"
#include "lib/res/handle.h"
#define MAX_BOOKMARKS 10
#define MAX_GROUPS 20

View File

@ -21,6 +21,7 @@
#include "simulation/Projectile.h"
#include "simulation/LOSManager.h"
#include "graphics/GameView.h"
#include "graphics/Terrain.h"
#define LOG_CATEGORY "world"
@ -31,7 +32,7 @@ CLightEnv g_LightEnv;
CWorld::CWorld(CGame *pGame):
m_pGame(pGame),
m_Terrain(),
m_Terrain(new CTerrain()),
m_UnitManager(&g_UnitMan),
m_EntityManager(new CEntityManager()),
m_ProjectileManager(new CProjectileManager()),
@ -54,7 +55,7 @@ void CWorld::Initialize(CGameAttributes *pAttribs)
try {
reader = new CMapReader;
reader->LoadMap(mapfilename, &m_Terrain, m_UnitManager, &g_LightEnv, m_pGame->GetView()->GetCamera());
reader->LoadMap(mapfilename, m_Terrain, m_UnitManager, &g_LightEnv, m_pGame->GetView()->GetCamera());
// fails immediately, or registers for delay loading
} catch (PSERROR_File&) {
delete reader;
@ -73,6 +74,7 @@ void CWorld::RegisterInit(CGameAttributes *pAttribs)
CWorld::~CWorld()
{
delete m_Terrain;
delete m_EntityManager;
delete m_ProjectileManager;
delete m_LOSManager;
@ -81,5 +83,5 @@ CWorld::~CWorld()
void CWorld::RewriteMap()
{
CMapWriter::RewriteAllMaps(&m_Terrain, m_UnitManager, &g_LightEnv, m_pGame->GetView()->GetCamera());
CMapWriter::RewriteAllMaps(m_Terrain, m_UnitManager, &g_LightEnv, m_pGame->GetView()->GetCamera());
}

View File

@ -1,8 +1,6 @@
#ifndef _ps_World_H
#define _ps_World_H
#include "graphics/Terrain.h"
#include "ps/Errors.h"
#ifndef ERROR_GROUP_GAME_DEFINED
@ -18,12 +16,13 @@ class CUnitManager;
class CEntityManager;
class CProjectileManager;
class CLOSManager;
class CTerrain;
class CWorld
{
CGame *m_pGame;
CTerrain m_Terrain;
CTerrain *m_Terrain;
CUnitManager *m_UnitManager;
CEntityManager *m_EntityManager;
@ -44,7 +43,7 @@ public:
void RewriteMap();
inline CTerrain *GetTerrain()
{ return &m_Terrain; }
{ return m_Terrain; }
inline CUnitManager *GetUnitManager()
{ return m_UnitManager; }
inline CEntityManager *GetEntityManager()

View File

@ -13,7 +13,8 @@
#include "ps/Profile.h"
#include "maths/MathUtil.h"
#include "simulation/LOSManager.h"
#include "graphics/Patch.h"
#include "graphics/Terrain.h"
const int BlendOffsets[8][2] = {
{ 0, -1 },

View File

@ -16,17 +16,13 @@
#include <vector>
#include "lib/ogl.h"
#include "graphics/Camera.h"
#include "graphics/Frustum.h"
#include "graphics/Terrain.h"
#include "ps/Singleton.h"
#include "ps/Overlay.h"
#include "scripting/ScriptableObject.h"
#include "renderer/ModelRenderer.h"
// necessary declarations
class CCamera;
class CPatch;
class CSprite;
class CParticleSys;
@ -35,7 +31,6 @@ class CMaterial;
class CModel;
class CLightEnv;
class CTexture;
class CTerrain;
class RenderPathVertexShader;
class WaterManager;

View File

@ -4,6 +4,7 @@
#include "graphics/ObjectManager.h"
#include "maths/scripting/JSInterface_Vector3D.h"
#include "ps/Parser.h"
#include "ps/Player.h"
#include "simulation/BaseEntity.h"
#include "lib/sysdep/sysdep.h" // finite

View File

@ -6,6 +6,8 @@
#include "Collision.h"
#include "ps/Game.h"
#include "ps/World.h"
#include "graphics/Patch.h"
#include "graphics/Terrain.h"
#include "ps/Profile.h"

View File

@ -8,6 +8,8 @@
#include "ps/XML/Xeromyces.h"
#include "ps/XML/XeroXMB.h"
#include "BaseEntity.h"
#include "Entity.h"
#include "ps/Player.h"
#define LOG_CATEGORY "Techs"

View File

@ -25,6 +25,7 @@
#include "simulation/FormationManager.h"
#include "BaseFormation.h"
#include "graphics/GameView.h"
#include "graphics/UnitManager.h"
extern CConsole* g_Console;

View File

@ -28,23 +28,22 @@
#include <deque>
#include "scripting/ScriptableComplex.h"
#include "ps/Player.h"
#include "ps/Vector2D.h"
#include "maths/Vector3D.h"
#include "graphics/UnitManager.h"
#include "EntityOrders.h"
#include "EntityHandles.h"
#include "EntityMessage.h"
#include "EventHandlers.h"
#include "ScriptObject.h"
#include "graphics/ObjectEntry.h"
#include "EntitySupport.h"
class CAura;
class CBaseEntity;
class CBoundingObject;
class CUnit;
class CAura;
class CPlayer;
class CProductionQueue;
class CSkeletonAnim;
class CUnit;
class CEntityFormation;

View File

@ -2,7 +2,9 @@
#include "EntityHandles.h"
#include "EntityManager.h"
#include "Entity.h"
#include "ps/CStr.h"
#include "ps/Network/Serialization.h"
CHandle::CHandle()
{

View File

@ -21,7 +21,6 @@
#define ENTITY_HANDLE_INCLUDED
#include "lib/types.h"
#include "ps/Network/Serialization.h"
#define INVALID_HANDLE 65535
// The maximum numerical value of an entity handle sent over the network

View File

@ -8,6 +8,8 @@
#include "graphics/Terrain.h"
#include "ps/Game.h"
#include "maths/MathUtil.h"
#include "Entity.h"
int SELECTION_CIRCLE_POINTS;
int SELECTION_BOX_POINTS;
int SELECTION_SMOOTHNESS_UNIFIED = 9;

View File

@ -19,12 +19,15 @@
#define ENTITY_MANAGER_INCLUDED
#include "ps/Singleton.h"
#include "Entity.h"
#include "EntityHandles.h"
#include "EntityPredicate.h"
#include "EntityMessage.h"
#include "ps/Game.h"
#include "ps/World.h"
#include "ps/CStr.h"
#include "maths/Vector3D.h"
class CBaseEntity;
#define MAX_HANDLES 4096

View File

@ -38,7 +38,6 @@
#include "EntityHandles.h"
#include "ps/Vector2D.h"
#include "scripting/DOMEvent.h"
// An order data field, which could represent different things depending on the type of order.
struct SOrderData

View File

@ -9,6 +9,8 @@
#include "ps/Game.h"
#include "Collision.h"
#include "graphics/ObjectManager.h"
#include "graphics/ObjectEntry.h"
#include "graphics/Terrain.h"
#include "ps/CLogger.h"
const double GRAVITY = 0.00001;

View File

@ -2,27 +2,29 @@
#include <vector>
#include "lib/timer.h"
#include "ps/Profile.h"
#include "Simulation.h"
#include "TurnManager.h"
#include "ps/Game.h"
#include "EntityFormation.h"
#include "EntityManager.h"
#include "LOSManager.h"
#include "Projectile.h"
#include "Scheduler.h"
#include "ps/Network/NetMessage.h"
#include "ps/CLogger.h"
#include "ps/CConsole.h"
#include "graphics/Unit.h"
#include "Simulation.h"
#include "TurnManager.h"
#include "graphics/Model.h"
#include "LOSManager.h"
#include "graphics/Terrain.h"
#include "graphics/Unit.h"
#include "graphics/UnitManager.h"
#include "lib/timer.h"
#include "ps/CConsole.h"
#include "ps/CLogger.h"
#include "ps/Game.h"
#include "ps/GameAttributes.h"
#include "ps/Loader.h"
#include "ps/LoaderThunks.h"
#include "ps/GameAttributes.h"
#include "ps/Network/NetMessage.h"
#include "ps/Profile.h"
#include "renderer/Renderer.h"
#include "renderer/WaterManager.h"
#include "EntityFormation.h"
#include "simulation/Entity.h"
#include "gui/CGUI.h"

View File

@ -9,6 +9,7 @@
#include "ps/World.h"
#include "maths/MathUtil.h"
#include "simulation/EntityManager.h"
#include "graphics/RenderableObject.h"
#include "../Brushes.h"
#include "../DeltaArray.h"

View File

@ -4,10 +4,11 @@
#include "../CommandProc.h"
#include "graphics/LightEnv.h"
#include "graphics/Terrain.h"
#include "ps/World.h"
#include "renderer/Renderer.h"
#include "renderer/WaterManager.h"
#include "ps/World.h"
#include "graphics/LightEnv.h"
namespace AtlasMessage {

View File

@ -6,7 +6,8 @@
#include "renderer/Renderer.h"
#include "graphics/GameView.h"
#include "gui/GUI.h"
#include "gui/GUIbase.h"
#include "gui/CGUI.h"
#include "ps/CConsole.h"
#include "ps/Game.h"
#include "maths/MathUtil.h"

View File

@ -3,11 +3,12 @@
#include "MessageHandler.h"
#include "../GameLoop.h"
#include "graphics/Patch.h"
#include "graphics/TextureManager.h"
#include "graphics/TextureEntry.h"
#include "graphics/MapWriter.h"
#include "graphics/GameView.h"
#include "graphics/MapWriter.h"
#include "graphics/Patch.h"
#include "graphics/Terrain.h"
#include "graphics/TextureEntry.h"
#include "graphics/TextureManager.h"
#include "ps/Game.h"
#include "ps/GameAttributes.h"
#include "ps/Loader.h"

View File

@ -5,19 +5,21 @@
#include "MessageHandler.h"
#include "../CommandProc.h"
#include "simulation/BaseEntityCollection.h"
#include "simulation/EntityManager.h"
#include "graphics/Unit.h"
#include "graphics/UnitManager.h"
#include "graphics/GameView.h"
#include "graphics/Model.h"
#include "graphics/ObjectManager.h"
#include "maths/Matrix3D.h"
#include "graphics/Terrain.h"
#include "graphics/Unit.h"
#include "graphics/UnitManager.h"
#include "lib/ogl.h"
#include "maths/MathUtil.h"
#include "maths/Matrix3D.h"
#include "ps/CLogger.h"
#include "ps/Game.h"
#include "ps/World.h"
#include "graphics/GameView.h"
#include "lib/ogl.h"
#include "simulation/BaseEntityCollection.h"
#include "simulation/Entity.h"
#include "simulation/EntityManager.h"
#define LOG_CATEGORY "editor"

View File

@ -4,6 +4,7 @@
#include "../CommandProc.h"
#include "graphics/Patch.h"
#include "graphics/TextureManager.h"
#include "graphics/TextureEntry.h"
#include "graphics/Terrain.h"