1 #ifndef ELEMENT_MOVER_H
2 #define ELEMENT_MOVER_H
16 #define MOVER_VERSION 1
29 class Element_Mover :
public Element<CC>
32 typedef typename CC::ATOM_TYPE T;
33 typedef typename CC::PARAM_CONFIG P;
34 enum { R = P::EVENT_WINDOW_RADIUS };
38 static Element_Mover THE_INSTANCE;
39 static const u32 TYPE() {
43 static const u32 TYPE_BITS = 12;
44 static const u32 TYPE_MASK = (1<<TYPE_BITS)-1;
46 static const u32 STATE_BITS = 0;
48 static bool IsMoverType(u32 type)
53 Element_Mover() :
Element<CC>(MFM_UUID_FOR(
"Mover", MOVER_VERSION))
61 static T defaultAtom(TYPE(),0,0,STATE_BITS);
85 const u32 selfType =
self.GetType();
87 if (!IsMoverType(selfType))
104 const SPoint sp = md.GetPoint(idx);
111 const u32 otherType = other.GetType();
115 if (random.
OneIn(++emptyCount)) {
126 if (random.
OneIn(++occupCount)) {
132 if (occupCount > 0) {
135 const u32 otherType = other.GetType();
140 if (isRes && moverCount==0 && resCount > 1) {
142 }
else if (emptyCount > 0) {
154 Element_Mover<CC> Element_Mover<CC>::THE_INSTANCE;
u32 GetFirstIndex(const u32 radius) const
Definition: MDist.h:112
void Diffuse(EventWindow< CC > &window) const
Definition: Element.tcc:73
u32 GetType() const
Definition: Element.h:290
virtual u32 DefaultPhysicsColor() const
Definition: Element_Mover.h:65
Definition: Element_Empty.h:41
u32 GetLastIndex(const u32 radius) const
Definition: MDist.h:129
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_Dreg.h:47
virtual u32 PercentMovable(const T &you, const T &me, const SPoint &offset) const
Definition: Element_Mover.h:75
const T & GetCenterAtom() const
Definition: EventWindow.h:209
virtual void Behavior(EventWindow< CC > &window) const
Definition: Element_Mover.h:80
virtual u32 DefaultLowlightColor() const
Definition: Element_Mover.h:70
bool IsType(u32 type) const
Definition: Element.h:345
Element(const UUID &uuid)
Definition: Element.h:246
Definition: Element_Mover.h:28
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 const T & GetDefaultAtom() const
Definition: Element_Mover.h:59
void SwapAtoms(const SPoint &locA, const SPoint &locB)
Definition: EventWindow.tcc:40