Don't accept in-room flags when not in room
authorunc0rr
Wed, 14 Nov 2012 14:31:17 +0400
changeset 8021 095d5ff3d39b
parent 8017 70d386de989f
child 8024 1d5baba66cb6
Don't accept in-room flags when not in room
QTfrontend/net/newnetclient.cpp
--- a/QTfrontend/net/newnetclient.cpp	Tue Nov 13 13:50:04 2012 +0400
+++ b/QTfrontend/net/newnetclient.cpp	Wed Nov 14 14:31:17 2012 +0400
@@ -380,11 +380,13 @@
         {
             flags.remove(0, 1);
             char c = flags[0].toAscii();
+            bool inRoom = (netClientState == InRoom || netClientState == InGame);
 
             switch(c)
             {
                 // flag indicating if a player is ready to start a game
                 case 'r':
+                    if(inRoom)
                         foreach (const QString & nick, nicks)
                         {
                             if (nick == mynick)
@@ -401,14 +403,16 @@
                         foreach(const QString & nick, nicks)
                             m_playersModel->setFlag(nick, PlayersListModel::Registered, setFlag);
                         break;
-
+                // flag indicating if a player has engine running
                 case 'g':
+                    if(inRoom)
                         foreach(const QString & nick, nicks)
                             m_playersModel->setFlag(nick, PlayersListModel::InGame, setFlag);
                         break;
 
                 // flag indicating if a player is the host/master of the room
                 case 'h':
+                    if(inRoom)
                         foreach (const QString & nick, nicks)
                         {
                             if (nick == mynick)