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

List:       atlantik-devel
Subject:    [atlantik-cvs] CVS: kdegames/atlantik/libatlantikclient
From:       kde () office ! kde ! org
Date:       2003-11-23 17:24:04
[Download RAW message or body]

Update of /home/kde/kdegames/atlantik/libatlantikclient
In directory office:/tmp/cvs-serv9127/libatlantikclient

Modified Files:
      Tag: atlantik_3_3_branch
	atlantik_network.cpp 
Log Message:
ensure setMaster succeeds by creating player object if necessary

Index: atlantik_network.cpp
===================================================================
RCS file: /home/kde/kdegames/atlantik/libatlantikclient/atlantik_network.cpp,v
retrieving revision 1.95.2.4
retrieving revision 1.95.2.5
diff -u -d -r1.95.2.4 -r1.95.2.5
--- atlantik_network.cpp	17 Nov 2003 02:50:42 -0000	1.95.2.4
+++ atlantik_network.cpp	23 Nov 2003 17:24:02 -0000	1.95.2.5
@@ -351,7 +351,6 @@
 					if (game && !a.isNull())
 						game->setCanBeJoined(a.value().toInt());
 
-
 					a = e.attributeNode(QString("description"));
 					if (game && !a.isNull())
 						game->setDescription(a.value());
@@ -364,10 +363,15 @@
 					if (game && !a.isNull())
 						game->setPlayers(a.value().toInt());
 
-					// FIXME: create player if non-existant
 					a = e.attributeNode(QString("master"));
 					if (game && !a.isNull())
-						game->setMaster(m_atlanticCore->findPlayer(a.value().toInt()));
+					{
+						// Ensure setMaster succeeds by creating player if necessary
+						Player *player = m_atlanticCore->findPlayer( a.value().toInt() );
+						if ( !player )
+							player = m_atlanticCore->newPlayer( a.value().toInt() );
+						game->setMaster( player );
+					}
 
 					QString status = e.attributeNode(QString("status")).value();
 					if (status == "config")

_______________________________________________
atlantik-cvs mailing list
atlantik-cvs@kde.org
https://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