diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2008-04-29 01:18:47 +0000 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2008-04-29 01:18:47 +0000 |
| commit | 40d6f3579a23c50a5570de3f511a407924703ec1 (patch) | |
| tree | deba50e4749e2bcdf3bb7ff7bb2aa57ab1121178 /pokemod/Move.cpp | |
| parent | 72e08e3222064d72d7a6f1bf9fcb294b22569c06 (diff) | |
[FIX] Less repetative code in pokemod
[FIX] clear is no longer inline
git-svn-id: https://pokegen.svn.sourceforge.net/svnroot/pokegen/trunk@115 6ecfd1a5-f3ed-3746-8530-beee90d26b22
Diffstat (limited to 'pokemod/Move.cpp')
| -rw-r--r-- | pokemod/Move.cpp | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/pokemod/Move.cpp b/pokemod/Move.cpp index 20e49c21..1c676eac 100644 --- a/pokemod/Move.cpp +++ b/pokemod/Move.cpp @@ -368,20 +368,23 @@ int Move::effectCount() const MoveEffect* Move::newEffect() { - m_effects.append(new MoveEffect(this, newEffectId())); - return m_effects[effectCount() - 1]; + return newEffect(new MoveEffect(this, newEffectId())); } MoveEffect* Move::newEffect(const QDomElement& xml) { - m_effects.append(new MoveEffect(xml, this, newEffectId())); - return m_effects[effectCount() - 1]; + return newEffect(new MoveEffect(xml, this, newEffectId())); } MoveEffect* Move::newEffect(const MoveEffect& effect) { - m_effects.append(new MoveEffect(effect, this, newEffectId())); - return m_effects[effectCount() - 1]; + return newEffect(new MoveEffect(effect, this, newEffectId())); +} + +MoveEffect* Move::newEffect(MoveEffect* effect) +{ + m_effects.append(effect); + return effect; } void Move::deleteEffect(const int index) throw(IndexException) @@ -428,3 +431,9 @@ Move& Move::operator=(const Move& rhs) COPY_SUB(MoveEffect, effects); return *this; } + +void Move::clear() +{ + while (effectCount()) + deleteEffect(0); +} |
