[prev in list] [next in list] [prev in thread] [next in thread] 

List:       atlantik-devel
Subject:    [atlantik-cvs] CVS: kdegames/atlantik/libatlantic atlantic_core.cpp,1.14,1.15 atlantic_core.h,1.13,1
From:       kde () office ! kde ! org
Date:       2002-11-27 21:08:58
[Download RAW message or body]

Update of /home/kde/kdegames/atlantik/libatlantic
In directory office:/tmp/cvs-serv6542/libatlantic

Modified Files:
	atlantic_core.cpp atlantic_core.h estate.cpp estate.h 
	estategroup.h player.cpp player.h 
Log Message:
qmap->qptrlist changes, improved estatedetails widget

Index: atlantic_core.cpp
===================================================================
RCS file: /home/kde/kdegames/atlantik/libatlantic/atlantic_core.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- atlantic_core.cpp	2002/10/23 15:56:41	1.14
+++ atlantic_core.cpp	2002/11/27 21:08:56	1.15
@@ -27,18 +27,47 @@
 	connect(this, SIGNAL(deleteTrade(Trade *)), this, SLOT(slotDeleteTrade(Trade *)));
 }
 
+void AtlanticCore::reset()
+{
+	m_auctions.setAutoDelete(true);
+	m_auctions.clear();
+	m_auctions.setAutoDelete(false);
+	m_estates.setAutoDelete(true);
+	m_estates.clear();
+	m_estates.setAutoDelete(false);
+	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);
+}
+
 QPtrList<Player> AtlanticCore::players()
 {
 	return m_players;
 }
 
-Player *AtlanticCore::newPlayer()
+Player *AtlanticCore::newPlayer(int playerId)
 {
-	Player *player = new Player();
+	Player *player = new Player(playerId);
 	m_players.append(player);
 	return player;
 }
 
+Player *AtlanticCore::findPlayer(int playerId)
+{
+	Player *player = 0;
+	for (QPtrListIterator<Player> it(m_players); (player = *it) ; ++it)
+		if (player->id() == playerId)
+			return player;
+
+	return 0;
+}
+
 QPtrList<Estate> AtlanticCore::estates()
 {
 	return m_estates;
@@ -51,16 +80,36 @@
 	return estate;
 }
 
+Estate *AtlanticCore::findEstate(int estateId)
+{
+	Estate *estate = 0;
+	for (QPtrListIterator<Estate> it(m_estates); (estate = *it) ; ++it)
+		if (estate->id() == estateId)
+			return estate;
+
+	return 0;
+}
+
 QPtrList<EstateGroup> AtlanticCore::estateGroups()
 {
 	return m_estateGroups;
 }
 
-EstateGroup *AtlanticCore::newEstateGroup(const int id)
+EstateGroup *AtlanticCore::newEstateGroup(int groupId)
 {
-	EstateGroup *estateGroup = new EstateGroup(id);
+	EstateGroup *estateGroup = new EstateGroup(groupId);
 	m_estateGroups.append(estateGroup);
 	return estateGroup;
+}
+
+EstateGroup *AtlanticCore::findEstateGroup(int groupId)
+{
+	EstateGroup *estateGroup = 0;
+	for (QPtrListIterator<EstateGroup> it(m_estateGroups); (estateGroup = *it) ; ++it)
+		if (estateGroup->id() == groupId)
+			return estateGroup;
+
+	return 0;
 }
 
 QPtrList<Trade> AtlanticCore::trades()

Index: atlantic_core.h
===================================================================
RCS file: /home/kde/kdegames/atlantik/libatlantic/atlantic_core.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- atlantic_core.h	2002/10/23 15:56:41	1.13
+++ atlantic_core.h	2002/11/27 21:08:56	1.14
@@ -33,14 +33,19 @@
 public:
 	AtlanticCore(QObject *parent, const char *name);
 
+	void reset();
+
 	QPtrList<Player> players();
-	Player *newPlayer();
+	Player *newPlayer(int playerId);
+	Player *findPlayer(int playerId);
 
 	QPtrList<Estate> estates();
 	Estate *newEstate(int estateId);
+	Estate *findEstate(int groupId);
 
 	QPtrList<EstateGroup> estateGroups();
-	EstateGroup *newEstateGroup(const int id);
+	EstateGroup *newEstateGroup(int groupId);
+	EstateGroup *findEstateGroup(int groupId);
 
 	QPtrList<Trade> trades();
 	Trade *newTrade(int tradeId);

