hedgewars/uFLScripts.pas
branchqmlfrontend
changeset 10612 eb3c1a289a23
parent 10517 844bd43db47a
child 10888 a04e04aaf599
equal deleted inserted replaced
10610:eadf2cea55e0 10612:eb3c1a289a23
    52     script: PScript;
    52     script: PScript;
    53     s: shortstring;
    53     s: shortstring;
    54     l: Longword;
    54     l: Longword;
    55 begin
    55 begin
    56     filesList:= pfsEnumerateFiles('/Scripts/Multiplayer');
    56     filesList:= pfsEnumerateFiles('/Scripts/Multiplayer');
    57     scriptsNumber:= 0;
    57     scriptsNumber:= 1;
    58 
    58 
    59     tmp:= filesList;
    59     tmp:= filesList;
    60     while tmp^ <> nil do
    60     while tmp^ <> nil do
    61     begin
    61     begin
    62         s:= shortstring(tmp^);
    62         s:= shortstring(tmp^);
    64         l:= length(s);
    64         l:= length(s);
    65         if (l > 4) and (copy(s, l - 3, 4) = '.lua') then inc(scriptsNumber);
    65         if (l > 4) and (copy(s, l - 3, 4) = '.lua') then inc(scriptsNumber);
    66         inc(tmp)
    66         inc(tmp)
    67     end;
    67     end;
    68 
    68 
    69     scriptsList:= GetMem(sizeof(scriptsList^) * scriptsNumber);
    69     scriptsList:= GetMem(sizeof(scriptsList^) * (scriptsNumber + 1));
    70 
    70 
    71     script:= scriptsList;
    71     script:= scriptsList;
       
    72 
       
    73     // add 'normal' script
       
    74     script^.scriptName:= 'Normal';
       
    75     script^.description:= 'Normal gameplay';
       
    76     inc(script);
       
    77 
       
    78     // fill the rest from *.lua list
    72     tmp:= filesList;
    79     tmp:= filesList;
    73     while tmp^ <> nil do
    80     while tmp^ <> nil do
    74     begin
    81     begin
    75         s:= shortstring(tmp^);
    82         s:= shortstring(tmp^);
    76         l:= length(s);
    83         l:= length(s);