Shuttleu
2010-07-29 16:00:14
i wanted to find a item but i dont know what tile it would be on, but couldnt find a function that gets all the item ID's in a TBox, so i made this
hope it helps
~shut
hope it helps
function AddGroundItemArrays(Array1, Array2: TGroundItemArray): TGroundItemArray;
var
x, y, z: Integer;
begin
x:= Length(Array1);
y:= Length(Array2);
SetArrayLength(Result, x+y);
for z:= 0 to High(Array1) do
Result[z]:= Array1[z];
for z:= 0 to y-1 do
Result[(x+y)-(y-z)]:= Array2[z];
end;
function GetItemsInBox(Box: TBox): TGroundItemArray;
var
x, y: Integer;
Temp: TGroundItemArray;
begin
for x:= Box.X1 to Box.X2 do
for y:= Box.Y1 to Box.Y2 do
begin
Temp:= GetItemsAt(Tile(x, y));
Result:= AddGroundItemArrays(Result, Temp);
end;
end; ~shut