hedgewars/uConsole.pas
author unc0rr
Wed, 17 Nov 2010 22:26:34 +0300
changeset 4371 ae172b2b03ed
parent 4369 334fc848e051
child 4373 fe0e3903bb9e
permissions -rw-r--r--
Some more
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
     1
(*
1066
1f1b3686a2b0 Update copyright headers a bit
unc0rr
parents: 1035
diff changeset
     2
 * Hedgewars, a free turn based strategy game
883
07a568ba44e0 Update copyright info in source files headers
unc0rr
parents: 871
diff changeset
     3
 * Copyright (c) 2004-2008 Andrey Korotaev <unC0Rr@gmail.com>
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
     4
 *
183
57c2ef19f719 Relicense to GPL
unc0rr
parents: 176
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
57c2ef19f719 Relicense to GPL
unc0rr
parents: 176
diff changeset
     6
 * it under the terms of the GNU General Public License as published by
57c2ef19f719 Relicense to GPL
unc0rr
parents: 176
diff changeset
     7
 * the Free Software Foundation; version 2 of the License
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
     8
 *
183
57c2ef19f719 Relicense to GPL
unc0rr
parents: 176
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
57c2ef19f719 Relicense to GPL
unc0rr
parents: 176
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
57c2ef19f719 Relicense to GPL
unc0rr
parents: 176
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
57c2ef19f719 Relicense to GPL
unc0rr
parents: 176
diff changeset
    12
 * GNU General Public License for more details.
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    13
 *
183
57c2ef19f719 Relicense to GPL
unc0rr
parents: 176
diff changeset
    14
 * You should have received a copy of the GNU General Public License
57c2ef19f719 Relicense to GPL
unc0rr
parents: 176
diff changeset
    15
 * along with this program; if not, write to the Free Software
57c2ef19f719 Relicense to GPL
unc0rr
parents: 176
diff changeset
    16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    17
 *)
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    18
2630
079ef82eac75 revamped file access and debug display
koda
parents: 2599
diff changeset
    19
{$INCLUDE "options.inc"}
079ef82eac75 revamped file access and debug display
koda
parents: 2599
diff changeset
    20
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    21
unit uConsole;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    22
interface
988
cdff3f6f9b38 Get rid of old console
unc0rr
parents: 970
diff changeset
    23
uses uFloat;
2630
079ef82eac75 revamped file access and debug display
koda
parents: 2599
diff changeset
    24
2699
249adefa9c1c replace initialization/finalization statements with custom init functions
koda
parents: 2695
diff changeset
    25
var isDeveloperMode: boolean;
371
731ad6d27bd1 integer -> LongInt
unc0rr
parents: 351
diff changeset
    26
type TVariableType = (vtCommand, vtLongInt, vthwFloat, vtBoolean);
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    27
     TCommandHandler = procedure (var params: shortstring);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    28
3038
4e48c276a468 In pascal unit is a namespace
unc0rr
parents: 2990
diff changeset
    29
procedure initModule;
4e48c276a468 In pascal unit is a namespace
unc0rr
parents: 2990
diff changeset
    30
procedure freeModule;
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    31
procedure WriteToConsole(s: shortstring);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    32
procedure WriteLnToConsole(s: shortstring);
351
29bc9c36ad5f Fixed-point arithmetics in engine.
unc0rr
parents: 312
diff changeset
    33
procedure ParseCommand(CmdStr: shortstring; TrustedSource: boolean);
936
ba582673db7d Fix 'AI may break demos playing' message while loading saves
unc0rr
parents: 917
diff changeset
    34
procedure StopMessages(Message: Longword);
53
0e27949850e3 - Fixed bubble theme object
unc0rr
parents: 51
diff changeset
    35
function  GetLastConsoleLine: shortstring;
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    36
543
465e2ec8f05f - Better randomness of placing hedgehogs on the land
unc0rr
parents: 539
diff changeset
    37
procedure doPut(putX, putY: LongInt; fromAI: boolean);
465e2ec8f05f - Better randomness of placing hedgehogs on the land
unc0rr
parents: 539
diff changeset
    38
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    39
implementation
4369
unc0rr
parents: 4359
diff changeset
    40
