Roguelike
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
octantiterator.h
Go to the documentation of this file.
1 #ifndef ROGUELIKE_ALG_LOS_OCTANTITERATOR_H_
2 #define ROGUELIKE_ALG_LOS_OCTANTITERATOR_H_
3 
4 // Inheritance
5 // (none)
6 
7 // External Dependencies
8 #include <ugdk/math/integer2D.h>
9 
10 // Internal Dependencies
11 // (none)
12 
13 // Forward Declarations
14 // (none)
15 
16 namespace game {
17 namespace alg {
18 namespace los {
19 
21  public:
22  OctantIterator(double range_squared, const ugdk::math::Integer2D& start_offset )
23  : range_squared_(range_squared), focus_(start_offset) {}
25 
26  ugdk::math::Integer2D operator*() const { return focus_; }
27  bool end() const { return focus_.x*focus_.x + focus_.y*focus_.y > range_squared_; }
28 
29  virtual OctantIterator& operator++() = 0;
30  virtual void Reset() = 0;
31  virtual bool FocusIsControlTile() const = 0;
32 
33  protected:
35  ugdk::math::Integer2D focus_;
36 };
37 
38 } // namespace los
39 } // namespace alg
40 } // namespace game
41 
42 #endif // ROGUELIKE_ALG_LOS_OCTANTITERATOR_H_
ugdk::math::Integer2D operator*() const
Definition: octantiterator.h:26
Definition: octantiterator.h:20
Definition: aim.cc:15
virtual bool FocusIsControlTile() const =0
virtual OctantIterator & operator++()=0
double range_squared_
Definition: octantiterator.h:34
OctantIterator(double range_squared, const ugdk::math::Integer2D &start_offset)
Definition: octantiterator.h:22
bool end() const
Definition: octantiterator.h:27
ugdk::math::Integer2D focus_
Definition: octantiterator.h:35
~OctantIterator()
Definition: octantiterator.h:24