hedgewars/uCommands.pas
author unC0Rr
Thu, 18 Nov 2010 09:12:27 +0300 (2010-11-18)
changeset 4373 fe0e3903bb9e
child 4374 bcefeeabaa33
permissions -rw-r--r--
Introduce uCommands.pas
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4373
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
     1
{$INCLUDE "options.inc"}
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
     2
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
     3
unit uCommands;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
     4
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
     5
interface
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
     6
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
     7
var isDeveloperMode: boolean;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
     8
type TVariableType = (vtCommand, vtLongInt, vthwFloat, vtBoolean);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
     9
     TCommandHandler = procedure (var params: shortstring);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    10
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    11
procedure initModule;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    12
procedure freeModule;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    13
procedure ParseCommand(CmdStr: shortstring; TrustedSource: boolean);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    14
procedure StopMessages(Message: Longword);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    15
procedure doPut(putX, putY: LongInt; fromAI: boolean);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    16
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    17
implementation
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    18
uses uMisc, uStore, Types, uConsts, uGears, uTeams, uIO, uKeys, uMobile,
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    19
     uRandom, uAmmos, uStats, uChat, SDLh, uSound, uVisualGears, uScript, uTypes,
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    20
     uVariables, uConsole, uFloat;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    21
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    22
type  PVariable = ^TVariable;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    23
      TVariable = record
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    24
                     Next: PVariable;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    25
                     Name: string[15];
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    26
                    VType: TVariableType;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    27
                  Handler: pointer;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    28
                  Trusted: boolean;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    29
                  end;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    30
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    31
var
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    32
      Variables: PVariable;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    33
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    34
function RegisterVariable(Name: shortstring; VType: TVariableType; p: pointer; Trusted: boolean): PVariable;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    35
var value: PVariable;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    36
begin
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    37
New(value);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    38
TryDo(value <> nil, 'RegisterVariable: value = nil', true);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    39
FillChar(value^, sizeof(TVariable), 0);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    40
value^.Name:= Name;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    41
value^.VType:= VType;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    42
value^.Handler:= p;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    43
value^.Trusted:= Trusted;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    44
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    45
if Variables = nil then Variables:= value
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    46
                   else begin
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    47
                        value^.Next:= Variables;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    48
                        Variables:= value
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    49
                        end;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    50
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    51
RegisterVariable:= value;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    52
end;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    53
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    54
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    55
procedure ParseCommand(CmdStr: shortstring; TrustedSource: boolean);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    56
var ii: LongInt;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    57
    s: shortstring;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    58
    t: PVariable;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    59
    c: char;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    60
begin
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    61
//WriteLnToConsole(CmdStr);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    62
if CmdStr[0]=#0 then exit;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    63
{$IFDEF DEBUGFILE}AddFileLog('ParseCommand "' + CmdStr + '"');{$ENDIF}
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    64
c:= CmdStr[1];
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    65
if c in ['/', '$'] then Delete(CmdStr, 1, 1) else c:= '/';
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    66
s:= '';
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    67
SplitBySpace(CmdStr, s);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    68
t:= Variables;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    69
while t <> nil do
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    70
      begin
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    71
      if t^.Name = CmdStr then
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    72
         begin
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    73
         if TrustedSource or t^.Trusted then
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    74
            case t^.VType of
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    75
              vtCommand: if c='/' then
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    76
                         begin
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    77
                         TCommandHandler(t^.Handler)(s);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    78
                         end;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    79
              vtLongInt: if c='$' then
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    80
                         if s[0]=#0 then
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    81
                            begin
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    82
                            str(PLongInt(t^.Handler)^, s);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    83
                            WriteLnToConsole('$' + CmdStr + ' is "' + s + '"');
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    84
                            end else val(s, PLongInt(t^.Handler)^);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    85
              vthwFloat: if c='$' then
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    86
                         if s[0]=#0 then
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    87
                            begin
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    88
                            //str(PhwFloat(t^.Handler)^:4:6, s);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    89
                            WriteLnToConsole('$' + CmdStr + ' is "' + s + '"');
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    90
                            end else; //val(s, PhwFloat(t^.Handler)^, i);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    91
             vtBoolean: if c='$' then
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    92
                         if s[0]=#0 then
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    93
                            begin
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    94
                            str(ord(boolean(t^.Handler^)), s);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    95
                            WriteLnToConsole('$' + CmdStr + ' is "' + s + '"');
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    96
                            end else
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    97
                            begin
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    98
                            val(s, ii);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
    99
                            boolean(t^.Handler^):= not (ii = 0)
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   100
                            end;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   101
              end;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   102
         exit
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   103
         end else t:= t^.Next
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   104
      end;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   105
