Pyrogenesis  trunk
ICmpVisibility.h
Go to the documentation of this file.
1 /* Copyright (C) 2015 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 
22 
24 
25 /**
26  * The Visibility component is a scripted component that allows any part of the simulation to
27  * influence the visibility of an entity.
28  *
29  * This component:
30  * - Holds the template values RetainInFog and AlwaysVisible, used by the range manager to compute
31  * the visibility of the entity;
32  * - Can supersede the range manager if it is "activated". This is to avoid useless calls to the scripts.
33  */
34 
35 class ICmpVisibility : public IComponent
36 {
37 public:
38  /**
39  * This function is a fallback for some entities whose visibility status
40  * cannot be cached by the range manager (especially local entities like previews).
41  * Calling the scripts is expensive, so only call it if really needed.
42  */
43  virtual bool IsActivated() = 0;
44 
45  virtual ICmpRangeManager::ELosVisibility GetVisibility(player_id_t player, bool isVisible, bool isExplored) = 0;
46 
47  virtual bool GetRetainInFog() = 0;
48 
49  virtual bool GetAlwaysVisible() = 0;
50 
51  DECLARE_INTERFACE_TYPE(Visibility)
52 };
53 
54 #endif // INCLUDED_ICMPVISIBILITY
Definition: IComponent.h:33
virtual bool IsActivated()=0
This function is a fallback for some entities whose visibility status cannot be cached by the range m...
virtual ICmpRangeManager::ELosVisibility GetVisibility(player_id_t player, bool isVisible, bool isExplored)=0
int32_t player_id_t
valid player IDs are non-negative (see ICmpOwnership)
Definition: Player.h:24
virtual bool GetAlwaysVisible()=0
#define DECLARE_INTERFACE_TYPE(iname)
Definition: Interface.h:23
ELosVisibility
Definition: ICmpRangeManager.h:229
virtual bool GetRetainInFog()=0
The Visibility component is a scripted component that allows any part of the simulation to influence ...
Definition: ICmpVisibility.h:35