diff options
author | Robert Vollmert <rvollmert@gmx.net> | 2010-03-21 16:14:25 +0100 |
---|---|---|
committer | Robert Vollmert <rvollmert@gmx.net> | 2010-03-21 20:14:38 +0100 |
commit | 9f90b2d9a942a463819d9ec7259b36b0c62f1785 (patch) | |
tree | bc1d306497cf0d956c0b338a22462a5d89b45f29 /crawl-ref/source/act-iter.h | |
parent | 2b188ef6f01ee18042a4511826b164c964bcd865 (diff) | |
download | crawl-ref-9f90b2d9a942a463819d9ec7259b36b0c62f1785.tar.gz crawl-ref-9f90b2d9a942a463819d9ec7259b36b0c62f1785.zip |
actor_iterator, a variant of monster_iterator that includes the player.
Diffstat (limited to 'crawl-ref/source/act-iter.h')
-rw-r--r-- | crawl-ref/source/act-iter.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/crawl-ref/source/act-iter.h b/crawl-ref/source/act-iter.h new file mode 100644 index 0000000000..3c48cfb5cd --- /dev/null +++ b/crawl-ref/source/act-iter.h @@ -0,0 +1,38 @@ +/* + * Provide a way to iterator over all actors, + * subject to a few common restrictions. + */ + +#ifndef ACT_ITER_H +#define ACT_ITER_H + +#include "mon-iter.h" + +class actor_iterator +{ +public: + actor_iterator(); + actor_iterator(const circle_def* circle_); + actor_iterator(const los_def* los_); + actor_iterator(const actor* act_); + + operator bool() const; + actor* operator*() const; + actor* operator->() const; + actor_iterator& operator++(); + actor_iterator operator++(int); + +protected: + restr_type restr; + const circle_def* circle; + const los_def* los; + const actor* act; + bool did_you; + monster_iterator mi; + + bool valid(const actor* a) const; + void raw_advance(); + void advance(bool may_stay=false); +}; + +#endif |