3 {$INCLUDE ../shared/a_modes.inc}
8 LCLIntf
, LCLType
, LMessages
, SysUtils
, Variants
, Classes
, Graphics
,
9 Controls
, Forms
, Dialogs
, StdCtrls
, ExtCtrls
, utils
;
12 TSelectMapForm
= class (TForm
)
18 procedure GetMaps(FileName
: String);
19 procedure FormActivate(Sender
: TObject
);
20 procedure lbMapListClick(Sender
: TObject
);
21 procedure bCancelClick(Sender
: TObject
);
24 { Private declarations }
26 { Public declarations }
30 SelectMapForm
: TSelectMapForm
;
35 MAPREADER
, MAPSTRUCT
, g_resources
, sfs
;
39 procedure TSelectMapForm
.FormActivate(Sender
: TObject
);
41 bOK
.Enabled
:= (lbMapList
.ItemIndex
<> -1);
45 procedure TSelectMapForm
.lbMapListClick(Sender
: TObject
);
47 if lbMapList
.ItemIndex
<> -1 then
51 procedure TSelectMapForm
.bCancelClick(Sender
: TObject
);
56 procedure TSelectMapForm
.GetMaps(FileName
: String);
60 sign
: Array [0..2] of Char;
63 lbMapList
.Items
.Clear();
65 list
:= SFSFileList(FileName
);
66 if list
= nil then Exit
;
68 for i
:= 0 to list
.Count
- 1 do
70 g_ReadResource(FileName
, win2utf(list
.Files
[i
].path
), win2utf(list
.Files
[i
].name
), data
, len
);
74 sign
[0] := chr(data
[0]);
75 sign
[1] := chr(data
[1]);
76 sign
[2] := chr(data
[2]);
77 if sign
= MAP_SIGNATURE
then
78 lbMapList
.Items
.Add(win2utf(list
.Files
[i
].name
))
81 if len
> 0 then FreeMem(data
)