Bad Boy JH
2011-03-07 03:04:42
during a procedure which is almost exclusivly dealing with objects, my memory usage went from 169,000 to 411,000.
Here is procedure
Here is procedure
function R_BestYCoordinate(MinY, MaxY: Integer): Integer;
{checks the coordinates between MinY and MaxY to
see which row has the least fires on them.}
var
I: Integer;
Possibles, FiresOnLine: TIntegerArray;
Fires: TRSObjectArray;
begin
Fires := GetObjectsByID(FireID, 0, 50);
SetLength(FiresOnLine, MaxY - MinY + 1);
for I := 0 to High(Fires) do
if InRange(Fires[I].Tile.y, MinY, MaxY) then
Inc(FiresOnLine[Fires[i].Tile.y - MinY]);
for I := 0 to High(FiresOnLine) do
if (FiresOnLine[i] = TMin(FiresOnLine)) then
Possibles := CombineIntArray(Possibles, [I]);
Fires := []; //Im even trying to free them here! no effect
Result := Possibles[Random(Length(Possibles))] + MinY;
end;