summaryrefslogtreecommitdiffstats
path: root/pokemod/MapWildList.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'pokemod/MapWildList.cpp')
-rw-r--r--pokemod/MapWildList.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/pokemod/MapWildList.cpp b/pokemod/MapWildList.cpp
index 59ccec3f..0f6730e7 100644
--- a/pokemod/MapWildList.cpp
+++ b/pokemod/MapWildList.cpp
@@ -52,8 +52,8 @@ MapWildList::MapWildList(const Pokemod* pokemod, const QString& fileName, const
MapWildList::~MapWildList()
{
- foreach (MapWildListEncounter* encounter, m_encounters)
- delete encounter;
+ while (encounterCount())
+ deleteEncounter(0);
}
bool MapWildList::validate() const
@@ -155,7 +155,8 @@ void MapWildList::load(const QString& fileName, int id) throw(Exception)
QStringList path = pokemod()->path().split('/');
path.removeLast();
QDir fdir(path.join("/"));
- m_encounters.clear();
+ while (encounterCount())
+ deleteEncounter(0);
if (fdir.cd("encounter"))
{
QStringList files(fdir.entryList(QStringList("*.pini"), QDir::Files, QDir::Name));
@@ -345,7 +346,8 @@ MapWildList& MapWildList::operator=(const MapWildList& rhs)
m_value = rhs.m_value;
m_times = rhs.m_times;
m_scope = rhs.m_scope;
- m_encounters.clear();
+ while (encounterCount())
+ deleteEncounter(0);
foreach (MapWildListEncounter* encounter, rhs.m_encounters)
m_encounters.append(new MapWildListEncounter(pokemod(), *encounter, encounter->id()));
return *this;