LCOV - code coverage report
Current view: top level - source/graphics - UnitManager.h (source / functions) Hit Total Coverage
Test: 0 A.D. test coverage report Lines: 0 1 0.0 %
Date: 2023-01-19 00:18:29 Functions: 0 1 0.0 %

          Line data    Source code
       1             : /* Copyright (C) 2022 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             : /*
      19             :  * Container that owns all units
      20             :  */
      21             : 
      22             : #ifndef INCLUDED_UNITMANAGER
      23             : #define INCLUDED_UNITMANAGER
      24             : 
      25             : #include "ps/CStrForward.h"
      26             : 
      27             : #include <vector>
      28             : #include <set>
      29             : 
      30             : class CUnit;
      31             : class CObjectManager;
      32             : 
      33             : ///////////////////////////////////////////////////////////////////////////////
      34             : // CUnitManager: simple container class holding all units within the world
      35             : class CUnitManager
      36             : {
      37             : public:
      38             :     // constructor, destructor
      39             :     CUnitManager();
      40             :     ~CUnitManager();
      41             : 
      42             :     // add given unit to world
      43             :     void AddUnit(CUnit* unit);
      44             :     // remove given unit from world, but don't delete it
      45             :     void RemoveUnit(CUnit* unit);
      46             :     // remove given unit from world and delete it
      47             :     void DeleteUnit(CUnit* unit);
      48             :     // remove and delete all units
      49             :     void DeleteAll();
      50             : 
      51             :     // creates a new unit and adds it to the world
      52             :     CUnit* CreateUnit(const CStrW& actorName, uint32_t seed);
      53             : 
      54             :     // return the units
      55             :     const std::vector<CUnit*>& GetUnits() const { return m_Units; }
      56             : 
      57           0 :     void SetObjectManager(CObjectManager& objectManager) { m_ObjectManager = &objectManager; }
      58             : 
      59             :     /**
      60             :      * Mark a specific region of the terrain as dirty.
      61             :      * Coordinates are in terrain tiles, lower inclusive, upper exclusive.
      62             :      */
      63             :     void MakeTerrainDirty(ssize_t i0, ssize_t j0, ssize_t i1, ssize_t j1, int dirtyFlags);
      64             : 
      65             : private:
      66             :     // list of all known units
      67             :     std::vector<CUnit*> m_Units;
      68             :     // graphical object manager; may be NULL if not set up
      69             :     CObjectManager* m_ObjectManager;
      70             : };
      71             : 
      72             : #endif

Generated by: LCOV version 1.13