uses uMisc, uStore, Types, uConsts, uGears, uTeams, uIO, uKeys, uMobile,
4359
83ef50815535 Move variables from uMisc to uVariables
unC0Rr
parents: 4357
diff changeset
    41
     uRandom, uAmmos, uStats, uChat, SDLh, uSound, uVisualGears, uScript, uTypes,
83ef50815535 Move variables from uMisc to uVariables
unC0Rr
parents: 4357
diff changeset
    42
     uVariables;
950
feb18ec0c5c2 Add nickname to message in more appropriate place
unc0rr
parents: 946
diff changeset
    43
371
731ad6d27bd1 integer -> LongInt
unc0rr
parents: 351
diff changeset
    44
const cLineWidth: LongInt = 0;
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    45
      cLinesCount = 256;
351
29bc9c36ad5f Fixed-point arithmetics in engine.
unc0rr
parents: 312
diff changeset
    46
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    47
type  PVariable = ^TVariable;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    48
      TVariable = record
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    49
                     Next: PVariable;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    50
                     Name: string[15];
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    51
                    VType: TVariableType;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    52
                  Handler: pointer;
167
805fa9a27e9e "Trusted" binds
unc0rr
parents: 166
diff changeset
    53
                  Trusted: boolean;
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    54
                  end;
785
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
    55
      TTextLine = record
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
    56
                  s: shortstring;
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
    57
                  end;
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    58
785
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
    59
var   ConsoleLines: array[byte] of TTextLine;
2699
249adefa9c1c replace initialization/finalization statements with custom init functions
koda
parents: 2695
diff changeset
    60
      CurrLine: LongInt;
249adefa9c1c replace initialization/finalization statements with custom init functions
koda
parents: 2695
diff changeset
    61
      Variables: PVariable;
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    62
785
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
    63
procedure SetLine(var tl: TTextLine; str: shortstring);
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
    64
begin
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
    65
with tl do
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
    66
     s:= str;
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
    67
end;
ac538f1a629e Start console OpenGL reincarnation
unc0rr
parents: 783
diff changeset
    68
2905
f3c79f7193a9 Engine:
smxx
parents: 2882
diff changeset
    69
function RegisterVariable(Name: shortstring; VType: TVariableType; p: pointer; Trusted: boolean): PVariable;
2695
ed789a7ef68d makes freepascal code compatible with OBJFPC mode
koda
parents: 2630
diff changeset
    70
var value: PVariable;
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    71
begin
2695
ed789a7ef68d makes freepascal code compatible with OBJFPC mode
koda
parents: 2630
diff changeset
    72
New(value);
ed789a7ef68d makes freepascal code compatible with OBJFPC mode
koda
parents: 2630
diff changeset
    73
TryDo(value <> nil, 'RegisterVariable: value = nil', true);
ed789a7ef68d makes freepascal code compatible with OBJFPC mode
koda
parents: 2630
diff changeset
    74
FillChar(value^, sizeof(TVariable), 0);
ed789a7ef68d makes freepascal code compatible with OBJFPC mode
koda
parents: 2630
diff changeset
    75
value^.Name:= Name;
ed789a7ef68d makes freepascal code compatible with OBJFPC mode
koda
parents: 2630
diff changeset
    76
value^.VType:= VType;
ed789a7ef68d makes freepascal code compatible with OBJFPC mode
koda
parents: 2630
diff changeset
    77
value^.Handler:= p;
ed789a7ef68d makes freepascal code compatible with OBJFPC mode
koda
parents: 2630
diff changeset
    78
value^.Trusted:= Trusted;
167
805fa9a27e9e "Trusted" binds
unc0rr
parents: 166
diff changeset
    79
2695
ed789a7ef68d makes freepascal code compatible with OBJFPC mode
koda
parents: 2630
diff changeset
    80
if Variables = nil then Variables:= value
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    81
                   else begin
2695
ed789a7ef68d makes freepascal code compatible with OBJFPC mode
koda
parents: 2630
diff changeset
    82
                        value^.Next:= Variables;
ed789a7ef68d makes freepascal code compatible with OBJFPC mode
koda
parents: 2630
diff changeset
    83
                        Variables:= value
351
29bc9c36ad5f Fixed-point arithmetics in engine.
unc0rr
parents: 312
diff changeset
    84
                        end;
29bc9c36ad5f Fixed-point arithmetics in engine.
unc0rr
parents: 312
diff changeset
    85
