MFMv2.0.10
Movable Feast Machine Simulator 2.0.10
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Element_Wanderer_Cyan.h
Go to the documentation of this file.
1 /* -*- mode:C++ -*-
2  Element_Wanderer_Cyan.h Child One in AbstractElement tutorial
3  Copyright (C) 2014 The Regents of the University of New Mexico. All rights reserved.
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this library; if not, write to the Free Software
17  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
18  USA
19 */
20 
27 #ifndef ELEMENT_WANDERER_CYAN_H
28 #define ELEMENT_WANDERER_CYAN_H
29 
30 #include "Element.h"
31 #include "EventWindow.h"
32 #include "ElementTable.h"
33 #include "itype.h"
34 #include "P1Atom.h"
36 
37 namespace MFM
38 {
39 
40 #define WANDERER_VERSION 1
41 
42  template <class CC>
44  {
45  // Extract short names for parameter types
46  typedef typename CC::ATOM_TYPE T;
47  typedef typename CC::PARAM_CONFIG P;
48  enum { R = P::EVENT_WINDOW_RADIUS };
49 
50  private:
51  ElementParameterS32<CC> m_wanderDistance;
52 
53  public:
54  static Element_Wanderer_Cyan THE_INSTANCE;
55 
57  : AbstractElement_Wanderer<CC>(MFM_UUID_FOR("WandererCyan", WANDERER_VERSION)),
58  m_wanderDistance(this, "cyanWanderDistance", "Wander Distance",
59  "Wander Distance", 0, 1, R/*, 1*/)
60  {
62  Element<CC>::SetName("WandererCyan");
63  }
64 
65  virtual u32 PercentMovable(const T& you,
66  const T& me, const SPoint& offset) const
67  {
68  return 100;
69  }
70 
71  virtual u32 DefaultPhysicsColor() const
72  {
73  return 0xff00ffff;
74  }
75 
76  virtual u32 DefaultLowlightColor() const
77  {
78  return 0xff007f7f;
79  }
80 
81  protected:
82  virtual u32 GetWanderDistance() const
83  {
84  return (u32)m_wanderDistance.GetValue();
85  }
86  };
87 
88  template <class CC>
89  Element_Wanderer_Cyan<CC> Element_Wanderer_Cyan<CC>::THE_INSTANCE;
90 
91 }
92 
93 #endif /* ELEMENT_WANDERER_CYAN_H */
virtual u32 DefaultPhysicsColor() const
Definition: Element_Wanderer_Cyan.h:71
virtual u32 PercentMovable(const T &you, const T &me, const SPoint &offset) const
Definition: Element_Wanderer_Cyan.h:65
void SetName(const char *name)
Definition: Element.h:209
void SetAtomicSymbol(const char *symbol)
Definition: Element.h:193
virtual u32 DefaultLowlightColor() const
Definition: Element_Wanderer_Cyan.h:76
Definition: Parameter.h:593
Definition: Element_Wanderer_Cyan.h:43
Definition: AbstractElement_Wanderer.h:39