[atlantik-cvs] CVS: kdegames/atlantik/libatlantic atlantic_core.cpp,1.19,1.20 atlantic_core.h,1.17,1.18
[email protected] Mon, 9 Jun 2003 20:22:38 +0200 (CEST)
Newsgroups
gmane.comp.kde.devel.atlantik
Message-ID
<[email protected] >
Update of /home/kde/kdegames/atlantik/libatlantic
In directory office:/tmp/cvs-serv29591/libatlantic
Modified Files:
atlantic_core.cpp atlantic_core.h
Log Message:
don't auto-delete player objects, add debug method
Index: atlantic_core.cpp
===================================================================
RCS file: /home/kde/kdegames/atlantik/libatlantic/atlantic_core.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- atlantic_core.cpp 21 Jan 2003 00:27:36 -0000 1.19
+++ atlantic_core.cpp 9 Jun 2003 18:22:35 -0000 1.20
@@ -14,6 +14,8 @@
// the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.
+#include <iostream>
+
#include "atlantic_core.moc"
#include "player.h"
@@ -39,12 +41,16 @@
m_estateGroups.setAutoDelete(true);
m_estateGroups.clear();
m_estateGroups.setAutoDelete(false);
- m_players.setAutoDelete(true);
- m_players.clear();
- m_players.setAutoDelete(false);
m_trades.setAutoDelete(true);
m_trades.clear();
m_trades.setAutoDelete(false);
+
+ Player *player = 0;
+ for (QPtrListIterator<Player> it(m_players); (player = *it) ; ++it)
+ {
+ player->setLocation(0);
+ player->setDestination(0);
+ }
}
QPtrList<Player> AtlanticCore::players()
@@ -181,4 +187,19 @@
{
m_auctions.remove(auction);
delete auction;
+}
+
+void AtlanticCore::printDebug()
+{
+ Player *player = 0;
+ for (QPtrListIterator<Player> it(m_players); (player = *it) ; ++it)
+ std::cout << " P: " << player->name().latin1() << std::endl;
+
+ Estate *estate = 0;
+ for (QPtrListIterator<Estate> it(m_estates); (estate = *it) ; ++it)
+ std::cout << " E: " << estate->name().latin1() << std::endl;
+
+ EstateGroup *estateGroup = 0;
+ for (QPtrListIterator<EstateGroup> it(m_estateGroups); (estateGroup = *it) ; ++it)
+ std::cout << "EG: " << estateGroup->name().latin1() << std::endl;
}
Index: atlantic_core.h
===================================================================
RCS file: /home/kde/kdegames/atlantik/libatlantic/atlantic_core.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- atlantic_core.h 21 Jan 2003 00:27:16 -0000 1.17
+++ atlantic_core.h 9 Jun 2003 18:22:36 -0000 1.18
@@ -57,6 +57,8 @@
Auction *newAuction(int auctionId, Estate *estate);
void delAuction(Auction *auction);
+ void printDebug();
+
signals:
void removeGUI(Player *player);
void deletePlayer(Player *player);