Fix the removal of implicit conversions in libfmt 10 by using explicit casts.
[0ad.git] / source / ps / World.h
blob9162b3aa22d06e5a24d2ecc1a5268e7f7edb8382
1 /* Copyright (C) 2021 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/>.
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.
23 **/
24 #ifndef INCLUDED_WORLD
25 #define INCLUDED_WORLD
27 #include "ps/CStrForward.h"
28 #include "ps/Errors.h"
30 #ifndef ERROR_GROUP_GAME_DEFINED
31 #define ERROR_GROUP_GAME_DEFINED
32 ERROR_GROUP(Game);
33 #endif
34 ERROR_SUBGROUP(Game, World);
35 ERROR_TYPE(Game_World, MapLoadFailed);
37 class CGame;
38 class CUnitManager;
39 class CTerrain;
40 class CMapReader;
41 class ScriptContext;
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
49 NONCOPYABLE(CWorld);
50 /**
51 * pointer to the CGame object representing the game.
52 **/
53 CGame *m_pGame;
55 /**
56 * pointer to the CTerrain object representing the height map.
57 **/
58 CTerrain *m_Terrain;
60 /**
61 * pointer to the CUnitManager that holds all the units in the world.
62 **/
63 CUnitManager *m_UnitManager;
65 CMapReader* m_MapReader;
67 public:
68 CWorld(CGame *pGame);
69 ~CWorld();
72 Initialize the World - load the map and all objects
74 void RegisterInit(const CStrW& mapFile, const ScriptContext& cx, JS::HandleValue settings, int playerID);
77 Initialize the World - generate and load the random map
79 void RegisterInitRMS(const CStrW& scriptFile, const ScriptContext& cx, JS::HandleValue settings, int playerID);
81 /**
82 * Explicitly delete m_MapReader once the map has finished loading.
83 **/
84 int DeleteMapReader();
86 /**
87 * Get the pointer to the terrain object.
89 * @return CTerrain * the value of m_Terrain.
90 **/
91 inline CTerrain *GetTerrain()
92 { return m_Terrain; }
94 /**
95 * Get a reference to the unit manager object.
97 * @return CUnitManager & dereferenced m_UnitManager.
98 **/
99 inline CUnitManager &GetUnitManager()
100 { return *m_UnitManager; }
103 // rationale: see definition.
104 class CLightEnv;
105 extern CLightEnv g_LightEnv;
107 #endif