00001 /* 00002 * Provide a way to iterator over all monsters, 00003 * subject to a few common restrictions. 00004 * 00005 * TODO: 00006 * - Iterate over actors? 00007 */ 00008 00009 #ifndef MON_ITER_H 00010 #define MON_ITER_H 00011 00012 enum restr_type 00013 { 00014 R_NONE, 00015 R_CIRC, 00016 R_LOS, 00017 R_ACT, 00018 }; 00019 00020 class circle_def; 00021 class los_base; 00022 class actor; 00023 00024 class monster_iterator 00025 { 00026 public: 00027 monster_iterator(); 00028 monster_iterator(const circle_def* circle_); 00029 monster_iterator(const los_base* los_); 00030 explicit monster_iterator(const actor* act_); 00031 00032 operator bool() const; 00033 monster* operator*() const; 00034 monster* operator->() const; 00035 monster_iterator& operator++(); 00036 monster_iterator operator++(int); 00037 00038 protected: 00039 restr_type restr; 00040 int curr_mid; 00041 const circle_def* circle; 00042 const los_base* los; 00043 const actor* act; 00044 00045 bool valid(int mid) const; 00046 void advance(bool may_stay=false); 00047 }; 00048 00049 #endif