Overseer
ChokePoint.h
1 #ifndef _OVERSEER_CHOKEPOINT_H_
2 #define _OVERSEER_CHOKEPOINT_H_
3 
4 #include "Region.h"
5 #include "Graph.h"
6 #include <tuple>
7 #include <utility>
8 
9 namespace Overseer{
10  typedef std::tuple<size_t, size_t, size_t> ChokePointId;
11 
17  class ChokePoint {
18  public:
19 
28  ChokePoint(const Region* region1, const Region* region2, size_t cp_id, std::vector<TilePosition> tilePositions);
29 
35  std::pair<const Region*, const Region*> getRegions() const;
36 
42  size_t size() const;
43 
49  sc2::Point2D getMidPoint() const;
50 
56  std::vector<sc2::Point2D> getPoints() const;
57 
63  std::vector<TilePosition> getTilePositions() const;
64 
70  ChokePointId getId() const;
71 
75  bool operator==(const ChokePoint& rhs) const;
76 
83  bool adjacent(ChokePoint& cp) const;
84 
90  std::string getStringId() const;
91 
95  size_t getChokePointId() const;
96 
97  private:
98  size_t m_id;
99  std::pair<const Region *, const Region *> m_regions;
100  std::vector<UnitPosition> m_neutralUnitPositions;
101  std::vector<TilePosition> m_tilePositions;
102  TilePosition m_center;
103  };
104 }
105 
106 #endif /* _OVERSEER_CHOKEPOINT_H_ */
std::vector< sc2::Point2D > getPoints() const
Get the points within the chokepoint.
Definition: ChokePoint.cpp:35
sc2::Point2D getMidPoint() const
Gets the mid point of the chokepoint.
Definition: ChokePoint.cpp:30
ChokePoint(const Region *region1, const Region *region2, size_t cp_id, std::vector< TilePosition > tilePositions)
class Constructor
Definition: ChokePoint.cpp:10
std::vector< TilePosition > getTilePositions() const
Get the tile positions inside the chokePoint.
std::string getStringId() const
Gets the chokepoint id as a string.
Definition: ChokePoint.cpp:49
size_t getChokePointId() const
Gets the chokepoints position between two regions (INTERNAL USE ONLY).
Definition: ChokePoint.cpp:60
Definition: ChokePoint.cpp:3
bool adjacent(ChokePoint &cp) const
check if this chokepoint share a region with chokepoint cp.
Definition: ChokePoint.cpp:66
A region handler.
Definition: Region.h:67
Class that is used as a chokepoint container with size and positioning on the map.
Definition: ChokePoint.h:17
bool operator==(const ChokePoint &rhs) const
How two chokepoints will be check if equal.
Definition: ChokePoint.cpp:62
std::pair< const Region *, const Region * > getRegions() const
Gets the regions where a chokepoint exists between them.
Definition: ChokePoint.cpp:21
ChokePointId getId() const
Get the id of the chokepoint.
Definition: ChokePoint.cpp:56
size_t size() const
Get the size of the found chokepoint.
Definition: ChokePoint.cpp:25