hedgewars/uConsole.pas
changeset 17 a6bed8d31444
parent 4 bcbd7adb4e4b
child 32 78bff13b11c0
equal deleted inserted replaced
16:b6f4b413dd41 17:a6bed8d31444
    65       InputStr: shortstring;
    65       InputStr: shortstring;
    66       Variables: PVariable = nil;
    66       Variables: PVariable = nil;
    67 
    67 
    68 function RegisterVariable(Name: string; VType: TVariableType; p: pointer): PVariable;
    68 function RegisterVariable(Name: string; VType: TVariableType; p: pointer): PVariable;
    69 begin
    69 begin
    70 try
    70 New(Result);
    71    New(Result);
    71 TryDo(Result <> nil, 'RegisterVariable: Result = nil', true);
    72 except Result:= nil; OutError(errmsgDynamicVar, true) end;
       
    73 FillChar(Result^, sizeof(TVariable), 0);
    72 FillChar(Result^, sizeof(TVariable), 0);
    74 Result.Name:= Name;
    73 Result.Name:= Name;
    75 Result.VType:= VType;
    74 Result.VType:= VType;
    76 Result.Handler:= p;
    75 Result.Handler:= p;
    77 if Variables = nil then Variables:= Result
    76 if Variables = nil then Variables:= Result
    88 Variables:= nil;
    87 Variables:= nil;
    89 while tt<>nil do
    88 while tt<>nil do
    90       begin
    89       begin
    91       t:= tt;
    90       t:= tt;
    92       tt:= tt.Next;
    91       tt:= tt.Next;
    93       try
       
    94       Dispose(t)
    92       Dispose(t)
    95       except OutError(errmsgDynamicVar) end;
       
    96       end;
    93       end;
    97 end;
    94 end;
    98 
    95 
    99 procedure SplitBySpace(var a, b: shortstring);
    96 procedure SplitBySpace(var a, b: shortstring);
   100 var i, t: integer;
    97 var i, t: integer;