[atlantik-cvs] CVS: kdegames/atlantik/libatlantikclient atlantik_network.cpp,1.99,1.100

[email protected] Fri, 28 May 2004 22:30:02 +0200
Newsgroups gmane.comp.kde.devel.atlantik
Message-ID <[email protected]>
Update of /home/kde/kdegames/atlantik/libatlantikclient
In directory office:/tmp/cvs-serv16304/libatlantikclient

Modified Files:
	atlantik_network.cpp 
Log Message:
actual fix against crashes on dev server

Index: atlantik_network.cpp
===================================================================
RCS file: /home/kde/kdegames/atlantik/libatlantikclient/atlantik_network.cpp,v
retrieving revision 1.99
retrieving revision 1.100
diff -u -d -r1.99 -r1.100
--- atlantik_network.cpp	21 May 2004 00:54:48 -0000	1.99
+++ atlantik_network.cpp	28 May 2004 20:30:00 -0000	1.100
@@ -1,4 +1,4 @@
-// Copyright (c) 2002-2003 Rob Kaper <[email protected]>
+// Copyright (c) 2002-2004 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
@@ -368,8 +368,9 @@
 				{
 					gameId = a.value().toInt();
 
-					if ( m_atlanticCore->playerSelf() && m_atlanticCore->playerSelf()->game() )
-						kdDebug() << "gameupdate for " << QString::number(gameId) << " with playerSelf in game " << QString::number(m_atlanticCore->playerSelf()->game()->id()) << endl;
+					Player *playerSelf = m_atlanticCore->playerSelf();
+					if ( playerSelf && playerSelf->game() )
+						kdDebug() << "gameupdate for " << QString::number(gameId) << " with playerSelf in game " << QString::number(playerSelf->game()->id()) << endl;
 					else
 						kdDebug() << "gameupdate for " << QString::number(gameId) << endl;
 
@@ -411,14 +412,17 @@
 					}
 
 					QString status = e.attributeNode(QString("status")).value();
-					if (status == "config")
-						emit gameConfig();
-					else if (status == "init")
-						emit gameInit();
-					else if (status == "run")
-						emit gameRun();
-					else if (status == "end")
-						emit gameEnd();
+					if ( playerSelf && playerSelf->game() == game )
+					{
+						if (status == "config")
+							emit gameConfig();
+						else if (status == "init")
+							emit gameInit();
+						else if (status == "run")
+							emit gameRun();
+						else if (status == "end")
+							emit gameEnd();
+					}
 
 					if (game)
 						game->update();