LCOV - code coverage report
Current view: top level - source/simulation2/components - ICmpVisibility.h (source / functions) Hit Total Coverage
Test: 0 A.D. test coverage report Lines: 2 2 100.0 %
Date: 2026-12-02 01:21:50 Functions: 0 0 -

          Line data    Source code
       1             : /* Copyright (C) 2025 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_ICMPVISIBILITY
      19             : #define INCLUDED_ICMPVISIBILITY
      20             : 
      21             : #include "simulation2/components/ICmpRangeManager.h"
      22             : #include "simulation2/helpers/Player.h"
      23             : #include "simulation2/system/Component.h"
      24             : #include "simulation2/system/Interface.h"
      25             : 
      26             : #include <js/Value.h>
      27             : 
      28             : /**
      29             :  * The Visibility component is a scripted component that allows any part of the simulation to
      30             :  * influence the visibility of an entity.
      31             :  *
      32             :  * This component:
      33             :  * - Holds the template values RetainInFog and AlwaysVisible, used by the range manager to compute
      34             :  * the visibility of the entity;
      35             :  * - Can supersede the range manager if it is "activated". This is to avoid useless calls to the scripts.
      36             :  */
      37             : 
      38         189 : class ICmpVisibility : public IComponent
      39             : {
      40             : public:
      41             :     /**
      42             :      * This function is a fallback for some entities whose visibility status
      43             :      * cannot be cached by the range manager (especially local entities like previews).
      44             :      * Calling the scripts is expensive, so only call it if really needed.
      45             :      */
      46             :     virtual bool IsActivated() = 0;
      47             : 
      48             :     virtual LosVisibility GetVisibility(player_id_t player, bool isVisible, bool isExplored) = 0;
      49             : 
      50             :     virtual bool GetRetainInFog() = 0;
      51             : 
      52             :     virtual bool GetAlwaysVisible() = 0;
      53             : 
      54       28455 :     DECLARE_INTERFACE_TYPE(Visibility)
      55             : };
      56             : 
      57             : #endif // INCLUDED_ICMPVISIBILITY

Generated by: LCOV version 1.16