possible fix hanging server on ctlr+w 0.9.15
authorkoda
Sat, 15 Jan 2011 21:32:44 +0100
branch0.9.15
changeset 4751 849740a91d36
parent 4749 62471157bd62
child 4753 449e48d2f4af
possible fix hanging server on ctlr+w
QTfrontend/hwform.cpp
hedgewars/uCommandHandlers.pas
hedgewars/uKeys.pas
--- a/QTfrontend/hwform.cpp	Sat Jan 15 21:00:45 2011 +0100
+++ b/QTfrontend/hwform.cpp	Sat Jan 15 21:32:44 2011 +0100
@@ -980,7 +980,7 @@
                 if (wBackground) wBackground->startAnimation();
                 if (hwnet) hwnet->gameFinished();
             }
-            if (gameState == gsHalted) close();
+            if (gameState == gsHalted) close();   
         };
     }
 }
--- a/hedgewars/uCommandHandlers.pas	Sat Jan 15 21:00:45 2011 +0100
+++ b/hedgewars/uCommandHandlers.pas	Sat Jan 15 21:32:44 2011 +0100
@@ -23,35 +23,35 @@
 procedure chQuit(var s: shortstring);
 const prevGState: TGameState = gsConfirm;
 begin
-s:= s; // avoid compiler hint
-if GameState <> gsConfirm then
-        begin
+    s:= s; // avoid compiler hint
+    if GameState <> gsConfirm then
+    begin
         prevGState:= GameState;
         GameState:= gsConfirm
-        end else
-        GameState:= prevGState
+    end else
+    GameState:= prevGState
 end;
 
 procedure chForceQuit(var s: shortstring);
 begin
     s:= s; // avoid compiler hint
-    SendIPC('Q');
-    GameState:= gsExit
+    GameState:= gsConfirm;
+    ParseCommand('confirm', true);
 end;
 
 procedure chConfirm(var s: shortstring);
 begin
-s:= s; // avoid compiler hint
-if GameState = gsConfirm then
+    s:= s; // avoid compiler hint
+    if GameState = gsConfirm then
     begin
-    SendIPC('Q');
-    GameState:= gsExit
+        SendIPC('Q');
+        GameState:= gsExit
     end
 else
     ParseCommand('chat team', true);
 end;
 
-procedure chShutdown (var s: shortstring);
+procedure chHalt (var s: shortstring);
 begin
     s:= s; // avoid compiler hint
     SendIPC('H');
@@ -598,7 +598,7 @@
     RegisterVariable('quit'    , vtCommand, @chQuit         , true );
     RegisterVariable('forcequit', vtCommand, @chForceQuit   , true );
     RegisterVariable('confirm' , vtCommand, @chConfirm      , true );
-    RegisterVariable('shutdown', vtCommand, @chShutdown     , true );
+    RegisterVariable('halt',     vtCommand, @chHalt         , true );
     RegisterVariable('+speedup', vtCommand, @chSpeedup_p    , true );
     RegisterVariable('-speedup', vtCommand, @chSpeedup_m    , true );
     RegisterVariable('zoomin'  , vtCommand, @chZoomIn       , true );
--- a/hedgewars/uKeys.pas	Sat Jan 15 21:00:45 2011 +0100
+++ b/hedgewars/uKeys.pas	Sat Jan 15 21:32:44 2011 +0100
@@ -136,7 +136,7 @@
     if ((tkbdn[KeyNameToCode('left_ctrl')] = 1) or (tkbdn[KeyNameToCode('right_ctrl')] = 1)) then
 {$ENDIF}
     begin
-        if tkbdn[KeyNameToCode('q')] = 1 then ParseCommand ('shutdown', true)
+        if tkbdn[KeyNameToCode('q')] = 1 then ParseCommand ('halt', true)
         else if tkbdn[KeyNameToCode('w')] = 1 then ParseCommand ('forcequit', true);
     end;