1 #ifndef ELEMENT_COLLECTOR_H
2 #define ELEMENT_COLLECTOR_H
26 typedef typename CC::ATOM_TYPE T;
27 typedef typename CC::PARAM_CONFIG P;
28 enum { R = P::EVENT_WINDOW_RADIUS };
36 static const u32 TYPE() {
40 static bool IsMyType(u32 type) {
52 static T defaultAtom(TYPE(),0,0,0);
76 const u32 selfType =
self.GetType();
78 if (!IsMyType(selfType))
96 const SPoint sp = md.GetPoint(idx);
103 const u32 otherType = other.GetType();
107 if (random.
OneIn(++emptyCount)) {
111 if (otherType == selfType)
114 if (random.
OneIn(++resCount)) {
117 }
else if (random.
OneIn(++occupCount)) {
119 occupType = otherType;
124 if (occupCount > 0 && emptyCount > 0) {
130 const SPoint sp = md.GetPoint(idx) + occup;
136 const u32 otherType = other.GetType();
139 if (otherType == occupType) {
144 if ((otherCount == 0 || random.
OneIn(100*otherCount)) && emptyCount > 0) {
150 if (resCount > 1 && meCount == 0) {
162 Element_Collector<CC> Element_Collector<CC>::THE_INSTANCE;
u32 GetFirstIndex(const u32 radius) const
Definition: MDist.h:112
void Diffuse(EventWindow< CC > &window) const
Definition: Element.tcc:73
virtual u32 PercentMovable(const T &you, const T &me, const SPoint &offset) const
Definition: Element_Collector.h:66
u32 GetType() const
Definition: Element.h:290
Definition: Element_Empty.h:41
u32 GetLastIndex(const u32 radius) const
Definition: MDist.h:129
virtual void Behavior(EventWindow< CC > &window) const
Definition: Element_Collector.h:71
virtual u32 DefaultPhysicsColor() const
Definition: Element_Collector.h:56
void SetName(const char *name)
Definition: Element.h:209
void SetAtomicSymbol(const char *symbol)
Definition: Element.h:193
bool IsLiveSite(const SPoint &location) const
Definition: EventWindow.h:148
bool OneIn(u32 odds)
Definition: Random.h:96
Random & GetRandom()
Definition: EventWindow.h:122
const T & GetRelativeAtom(const SPoint &offset) const
Definition: EventWindow.tcc:26
Definition: Element_Collector.h:23
const T & GetCenterAtom() const
Definition: EventWindow.h:209
virtual const T & GetDefaultAtom() const
Definition: Element_Collector.h:50
bool IsType(u32 type) const
Definition: Element.h:345
static MDist< R > & get()
Definition: MDist.tcc:193
Definition: Element_Res.h:48
Definition: ElementTable.h:43
bool SetRelativeAtom(const SPoint &offset, const T &atom)
Definition: EventWindow.tcc:15
virtual u32 DefaultLowlightColor() const
Definition: Element_Collector.h:61
void SwapAtoms(const SPoint &locA, const SPoint &locB)
Definition: EventWindow.tcc:40