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/MapWildList.cpp | |
| parent | 72e08e3222064d72d7a6f1bf9fcb294b22569c06 (diff) | |
| download | sigen-40d6f3579a23c50a5570de3f511a407924703ec1.tar.gz sigen-40d6f3579a23c50a5570de3f511a407924703ec1.tar.xz sigen-40d6f3579a23c50a5570de3f511a407924703ec1.zip | |
[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/MapWildList.cpp')
| -rw-r--r-- | pokemod/MapWildList.cpp | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/pokemod/MapWildList.cpp b/pokemod/MapWildList.cpp index 3aa51d85..5c866aef 100644 --- a/pokemod/MapWildList.cpp +++ b/pokemod/MapWildList.cpp @@ -277,20 +277,23 @@ int MapWildList::encounterCount() const MapWildListEncounter* MapWildList::newEncounter() { - m_encounters.append(new MapWildListEncounter(this, newEncounterId())); - return m_encounters[encounterCount() - 1]; + return newEncounter(new MapWildListEncounter(this, newEncounterId())); } MapWildListEncounter* MapWildList::newEncounter(const QDomElement& xml) { - m_encounters.append(new MapWildListEncounter(xml, this, newEncounterId())); - return m_encounters[encounterCount() - 1]; + return newEncounter(new MapWildListEncounter(xml, this, newEncounterId())); } MapWildListEncounter* MapWildList::newEncounter(const MapWildListEncounter& encounter) { - m_encounters.append(new MapWildListEncounter(encounter, this, newEncounterId())); - return m_encounters[encounterCount() - 1]; + return newEncounter(new MapWildListEncounter(encounter, this, newEncounterId())); +} + +MapWildListEncounter* MapWildList::newEncounter(MapWildListEncounter* encounter) +{ + m_encounters.append(encounter); + return encounter; } void MapWildList::deleteEncounter(const int index) throw(IndexException) @@ -326,3 +329,9 @@ MapWildList& MapWildList::operator=(const MapWildList& rhs) COPY_SUB(MapWildListEncounter, encounters); return *this; } + +void MapWildList::clear() +{ + while (encounterCount()) + deleteEncounter(0); +} |
