[atlantik-cvs] CVS: kdegames/atlantik/libatlantic atlantic_core.cpp,1.22,1.23 atlantic_core.h,1.19,1.20
[email protected] Tue, 17 Jun 2003 21:54:37 +0200 (CEST)
Newsgroups
gmane.comp.kde.devel.atlantik
Message-ID
<[email protected] >
Update of /home/kde/kdegames/atlantik/libatlantic
In directory office:/tmp/cvs-serv16711/libatlantic
Modified Files:
atlantic_core.cpp atlantic_core.h
Log Message:
reset complete core when going to the select server page
Index: atlantic_core.cpp
===================================================================
RCS file: /home/kde/kdegames/atlantik/libatlantic/atlantic_core.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- atlantic_core.cpp 17 Jun 2003 19:10:44 -0000 1.22
+++ atlantic_core.cpp 17 Jun 2003 19:54:35 -0000 1.23
@@ -30,7 +30,7 @@
connect(this, SIGNAL(deleteTrade(Trade *)), this, SLOT(slotDeleteTrade(Trade *)));
}
-void AtlanticCore::reset()
+void AtlanticCore::reset(bool deletePlayers)
{
m_auctions.setAutoDelete(true);
m_auctions.clear();
@@ -46,11 +46,20 @@
for (QPtrListIterator<Trade> it(m_trades); (trade = *it) ; ++it)
removeTrade(trade);
- Player *player = 0;
- for (QPtrListIterator<Player> it(m_players); (player = *it) ; ++it)
+ if (deletePlayers)
{
- player->setLocation(0);
- player->setDestination(0);
+ m_players.setAutoDelete(true);
+ m_players.clear();
+ m_players.setAutoDelete(false);
+ }
+ else
+ {
+ Player *player = 0;
+ for (QPtrListIterator<Player> it(m_players); (player = *it) ; ++it)
+ {
+ player->setLocation(0);
+ player->setDestination(0);
+ }
}
}
Index: atlantic_core.h
===================================================================
RCS file: /home/kde/kdegames/atlantik/libatlantic/atlantic_core.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- atlantic_core.h 17 Jun 2003 18:21:28 -0000 1.19
+++ atlantic_core.h 17 Jun 2003 19:54:35 -0000 1.20
@@ -33,7 +33,7 @@
public:
AtlanticCore(QObject *parent, const char *name);
- void reset();
+ void reset(bool deletePlayers = false);
QPtrList<Player> players();
Player *newPlayer(int playerId);