mercator  0.4.0
A terrain generation library for the Worldforge system.
Effector.cpp
1 // This file may be redistributed and modified only under the terms of
2 // the GNU General Public License (See COPYING for details).
3 // Copyright (C) 2010 Alistair Riddoch
4 
5 #include "Effector.h"
6 
7 #include <algorithm>
8 
9 namespace Mercator
10 {
11 
12 void Effector::setContext(std::unique_ptr<Effector::Context> c)
13 {
14  m_context = std::move(c);
15 }
16 
17 Effector::Effector() = default;
18 
19 // Ensure that m_context is not copied only one object can own the context
20 Effector::Effector(const Effector & o) : m_box(o.m_box)
21 {
22 }
23 
24 // Ensure that m_context is not copied only one object can own the context
26 {
27  m_box = rhs.m_box;
28  m_context.reset();
29  return *this;
30 }
31 
32 Effector::~Effector() = default;
33 
35 float set(float orig, float mod)
36 {
37  return mod;
38 }
39 
41 float max(float orig, float mod)
42 {
43  return std::max(orig, mod);
44 }
45 
47 float min(float orig, float mod)
48 {
49  return std::min(orig, mod);
50 }
51 
53 float sum(float orig, float mod)
54 {
55  return orig + mod;
56 }
57 
59 float dif(float orig, float mod)
60 {
61  return orig - mod;
62 }
63 
64 } // of namespace
Device which effects a change in the terrain.
Definition: Effector.h:26
WFMath::AxisBox< 2 > m_box
The bounding box of the geometric shape.
Definition: Effector.h:57
std::unique_ptr< Context > m_context
The application context of this effector.
Definition: Effector.h:60
Effector & operator=(const Effector &)
Assignment.
Definition: Effector.cpp:25
Effector()
Constructor.