2007-01-31 17:34:17 -08:00
|
|
|
/**
|
|
|
|
|
* File : World.h
|
|
|
|
|
* Project : engine
|
|
|
|
|
* Description : Contains the CWorld Class which contains all the entities and represents them at a specific moment in time.
|
|
|
|
|
*
|
|
|
|
|
**/
|
2007-05-07 09:33:24 -07:00
|
|
|
#ifndef INCLUDED_WORLD
|
|
|
|
|
#define INCLUDED_WORLD
|
2004-07-27 14:00:53 -07:00
|
|
|
|
2006-04-03 21:14:10 -07:00
|
|
|
#include "ps/Errors.h"
|
|
|
|
|
|
|
|
|
|
#ifndef ERROR_GROUP_GAME_DEFINED
|
|
|
|
|
#define ERROR_GROUP_GAME_DEFINED
|
|
|
|
|
ERROR_GROUP(Game);
|
|
|
|
|
#endif
|
|
|
|
|
ERROR_SUBGROUP(Game, World);
|
|
|
|
|
ERROR_TYPE(Game_World, MapLoadFailed);
|
|
|
|
|
|
2004-07-27 14:00:53 -07:00
|
|
|
class CGame;
|
|
|
|
|
class CGameAttributes;
|
2005-09-29 17:59:42 -07:00
|
|
|
class CUnitManager;
|
|
|
|
|
class CEntityManager;
|
|
|
|
|
class CProjectileManager;
|
2005-10-08 20:43:03 -07:00
|
|
|
class CLOSManager;
|
2006-07-08 15:40:01 -07:00
|
|
|
class CTerritoryManager;
|
2006-06-09 09:44:16 -07:00
|
|
|
class CTerrain;
|
2004-07-27 14:00:53 -07:00
|
|
|
|
2007-01-31 17:34:17 -08:00
|
|
|
/**
|
|
|
|
|
* CWorld is a general data class containing whatever is needed to accurately represent the world.
|
|
|
|
|
* This includes the map, entities, influence maps, tiles, heightmap, etc.
|
|
|
|
|
**/
|
|
|
|
|
class CWorld : boost::noncopyable
|
2004-07-27 14:00:53 -07:00
|
|
|
{
|
2007-01-31 17:34:17 -08:00
|
|
|
/**
|
|
|
|
|
* pointer to the CGame object representing the game.
|
|
|
|
|
**/
|
2004-07-27 14:00:53 -07:00
|
|
|
CGame *m_pGame;
|
|
|
|
|
|
2007-01-31 17:34:17 -08:00
|
|
|
/**
|
|
|
|
|
* pointer to the CTerrain object representing the height map.
|
|
|
|
|
**/
|
2006-06-09 09:44:16 -07:00
|
|
|
CTerrain *m_Terrain;
|
2006-03-21 12:55:45 -08:00
|
|
|
|
2007-01-31 17:34:17 -08:00
|
|
|
/**
|
|
|
|
|
* pointer to the CUnitManager that holds all the units in the world.
|
|
|
|
|
**/
|
2006-03-21 12:55:45 -08:00
|
|
|
CUnitManager *m_UnitManager;
|
2007-01-31 17:34:17 -08:00
|
|
|
/**
|
|
|
|
|
* pointer to the CEntityManager that holds all the entities in the world.
|
|
|
|
|
**/
|
2006-03-21 12:55:45 -08:00
|
|
|
CEntityManager *m_EntityManager;
|
2007-01-31 17:34:17 -08:00
|
|
|
/**
|
|
|
|
|
* pointer to the CProjectileManager that holds all the projectiles in the world.
|
|
|
|
|
**/
|
2006-03-21 12:55:45 -08:00
|
|
|
CProjectileManager *m_ProjectileManager;
|
2007-01-31 17:34:17 -08:00
|
|
|
/**
|
|
|
|
|
* pointer to the CLOSManager that holds the visibility matrix for the world.
|
|
|
|
|
**/
|
2006-03-21 12:55:45 -08:00
|
|
|
CLOSManager *m_LOSManager;
|
2007-01-31 17:34:17 -08:00
|
|
|
/**
|
|
|
|
|
* pointer to the CTerritoryManager that holds territory matrix for the world.
|
|
|
|
|
**/
|
2006-07-08 15:40:01 -07:00
|
|
|
CTerritoryManager *m_TerritoryManager;
|
2005-03-21 18:17:55 -08:00
|
|
|
|
2004-07-27 14:00:53 -07:00
|
|
|
public:
|
2005-09-29 17:59:42 -07:00
|
|
|
CWorld(CGame *pGame);
|
2004-08-05 06:07:51 -07:00
|
|
|
~CWorld();
|
|
|
|
|
|
2005-03-21 18:17:55 -08:00
|
|
|
void RegisterInit(CGameAttributes *pGameAttributes);
|
2004-07-27 14:00:53 -07:00
|
|
|
/*
|
2005-03-21 18:17:55 -08:00
|
|
|
Initialize the World - load the map and all objects
|
2004-07-27 14:00:53 -07:00
|
|
|
*/
|
|
|
|
|
void Initialize(CGameAttributes *pGameAttributes);
|
2005-03-21 18:17:55 -08:00
|
|
|
|
2005-08-14 16:34:37 -07:00
|
|
|
// provided for JS _rewritemaps function
|
|
|
|
|
void RewriteMap();
|
2005-03-21 18:17:55 -08:00
|
|
|
|
2007-01-31 17:34:17 -08:00
|
|
|
/**
|
|
|
|
|
* Get the pointer to the terrain object.
|
|
|
|
|
*
|
|
|
|
|
* @return CTerrain * the value of m_Terrain.
|
|
|
|
|
**/
|
2004-07-27 14:00:53 -07:00
|
|
|
inline CTerrain *GetTerrain()
|
2006-06-09 09:44:16 -07:00
|
|
|
{ return m_Terrain; }
|
2007-01-31 17:34:17 -08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get a reference to the unit manager object.
|
|
|
|
|
*
|
|
|
|
|
* @return CUnitManager & dereferenced m_UnitManager.
|
|
|
|
|
**/
|
2007-01-07 17:56:46 -08:00
|
|
|
inline CUnitManager &GetUnitManager()
|
|
|
|
|
{ return *m_UnitManager; }
|
2007-01-31 17:34:17 -08:00
|
|
|
/**
|
|
|
|
|
* Get a reference to the entity manager object.
|
|
|
|
|
*
|
|
|
|
|
* @return CWorld CEntityManager & dereferenced m_EntityManager.
|
|
|
|
|
**/
|
2007-01-24 12:17:28 -08:00
|
|
|
inline CEntityManager &GetEntityManager()
|
|
|
|
|
{ return *m_EntityManager; }
|
2007-01-31 17:34:17 -08:00
|
|
|
/**
|
|
|
|
|
* Get a reference to the projectile manager object.
|
|
|
|
|
*
|
|
|
|
|
* @return CProjectileManager & dereferenced m_ProjectileManager.
|
|
|
|
|
**/
|
2007-01-07 17:56:46 -08:00
|
|
|
inline CProjectileManager &GetProjectileManager()
|
|
|
|
|
{ return *m_ProjectileManager; }
|
2007-01-31 17:34:17 -08:00
|
|
|
/**
|
|
|
|
|
* Get the pointer to the LOS manager object.
|
|
|
|
|
*
|
|
|
|
|
* @return CLOSManager * the value of m_LOSManager.
|
|
|
|
|
**/
|
2005-10-08 20:43:03 -07:00
|
|
|
inline CLOSManager *GetLOSManager()
|
2006-03-21 12:55:45 -08:00
|
|
|
{ return m_LOSManager; }
|
2007-01-31 17:34:17 -08:00
|
|
|
/**
|
|
|
|
|
* Get the pointer to the territory manager object.
|
|
|
|
|
*
|
|
|
|
|
* @return CTerritoryManager * the value of m_TerritoryManager.
|
|
|
|
|
**/
|
2006-07-08 15:40:01 -07:00
|
|
|
inline CTerritoryManager *GetTerritoryManager()
|
|
|
|
|
{ return m_TerritoryManager; }
|
2004-07-27 14:00:53 -07:00
|
|
|
};
|
|
|
|
|
|
2005-08-14 16:34:37 -07:00
|
|
|
// rationale: see definition.
|
|
|
|
|
class CLightEnv;
|
|
|
|
|
extern CLightEnv g_LightEnv;
|
|
|
|
|
|
2004-07-27 14:00:53 -07:00
|
|
|
#endif
|