hedgewars/uCommandHandlers.pas
branch0.9.15
changeset 4751 849740a91d36
parent 4746 3ae448aebe7e
child 4845 9a0f5377c529
equal deleted inserted replaced
4749:62471157bd62 4751:849740a91d36
    21 end;
    21 end;
    22 
    22 
    23 procedure chQuit(var s: shortstring);
    23 procedure chQuit(var s: shortstring);
    24 const prevGState: TGameState = gsConfirm;
    24 const prevGState: TGameState = gsConfirm;
    25 begin
    25 begin
    26 s:= s; // avoid compiler hint
    26     s:= s; // avoid compiler hint
    27 if GameState <> gsConfirm then
    27     if GameState <> gsConfirm then
    28         begin
    28     begin
    29         prevGState:= GameState;
    29         prevGState:= GameState;
    30         GameState:= gsConfirm
    30         GameState:= gsConfirm
    31         end else
    31     end else
    32         GameState:= prevGState
    32     GameState:= prevGState
    33 end;
    33 end;
    34 
    34 
    35 procedure chForceQuit(var s: shortstring);
    35 procedure chForceQuit(var s: shortstring);
    36 begin
    36 begin
    37     s:= s; // avoid compiler hint
    37     s:= s; // avoid compiler hint
    38     SendIPC('Q');
    38     GameState:= gsConfirm;
    39     GameState:= gsExit
    39     ParseCommand('confirm', true);
    40 end;
    40 end;
    41 
    41 
    42 procedure chConfirm(var s: shortstring);
    42 procedure chConfirm(var s: shortstring);
    43 begin
    43 begin
    44 s:= s; // avoid compiler hint
    44     s:= s; // avoid compiler hint
    45 if GameState = gsConfirm then
    45     if GameState = gsConfirm then
    46     begin
    46     begin
    47     SendIPC('Q');
    47         SendIPC('Q');
    48     GameState:= gsExit
    48         GameState:= gsExit
    49     end
    49     end
    50 else
    50 else
    51     ParseCommand('chat team', true);
    51     ParseCommand('chat team', true);
    52 end;
    52 end;
    53 
    53 
    54 procedure chShutdown (var s: shortstring);
    54 procedure chHalt (var s: shortstring);
    55 begin
    55 begin
    56     s:= s; // avoid compiler hint
    56     s:= s; // avoid compiler hint
    57     SendIPC('H');
    57     SendIPC('H');
    58     GameState:= gsExit
    58     GameState:= gsExit
    59 end;
    59 end;
   596     RegisterVariable('grave'   , vtCommand, @chGrave        , false);
   596     RegisterVariable('grave'   , vtCommand, @chGrave        , false);
   597     RegisterVariable('hat'     , vtCommand, @chSetHat       , false);
   597     RegisterVariable('hat'     , vtCommand, @chSetHat       , false);
   598     RegisterVariable('quit'    , vtCommand, @chQuit         , true );
   598     RegisterVariable('quit'    , vtCommand, @chQuit         , true );
   599     RegisterVariable('forcequit', vtCommand, @chForceQuit   , true );
   599     RegisterVariable('forcequit', vtCommand, @chForceQuit   , true );
   600     RegisterVariable('confirm' , vtCommand, @chConfirm      , true );
   600     RegisterVariable('confirm' , vtCommand, @chConfirm      , true );
   601     RegisterVariable('shutdown', vtCommand, @chShutdown     , true );
   601     RegisterVariable('halt',     vtCommand, @chHalt         , true );
   602     RegisterVariable('+speedup', vtCommand, @chSpeedup_p    , true );
   602     RegisterVariable('+speedup', vtCommand, @chSpeedup_p    , true );
   603     RegisterVariable('-speedup', vtCommand, @chSpeedup_m    , true );
   603     RegisterVariable('-speedup', vtCommand, @chSpeedup_m    , true );
   604     RegisterVariable('zoomin'  , vtCommand, @chZoomIn       , true );
   604     RegisterVariable('zoomin'  , vtCommand, @chZoomIn       , true );
   605     RegisterVariable('zoomout' , vtCommand, @chZoomOut      , true );
   605     RegisterVariable('zoomout' , vtCommand, @chZoomOut      , true );
   606     RegisterVariable('zoomreset',vtCommand, @chZoomReset    , true );
   606     RegisterVariable('zoomreset',vtCommand, @chZoomReset    , true );