diff options
Diffstat (limited to 'pokemod/CoinList.cpp')
| -rw-r--r-- | pokemod/CoinList.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/pokemod/CoinList.cpp b/pokemod/CoinList.cpp index c0e83a59..0b0ff46b 100644 --- a/pokemod/CoinList.cpp +++ b/pokemod/CoinList.cpp @@ -50,8 +50,8 @@ CoinList::CoinList(const Pokemod* pokemod, const QString& fileName, const int id CoinList::~CoinList() { - foreach (CoinListObject* object, m_objects) - delete object; + while (objectCount()) + deleteObject(0); } bool CoinList::validate() const @@ -124,7 +124,8 @@ void CoinList::load(const QString& fileName, int id) throw(Exception) QStringList path = pokemod()->path().split('/'); path.removeLast(); QDir fdir(path.join("/")); - m_objects.clear(); + while (objectCount()) + deleteObject(0); if (fdir.cd("item")) { QStringList files(fdir.entryList(QStringList("*.pini"), QDir::Files, QDir::Name)); @@ -260,7 +261,8 @@ CoinList& CoinList::operator=(const CoinList& rhs) if (this == &rhs) return *this; m_name = rhs.m_name; - m_objects.clear(); + while (objectCount()) + deleteObject(0); foreach (CoinListObject* object, rhs.m_objects) m_objects.append(new CoinListObject(pokemod(), *object, object->id())); return *this; |
