QTfrontend/game.cpp
changeset 15299 16f389fcd462
parent 14983 da7eb3414e02
child 15304 c4fd2813b127
child 15320 3bf780084c86
--- a/QTfrontend/game.cpp	Fri Jul 26 01:13:48 2019 +0200
+++ b/QTfrontend/game.cpp	Sat Jul 27 03:42:17 2019 +0200
@@ -76,22 +76,29 @@
 
 void HWGame::onClientDisconnect()
 {
-    switch (gameType)
+    if (demoIsPresent)
     {
-        case gtDemo:
-            // for video recording we need demo anyway
-            emit HaveRecord(rtNeither, demo);
-            break;
-        case gtNet:
-            emit HaveRecord(rtDemo, demo);
-            break;
-        default:
-            if (gameState == gsInterrupted || gameState == gsHalted)
-                emit HaveRecord(rtSave, demo);
-            else if (gameState == gsFinished)
+        switch (gameType)
+        {
+            case gtDemo:
+                // for video recording we need demo anyway
+                emit HaveRecord(rtNeither, demo);
+                break;
+            case gtNet:
                 emit HaveRecord(rtDemo, demo);
-            else
-                emit HaveRecord(rtNeither, demo);
+                break;
+            default:
+                if (gameState == gsInterrupted || gameState == gsHalted)
+                    emit HaveRecord(rtSave, demo);
+                else if (gameState == gsFinished)
+                    emit HaveRecord(rtDemo, demo);
+                else
+                    emit HaveRecord(rtNeither, demo);
+        }
+    }
+    else
+    {
+        emit HaveRecord(rtNeither, demo);
     }
     SetGameState(gsStopped);
 }
@@ -452,6 +459,11 @@
             SetGameState(gsFinished);
             break;
         }
+        case 'm':
+        {
+            SetDemoPresence(false);
+            break;
+        }
         case 'H':
         {
             SetGameState(gsHalted);
@@ -751,6 +763,11 @@
     }
 }
 
+void HWGame::SetDemoPresence(bool hasDemo)
+{
+    emit DemoPresenceChanged(hasDemo);
+}
+
 void HWGame::abort()
 {
     QByteArray buf;