LCOV - code coverage report
Current view: top level - source/simulation2/system - SimContext.cpp (source / functions) Hit Total Coverage
Test: 0 A.D. test coverage report Lines: 16 23 69.6 %
Date: 2022-06-14 00:41:00 Functions: 6 9 66.7 %

          Line data    Source code
       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             : 
      26         128 : CSimContext::CSimContext() :
      27         256 :     m_ComponentManager(NULL), m_UnitManager(NULL), m_Terrain(NULL)
      28             : {
      29         128 : }
      30             : 
      31         128 : CSimContext::~CSimContext()
      32             : {
      33         128 : }
      34             : 
      35         176 : CComponentManager& CSimContext::GetComponentManager() const
      36             : {
      37         196 :     return *m_ComponentManager;
      38             : }
      39             : 
      40           0 : bool CSimContext::HasUnitManager() const
      41             : {
      42           0 :     return m_UnitManager != NULL;
      43             : }
      44             : 
      45           0 : CUnitManager& CSimContext::GetUnitManager() const
      46             : {
      47           0 :     ENSURE(m_UnitManager);
      48           0 :     return *m_UnitManager;
      49             : }
      50             : 
      51           3 : CTerrain& CSimContext::GetTerrain() const
      52             : {
      53           3 :     ENSURE(m_Terrain);
      54           3 :     return *m_Terrain;
      55             : }
      56             : 
      57         128 : void CSimContext::SetComponentManager(CComponentManager* man)
      58             : {
      59         128 :     ENSURE(!m_ComponentManager);
      60         128 :     m_ComponentManager = man;
      61         128 : }
      62             : 
      63          20 : ScriptInterface& CSimContext::GetScriptInterface() const
      64             : {
      65          60 :     return GetComponentManager().GetScriptInterface();
      66             : }
      67             : 
      68           0 : int CSimContext::GetCurrentDisplayedPlayer() const
      69             : {
      70           0 :     return g_Game ? g_Game->GetViewedPlayerID() : -1;
      71             : }

Generated by: LCOV version 1.13