diff options
author | archshift <admin@archshift.com> | 2014-07-14 00:43:49 +0200 |
---|---|---|
committer | archshift <admin@archshift.com> | 2014-07-14 00:43:49 +0200 |
commit | 0409daf7360d503e9e2b6258fa2582d7bdd7e5a0 (patch) | |
tree | f57edc3d6753017a6652b6bea86566aaa67ab3a3 | |
parent | Changed separating comment style from asterisks to slashes. (diff) | |
download | cuberite-0409daf7360d503e9e2b6258fa2582d7bdd7e5a0.tar cuberite-0409daf7360d503e9e2b6258fa2582d7bdd7e5a0.tar.gz cuberite-0409daf7360d503e9e2b6258fa2582d7bdd7e5a0.tar.bz2 cuberite-0409daf7360d503e9e2b6258fa2582d7bdd7e5a0.tar.lz cuberite-0409daf7360d503e9e2b6258fa2582d7bdd7e5a0.tar.xz cuberite-0409daf7360d503e9e2b6258fa2582d7bdd7e5a0.tar.zst cuberite-0409daf7360d503e9e2b6258fa2582d7bdd7e5a0.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Entities/EntityEffect.cpp | 35 | ||||
-rw-r--r-- | src/Entities/EntityEffect.h | 14 |
2 files changed, 29 insertions, 20 deletions
diff --git a/src/Entities/EntityEffect.cpp b/src/Entities/EntityEffect.cpp index be501297c..852099b79 100644 --- a/src/Entities/EntityEffect.cpp +++ b/src/Entities/EntityEffect.cpp @@ -33,7 +33,11 @@ cEntityEffect::cEntityEffect(int a_Duration, short a_Intensity, double a_Distanc -cEntityEffect::~cEntityEffect() +cEntityEffect::cEntityEffect(const cEntityEffect & a_OtherEffect): + m_Ticks(a_OtherEffect.m_Ticks), + m_Duration(a_OtherEffect.m_Duration), + m_Intensity(a_OtherEffect.m_Intensity), + m_DistanceModifier(a_OtherEffect.m_DistanceModifier) { } @@ -42,6 +46,19 @@ cEntityEffect::~cEntityEffect() +cEntityEffect & cEntityEffect::operator=(cEntityEffect a_OtherEffect) +{ + std::swap(m_Ticks, a_OtherEffect.m_Ticks); + std::swap(m_Duration, a_OtherEffect.m_Duration); + std::swap(m_Intensity, a_OtherEffect.m_Intensity); + std::swap(m_DistanceModifier, a_OtherEffect.m_DistanceModifier); + return *this; +} + + + + + cEntityEffect * cEntityEffect::CreateEntityEffect(cEntityEffect::eType a_EffectType, int a_Duration, short a_Intensity, double a_DistanceModifier) { switch (a_EffectType) @@ -90,22 +107,6 @@ void cEntityEffect::OnTick(cPawn & a_Target) -void cEntityEffect::OnActivate(cPawn & a_Target) -{ -} - - - - - -void cEntityEffect::OnDeactivate(cPawn & a_Target) -{ -} - - - - - ///////////////////////////////////////////////////////////////////////// // Instant Health ///////////////////////////////////////////////////////////////////////// diff --git a/src/Entities/EntityEffect.h b/src/Entities/EntityEffect.h index 6e53d83b8..c6532a9bd 100644 --- a/src/Entities/EntityEffect.h +++ b/src/Entities/EntityEffect.h @@ -45,7 +45,15 @@ public: @param a_DistanceModifier The distance modifier for affecting potency, defaults to 1 */ cEntityEffect(int a_Duration, short a_Intensity, double a_DistanceModifier = 1); - virtual ~cEntityEffect(void); + /** Creates an entity effect by copying another + @param a_OtherEffect The other effect to copy */ + cEntityEffect(const cEntityEffect & a_OtherEffect); + + /** Creates an entity effect by copying another + @param a_OtherEffect The other effect to copy */ + cEntityEffect & operator=(cEntityEffect a_OtherEffect); + + virtual ~cEntityEffect(void) {}; /** Creates a pointer to the proper entity effect from the effect type @warning This function creates raw pointers that must be manually managed. @@ -70,8 +78,8 @@ public: void SetDistanceModifier(double a_DistanceModifier) { m_DistanceModifier = a_DistanceModifier; } virtual void OnTick(cPawn & a_Target); - virtual void OnActivate(cPawn & a_Target); - virtual void OnDeactivate(cPawn & a_Target); + virtual void OnActivate(cPawn & a_Target) { } + virtual void OnDeactivate(cPawn & a_Target) { } protected: /** How many ticks this effect has been active for */ |