ok, here's the function where I use all the stream stuff.
TMapTile is an object, only the picfilename property is important for here. picfilename is of course a string.
Code:
var
GroundMap: array[0..31, 0..31] of TMapTile;
(...)
function LoadGroundMapFromFile(FileName: string): Boolean;
var
FileStream: TFileStream;
c: string;
len: longint;
x, y: Word;
begin
result := true;
len := 5;
x := 5;
y := 0;
setlength(c, len);
FileStream := TFileStream.Create(FileName, fmOpenRead);
try
for y := 0 to 31 do
begin
for x := 0 to 31 do
begin
FileStream.ReadBuffer(c[1], (len * SizeOf(Char)));
GroundMap[x, y].Picfilename := c;
end;
end;
except begin
result := false;
FileStream.Free;
exit;
end;
end;
FileStream.Free;
end;
sven
Bookmarks