Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
SimContext.h
Go to the documentation of this file.
1/* Copyright (C) 2024 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#ifndef INCLUDED_SIMCONTEXT
19#define INCLUDED_SIMCONTEXT
20
21#include "Entity.h"
22
24class CUnitManager;
25class CTerrain;
26class ScriptInterface;
27
28/**
29 * Contains pointers to various 'global' objects that are needed by the simulation code,
30 * to allow easy access without using real (evil) global variables.
31 */
33{
34public:
35 CSimContext(CTerrain* terrain = nullptr, CUnitManager* unitManager = nullptr);
37
40
41 bool HasUnitManager() const;
43
44 CTerrain& GetTerrain() const;
45
47
50
51 /**
52 * Returns the player ID that the current display is being rendered for.
53 * Currently relies on g_Game being initialised (evil globals...)
54 */
55 int GetCurrentDisplayedPlayer() const;
56
57private:
61
63};
64
65#endif // INCLUDED_SIMCONTEXT
Definition: ComponentManager.h:40
Object wrapping an entity_id_t, with a SEntityComponentCache to support fast QueryInterface() / CmpPt...
Definition: Entity.h:80
entity_id_t GetId() const
Definition: Entity.h:88
Contains pointers to various 'global' objects that are needed by the simulation code,...
Definition: SimContext.h:33
~CSimContext()
Definition: SimContext.cpp:32
void SetComponentManager(CComponentManager *man)
Definition: SimContext.cpp:58
ScriptInterface & GetScriptInterface() const
Definition: SimContext.cpp:64
CTerrain & GetTerrain() const
Definition: SimContext.cpp:52
CEntityHandle m_SystemEntity
Definition: SimContext.h:62
CTerrain * m_Terrain
Definition: SimContext.h:60
CSimContext(CTerrain *terrain=nullptr, CUnitManager *unitManager=nullptr)
Definition: SimContext.cpp:26
void SetSystemEntity(CEntityHandle ent)
Definition: SimContext.h:48
CComponentManager & GetComponentManager() const
Definition: SimContext.cpp:36
CUnitManager & GetUnitManager() const
Definition: SimContext.cpp:46
bool HasUnitManager() const
Definition: SimContext.cpp:41
CComponentManager * m_ComponentManager
Definition: SimContext.h:58
CUnitManager * m_UnitManager
Definition: SimContext.h:59
CEntityHandle GetSystemEntity() const
Definition: SimContext.h:49
int GetCurrentDisplayedPlayer() const
Returns the player ID that the current display is being rendered for.
Definition: SimContext.cpp:69
Definition: Terrain.h:52
Definition: UnitManager.h:38
Abstraction around a SpiderMonkey JS::Realm.
Definition: ScriptInterface.h:72
#define ASSERT(expr)
same as ENSURE in debug mode, does nothing in release mode.
Definition: debug.h:305
const entity_id_t SYSTEM_ENTITY
Entity ID for singleton 'system' components.
Definition: Entity.h:43