Pyrogenesis  13997
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ICmpTerritoryManager.h
Go to the documentation of this file.
1 /* Copyright (C) 2011 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_ICMPTERRITORYMANAGER
19 #define INCLUDED_ICMPTERRITORYMANAGER
20 
22 
26 
28 {
29 public:
30  virtual bool NeedUpdate(size_t* dirtyID) = 0;
31 
32  static const int TERRITORY_PLAYER_MASK = 0x3F;
33  static const int TERRITORY_CONNECTED_MASK = 0x40;
34  static const int TERRITORY_PROCESSED_MASK = 0x80; //< For internal use; marks a tile as processed.
35 
36  /**
37  * For each tile, the TERRITORY_PLAYER_MASK bits are player ID;
38  * TERRITORY_CONNECTED_MASK is set if the tile is connected to a root object
39  * (civ center etc).
40  */
41  virtual const Grid<u8>& GetTerritoryGrid() = 0;
42 
43  /**
44  * Get owner of territory at given position.
45  * @return player ID of owner; 0 if neutral territory
46  */
48 
49  /**
50  * Get whether territory at given position is connected to a root object
51  * (civ center etc) owned by that territory's player.
52  */
53  virtual bool IsConnected(entity_pos_t x, entity_pos_t z) = 0;
54 
55  DECLARE_INTERFACE_TYPE(TerritoryManager)
56 };
57 
58 #endif // INCLUDED_ICMPTERRITORYMANAGER
A simple fixed-point number class.
Definition: Fixed.h:115
virtual const Grid< u8 > & GetTerritoryGrid()=0
For each tile, the TERRITORY_PLAYER_MASK bits are player ID; TERRITORY_CONNECTED_MASK is set if the t...
virtual bool NeedUpdate(size_t *dirtyID)=0
int32_t player_id_t
valid player IDs are non-negative (see ICmpOwnership)
Definition: Player.h:24
#define DECLARE_INTERFACE_TYPE(iname)
Definition: Interface.h:23
virtual bool IsConnected(entity_pos_t x, entity_pos_t z)=0
Get whether territory at given position is connected to a root object (civ center etc) owned by that ...
static const int TERRITORY_CONNECTED_MASK
static const int TERRITORY_PLAYER_MASK
static const int TERRITORY_PROCESSED_MASK
virtual player_id_t GetOwner(entity_pos_t x, entity_pos_t z)=0
Get owner of territory at given position.