Frontend sends ROUNDFINISHED with information about whether the round was played till end (will be needed for stats)
authorunc0rr
Wed, 02 Feb 2011 22:14:00 +0300
changeset 4908 99d6797b7ff4
parent 4907 8bf14795a528
child 4909 dc6482438674
Frontend sends ROUNDFINISHED with information about whether the round was played till end (will be needed for stats)
QTfrontend/hwform.cpp
QTfrontend/newnetclient.cpp
QTfrontend/newnetclient.h
gameServer/HWProtoInRoomState.hs
--- a/QTfrontend/hwform.cpp	Wed Feb 02 21:53:19 2011 +0300
+++ b/QTfrontend/hwform.cpp	Wed Feb 02 22:14:00 2011 +0300
@@ -970,7 +970,7 @@
             Music(ui.pageOptions->CBEnableFrontendMusic->isChecked());
             if (wBackground) wBackground->startAnimation();
             GoToPage(ID_PAGE_GAMESTATS);
-            if (hwnet && (!game || !game->netSuspend)) hwnet->gameFinished();
+            if (hwnet && (!game || !game->netSuspend)) hwnet->gameFinished(true);
             if (game) game->netSuspend = false;
             break;
         }
@@ -985,7 +985,7 @@
                 if (id == ID_PAGE_INGAME) GoBack();
                 Music(ui.pageOptions->CBEnableFrontendMusic->isChecked());
                 if (wBackground) wBackground->startAnimation();
-                if (hwnet) hwnet->gameFinished();
+                if (hwnet) hwnet->gameFinished(false);
             }
             if (gameState == gsHalted) close();
         };
--- a/QTfrontend/newnetclient.cpp	Wed Feb 02 21:53:19 2011 +0300
+++ b/QTfrontend/newnetclient.cpp	Wed Feb 02 22:14:00 2011 +0300
@@ -693,10 +693,10 @@
     return isChief;
 }
 
-void HWNewNet::gameFinished()
+void HWNewNet::gameFinished(bool correctly)
 {
     if (netClientState == 5) netClientState = 3;
-    RawSendNet(QString("ROUNDFINISHED"));
+    RawSendNet(QString("ROUNDFINISHED%1%2").arg(delimeter).arg(correctly ? "1" : "0"));
 }
 
 void HWNewNet::banPlayer(const QString & nick)
--- a/QTfrontend/newnetclient.h	Wed Feb 02 21:53:19 2011 +0300
+++ b/QTfrontend/newnetclient.h	Wed Feb 02 22:14:00 2011 +0300
@@ -148,7 +148,7 @@
   void JoinRoom(const QString & room);
   void CreateRoom(const QString & room);
   void askRoomsList();
-  void gameFinished();
+  void gameFinished(bool correcly);
   void banPlayer(const QString &);
   void kickPlayer(const QString &);
   void infoPlayer(const QString &);
--- a/gameServer/HWProtoInRoomState.hs	Wed Feb 02 21:53:19 2011 +0300
+++ b/gameServer/HWProtoInRoomState.hs	Wed Feb 02 22:14:00 2011 +0300
@@ -195,7 +195,7 @@
         (isLegal, isKeepAlive) = checkNetCmd msg
 
 
-handleCmd_inRoom ["ROUNDFINISHED"] = do
+handleCmd_inRoom ["ROUNDFINISHED", _] = do
     cl <- thisClient
     r <- thisRoom
     chans <- roomClientsChans