28 #ifndef ELEMENT_DATA_H
29 #define ELEMENT_DATA_H
38 #define DATA_MAXVAL 1000000
44 #define DATA_VERSION 1
50 typedef typename CC::ATOM_TYPE T;
60 static const u32 TYPE()
65 static const u32 STATE_DATA_IDX = 0;
66 static const u32 STATE_DATA_LEN = 32;
68 u32 GetDatum(
const T &atom, u32 badType)
const
74 return atom.GetStateField(STATE_DATA_IDX,STATE_DATA_LEN);
77 bool SetDatum(T &atom, u32 value)
const
83 atom.SetStateField(STATE_DATA_IDX,STATE_DATA_LEN,value);
89 const T& atom = *atomPtr;
91 u32 datum = GetDatum(atom, 0);
94 desc.Printf(
"Datum: %d", datum);
98 desc.Printf(
"Datum: INVALID");
104 static T defaultAtom(TYPE(),0,0,STATE_DATA_LEN);
105 static bool initted =
false;
108 SetDatum(defaultAtom, (DATA_MAXVAL + DATA_MINVAL) / 2);
131 return "An element designed simply to hold a 32-bit value, usually generated "
132 "at random when created by an emitter atom.";
140 return ColorMap_CubeHelixRev::THE_INSTANCE.
141 GetInterpolatedColor(GetDatum(atom,0),DATA_MINVAL,DATA_MAXVAL,0xffff0000);
150 if (val < DATA_MINVAL || val > DATA_MAXVAL)
160 Element_Data<CC> Element_Data<CC>::THE_INSTANCE;
void Diffuse(EventWindow< CC > &window) const
Definition: Element.tcc:73
u32 GetType() const
Definition: Element.h:290
Definition: Element_Data.h:47
virtual const char * GetDescription() const
Definition: Element_Data.h:129
void SetName(const char *name)
Definition: Element.h:209
void SetAtomicSymbol(const char *symbol)
Definition: Element.h:193
virtual u32 PercentMovable(const T &you, const T &me, const SPoint &offset) const
Definition: Element_Data.h:124
virtual void Behavior(EventWindow< CC > &window) const
Definition: Element_Data.h:147
virtual u32 DefaultPhysicsColor() const
Definition: Element_Data.h:114
const T & GetCenterAtom() const
Definition: EventWindow.h:209
virtual const T & GetDefaultAtom() const
Definition: Element_Data.h:102
virtual void AppendDescription(const T *atomPtr, OString64 &desc) const
Definition: Element_Data.h:87
Definition: ElementTable.h:43
virtual u32 PhysicsColor() const
Definition: Element.h:398
virtual u32 DefaultLowlightColor() const
Definition: Element_Data.h:119
virtual u32 LocalPhysicsColor(const T &atom, u32 selector) const
Definition: Element_Data.h:135