Index: estate.cpp
===================================================================
RCS file: /home/kde/kdegames/atlantik/libatlantic/estate.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- estate.cpp	2002/06/30 23:32:27	1.6
+++ estate.cpp	2002/11/27 21:08:56	1.7
@@ -22,7 +22,7 @@
 
 Estate::Estate(int estateId) : QObject()
 {
-	m_estateId = estateId;
+	m_id = estateId;
 	m_owner = 0;
 	m_houses = 0;
 	m_price = 0;
@@ -77,7 +77,7 @@
 	}
 }
 
-void Estate::setColor(const QColor color)
+void Estate::setColor(QColor color)
 {
 	if (m_color != color)
 	{
@@ -86,7 +86,7 @@
 	}
 }
 
-void Estate::setBgColor(const QColor color)
+void Estate::setBgColor(QColor color)
 {
 	if (m_bgColor != color)
 	{

Index: estate.h
===================================================================
RCS file: /home/kde/kdegames/atlantik/libatlantic/estate.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- estate.h	2002/06/30 23:32:27	1.9
+++ estate.h	2002/11/27 21:08:56	1.10
@@ -29,7 +29,7 @@
 
 public:
 	Estate(int estateId);
-	int estateId() const { return m_estateId; }
+	int id() const { return m_id; }
 	void setName(const QString name);
 	QString name() const { return m_name; }
 	void setEstateGroup(EstateGroup *estateGroup);
@@ -50,9 +50,9 @@
 	bool isMortgaged() const { return m_isMortgaged; }
 	void setCanToggleMortgage(const bool canToggleMortgage);
 	bool canToggleMortgage() const { return m_canToggleMortgage; }
-	void setColor(const QColor color);
+	void setColor(QColor color);
 	QColor color() const { return m_color; }
-	void setBgColor(const QColor color);
+	void setBgColor(QColor color);
 	QColor bgColor() const { return m_bgColor; }
 	void setPrice(const unsigned int price) { m_price = price; }
 	unsigned int price() const { return m_price; }
@@ -68,7 +68,7 @@
 
 protected:
 	bool m_changed;
-	int m_estateId;
+	int m_id;
 
 private:
 	QString m_name;

Index: estategroup.h
===================================================================
RCS file: /home/kde/kdegames/atlantik/libatlantic/estategroup.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- estategroup.h	2002/10/23 15:56:41	1.4
+++ estategroup.h	2002/11/27 21:08:56	1.5
@@ -25,6 +25,7 @@
 
 public:
 	EstateGroup(const int id);
+	int id() { return m_id; }
 	void setName(const QString name);
 	QString name() const { return m_name; }
 	void update(bool force = false);

Index: player.cpp
===================================================================
RCS file: /home/kde/kdegames/atlantik/libatlantic/player.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- player.cpp	2002/07/07 02:35:58	1.9
+++ player.cpp	2002/11/27 21:08:56	1.10
@@ -18,8 +18,9 @@
 #include "player.moc"
 #include "estate.h"
 
-Player::Player() : QObject()
+Player::Player(int playerId) : QObject()
 {
+	m_id = playerId;
 	m_location = 0;
 	m_changed = m_isSelf = false;
 	m_hasTurn = m_canRoll = m_canBuy = m_inJail = false;

Index: player.h
===================================================================
RCS file: /home/kde/kdegames/atlantik/libatlantic/player.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- player.h	2002/04/23 17:02:55	1.7
+++ player.h	2002/11/27 21:08:56	1.8
@@ -27,8 +27,9 @@
 Q_OBJECT
 
 public:
-	Player();
+	Player(int playerId);
 
+	int id() { return m_id; }
 	void setLocation(Estate *estate);
 	Estate *location() { return m_location; }
 	void setIsSelf(const bool isSelf) { m_isSelf = isSelf; }
@@ -51,6 +52,7 @@
 	void changed(Player *player);
 
 private:
+	int m_id;
 	bool m_changed, m_isSelf;
 	bool m_hasTurn, m_canRoll, m_canBuy, m_inJail;
 	unsigned int m_money;

_______________________________________________
atlantik-cvs mailing list
atlantik-cvs@mail.kde.org
http://mail.kde.org/mailman/listinfo/atlantik-cvs
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic