hedgewars/uCommandHandlers.pas
changeset 9790 0b4b9fda5bd4
parent 9714 54d756b6dbb1
child 9796 a05105e35d49
equal deleted inserted replaced
9789:4b7df6e96b78 9790:0b4b9fda5bd4
   107 if CurrentTeam = nil then
   107 if CurrentTeam = nil then
   108     OutError(errmsgIncorrectUse + ' "/rdriven"', true);
   108     OutError(errmsgIncorrectUse + ' "/rdriven"', true);
   109 CurrentTeam^.ExtDriven:= true
   109 CurrentTeam^.ExtDriven:= true
   110 end;
   110 end;
   111 
   111 
   112 procedure chGrave(var s: shortstring);
       
   113 begin
       
   114 if CurrentTeam = nil then
       
   115     OutError(errmsgIncorrectUse + ' "/grave"', true);
       
   116 if s[1]='"' then
       
   117     Delete(s, 1, 1);
       
   118 if s[byte(s[0])]='"' then
       
   119     Delete(s, byte(s[0]), 1);
       
   120 CurrentTeam^.GraveName:= s
       
   121 end;
       
   122 
       
   123 procedure chFort(var s: shortstring);
       
   124 begin
       
   125 if CurrentTeam = nil then
       
   126     OutError(errmsgIncorrectUse + ' "/fort"', true);
       
   127 if s[1]='"' then
       
   128     Delete(s, 1, 1);
       
   129 if s[byte(s[0])]='"' then
       
   130     Delete(s, byte(s[0]), 1);
       
   131 CurrentTeam^.FortName:= s
       
   132 end;
       
   133 
       
   134 procedure chFlag(var s: shortstring);
       
   135 begin
       
   136 if CurrentTeam = nil then
       
   137     OutError(errmsgIncorrectUse + ' "/flag"', true);
       
   138 if s[1]='"' then
       
   139     Delete(s, 1, 1);
       
   140 if s[byte(s[0])]='"' then
       
   141     Delete(s, byte(s[0]), 1);
       
   142 CurrentTeam^.flag:= s
       
   143 end;
       
   144 
       
   145 procedure chScript(var s: shortstring);
   112 procedure chScript(var s: shortstring);
   146 begin
   113 begin
   147 if s[1]='"' then
   114 if s[1]='"' then
   148     Delete(s, 1, 1);
   115     Delete(s, 1, 1);
   149 if s[byte(s[0])]='"' then
   116 if s[byte(s[0])]='"' then
   150     Delete(s, byte(s[0]), 1);
   117     Delete(s, byte(s[0]), 1);
   151 cScriptName:= s;
   118 cScriptName:= s;
   152 ScriptLoad(s)
   119 ScriptLoad(s)
   153 end;
       
   154 
       
   155 procedure chSetHat(var s: shortstring);
       
   156 begin
       
   157 if (not isDeveloperMode) or (CurrentTeam = nil) then exit;
       
   158 with CurrentTeam^ do
       
   159     begin
       
   160     if not CurrentHedgehog^.King then
       
   161     if (s = '')
       
   162     or (((GameFlags and gfKing) <> 0) and (s = 'crown'))
       
   163     or ((Length(s) > 39) and (Copy(s,1,8) = 'Reserved') and (Copy(s,9,32) <> PlayerHash)) then
       
   164         CurrentHedgehog^.Hat:= 'NoHat'
       
   165     else
       
   166         CurrentHedgehog^.Hat:= s
       
   167     end;
       
   168 end;
   120 end;
   169 
   121 
   170 procedure chCurU_p(var s: shortstring);
   122 procedure chCurU_p(var s: shortstring);
   171 begin
   123 begin
   172 s:= s; // avoid compiler hint
   124 s:= s; // avoid compiler hint
   841     RegisterVariable('-attack' , @chAttack_m     , false);
   793     RegisterVariable('-attack' , @chAttack_m     , false);
   842     RegisterVariable('slot'    , @chSlot         , false);
   794     RegisterVariable('slot'    , @chSlot         , false);
   843     RegisterVariable('setweap' , @chSetWeapon    , false, true);
   795     RegisterVariable('setweap' , @chSetWeapon    , false, true);
   844 //////// End top by freq analysis
   796 //////// End top by freq analysis
   845     RegisterVariable('gencmd'  , @chGenCmd       , false);
   797     RegisterVariable('gencmd'  , @chGenCmd       , false);
   846     RegisterVariable('flag'    , @chFlag         , false);
       
   847     RegisterVariable('script'  , @chScript       , false);
   798     RegisterVariable('script'  , @chScript       , false);
   848     RegisterVariable('proto'   , @chCheckProto   , true );
   799     RegisterVariable('proto'   , @chCheckProto   , true );
   849     RegisterVariable('spectate', @chFastUntilLag   , false);
   800     RegisterVariable('spectate', @chFastUntilLag   , false);
   850     RegisterVariable('capture' , @chCapture      , true );
   801     RegisterVariable('capture' , @chCapture      , true );
   851     RegisterVariable('rotmask' , @chRotateMask   , true );
   802     RegisterVariable('rotmask' , @chRotateMask   , true );
   871     RegisterVariable('minesnum', @chLandMines     , false);
   822     RegisterVariable('minesnum', @chLandMines     , false);
   872     RegisterVariable('explosives',@chExplosives    , false);
   823     RegisterVariable('explosives',@chExplosives    , false);
   873     RegisterVariable('gmflags' , @chGameFlags      , false);
   824     RegisterVariable('gmflags' , @chGameFlags      , false);
   874     RegisterVariable('turntime', @chHedgehogTurnTime, false);
   825     RegisterVariable('turntime', @chHedgehogTurnTime, false);
   875     RegisterVariable('minestime',@chMinesTime     , false);
   826     RegisterVariable('minestime',@chMinesTime     , false);
   876     RegisterVariable('fort'    , @chFort         , false);
       
   877     RegisterVariable('grave'   , @chGrave        , false);
       
   878     RegisterVariable('hat'     , @chSetHat       , false);
       
   879     RegisterVariable('quit'    , @chQuit         , true );
   827     RegisterVariable('quit'    , @chQuit         , true );
   880     RegisterVariable('forcequit', @chForceQuit   , true );
   828     RegisterVariable('forcequit', @chForceQuit   , true );
   881     RegisterVariable('confirm' , @chConfirm      , true );
   829     RegisterVariable('confirm' , @chConfirm      , true );
   882     RegisterVariable('halt',     @chHalt         , true );
   830     RegisterVariable('halt',     @chHalt         , true );
   883     RegisterVariable('+speedup', @chSpeedup_p    , true );
   831     RegisterVariable('+speedup', @chSpeedup_p    , true );