2695
ed789a7ef68d makes freepascal code compatible with OBJFPC mode
koda
parents: 2630
diff changeset
    86
RegisterVariable:= value;
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    87
end;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    88
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    89
procedure WriteToConsole(s: shortstring);
371
731ad6d27bd1 integer -> LongInt
unc0rr
parents: 351
diff changeset
    90
var Len: LongInt;
2699
249adefa9c1c replace initialization/finalization statements with custom init functions
koda
parents: 2695
diff changeset
    91
    done: boolean;
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
    92
begin
3818
e668970413e6 add a noconsole symbol, update the project file for appstore distribution
koda
parents: 3777
diff changeset
    93
{$IFNDEF NOCONSOLE}
4046
cfdbddc4b385 making indentation consistent (noticed while debugging)
nemo
parents: 4003
diff changeset
    94
{$IFDEF DEBUGFILE}AddFileLog('Console write: ' + s);{$ENDIF}
cfdbddc4b385 making indentation consistent (noticed while debugging)
nemo
parents: 4003
diff changeset
    95
Write(s);
cfdbddc4b385 making indentation consistent (noticed while debugging)
nemo
parents: 4003
diff changeset
    96
done:= false;
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3617
diff changeset
    97
4046
cfdbddc4b385 making indentation consistent (noticed while debugging)
nemo
parents: 4003
diff changeset
    98
while not done do
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
    99
    begin
4046
cfdbddc4b385 making indentation consistent (noticed while debugging)
nemo
parents: 4003
diff changeset
   100
    Len:= cLineWidth - Length(ConsoleLines[CurrLine].s);
cfdbddc4b385 making indentation consistent (noticed while debugging)
nemo
parents: 4003
diff changeset
   101
    SetLine(ConsoleLines[CurrLine], ConsoleLines[CurrLine].s + copy(s, 1, Len));
cfdbddc4b385 making indentation consistent (noticed while debugging)
nemo
parents: 4003
diff changeset
   102
    Delete(s, 1, Len);
cfdbddc4b385 making indentation consistent (noticed while debugging)
nemo
parents: 4003
diff changeset
   103
    if byte(ConsoleLines[CurrLine].s[0]) = cLineWidth then
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   104
        begin
4046
cfdbddc4b385 making indentation consistent (noticed while debugging)
nemo
parents: 4003
diff changeset
   105
        inc(CurrLine);
cfdbddc4b385 making indentation consistent (noticed while debugging)
nemo
parents: 4003
diff changeset
   106
        if CurrLine = cLinesCount then CurrLine:= 0;
cfdbddc4b385 making indentation consistent (noticed while debugging)
nemo
parents: 4003
diff changeset
   107
        PByte(@ConsoleLines[CurrLine].s)^:= 0
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   108
        end;
4046
cfdbddc4b385 making indentation consistent (noticed while debugging)
nemo
parents: 4003
diff changeset
   109
    done:= (Length(s) = 0);
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   110
    end;
3818
e668970413e6 add a noconsole symbol, update the project file for appstore distribution
koda
parents: 3777
diff changeset
   111
{$ENDIF}
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   112
end;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   113
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   114
procedure WriteLnToConsole(s: shortstring);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   115
begin
3825
fd6c20cd90e3 typos, reduced sound size and last minute fixes
koda
parents: 3818
diff changeset
   116
{$IFNDEF NOCONSOLE}
4046
cfdbddc4b385 making indentation consistent (noticed while debugging)
nemo
parents: 4003
diff changeset
   117
WriteToConsole(s);
cfdbddc4b385 making indentation consistent (noticed while debugging)
nemo
parents: 4003
diff changeset
   118
WriteLn;
cfdbddc4b385 making indentation consistent (noticed while debugging)
nemo
parents: 4003
diff changeset
   119
inc(CurrLine);
cfdbddc4b385 making indentation consistent (noticed while debugging)
nemo
parents: 4003
diff changeset
   120
if CurrLine = cLinesCount then
cfdbddc4b385 making indentation consistent (noticed while debugging)
nemo
parents: 4003
diff changeset
   121
    CurrLine:= 0;
cfdbddc4b385 making indentation consistent (noticed while debugging)
nemo
parents: 4003
diff changeset
   122
