Line data Source code
1 : /* Copyright (C) 2020 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/system/Interface.h"
22 :
23 : #include "simulation2/components/ICmpRangeManager.h"
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 0 : 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 LosVisibility GetVisibility(player_id_t player, bool isVisible, bool isExplored) = 0;
46 :
47 : virtual bool GetRetainInFog() = 0;
48 :
49 : virtual bool GetAlwaysVisible() = 0;
50 :
51 119 : DECLARE_INTERFACE_TYPE(Visibility)
52 : };
53 :
54 : #endif // INCLUDED_ICMPVISIBILITY
|