[atlantik-cvs] CVS: kdegames/atlantik/libatlantikclient atlantik_network.cpp,1.65.4.5,1.65.4.6

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

Modified Files:
      Tag: KDE_3_1_BRANCH
	atlantik_network.cpp 
Log Message:
backport deleteplayer tag, small code cleanups

Index: atlantik_network.cpp
===================================================================
RCS file: /home/kde/kdegames/atlantik/libatlantikclient/atlantik_network.cpp,v
retrieving revision 1.65.4.5
retrieving revision 1.65.4.6
diff -u -d -r1.65.4.5 -r1.65.4.6
--- atlantik_network.cpp	20 Jan 2003 22:28:07 -0000	1.65.4.5
+++ atlantik_network.cpp	20 Jan 2003 22:44:41 -0000	1.65.4.6
@@ -381,6 +381,18 @@
 						emit gameEnd();
 				}
 			}
+			else if (e.tagName() == "deleteplayer")
+			{
+				a = e.attributeNode(QString("playerid"));
+				if (!a.isNull())
+				{
+					int playerId = a.value().toInt();
+
+					Player *player = m_atlanticCore->findPlayer(playerId);
+					if (player)
+						m_atlanticCore->removePlayer(player);
+				}
+			}
 			else if (e.tagName() == "playerupdate")
 			{
 				int playerId = -1;
@@ -474,7 +486,7 @@
 				{
 					int groupId = a.value().toInt();
 
-					EstateGroup *estateGroup;
+					EstateGroup *estateGroup = 0;
 					bool b_newEstateGroup = false;
 					
 					if (!(estateGroup = m_atlanticCore->findEstateGroup(groupId)))
@@ -512,18 +524,17 @@
 					bool b_newEstate = false;
 
 					// FIXME: allow any estateId, GUI should not use it to determin its geometry
-					if (estateId >=0 && estateId < 100 && !(estate = m_atlanticCore->findEstate(a.value().toInt())))
+					if (estateId >= 0 && estateId < 100 && !(estate = m_atlanticCore->findEstate(a.value().toInt())))
 					{
 						// Create estate object
 						estate = m_atlanticCore->newEstate(estateId);
+						b_newEstate = true;
 
 						QObject::connect(estate, SIGNAL(estateToggleMortgage(Estate *)), this, SLOT(estateToggleMortgage(Estate *)));
 						QObject::connect(estate, SIGNAL(estateHouseBuy(Estate *)), this, SLOT(estateHouseBuy(Estate *)));
 						QObject::connect(estate, SIGNAL(estateHouseSell(Estate *)), this, SLOT(estateHouseSell(Estate *)));
 						QObject::connect(estate, SIGNAL(newTrade(Player *)), this, SLOT(newTrade(Player *)));
 
-						b_newEstate = true;
-
 						// Players without estate should get one
 						Player *player = 0;
 						QPtrList<Player> playerList = m_atlanticCore->players();
@@ -793,7 +804,6 @@
 
 void AtlantikNetwork::serverConnect(const QString host, int port)
 {
-	kdDebug() << "AtlantikNetwork::serverConnect(" << host << ", " << QString::number(port) << ")" << endl;
 	setAddress(host, port);
 	enableRead(true);
 	startAsyncConnect();
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.