PByte(@ConsoleLines[CurrLine].s)^:= 0
3818
e668970413e6 add a noconsole symbol, update the project file for appstore distribution
koda
parents: 3777
diff changeset
   123
{$ENDIF}
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   124
end;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   125
351
29bc9c36ad5f Fixed-point arithmetics in engine.
unc0rr
parents: 312
diff changeset
   126
procedure ParseCommand(CmdStr: shortstring; TrustedSource: boolean);
495
62c1c2b4414c - Fix most of the warnings in hwengine
unc0rr
parents: 415
diff changeset
   127
var ii: LongInt;
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   128
    s: shortstring;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   129
    t: PVariable;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   130
    c: char;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   131
begin
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   132
//WriteLnToConsole(CmdStr);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   133
if CmdStr[0]=#0 then exit;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   134
{$IFDEF DEBUGFILE}AddFileLog('ParseCommand "' + CmdStr + '"');{$ENDIF}
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   135
c:= CmdStr[1];
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   136
if c in ['/', '$'] then Delete(CmdStr, 1, 1) else c:= '/';
3407
dcc129c4352e Engine:
smxx
parents: 3346
diff changeset
   137
s:= '';
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   138
SplitBySpace(CmdStr, s);
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   139
t:= Variables;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   140
while t <> nil do
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   141
      begin
351
29bc9c36ad5f Fixed-point arithmetics in engine.
unc0rr
parents: 312
diff changeset
   142
      if t^.Name = CmdStr then
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   143
         begin
351
29bc9c36ad5f Fixed-point arithmetics in engine.
unc0rr
parents: 312
diff changeset
   144
         if TrustedSource or t^.Trusted then
29bc9c36ad5f Fixed-point arithmetics in engine.
unc0rr
parents: 312
diff changeset
   145
            case t^.VType of
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   146
              vtCommand: if c='/' then
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   147
                         begin
351
29bc9c36ad5f Fixed-point arithmetics in engine.
unc0rr
parents: 312
diff changeset
   148
                         TCommandHandler(t^.Handler)(s);
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   149
                         end;
371
731ad6d27bd1 integer -> LongInt
unc0rr
parents: 351
diff changeset
   150
              vtLongInt: if c='$' then
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   151
                         if s[0]=#0 then
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   152
                            begin
371
731ad6d27bd1 integer -> LongInt
unc0rr
parents: 351
diff changeset
   153
                            str(PLongInt(t^.Handler)^, s);
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   154
                            WriteLnToConsole('$' + CmdStr + ' is "' + s + '"');
495
62c1c2b4414c - Fix most of the warnings in hwengine
unc0rr
parents: 415
diff changeset
   155
                            end else val(s, PLongInt(t^.Handler)^);
62c1c2b4414c - Fix most of the warnings in hwengine
unc0rr
parents: 415
diff changeset
   156
              vthwFloat: if c='$' then
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   157
                         if s[0]=#0 then
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   158
                            begin
351
29bc9c36ad5f Fixed-point arithmetics in engine.
unc0rr
parents: 312
diff changeset
   159
                            //str(PhwFloat(t^.Handler)^:4:6, s);
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   160
                            WriteLnToConsole('$' + CmdStr + ' is "' + s + '"');
351
29bc9c36ad5f Fixed-point arithmetics in engine.
unc0rr
parents: 312
diff changeset
   161
                            end else; //val(s, PhwFloat(t^.Handler)^, i);
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   162
             vtBoolean: if c='$' then
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   163
                         if s[0]=#0 then
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   164
                            begin
351
29bc9c36ad5f Fixed-point arithmetics in engine.
unc0rr
parents: 312
diff changeset
   165
                            str(ord(boolean(t^.Handler^)), s);
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   166
                            WriteLnToConsole('$' + CmdStr + ' is "' + s + '"');
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   167
                            end else
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   168
                            begin
495
62c1c2b4414c - Fix most of the warnings in hwengine
unc0rr
parents: 415
diff changeset
   169
                            val(s, ii);
351
29bc9c36ad5f Fixed-point arithmetics in engine.
unc0rr
parents: 312
diff changeset
   170
                            boolean(t^.Handler^):= not (ii = 0)
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   171
                            end;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   172
              end;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   173
         exit
351
29bc9c36ad5f Fixed-point arithmetics in engine.
unc0rr
parents: 312
diff changeset
   174
         end else t:= t^.Next
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   175
      end;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   176
