# HG changeset patch
# User unc0rr
# Date 1296674040 -10800
# Node ID 99d6797b7ff48b8377b4362fae904ba4e46b6389
# Parent  8bf14795a528a19ea48dca9eaf9fef3011d3a65c
Frontend sends ROUNDFINISHED with information about whether the round was played till end (will be needed for stats)

diff -r 8bf14795a528 -r 99d6797b7ff4 QTfrontend/hwform.cpp
--- 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();
         };
diff -r 8bf14795a528 -r 99d6797b7ff4 QTfrontend/newnetclient.cpp
--- 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)
diff -r 8bf14795a528 -r 99d6797b7ff4 QTfrontend/newnetclient.h
--- 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 &);
diff -r 8bf14795a528 -r 99d6797b7ff4 gameServer/HWProtoInRoomState.hs
--- 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