case c of
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   106
     '$': WriteLnToConsole(errmsgUnknownVariable + ': "$' + CmdStr + '"')
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   107
     else WriteLnToConsole(errmsgUnknownCommand  + ': "/' + CmdStr + '"') end
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   108
end;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   109
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   110
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   111
procedure StopMessages(Message: Longword);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   112
begin
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   113
if (Message and gmLeft) <> 0 then ParseCommand('/-left', true) else
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   114
if (Message and gmRight) <> 0 then ParseCommand('/-right', true) else
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   115
if (Message and gmUp) <> 0 then ParseCommand('/-up', true) else
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   116
if (Message and gmDown) <> 0 then ParseCommand('/-down', true) else
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   117
if (Message and gmAttack) <> 0 then ParseCommand('/-attack', true)
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   118
end;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   119
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   120
{$INCLUDE "CCHandlers.inc"}
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   121
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   122
procedure initModule;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   123
begin
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   124
    Variables:= nil;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   125
    isDeveloperMode:= true;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   126
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   127
    // NOTE: please, keep most frequently used commands on bottom
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   128
    RegisterVariable('flag'    , vtCommand, @chFlag         , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   129
    RegisterVariable('script'  , vtCommand, @chScript       , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   130
    RegisterVariable('proto'   , vtCommand, @chCheckProto   , true );
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   131
    RegisterVariable('spectate', vtBoolean, @fastUntilLag   , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   132
    RegisterVariable('capture' , vtCommand, @chCapture      , true );
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   133
    RegisterVariable('rotmask' , vtCommand, @chRotateMask   , true );
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   134
    RegisterVariable('addteam' , vtCommand, @chAddTeam      , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   135
    RegisterVariable('rdriven' , vtCommand, @chTeamLocal    , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   136
    RegisterVariable('map'     , vtCommand, @chSetMap       , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   137
    RegisterVariable('theme'   , vtCommand, @chSetTheme     , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   138
    RegisterVariable('seed'    , vtCommand, @chSetSeed      , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   139
    RegisterVariable('template_filter', vtLongInt, @cTemplateFilter, false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   140
    RegisterVariable('mapgen'  , vtLongInt, @cMapGen        , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   141
    RegisterVariable('maze_size',vtLongInt, @cMazeSize      , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   142
    RegisterVariable('delay'   , vtLongInt, @cInactDelay    , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   143
    RegisterVariable('ready'   , vtLongInt, @cReadyDelay    , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   144
    RegisterVariable('casefreq', vtLongInt, @cCaseFactor    , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   145
    RegisterVariable('healthprob', vtLongInt, @cHealthCaseProb, false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   146
    RegisterVariable('hcaseamount', vtLongInt, @cHealthCaseAmount, false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   147
    RegisterVariable('sd_turns', vtLongInt, @cSuddenDTurns  , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   148
    RegisterVariable('waterrise', vtLongInt, @cWaterRise    , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   149
    RegisterVariable('healthdec', vtLongInt, @cHealthDecrease, false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   150
    RegisterVariable('damagepct',vtLongInt, @cDamagePercent , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   151
    RegisterVariable('minedudpct',vtLongInt,@cMineDudPercent, false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   152
    RegisterVariable('minesnum', vtLongInt, @cLandMines     , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   153
    RegisterVariable('explosives',vtLongInt,@cExplosives    , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   154
    RegisterVariable('gmflags' , vtLongInt, @GameFlags      , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   155
    RegisterVariable('trflags' , vtLongInt, @TrainingFlags  , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   156
    RegisterVariable('turntime', vtLongInt, @cHedgehogTurnTime, false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   157
    RegisterVariable('minestime',vtLongInt, @cMinesTime     , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   158
    RegisterVariable('fort'    , vtCommand, @chFort         , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   159
    RegisterVariable('voicepack',vtCommand, @chVoicepack    , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   160
    RegisterVariable('grave'   , vtCommand, @chGrave        , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   161
    RegisterVariable('bind'    , vtCommand, @chBind         , true );
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   162
    RegisterVariable('addhh'   , vtCommand, @chAddHH        , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   163
    RegisterVariable('hat'     , vtCommand, @chSetHat       , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   164
    RegisterVariable('hhcoords', vtCommand, @chSetHHCoords  , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   165
    RegisterVariable('ammloadt', vtCommand, @chSetAmmoLoadout, false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   166
    RegisterVariable('ammdelay', vtCommand, @chSetAmmoDelay, false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   167
    RegisterVariable('ammprob',  vtCommand, @chSetAmmoProbability, false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   168
    RegisterVariable('ammreinf', vtCommand, @chSetAmmoReinforcement, false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   169
    RegisterVariable('ammstore', vtCommand, @chAddAmmoStore , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   170
    RegisterVariable('quit'    , vtCommand, @chQuit         , true );
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   171
    RegisterVariable('confirm' , vtCommand, @chConfirm      , true );
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   172
    RegisterVariable('+speedup', vtCommand, @chSpeedup_p    , true );
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   173
    RegisterVariable('-speedup', vtCommand, @chSpeedup_m    , true );
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   174
    RegisterVariable('zoomin'  , vtCommand, @chZoomIn       , true );
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   175
    RegisterVariable('zoomout' , vtCommand, @chZoomOut      , true );
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   176
    RegisterVariable('zoomreset',vtCommand, @chZoomReset    , true );
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   177
    RegisterVariable('skip'    , vtCommand, @chSkip         , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   178
    RegisterVariable('history' , vtCommand, @chHistory      , true );
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   179
    RegisterVariable('chat'    , vtCommand, @chChat         , true );
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   180
    RegisterVariable('say'     , vtCommand, @chSay          , true );
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   181
    RegisterVariable('hogsay'  , vtCommand, @chHogSay       , true );
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   182
    RegisterVariable('team'    , vtCommand, @chTeamSay      , true );
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   183
    RegisterVariable('ammomenu', vtCommand, @chAmmoMenu     , true);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   184
    RegisterVariable('+precise', vtCommand, @chPrecise_p    , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   185
    RegisterVariable('-precise', vtCommand, @chPrecise_m    , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   186
    RegisterVariable('+left'   , vtCommand, @chLeft_p       , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   187
    RegisterVariable('-left'   , vtCommand, @chLeft_m       , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   188
    RegisterVariable('+right'  , vtCommand, @chRight_p      , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   189
    RegisterVariable('-right'  , vtCommand, @chRight_m      , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   190
    RegisterVariable('+up'     , vtCommand, @chUp_p         , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   191
    RegisterVariable('-up'     , vtCommand, @chUp_m         , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   192
    RegisterVariable('+down'   , vtCommand, @chDown_p       , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   193
    RegisterVariable('-down'   , vtCommand, @chDown_m       , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   194
    RegisterVariable('+attack' , vtCommand, @chAttack_p     , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   195
    RegisterVariable('-attack' , vtCommand, @chAttack_m     , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   196
    RegisterVariable('switch'  , vtCommand, @chSwitch       , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   197
    RegisterVariable('nextturn', vtCommand, @chNextTurn     , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   198
    RegisterVariable('timer'   , vtCommand, @chTimer        , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   199
    RegisterVariable('taunt'   , vtCommand, @chTaunt        , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   200
    RegisterVariable('setweap' , vtCommand, @chSetWeapon    , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   201
    RegisterVariable('slot'    , vtCommand, @chSlot         , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   202
    RegisterVariable('put'     , vtCommand, @chPut          , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   203
    RegisterVariable('ljump'   , vtCommand, @chLJump        , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   204
    RegisterVariable('hjump'   , vtCommand, @chHJump        , false);
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   205
    RegisterVariable('fullscr' , vtCommand, @chFullScr      , true );
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   206
    RegisterVariable('+volup'  , vtCommand, @chVol_p        , true );
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   207
    RegisterVariable('-volup'  , vtCommand, @chVol_m        , true );
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   208
    RegisterVariable('+voldown', vtCommand, @chVol_m        , true );
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   209
    RegisterVariable('-voldown', vtCommand, @chVol_p        , true );
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   210
    RegisterVariable('findhh'  , vtCommand, @chFindhh       , true );
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   211
    RegisterVariable('pause'   , vtCommand, @chPause        , true );
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   212
    RegisterVariable('+cur_u'  , vtCommand, @chCurU_p       , true );
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   213
    RegisterVariable('-cur_u'  , vtCommand, @chCurU_m       , true );
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   214
    RegisterVariable('+cur_d'  , vtCommand, @chCurD_p       , true );
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   215
    RegisterVariable('-cur_d'  , vtCommand, @chCurD_m       , true );
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   216
    RegisterVariable('+cur_l'  , vtCommand, @chCurL_p       , true );
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   217
    RegisterVariable('-cur_l'  , vtCommand, @chCurL_m       , true );
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   218
    RegisterVariable('+cur_r'  , vtCommand, @chCurR_p       , true );
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   219
    RegisterVariable('-cur_r'  , vtCommand, @chCurR_m       , true );
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   220
end;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   221
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   222
procedure freeModule;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   223
var t, tt: PVariable;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   224
begin
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   225
    tt:= Variables;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   226
    Variables:= nil;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   227
    while tt <> nil do
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   228
    begin
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   229
        t:= tt;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   230
        tt:= tt^.Next;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   231
        Dispose(t)
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   232
    end;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   233
end;
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   234
fe0e3903bb9e Introduce uCommands.pas
unC0Rr
parents:
diff changeset
   235
end.