1 /* Copyright (C) 2017 Wildfire Games.
2 * This file is part of 0 A.D.
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.
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.
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/>.
21 * Description : Contains the CWorld Class which contains all the entities and represents them at a specific moment in time.
24 #ifndef INCLUDED_WORLD
25 #define INCLUDED_WORLD
27 #include "ps/Errors.h"
28 #include "scriptinterface/ScriptInterface.h"
30 #ifndef ERROR_GROUP_GAME_DEFINED
31 #define ERROR_GROUP_GAME_DEFINED
34 ERROR_SUBGROUP(Game
, World
);
35 ERROR_TYPE(Game_World
, MapLoadFailed
);
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.
51 * pointer to the CGame object representing the game.
56 * pointer to the CTerrain object representing the height map.
61 * pointer to the CUnitManager that holds all the units in the world.
63 CUnitManager
*m_UnitManager
;
65 CMapReader
* m_MapReader
;
72 Initialize the World - load the map and all objects
74 void RegisterInit(const CStrW
& mapFile
, JSRuntime
* rt
, JS::HandleValue settings
, int playerID
);
77 Initialize the World - generate and load the random map
79 void RegisterInitRMS(const CStrW
& scriptFile
, JSRuntime
* rt
, JS::HandleValue settings
, int playerID
);
82 * Explicitly delete m_MapReader once the map has finished loading.
84 int DeleteMapReader();
87 * Get the pointer to the terrain object.
89 * @return CTerrain * the value of m_Terrain.
91 inline CTerrain
*GetTerrain()
95 * Get a reference to the unit manager object.
97 * @return CUnitManager & dereferenced m_UnitManager.
99 inline CUnitManager
&GetUnitManager()
100 { return *m_UnitManager
; }
103 // rationale: see definition.
105 extern CLightEnv g_LightEnv
;