hedgewars/uCommandHandlers.pas
changeset 4845 9a0f5377c529
parent 4808 7c3e5b52344a
parent 4751 849740a91d36
child 4900 8ad0e23e6d63
--- a/hedgewars/uCommandHandlers.pas	Sun Jan 16 13:53:32 2011 -0500
+++ b/hedgewars/uCommandHandlers.pas	Mon Jan 17 23:22:52 2011 +0100
@@ -23,27 +23,41 @@
 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
+    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 chHalt (var s: shortstring);
+begin
+    s:= s; // avoid compiler hint
+    SendIPC('H');
+    GameState:= gsExit
+end;
+
 procedure chCheckProto(var s: shortstring);
 var i, c: LongInt;
 begin
@@ -581,7 +595,9 @@
     RegisterVariable('grave'   , vtCommand, @chGrave        , false);
     RegisterVariable('hat'     , vtCommand, @chSetHat       , false);
     RegisterVariable('quit'    , vtCommand, @chQuit         , true );
+    RegisterVariable('forcequit', vtCommand, @chForceQuit   , true );
     RegisterVariable('confirm' , vtCommand, @chConfirm      , true );
+    RegisterVariable('halt',     vtCommand, @chHalt         , true );
     RegisterVariable('+speedup', vtCommand, @chSpeedup_p    , true );
     RegisterVariable('-speedup', vtCommand, @chSpeedup_m    , true );
     RegisterVariable('zoomin'  , vtCommand, @chZoomIn       , true );