наверно где нибудь запись за границы происходит,
я такие находить не умею, поэтому два способа:
- не динамический массив[0..99999] + count: integer
- контейнер, например tstringlist
двумерный массив из stringlista:
PHP код:
tMatrix = class(TStringList)
private
function toS(x, y: integer): string;
function toI(s: string): Types.tPoint;
public
constructor Create;
function get(x, y: integer): tvirus;
procedure let(x, y: integer; v: tvirus);
end;
....
constructor tMatrix.Create;
begin
inherited;
Sorted := true;
end;
function tMatrix.get(x, y: integer): tvirus;
var i: integer;
begin
if Find(toS(x,y), i) then
result := (objects[i] as TVirus)
else
result := nil
end;
procedure tMatrix.let(x, y: integer; v: tvirus);
var s: string; i: integer;
begin
s := toS(x,y);
if Find(s, i) then Delete(i);
AddObject(s, v);
end;
function tMatrix.toI(s: string): Types.tPoint;
begin
result.x := StrToInt(Copy(s, 1, pos(' ', s)));
result.y := StrToInt(Copy(s, pos(' ', s)+1, length(s)));
end;
function tMatrix.toS(x, y: integer): string;
begin
result := IntToStr(x)+' '+IntToStr(y);
end;