case c of
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   177
     '$': WriteLnToConsole(errmsgUnknownVariable + ': "$' + CmdStr + '"')
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   178
     else WriteLnToConsole(errmsgUnknownCommand  + ': "/' + CmdStr + '"') end
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   179
end;
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   180
53
0e27949850e3 - Fixed bubble theme object
unc0rr
parents: 51
diff changeset
   181
function GetLastConsoleLine: shortstring;
2695
ed789a7ef68d makes freepascal code compatible with OBJFPC mode
koda
parents: 2630
diff changeset
   182
var valueStr: shortstring;
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   183
    i: LongWord;
53
0e27949850e3 - Fixed bubble theme object
unc0rr
parents: 51
diff changeset
   184
begin
1242
4aca5f7b2504 Hats now fully implemented for local game
unc0rr
parents: 1066
diff changeset
   185
i:= (CurrLine + cLinesCount - 2) mod cLinesCount;
2695
ed789a7ef68d makes freepascal code compatible with OBJFPC mode
koda
parents: 2630
diff changeset
   186
valueStr:= ConsoleLines[i].s;
1242
4aca5f7b2504 Hats now fully implemented for local game
unc0rr
parents: 1066
diff changeset
   187
2695
ed789a7ef68d makes freepascal code compatible with OBJFPC mode
koda
parents: 2630
diff changeset
   188
valueStr:= valueStr + #10;
1242
4aca5f7b2504 Hats now fully implemented for local game
unc0rr
parents: 1066
diff changeset
   189
4aca5f7b2504 Hats now fully implemented for local game
unc0rr
parents: 1066
diff changeset
   190
i:= (CurrLine + cLinesCount - 1) mod cLinesCount;
2695
ed789a7ef68d makes freepascal code compatible with OBJFPC mode
koda
parents: 2630
diff changeset
   191
valueStr:= valueStr + ConsoleLines[i].s;
1242
4aca5f7b2504 Hats now fully implemented for local game
unc0rr
parents: 1066
diff changeset
   192
2695
ed789a7ef68d makes freepascal code compatible with OBJFPC mode
koda
parents: 2630
diff changeset
   193
GetLastConsoleLine:= valueStr;
53
0e27949850e3 - Fixed bubble theme object
unc0rr
parents: 51
diff changeset
   194
end;
0e27949850e3 - Fixed bubble theme object
unc0rr
parents: 51
diff changeset
   195
936
ba582673db7d Fix 'AI may break demos playing' message while loading saves
unc0rr
parents: 917
diff changeset
   196
procedure StopMessages(Message: Longword);
ba582673db7d Fix 'AI may break demos playing' message while loading saves
unc0rr
parents: 917
diff changeset
   197
begin
3894
9abce5468583 Engine:
smaxx
parents: 3825
diff changeset
   198
if (Message and gmLeft) <> 0 then ParseCommand('/-left', true) else
9abce5468583 Engine:
smaxx
parents: 3825
diff changeset
   199
if (Message and gmRight) <> 0 then ParseCommand('/-right', true) else
9abce5468583 Engine:
smaxx
parents: 3825
diff changeset
   200
if (Message and gmUp) <> 0 then ParseCommand('/-up', true) else
9abce5468583 Engine:
smaxx
parents: 3825
diff changeset
   201
if (Message and gmDown) <> 0 then ParseCommand('/-down', true) else
9abce5468583 Engine:
smaxx
parents: 3825
diff changeset
   202
if (Message and gmAttack) <> 0 then ParseCommand('/-attack', true)
936
ba582673db7d Fix 'AI may break demos playing' message while loading saves
unc0rr
parents: 917
diff changeset
   203
end;
ba582673db7d Fix 'AI may break demos playing' message while loading saves
unc0rr
parents: 917
diff changeset
   204
2599
c7153d2348f3 move compiler directives to standard pascal
koda
parents: 2578
diff changeset
   205
{$INCLUDE "CCHandlers.inc"}
3038
4e48c276a468 In pascal unit is a namespace
unc0rr
parents: 2990
diff changeset
   206
procedure initModule;
2699
249adefa9c1c replace initialization/finalization statements with custom init functions
koda
parents: 2695
diff changeset
   207
var i: LongInt;
249adefa9c1c replace initialization/finalization statements with custom init functions
koda
parents: 2695
diff changeset
   208
