My bad, small typo on my behalf:[pascal]procedure TForm1.SetupMap(mapfile: AnsiString);
var stream:TFilestream;
C : Char;
x, y : Word;
tempbuffer : array[ 0..Rows-1, 0..Cols-1] of Char; // Typo was here
begin
Stream:=tfilestream.Create(mapfile, fmopenread);
try
try
if stream.size <> cols* rows then
raise exception.CreateFmt('Data file "%s" size incorrect!', [MapFile]);
Stream.ReadBuffer(tempbuffer[0, 0], cols*rows);
except on e:exception do
messagedlg(e.Message, mterror, [mbok], 0);
end;
finally
Stream.free
end;


for y := 0 to rows - 1 do
for x := 0 to cols - 1 do
case tempbuffer[y, x] of
'0' : map[x][y].Tile:=0; //grass
'1' : map[x][y].Tile:=1; //path
'2' : map[x][y].Tile:=2; //Water
end;
end;[/pascal]

Download a running example here: http://www.eonclash.com/PGD/leniz.zip