Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
ICmpVisibility.h
Go to the documentation of this file.
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
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
39{
40public:
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 DECLARE_INTERFACE_TYPE(Visibility)
55};
56
57#endif // INCLUDED_ICMPVISIBILITY
LosVisibility
Since GetVisibility queries are run by the range manager other code using these must include ICmpRang...
Definition: ICmpRangeManager.h:55
int32_t player_id_t
valid player IDs are non-negative (see ICmpOwnership)
Definition: Player.h:26
The Visibility component is a scripted component that allows any part of the simulation to influence ...
Definition: ICmpVisibility.h:39
virtual bool IsActivated()=0
This function is a fallback for some entities whose visibility status cannot be cached by the range m...
virtual bool GetAlwaysVisible()=0
virtual bool GetRetainInFog()=0
virtual LosVisibility GetVisibility(player_id_t player, bool isVisible, bool isExplored)=0
Definition: IComponent.h:33
#define DECLARE_INTERFACE_TYPE(iname)
Definition: Interface.h:23