hedgewars/uIO.pas
author unc0rr
Mon, 22 Aug 2005 13:35:41 +0000
changeset 1 30f2d1037d5d
child 4 bcbd7adb4e4b
permissions -rw-r--r--
Add current sources. hw, hwserv and runhelper are compilable under Windows and *nix with FreePascal (and use -Od option) and run well on these OSes Hedge.dpr can be run only in Windows... to be ported
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
     1
(*
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
     2
 * Hedgewars, a worms-like game
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
     3
 * Copyright (c) 2004, 2005 Andrey Korotaev <unC0Rr@gmail.com>
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
     4
 *
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
     5
 * Distributed under the terms of the BSD-modified licence:
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
     6
 *
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
     7
 * Permission is hereby granted, free of charge, to any person obtaining a copy
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
     8
 * of this software and associated documentation files (the "Software"), to deal
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
     9
 * with the Software without restriction, including without limitation the
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    10
 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    11
 * sell copies of the Software, and to permit persons to whom the Software is
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    12
 * furnished to do so, subject to the following conditions:
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    13
 *
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    14
 * 1. Redistributions of source code must retain the above copyright notice,
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    15
 *    this list of conditions and the following disclaimer.
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    16
 * 2. Redistributions in binary form must reproduce the above copyright notice,
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    17
 *    this list of conditions and the following disclaimer in the documentation
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    18
 *    and/or other materials provided with the distribution.
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    19
 * 3. The name of the author may not be used to endorse or promote products
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    20
 *    derived from this software without specific prior written permission.
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    21
 *
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    22
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    23
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    24
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    25
 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    26
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    27
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    28
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    29
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    30
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    31
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    32
 *)
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    33
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    34
unit uIO;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    35
interface
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    36
uses SDLh;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    37
{$INCLUDE options.inc}
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    38
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    39
const ipcPort: Word = 0;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    40
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    41
procedure SendIPC(s: shortstring);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    42
procedure SendIPCAndWaitReply(s: shortstring);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    43
procedure IPCCheckSock;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    44
procedure InitIPC;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    45
procedure CloseIPC;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    46
procedure NetGetNextCmd;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    47
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    48
implementation
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    49
uses uConsole, uConsts, uWorld, uMisc;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    50
const isPonged: boolean = false;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    51
var  IPCSock: PTCPSocket;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    52
     fds: PSDLNet_SocketSet;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    53
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    54
     extcmd: array[word] of packed record
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    55
                                   Time: LongWord;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    56
                                   case byte of
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    57
                                        1: (len: byte;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    58
                                            cmd: Char;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    59
                                            X, Y: integer;);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    60
                                        2: (str: shortstring);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    61
                                   end;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    62
     cmdcurpos: integer = 0;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    63
     cmdendpos: integer = -1;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    64
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    65
procedure InitIPC;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    66
var ipaddr: TIPAddress;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    67
begin
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    68
WriteToConsole('Init SDL_Net... ');
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    69
SDLTry(SDLNet_Init = 0, true);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    70
fds:= SDLNet_AllocSocketSet(1);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    71
SDLTry(fds <> nil, true);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    72
WriteLnToConsole(msgOK);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    73
WriteToConsole('Establishing IPC connection... ');
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    74
SDLTry(SDLNet_ResolveHost(ipaddr, '127.0.0.1', ipcPort) = 0, true);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    75
IPCSock:= SDLNet_TCP_Open(ipaddr);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    76
SDLTry(IPCSock <> nil, true);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    77
WriteLnToConsole(msgOK)
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    78
end;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    79
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    80
procedure CloseIPC;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    81
begin
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    82
SDLNet_FreeSocketSet(fds);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    83
SDLNet_TCP_Close(IPCSock);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    84
SDLNet_Quit
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    85
end;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    86
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    87
procedure ParseIPCCommand(s: shortstring);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    88
begin
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    89
case s[1] of
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    90
     '!': isPonged:= true;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    91
     '?': SendIPC('!');
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    92
     'e': ParseCommand(copy(s, 2, Length(s) - 1));
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    93
     'E': OutError(copy(s, 2, Length(s) - 1), true);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    94
     'W': OutError(copy(s, 2, Length(s) - 1), false);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    95
     'T': case s[2] of
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    96
               'L': GameType:= gmtLocal;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    97
               'D': GameType:= gmtDemo;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    98
               'N': GameType:= gmtNet;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
    99
               else OutError(errmsgIncorrectUse + ' IPC "T" :' + s[2], true) end;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   100
     else
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   101
     inc(cmdendpos);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   102
     extcmd[cmdendpos].Time := PLongWord(@s[byte(s[0]) - 3])^;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   103
     extcmd[cmdendpos].str  := s;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   104
     {$IFDEF DEBUGFILE}AddFileLog('IPC in: '+s[1]+' ticks '+inttostr(extcmd[cmdendpos].Time)+' at '+inttostr(cmdendpos));{$ENDIF}
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   105
     dec(extcmd[cmdendpos].len, 4)
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   106
     end
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   107
end;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   108
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   109
procedure IPCCheckSock;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   110
const ss: string = '';
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   111
var i: integer;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   112
    buf: array[0..255] of byte;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   113
    s: shortstring absolute buf;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   114
begin
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   115
fds.numsockets:= 0;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   116
SDLNet_AddSocket(fds, IPCSock);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   117
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   118
while SDLNet_CheckSockets(fds, 0) > 0 do
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   119
      begin
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   120
      i:= SDLNet_TCP_Recv(IPCSock, @buf[1], 255);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   121
      if i > 0 then
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   122
         begin
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   123
         buf[0]:= i;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   124
         ss:= ss + s;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   125
         while (Length(ss) > 1)and(Length(ss) > byte(ss[1])) do
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   126
               begin
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   127
               ParseIPCCommand(copy(ss, 2, byte(ss[1])));
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   128
               Delete(ss, 1, Succ(byte(ss[1])))
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   129
               end
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   130
         end else OutError('IPC connection lost', true)
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   131
      end;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   132
end;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   133
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   134
procedure SendIPC(s: shortstring);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   135
begin
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   136
//WriteLnToConsole(s);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   137
if s[0]>#251 then s[0]:= #251;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   138
PLongWord(@s[Succ(byte(s[0]))])^:= GameTicks;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   139
{$IFDEF DEBUGFILE}AddFileLog('IPC send: '+s);{$ENDIF}
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   140
inc(s[0],4);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   141
SDLNet_TCP_Send(IPCSock, @s, Succ(byte(s[0])))
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   142
end;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   143
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   144
procedure SendIPCAndWaitReply(s: shortstring);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   145
begin
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   146
SendIPC(s);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   147
s:= '?';
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   148
SDLNet_TCP_Send(IPCSock, @s, Succ(byte(s[0])));
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   149
isPonged:= false;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   150
repeat
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   151
   IPCCheckSock;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   152
   SDL_Delay(1)
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   153
until isPonged
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   154
end;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   155
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   156
procedure NetGetNextCmd;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   157
var tmpflag: boolean;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   158
begin
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   159
while (cmdcurpos <= cmdendpos)and(extcmd[cmdcurpos].cmd = 's') do
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   160
      begin
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   161
      WriteLnToConsole('> ' + copy(extcmd[cmdcurpos].str, 2, Pred(extcmd[cmdcurpos].len)));
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   162
      AddCaption('> ' + copy(extcmd[cmdcurpos].str, 2, Pred(extcmd[cmdcurpos].len)), $FFFFFF, capgrpNetSay);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   163
      inc(cmdcurpos)
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   164
      end;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   165
         
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   166
if cmdcurpos <= cmdendpos then
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   167
   if GameTicks > extcmd[cmdcurpos].Time then
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   168
      outerror('oops, queue error. in buffer: '+extcmd[cmdcurpos].cmd+' ('+inttostr(GameTicks)+' > '+inttostr(extcmd[cmdcurpos].Time)+')', true);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   169
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   170
tmpflag:= true;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   171
while (cmdcurpos <= cmdendpos)and(GameTicks = extcmd[cmdcurpos].Time) do
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   172
   begin
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   173
   case extcmd[cmdcurpos].cmd of
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   174
        'L': ParseCommand('/+left');
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   175
        'l': ParseCommand('/-left');
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   176
        'R': ParseCommand('/+right');
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   177
        'r': ParseCommand('/-right');
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   178
        'U': ParseCommand('/+up');
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   179
        'u': ParseCommand('/-up');
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   180
        'D': ParseCommand('/+down');
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   181
        'd': ParseCommand('/-down');
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   182
        'A': ParseCommand('/+attack');
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   183
        'a': ParseCommand('/-attack');
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   184
        'S': ParseCommand('/switch');
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   185
        'j': ParseCommand('/ljump');
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   186
        'J': ParseCommand('/hjump');
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   187
        'N': begin
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   188
             tmpflag:= false;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   189
             {$IFDEF DEBUGFILE}AddFileLog('got cmd "N": time '+inttostr(extcmd[cmdcurpos].Time)){$ENDIF}
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   190
             end;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   191
        'p': begin
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   192
             TargetPoint.X:= extcmd[cmdcurpos].X;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   193
             TargetPoint.Y:= extcmd[cmdcurpos].Y;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   194
             ParseCommand('/put')
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   195
             end;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   196
        'P': begin
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   197
             CursorPoint.X:= extcmd[cmdcurpos].X + WorldDx;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   198
             CursorPoint.Y:= extcmd[cmdcurpos].Y + WorldDy;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   199
             end;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   200
        '1'..'5': ParseCommand('/timer ' + extcmd[cmdcurpos].cmd);
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   201
        #128..#131: ParseCommand('/slot ' + char(byte(extcmd[cmdcurpos].cmd) - 79))
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   202
        end;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   203
   inc(cmdcurpos)
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   204
   end;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   205
isInLag:= (cmdcurpos > cmdendpos) and tmpflag
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   206
end;
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   207
30f2d1037d5d Add current sources.
unc0rr
parents:
diff changeset
   208
end.