begin
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   209
    CurrLine:= 0;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   210
    Variables:= nil;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   211
    isDeveloperMode:= true;
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3617
diff changeset
   212
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   213
    // initConsole
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   214
    cLineWidth:= cScreenWidth div 10;
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   215
    if cLineWidth > 255 then
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   216
        cLineWidth:= 255;
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3617
diff changeset
   217
    for i:= 0 to Pred(cLinesCount) do
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   218
        PByte(@ConsoleLines[i])^:= 0;
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 3617
diff changeset
   219
3938
033114a6a960 Some optimizations
unc0rr
parents: 3894
diff changeset
   220
    // NOTE: please, keep most frequently used commands on bottom
033114a6a960 Some optimizations
unc0rr
parents: 3894
diff changeset
   221
    RegisterVariable('flag'    , vtCommand, @chFlag         , false);
033114a6a960 Some optimizations
unc0rr
parents: 3894
diff changeset
   222
    RegisterVariable('script'  , vtCommand, @chScript       , false);
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   223
    RegisterVariable('proto'   , vtCommand, @chCheckProto   , true );
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   224
    RegisterVariable('spectate', vtBoolean, @fastUntilLag   , false);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   225
    RegisterVariable('capture' , vtCommand, @chCapture      , true );
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   226
    RegisterVariable('rotmask' , vtCommand, @chRotateMask   , true );
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   227
    RegisterVariable('addteam' , vtCommand, @chAddTeam      , false);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   228
    RegisterVariable('rdriven' , vtCommand, @chTeamLocal    , false);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   229
    RegisterVariable('map'     , vtCommand, @chSetMap       , false);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   230
    RegisterVariable('theme'   , vtCommand, @chSetTheme     , false);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   231
    RegisterVariable('seed'    , vtCommand, @chSetSeed      , false);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   232
    RegisterVariable('template_filter', vtLongInt, @cTemplateFilter, false);
3133
1ab5f18f4df8 prg's maze generator
nemo
parents: 3038
diff changeset
   233
    RegisterVariable('mapgen'  , vtLongInt, @cMapGen        , false);
1ab5f18f4df8 prg's maze generator
nemo
parents: 3038
diff changeset
   234
    RegisterVariable('maze_size',vtLongInt, @cMazeSize      , false);
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   235
    RegisterVariable('delay'   , vtLongInt, @cInactDelay    , false);
3777
5276f2150d65 Engine:
smaxx
parents: 3697
diff changeset
   236
    RegisterVariable('ready'   , vtLongInt, @cReadyDelay    , false);
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   237
    RegisterVariable('casefreq', vtLongInt, @cCaseFactor    , false);
4143
eb7981f34800 Remove the last vestiges of the shoppa hack by adding 2 spinners for percentage health and amount of health in crate, also update translations and increase SD spinner (some users have requested it)
henek
parents: 4046
diff changeset
   238
    RegisterVariable('healthprob', vtLongInt, @cHealthCaseProb, false);
eb7981f34800 Remove the last vestiges of the shoppa hack by adding 2 spinners for percentage health and amount of health in crate, also update translations and increase SD spinner (some users have requested it)
henek
parents: 4046
diff changeset
   239
    RegisterVariable('hcaseamount', vtLongInt, @cHealthCaseAmount, false);
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   240
    RegisterVariable('sd_turns', vtLongInt, @cSuddenDTurns  , false);
4153
6bd94e4c5d65 2 more variables to control water rise and health loss during sudden death.
henek
parents: 4143
diff changeset
   241
    RegisterVariable('waterrise', vtLongInt, @cWaterRise    , false);
6bd94e4c5d65 2 more variables to control water rise and health loss during sudden death.
henek
parents: 4143
diff changeset
   242
    RegisterVariable('healthdec', vtLongInt, @cHealthDecrease, false);
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   243
    RegisterVariable('damagepct',vtLongInt, @cDamagePercent , false);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   244
    RegisterVariable('minedudpct',vtLongInt,@cMineDudPercent, false);
4003
ca0600ab38bf disable gfMines and update variable names (landadds -> minesnum, cLandAdditions -> cLandMines)
koda
parents: 3969
diff changeset
   245
    RegisterVariable('minesnum', vtLongInt, @cLandMines     , false);
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   246
    RegisterVariable('explosives',vtLongInt,@cExplosives    , false);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   247
    RegisterVariable('gmflags' , vtLongInt, @GameFlags      , false);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   248
    RegisterVariable('trflags' , vtLongInt, @TrainingFlags  , false);
4210
caa9b08990eb revert 4200:dd54999c2822 - it was breaking schemes. koda. just leave this alone until next release
nemo
parents: 4208
diff changeset
   249
    RegisterVariable('turntime', vtLongInt, @cHedgehogTurnTime, false);
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   250
    RegisterVariable('minestime',vtLongInt, @cMinesTime     , false);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   251
    RegisterVariable('fort'    , vtCommand, @chFort         , false);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   252
    RegisterVariable('voicepack',vtCommand, @chVoicepack    , false);
3969
5f4ef3db0a65 Ok. Let's disable the right one this time. In fact, let's just remove newgrave entirely - no point in half-measures.
nemo
parents: 3968
diff changeset
   253
    RegisterVariable('grave'   , vtCommand, @chGrave        , false);
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   254
    RegisterVariable('bind'    , vtCommand, @chBind         , true );
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   255
    RegisterVariable('addhh'   , vtCommand, @chAddHH        , false);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   256
    RegisterVariable('hat'     , vtCommand, @chSetHat       , false);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   257
    RegisterVariable('hhcoords', vtCommand, @chSetHHCoords  , false);
3346
967fd96f7373 Engine/Frontend:
smxx
parents: 3133
diff changeset
   258
    RegisterVariable('ammloadt', vtCommand, @chSetAmmoLoadout, false);
967fd96f7373 Engine/Frontend:
smxx
parents: 3133
diff changeset
   259
    RegisterVariable('ammdelay', vtCommand, @chSetAmmoDelay, false);
967fd96f7373 Engine/Frontend:
smxx
parents: 3133
diff changeset
   260
    RegisterVariable('ammprob',  vtCommand, @chSetAmmoProbability, false);
967fd96f7373 Engine/Frontend:
smxx
parents: 3133
diff changeset
   261
    RegisterVariable('ammreinf', vtCommand, @chSetAmmoReinforcement, false);
2948
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   262
    RegisterVariable('ammstore', vtCommand, @chAddAmmoStore , false);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   263
    RegisterVariable('quit'    , vtCommand, @chQuit         , true );
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   264
    RegisterVariable('confirm' , vtCommand, @chConfirm      , true );
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   265
    RegisterVariable('+speedup', vtCommand, @chSpeedup_p    , true );
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   266
    RegisterVariable('-speedup', vtCommand, @chSpeedup_m    , true );
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   267
    RegisterVariable('zoomin'  , vtCommand, @chZoomIn       , true );
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   268
    RegisterVariable('zoomout' , vtCommand, @chZoomOut      , true );
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   269
    RegisterVariable('zoomreset',vtCommand, @chZoomReset    , true );
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   270
    RegisterVariable('skip'    , vtCommand, @chSkip         , false);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   271
    RegisterVariable('history' , vtCommand, @chHistory      , true );
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   272
    RegisterVariable('chat'    , vtCommand, @chChat         , true );
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   273
    RegisterVariable('say'     , vtCommand, @chSay          , true );
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   274
    RegisterVariable('hogsay'  , vtCommand, @chHogSay       , true );
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   275
    RegisterVariable('team'    , vtCommand, @chTeamSay      , true );
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   276
    RegisterVariable('ammomenu', vtCommand, @chAmmoMenu     , true);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   277
    RegisterVariable('+precise', vtCommand, @chPrecise_p    , false);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   278
    RegisterVariable('-precise', vtCommand, @chPrecise_m    , false);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   279
    RegisterVariable('+left'   , vtCommand, @chLeft_p       , false);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   280
    RegisterVariable('-left'   , vtCommand, @chLeft_m       , false);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   281
    RegisterVariable('+right'  , vtCommand, @chRight_p      , false);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   282
    RegisterVariable('-right'  , vtCommand, @chRight_m      , false);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   283
    RegisterVariable('+up'     , vtCommand, @chUp_p         , false);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   284
    RegisterVariable('-up'     , vtCommand, @chUp_m         , false);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   285
    RegisterVariable('+down'   , vtCommand, @chDown_p       , false);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   286
    RegisterVariable('-down'   , vtCommand, @chDown_m       , false);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   287
    RegisterVariable('+attack' , vtCommand, @chAttack_p     , false);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   288
    RegisterVariable('-attack' , vtCommand, @chAttack_m     , false);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   289
    RegisterVariable('switch'  , vtCommand, @chSwitch       , false);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   290
    RegisterVariable('nextturn', vtCommand, @chNextTurn     , false);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   291
    RegisterVariable('timer'   , vtCommand, @chTimer        , false);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   292
    RegisterVariable('taunt'   , vtCommand, @chTaunt        , false);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   293
    RegisterVariable('setweap' , vtCommand, @chSetWeapon    , false);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   294
    RegisterVariable('slot'    , vtCommand, @chSlot         , false);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   295
    RegisterVariable('put'     , vtCommand, @chPut          , false);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   296
    RegisterVariable('ljump'   , vtCommand, @chLJump        , false);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   297
    RegisterVariable('hjump'   , vtCommand, @chHJump        , false);
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   298
    RegisterVariable('fullscr' , vtCommand, @chFullScr      , true );
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   299
    RegisterVariable('+volup'  , vtCommand, @chVol_p        , true );
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   300
    RegisterVariable('-volup'  , vtCommand, @chVol_m        , true );
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   301
    RegisterVariable('+voldown', vtCommand, @chVol_m        , true );
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   302
    RegisterVariable('-voldown', vtCommand, @chVol_p        , true );
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   303
    RegisterVariable('findhh'  , vtCommand, @chFindhh       , true );
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   304
    RegisterVariable('pause'   , vtCommand, @chPause        , true );
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   305
    RegisterVariable('+cur_u'  , vtCommand, @chCurU_p       , true );
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   306
    RegisterVariable('-cur_u'  , vtCommand, @chCurU_m       , true );
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   307
    RegisterVariable('+cur_d'  , vtCommand, @chCurD_p       , true );
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   308
    RegisterVariable('-cur_d'  , vtCommand, @chCurD_m       , true );
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   309
    RegisterVariable('+cur_l'  , vtCommand, @chCurL_p       , true );
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   310
    RegisterVariable('-cur_l'  , vtCommand, @chCurL_m       , true );
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   311
    RegisterVariable('+cur_r'  , vtCommand, @chCurR_p       , true );
3f21a9dc93d0 Replace tabs with spaces using 'expand -t 4' command
unc0rr
parents: 2915
diff changeset
   312
    RegisterVariable('-cur_r'  , vtCommand, @chCurR_m       , true );
2699
249adefa9c1c replace initialization/finalization statements with custom init functions
koda
parents: 2695
diff changeset
   313
end;
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   314
3038
4e48c276a468 In pascal unit is a namespace
unc0rr
parents: 2990
diff changeset
   315
procedure freeModule;
3617
1df21e06b8ba a couple of fixes i missed previously
koda
parents: 3407
diff changeset
   316
var t, tt: PVariable;
2699
249adefa9c1c replace initialization/finalization statements with custom init functions
koda
parents: 2695
diff changeset
   317
begin
3617
1df21e06b8ba a couple of fixes i missed previously
koda
parents: 3407
diff changeset
   318
    tt:= Variables;
1df21e06b8ba a couple of fixes i missed previously
koda
parents: 3407
diff changeset
   319
    Variables:= nil;
1df21e06b8ba a couple of fixes i missed previously
koda
parents: 3407
diff changeset
   320
    while tt <> nil do
1df21e06b8ba a couple of fixes i missed previously
koda
parents: 3407
diff changeset
   321
    begin
1df21e06b8ba a couple of fixes i missed previously
koda
parents: 3407
diff changeset
   322
        t:= tt;
1df21e06b8ba a couple of fixes i missed previously
koda
parents: 3407
diff changeset
   323
        tt:= tt^.Next;
1df21e06b8ba a couple of fixes i missed previously
koda
parents: 3407
diff changeset
   324
        Dispose(t)
1df21e06b8ba a couple of fixes i missed previously
koda
parents: 3407
diff changeset
   325
    end;
2699
249adefa9c1c replace initialization/finalization statements with custom init functions
koda
parents: 2695
diff changeset
   326
end;
4
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   327
bcbd7adb4e4b - set svn:eol-style to native
unc0rr
parents: 2
diff changeset
   328
end.