LCOV - code coverage report
Current view: top level - source/ps - World.h (source / functions) Hit Total Coverage
Test: 0 A.D. test coverage report Lines: 0 7 0.0 %
Date: 2023-01-19 00:18:29 Functions: 0 8 0.0 %

          Line data    Source code
       1             : /* Copyright (C) 2021 Wildfire Games.
       2             :  * This file is part of 0 A.D.
       3             :  *
       4             :  * 0 A.D. is free software: you can redistribute it and/or modify
       5             :  * it under the terms of the GNU General Public License as published by
       6             :  * the Free Software Foundation, either version 2 of the License, or
       7             :  * (at your option) any later version.
       8             :  *
       9             :  * 0 A.D. is distributed in the hope that it will be useful,
      10             :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      11             :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      12             :  * GNU General Public License for more details.
      13             :  *
      14             :  * You should have received a copy of the GNU General Public License
      15             :  * along with 0 A.D.  If not, see <http://www.gnu.org/licenses/>.
      16             :  */
      17             : 
      18             : /**
      19             :  * File        : World.h
      20             :  * Project     : engine
      21             :  * Description : Contains the CWorld Class which contains all the entities and represents them at a specific moment in time.
      22             :  *
      23             :  **/
      24             : #ifndef INCLUDED_WORLD
      25             : #define INCLUDED_WORLD
      26             : 
      27             : #include "ps/CStrForward.h"
      28             : #include "ps/Errors.h"
      29             : 
      30             : #ifndef ERROR_GROUP_GAME_DEFINED
      31             : #define ERROR_GROUP_GAME_DEFINED
      32           0 : ERROR_GROUP(Game);
      33             : #endif
      34           0 : ERROR_SUBGROUP(Game, World);
      35           0 : ERROR_TYPE(Game_World, MapLoadFailed);
      36             : 
      37             : class CGame;
      38             : class CUnitManager;
      39             : class CTerrain;
      40             : class CMapReader;
      41             : class ScriptContext;
      42             : 
      43             : /**
      44             :  * CWorld is a general data class containing whatever is needed to accurately represent the world.
      45             :  * This includes the map, entities, influence maps, tiles, heightmap, etc.
      46             :  **/
      47             : class CWorld
      48             : {
      49             :     NONCOPYABLE(CWorld);
      50             :     /**
      51             :      * pointer to the CGame object representing the game.
      52             :      **/
      53             :     CGame *m_pGame;
      54             : 
      55             :     /**
      56             :      * pointer to the CTerrain object representing the height map.
      57             :      **/
      58             :     CTerrain *m_Terrain;
      59             : 
      60             :     /**
      61             :      * pointer to the CUnitManager that holds all the units in the world.
      62             :      **/
      63             :     CUnitManager *m_UnitManager;
      64             : 
      65             :     CMapReader* m_MapReader;
      66             : 
      67             : public:
      68             :     CWorld(CGame *pGame);
      69             :     ~CWorld();
      70             : 
      71             :     /*
      72             :     Initialize the World - load the map and all objects
      73             :     */
      74             :     void RegisterInit(const CStrW& mapFile, const ScriptContext& cx, JS::HandleValue settings, int playerID);
      75             : 
      76             :     /*
      77             :     Initialize the World - generate and load the random map
      78             :     */
      79             :     void RegisterInitRMS(const CStrW& scriptFile, const ScriptContext& cx, JS::HandleValue settings, int playerID);
      80             : 
      81             :     /**
      82             :      * Explicitly delete m_MapReader once the map has finished loading.
      83             :      **/
      84             :     int DeleteMapReader();
      85             : 
      86             :     /**
      87             :      * Get the pointer to the terrain object.
      88             :      *
      89             :      * @return CTerrain * the value of m_Terrain.
      90             :      **/
      91           0 :     inline CTerrain *GetTerrain()
      92           0 :     {   return m_Terrain; }
      93             : 
      94             :     /**
      95             :      * Get a reference to the unit manager object.
      96             :      *
      97             :      * @return CUnitManager & dereferenced m_UnitManager.
      98             :      **/
      99           0 :     inline CUnitManager &GetUnitManager()
     100           0 :     {   return *m_UnitManager; }
     101             : };
     102             : 
     103             : // rationale: see definition.
     104             : class CLightEnv;
     105             : extern CLightEnv g_LightEnv;
     106             : 
     107             : #endif

Generated by: LCOV version 1.13