Commit f1932a69 authored by Stefan Majewsky's avatar Stefan Majewsky

Refactoring: Simplify unnecessarily complicated deletion statements.

svn path=/trunk/KDE/kdegames/ksirk/; revision=1145635
parent d372db35
......@@ -117,10 +117,7 @@ void NewGameWidget::fillSkinsCombo()
kDebug() << "Filling skins combo";
skinCombo->clear();
foreach (GameLogic::ONU* onu, m_newGameSetup->worlds())
{
delete onu;
}
qDeleteAll(m_newGameSetup->worlds());
KStandardDirs *m_dirs = KGlobal::dirs();
QStringList skinsDirs = m_dirs->findDirs("appdata","skins");
......
......@@ -199,10 +199,7 @@ GameAutomaton::GameAutomaton() :
GameAutomaton::~GameAutomaton()
{
kDebug();
foreach (Goal* goal, m_goals)
{
delete goal;
}
qDeleteAll(m_goals);
}
void GameAutomaton::init(KGameWindow* gw)
......@@ -2637,10 +2634,7 @@ void GameAutomaton::removeAllPlayers()
{
kDebug();
m_currentPlayer = "";
foreach (KPlayer*p, *playerList())
{
delete p;
}
qDeleteAll(*playerList());
playerList()->clear();
}
......
......@@ -1179,10 +1179,7 @@ void KGameWindow::slotNewPlayerCancel()
{
kDebug();
/// @TODO other uninits to do
foreach (NewPlayerData* player, m_newGameSetup->players())
{
delete player;
}
qDeleteAll(m_newGameSetup->players());
m_newGameSetup->players().clear();
m_centralWidget->setCurrentIndex(m_stackWidgetBeforeNewGame);
}
......
......@@ -384,31 +384,10 @@ ONU::ONU(const QString& configDir):
ONU::~ONU()
{
QList<Country*>::iterator countriesIt, countriesIt_end;
countriesIt = m_countries.begin(); countriesIt_end = m_countries.end();
for (; countriesIt != countriesIt_end; countriesIt++)
{
delete *countriesIt;
}
QList<Nationality*>::iterator nationalitiesIt, nationalitiesIt_end;
nationalitiesIt = m_nationalities.begin(); nationalitiesIt_end = m_nationalities.end();
for (; nationalitiesIt != nationalitiesIt_end; nationalitiesIt++)
{
delete *nationalitiesIt;
}
QList<Continent*>::iterator continentsIt, continentsIt_end;
continentsIt = m_continents.begin(); continentsIt_end = m_continents.end();
for (; continentsIt != continentsIt_end; continentsIt++)
{
delete *continentsIt;
}
foreach (Goal* goal, m_goals)
{
delete goal;
}
qDeleteAll(m_countries);
qDeleteAll(m_nationalities);
qDeleteAll(m_continents);
qDeleteAll(m_goals);
}
void ONU::saveConfig(const QString& configFileName)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment