SRL Archive - Reflection Development

RandomizePath doesnt work


Phran6

2009-06-14 22:19:56

{*******************************************************************************
function RandomizePath(Path: TPointArray; rX, rY: integer): TPointArray;
By: lordsaturn
Description: Randomizes a path with max dist rX and rY.
*******************************************************************************}
function RandomizePath(Path: TPointArray; rX, rY: integer): TPointArray;
var
i, Hi: integer;
begin
Hi := High(Path);
if Hi < 0 then Exit;
for i := 0 to Hi do
Result[i] := RandomizeTile(Result[i], rX, rY);
end;

need to be changed to

function RandomizePath(Path: TPointArray; rX, rY: integer): TPointArray;
var
i, Hi: integer;
begin
Hi := High(Path);
if Hi < 0 then Exit;
for i := 0 to Hi do
begin
setlength(result, Length(result)+1)
result[high(result)]:=RandomizeTile(Path[i], rX, rY);
end;
end;

lordsaturn

2009-06-14 22:41:05

function RandomizePath(Path: TPointArray; rX, rY: integer): TPointArray;
var
i, Hi: integer;
begin
Hi := High(Path);
if Hi < 0 then Exit;
SetLength(Result, Hi+1);
for i := 0 to Hi do
Result[i] := RandomizeTile(Path[i], rX, rY);
end;
Thanks for the catch.

Phran6

2009-06-14 23:05:18

ohh yeah :) that too work