Pyrogenesis  13997
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SimContext.cpp
Go to the documentation of this file.
1 /* Copyright (C) 2011 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 #include "precompiled.h"
19 
20 #include "SimContext.h"
21 
22 #include "ComponentManager.h"
23 
24 #include "ps/Game.h"
25 
27  m_ComponentManager(NULL), m_UnitManager(NULL), m_Terrain(NULL)
28 {
29 }
30 
32 {
33 }
34 
36 {
37  return *m_ComponentManager;
38 }
39 
41 {
42  return m_UnitManager != NULL;
43 }
44 
46 {
48  return *m_UnitManager;
49 }
50 
52 {
54  return *m_Terrain;
55 }
56 
58 {
60  m_ComponentManager = man;
61 }
62 
64 {
66 }
67 
69 {
70  if (!g_Game)
71  return -1;
72  return g_Game->GetPlayerID();
73 }
CComponentManager * m_ComponentManager
Definition: SimContext.h:58
CTerrain * m_Terrain
Definition: SimContext.h:60
ScriptInterface & GetScriptInterface()
int GetPlayerID()
Definition: Game.cpp:249
ScriptInterface & GetScriptInterface() const
Definition: SimContext.cpp:63
#define ENSURE(expr)
ensure the expression &lt;expr&gt; evaluates to non-zero.
Definition: debug.h:282
CGame * g_Game
Globally accessible pointer to the CGame object.
Definition: Game.cpp:56
int GetCurrentDisplayedPlayer() const
Returns the player ID that the current display is being rendered for.
Definition: SimContext.cpp:68
bool HasUnitManager() const
Definition: SimContext.cpp:40
CUnitManager & GetUnitManager() const
Definition: SimContext.cpp:45
Abstraction around a SpiderMonkey JSContext.
void SetComponentManager(CComponentManager *man)
Definition: SimContext.cpp:57
CUnitManager * m_UnitManager
Definition: SimContext.h:59
CComponentManager & GetComponentManager() const
Definition: SimContext.cpp:35
CTerrain & GetTerrain() const
Definition: SimContext.cpp:51