source: ps/trunk/source/simulation2/system/SimContext.cpp@ 27965

Last change on this file since 27965 was 27965, checked in by Vladislav Belov, 8 months ago

Revert non-ASCII characters from source and configuration files introduced in rP27786.

Fixes #6846

Differential Revision: https://code.wildfiregames.com/D5185

  • Property svn:eol-style set to native
File size: 1.6 KB
Line 
1/* Copyright (C) 2016 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
26CSimContext::CSimContext() :
27 m_ComponentManager(NULL), m_UnitManager(NULL), m_Terrain(NULL)
28{
29}
30
31CSimContext::~CSimContext()
32{
33}
34
35CComponentManager& CSimContext::GetComponentManager() const
36{
37 return *m_ComponentManager;
38}
39
40bool CSimContext::HasUnitManager() const
41{
42 return m_UnitManager != NULL;
43}
44
45CUnitManager& CSimContext::GetUnitManager() const
46{
47 ENSURE(m_UnitManager);
48 return *m_UnitManager;
49}
50
51CTerrain& CSimContext::GetTerrain() const
52{
53 ENSURE(m_Terrain);
54 return *m_Terrain;
55}
56
57void CSimContext::SetComponentManager(CComponentManager* man)
58{
59 ENSURE(!m_ComponentManager);
60 m_ComponentManager = man;
61}
62
63ScriptInterface& CSimContext::GetScriptInterface() const
64{
65 return GetComponentManager().GetScriptInterface();
66}
67
68int CSimContext::GetCurrentDisplayedPlayer() const
69{
70 return g_Game ? g_Game->GetViewedPlayerID() : -1;
71}
Note: See TracBrowser for help on using the repository browser.