[atlantik-cvs] CVS: kdegames/atlantik/libatlantic atlantic_core.cpp,1.14.4.1,1.14.4.2 atlantic_core.h,1.13.4.1,1.13.4.2 estategroup.h,1.4,1.4.4.1 player.cpp,1.9.8.2,1.9.8.3 player.h,1.7.8.1,1.7.8.2

[email protected]
Newsgroups gmane.comp.kde.devel.atlantik
Message-ID <[email protected]>
Update of /home/kde/kdegames/atlantik/libatlantic
In directory office:/tmp/cvs-serv11080/libatlantic

Modified Files:
      Tag: KDE_3_1_BRANCH
	atlantic_core.cpp atlantic_core.h estategroup.h player.cpp 
	player.h 
Log Message:
backport of core changes, fixes #52933

Index: atlantic_core.cpp
===================================================================
RCS file: /home/kde/kdegames/atlantik/libatlantic/atlantic_core.cpp,v
retrieving revision 1.14.4.1
retrieving revision 1.14.4.2
diff -u -d -r1.14.4.1 -r1.14.4.2
--- atlantic_core.cpp	13 Jan 2003 15:14:27 -0000	1.14.4.1
+++ atlantic_core.cpp	13 Jan 2003 17:14:39 -0000	1.14.4.2
@@ -1,4 +1,4 @@
-// Copyright (c) 2002 Rob Kaper <[email protected]>
+// Copyright (c) 2002-2003 Rob Kaper <[email protected]>
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -51,13 +51,24 @@
 	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;
@@ -70,16 +81,36 @@
 	return estate;
 }
 
+Estate *AtlanticCore::findEstate(int estateId)
+{
+	Estate *estate = 0;
+	for (QPtrListIterator<Estate> it(m_estates); (estate = *it) ; ++it)
+		if (estate->estateId() == 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.4.1
retrieving revision 1.13.4.2
diff -u -d -r1.13.4.1 -r1.13.4.2
--- atlantic_core.h	13 Jan 2003 15:14:27 -0000	1.13.4.1
+++ atlantic_core.h	13 Jan 2003 17:14:39 -0000	1.13.4.2
@@ -1,4 +1,4 @@
-// Copyright (c) 2002 Rob Kaper <[email protected]>
+// Copyright (c) 2002-2003 Rob Kaper <[email protected]>
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -36,13 +36,16 @@
 	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 estateId);
 
 	QPtrList<EstateGroup> estateGroups();
-	EstateGroup *newEstateGroup(const int id);
+	EstateGroup *newEstateGroup(int groupId);
+	EstateGroup *findEstateGroup(int groupId);
 
 	QPtrList<Trade> trades();
 	Trade *newTrade(int tradeId);

Index: estategroup.h
===================================================================
RCS file: /home/kde/kdegames/atlantik/libatlantic/estategroup.h,v
retrieving revision 1.4
retrieving revision 1.4.4.1
diff -u -d -r1.4 -r1.4.4.1
--- estategroup.h	23 Oct 2002 15:56:41 -0000	1.4
+++ estategroup.h	13 Jan 2003 17:14:39 -0000	1.4.4.1
@@ -1,4 +1,4 @@
-// Copyright (c) 2002 Rob Kaper <[email protected]>
+// Copyright (c) 2002-2003 Rob Kaper <[email protected]>
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -24,7 +24,9 @@
 Q_OBJECT
 
 public:
-	EstateGroup(const int id);
+	EstateGroup(int groupId);
+
+	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.8.2
retrieving revision 1.9.8.3
diff -u -d -r1.9.8.2 -r1.9.8.3
--- player.cpp	13 Jan 2003 15:01:08 -0000	1.9.8.2
+++ player.cpp	13 Jan 2003 17:14:39 -0000	1.9.8.3
@@ -1,4 +1,4 @@
-// Copyright (c) 2002 Rob Kaper <[email protected]>
+// Copyright (c) 2002-2003 Rob Kaper <[email protected]>
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -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_money = 0;
 	m_name = "";

Index: player.h
===================================================================
RCS file: /home/kde/kdegames/atlantik/libatlantic/player.h,v
retrieving revision 1.7.8.1
retrieving revision 1.7.8.2
diff -u -d -r1.7.8.1 -r1.7.8.2
--- player.h	13 Jan 2003 15:01:08 -0000	1.7.8.1
+++ player.h	13 Jan 2003 17:14:39 -0000	1.7.8.2
@@ -1,4 +1,4 @@
-// Copyright (c) 2002 Rob Kaper <[email protected]>
+// Copyright (c) 2002-2003 Rob Kaper <[email protected]>
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -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; }
@@ -53,6 +54,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;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.