MFMv2.0.10
Movable Feast Machine Simulator 2.0.10
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Element_Wall.h
Go to the documentation of this file.
1 /* -*- mode:C++ -*-
2  Element_Wall.h Basic immovable element
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  You should have received a copy of the GNU General Public License
15  along with this library; if not, write to the Free Software
16  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
17  USA
18 */
19 
27 #ifndef ELEMENT_WALL_H
28 #define ELEMENT_WALL_H
29 
30 #include "Element.h"
31 #include "EventWindow.h"
32 #include "ElementTable.h"
33 #include "itype.h"
34 #include "P1Atom.h"
35 
36 namespace MFM
37 {
38 
39 #define WALL_VERSION 1
40 
41  template <class CC>
42  class Element_Wall : public Element<CC>
43  {
44  // Short names for params
45  typedef typename CC::ATOM_TYPE T;
46  typedef typename CC::PARAM_CONFIG P;
47  enum { R = P::EVENT_WINDOW_RADIUS };
48 
49  public:
50  static Element_Wall THE_INSTANCE;
51  static const u32 TYPE() {
52  return THE_INSTANCE.GetType();
53  }
54 
55  Element_Wall() : Element<CC>(MFM_UUID_FOR("Wall", WALL_VERSION))
56  {
58  Element<CC>::SetName("Wall");
59  }
60 
61  virtual const T & GetDefaultAtom() const
62  {
63  static T defaultAtom(TYPE(),0,0,0);
64  return defaultAtom;
65  }
66 
67  virtual u32 DefaultPhysicsColor() const
68  {
69  return 0xffffffff;
70  }
71 
72  virtual u32 DefaultLowlightColor() const
73  {
74  return 0xff202020;
75  }
76 
77  virtual const char* GetDescription() const
78  {
79  return "The Element which represents an immovable wall. Other Elements may "
80  "modify the position or existance of this Wall, but most Elements like "
81  "DREG will not.";
82  }
83 
84  virtual u32 Diffusability(EventWindow<CC> & ew, SPoint nowAt, SPoint maybeAt) const
85  {
86  return nowAt.Equals(maybeAt)?Element<CC>::COMPLETE_DIFFUSABILITY:0;
87  }
88 
89  virtual u32 PercentMovable(const T& you,
90  const T& me, const SPoint& offset) const
91  {
92  return 0;
93  }
94 
95  virtual void Behavior(EventWindow<CC>& window) const
96  { }
97  };
98 
99  template <class CC>
100  Element_Wall<CC> Element_Wall<CC>::THE_INSTANCE;
101 }
102 
103 #endif /* ELEMENT_WALL_H */
virtual const char * GetDescription() const
Definition: Element_Wall.h:77
u32 GetType() const
Definition: Element.h:290
virtual u32 PercentMovable(const T &you, const T &me, const SPoint &offset) const
Definition: Element_Wall.h:89
bool Equals(const Point< T > &rhs) const
Definition: Point.tcc:205
virtual u32 Diffusability(EventWindow< CC > &ew, SPoint nowAt, SPoint maybeAt) const
Definition: Element_Wall.h:84
void SetName(const char *name)
Definition: Element.h:209
void SetAtomicSymbol(const char *symbol)
Definition: Element.h:193
virtual u32 DefaultLowlightColor() const
Definition: Element_Wall.h:72
virtual void Behavior(EventWindow< CC > &window) const
Definition: Element_Wall.h:95
virtual u32 DefaultPhysicsColor() const
Definition: Element_Wall.h:67
virtual const T & GetDefaultAtom() const
Definition: Element_Wall.h:61
Definition: Element_Wall.h:42
Definition: ElementTable.h:43
Definition: Atom.h:43