hedgewars/uFLSchemes.pas
author unc0rr
Sat, 07 Feb 2015 23:26:14 +0300
branchqmlfrontend
changeset 10817 48a53259fad8
parent 10757 f71275973737
child 10819 57e21f7621b0
permissions -rw-r--r--
merge with default
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10616
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
     1
unit uFLSchemes;
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
     2
interface
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
     3
uses uFLTypes;
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
     4
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
     5
function getSchemesList: PPChar; cdecl;
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
     6
procedure freeSchemesList;
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
     7
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
     8
implementation
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
     9
uses uFLUtils, uFLIPC, uPhysFSLayer, uFLData;
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
    10
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
    11
const MAX_SCHEME_NAMES = 64;
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
    12
type
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
    13
    TScheme = record
10754
8dd1cf1be5a2 [flib] yay, some work on schemes
unc0rr
parents: 10616
diff changeset
    14
            schemeName
8dd1cf1be5a2 [flib] yay, some work on schemes
unc0rr
parents: 10616
diff changeset
    15
            , scriptparam : shortstring;
8dd1cf1be5a2 [flib] yay, some work on schemes
unc0rr
parents: 10616
diff changeset
    16
            fortsmode
8dd1cf1be5a2 [flib] yay, some work on schemes
unc0rr
parents: 10616
diff changeset
    17
            , divteams
8dd1cf1be5a2 [flib] yay, some work on schemes
unc0rr
parents: 10616
diff changeset
    18
            , solidland
8dd1cf1be5a2 [flib] yay, some work on schemes
unc0rr
parents: 10616
diff changeset
    19
            , border
8dd1cf1be5a2 [flib] yay, some work on schemes
unc0rr
parents: 10616
diff changeset
    20
            , lowgrav
8dd1cf1be5a2 [flib] yay, some work on schemes
unc0rr
parents: 10616
diff changeset
    21
            , laser
8dd1cf1be5a2 [flib] yay, some work on schemes
unc0rr
parents: 10616
diff changeset
    22
            , invulnerability
8dd1cf1be5a2 [flib] yay, some work on schemes
unc0rr
parents: 10616
diff changeset
    23
            , mines
8dd1cf1be5a2 [flib] yay, some work on schemes
unc0rr
parents: 10616
diff changeset
    24
            , vampiric
8dd1cf1be5a2 [flib] yay, some work on schemes
unc0rr
parents: 10616
diff changeset
    25
            , karma
8dd1cf1be5a2 [flib] yay, some work on schemes
unc0rr
parents: 10616
diff changeset
    26
            , artillery
8dd1cf1be5a2 [flib] yay, some work on schemes
unc0rr
parents: 10616
diff changeset
    27
            , randomorder
8dd1cf1be5a2 [flib] yay, some work on schemes
unc0rr
parents: 10616
diff changeset
    28
            , king
8dd1cf1be5a2 [flib] yay, some work on schemes
unc0rr
parents: 10616
diff changeset
    29
            , placehog
8dd1cf1be5a2 [flib] yay, some work on schemes
unc0rr
parents: 10616
diff changeset
    30
            , sharedammo
8dd1cf1be5a2 [flib] yay, some work on schemes
unc0rr
parents: 10616
diff changeset
    31
            , disablegirders
8dd1cf1be5a2 [flib] yay, some work on schemes
unc0rr
parents: 10616
diff changeset
    32
            , disablewind
8dd1cf1be5a2 [flib] yay, some work on schemes
unc0rr
parents: 10616
diff changeset
    33
            , morewind
8dd1cf1be5a2 [flib] yay, some work on schemes
unc0rr
parents: 10616
diff changeset
    34
            , tagteam
8dd1cf1be5a2 [flib] yay, some work on schemes
unc0rr
parents: 10616
diff changeset
    35
            , bottomborder: boolean;
8dd1cf1be5a2 [flib] yay, some work on schemes
unc0rr
parents: 10616
diff changeset
    36
            damagefactor
8dd1cf1be5a2 [flib] yay, some work on schemes
unc0rr
parents: 10616
diff changeset
    37
            , turntime
8dd1cf1be5a2 [flib] yay, some work on schemes
unc0rr
parents: 10616
diff changeset
    38
            , health
8dd1cf1be5a2 [flib] yay, some work on schemes
unc0rr
parents: 10616
diff changeset
    39
            , suddendeath
8dd1cf1be5a2 [flib] yay, some work on schemes
unc0rr
parents: 10616
diff changeset
    40
            , caseprobability
8dd1cf1be5a2 [flib] yay, some work on schemes
unc0rr
parents: 10616
diff changeset
    41
            , minestime
8dd1cf1be5a2 [flib] yay, some work on schemes
unc0rr
parents: 10616
diff changeset
    42
            , landadds
8dd1cf1be5a2 [flib] yay, some work on schemes
unc0rr
parents: 10616
diff changeset
    43
            , minedudpct
8dd1cf1be5a2 [flib] yay, some work on schemes
unc0rr
parents: 10616
diff changeset
    44
            , explosives
8dd1cf1be5a2 [flib] yay, some work on schemes
unc0rr
parents: 10616
diff changeset
    45
            , minesnum
8dd1cf1be5a2 [flib] yay, some work on schemes
unc0rr
parents: 10616
diff changeset
    46
            , healthprobability
8dd1cf1be5a2 [flib] yay, some work on schemes
unc0rr
parents: 10616
diff changeset
    47
            , healthcaseamount
8dd1cf1be5a2 [flib] yay, some work on schemes
unc0rr
parents: 10616
diff changeset
    48
            , waterrise
8dd1cf1be5a2 [flib] yay, some work on schemes
unc0rr
parents: 10616
diff changeset
    49
            , healthdecrease
8dd1cf1be5a2 [flib] yay, some work on schemes
unc0rr
parents: 10616
diff changeset
    50
            , ropepct
8dd1cf1be5a2 [flib] yay, some work on schemes
unc0rr
parents: 10616
diff changeset
    51
            , getawaytime
8dd1cf1be5a2 [flib] yay, some work on schemes
unc0rr
parents: 10616
diff changeset
    52
            , worldedge: LongInt
10616
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
    53
        end;
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
    54
    PScheme = ^TScheme;
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
    55
    TSchemeArray = array [0..0] of TScheme;
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
    56
    PSchemeArray = ^TSchemeArray;
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
    57
var
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
    58
    schemesList: PScheme;
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
    59
    schemesNumber: LongInt;
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
    60
    listOfSchemeNames: array[0..MAX_SCHEME_NAMES] of PChar;
10757
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
    61
    tmpScheme: TScheme;
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
    62
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
    63
const ints: array[0 .. 16] of record
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
    64
            name: shortstring;
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
    65
            param: ^LongInt;
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
    66
        end = (
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
    67
              (name: 'damagefactor'; param: @tmpScheme.damagefactor)
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
    68
            , (name: 'turntime'; param: @tmpScheme.turntime)
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
    69
            , (name: 'health'; param: @tmpScheme.health)
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
    70
            , (name: 'suddendeath'; param: @tmpScheme.suddendeath)
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
    71
            , (name: 'caseprobability'; param: @tmpScheme.caseprobability)
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
    72
            , (name: 'minestime'; param: @tmpScheme.minestime)
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
    73
            , (name: 'landadds'; param: @tmpScheme.landadds)
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
    74
            , (name: 'minedudpct'; param: @tmpScheme.minedudpct)
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
    75
            , (name: 'explosives'; param: @tmpScheme.explosives)
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
    76
            , (name: 'minesnum'; param: @tmpScheme.minesnum)
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
    77
            , (name: 'healthprobability'; param: @tmpScheme.healthprobability)
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
    78
            , (name: 'healthcaseamount'; param: @tmpScheme.healthcaseamount)
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
    79
            , (name: 'waterrise'; param: @tmpScheme.waterrise)
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
    80
            , (name: 'healthdecrease'; param: @tmpScheme.healthdecrease)
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
    81
            , (name: 'ropepct'; param: @tmpScheme.ropepct)
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
    82
            , (name: 'getawaytime'; param: @tmpScheme.getawaytime)
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
    83
            , (name: 'worldedge'; param: @tmpScheme.worldedge)
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
    84
              );
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
    85
const bools: array[0 .. 19] of record
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
    86
            name: shortstring;
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
    87
            param: ^boolean;
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
    88
        end = (
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
    89
              (name: 'fortsmode'; param: @tmpScheme.fortsmode)
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
    90
            , (name: 'divteams'; param: @tmpScheme.divteams)
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
    91
            , (name: 'solidland'; param: @tmpScheme.solidland)
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
    92
            , (name: 'border'; param: @tmpScheme.border)
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
    93
            , (name: 'lowgrav'; param: @tmpScheme.lowgrav)
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
    94
            , (name: 'laser'; param: @tmpScheme.laser)
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
    95
            , (name: 'invulnerability'; param: @tmpScheme.invulnerability)
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
    96
            , (name: 'mines'; param: @tmpScheme.mines)
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
    97
            , (name: 'vampiric'; param: @tmpScheme.vampiric)
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
    98
            , (name: 'karma'; param: @tmpScheme.karma)
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
    99
            , (name: 'artillery'; param: @tmpScheme.artillery)
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
   100
            , (name: 'randomorder'; param: @tmpScheme.randomorder)
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
   101
            , (name: 'king'; param: @tmpScheme.king)
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
   102
            , (name: 'placehog'; param: @tmpScheme.placehog)
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
   103
            , (name: 'sharedammo'; param: @tmpScheme.sharedammo)
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
   104
            , (name: 'disablegirders'; param: @tmpScheme.disablegirders)
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
   105
            , (name: 'disablewind'; param: @tmpScheme.disablewind)
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
   106
            , (name: 'morewind'; param: @tmpScheme.morewind)
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
   107
            , (name: 'tagteam'; param: @tmpScheme.tagteam)
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
   108
            , (name: 'bottomborder'; param: @tmpScheme.bottomborder)
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
   109
              );
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
   110
10616
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   111
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   112
procedure loadSchemes;
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   113
var f: PFSFile;
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   114
    scheme: PScheme;
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   115
    schemes: PSchemeArray;
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   116
    s: shortstring;
10757
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
   117
    l, i, ii: Longword;
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
   118
    isFound: boolean;
10616
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   119
begin
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   120
    f:= pfsOpenRead('/Config/schemes.ini');
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   121
    schemesNumber:= 0;
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   122
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   123
    if f <> nil then
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   124
    begin
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   125
        while (not pfsEOF(f)) and (schemesNumber = 0) do
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   126
        begin
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   127
            pfsReadLn(f, s);
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   128
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   129
            if copy(s, 1, 5) = 'size=' then
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   130
                schemesNumber:= strToInt(midStr(s, 6));
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   131
        end;
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   132
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   133
        //inc(schemesNumber); // add some default schemes
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   134
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   135
        schemesList:= GetMem(sizeof(schemesList^) * (schemesNumber + 1));
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   136
        schemes:= PSchemeArray(schemesList);
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   137
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   138
        while (not pfsEOF(f)) do
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   139
        begin
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   140
            pfsReadLn(f, s);
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   141
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   142
            i:= 1;
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   143
            while(i <= length(s)) and (s[i] <> '\') do inc(i);
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   144
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   145
            if i < length(s) then
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   146
            begin
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   147
                l:= strToInt(copy(s, 1, i - 1));
10757
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
   148
                delete(s, 1, i);
10616
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   149
10757
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
   150
                if (l <= schemesNumber) and (l > 0) then
10616
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   151
                begin
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   152
                    scheme:= @schemes^[l - 1];
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   153
10757
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
   154
                    if copy(s, 1, 5) = 'name=' then
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
   155
                        tmpScheme. schemeName:= midStr(s, 6)
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
   156
                    else if copy(s, 1, 12) = 'scriptparam=' then
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
   157
                        tmpScheme. schemeName:= midStr(s, 13) else
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
   158
                    begin
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
   159
                        ii:= 0;
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
   160
                        repeat
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
   161
                            isFound:= readInt(ints[ii].name, s, ints[ii].param^);
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
   162
                            inc(ii)
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
   163
                        until isFound or (ii > High(ints));
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
   164
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
   165
                        if not isFound then
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
   166
                            begin
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
   167
                                ii:= 0;
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
   168
                                repeat
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
   169
                                    isFound:= readBool(bools[ii].name, s, bools[ii].param^);
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
   170
                                    inc(ii)
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
   171
                                until isFound or (ii > High(bools));
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
   172
                            end;
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
   173
                    end;
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
   174
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
   175
                    scheme^:= tmpScheme
10616
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   176
                end;
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   177
            end;
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   178
        end;
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   179
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   180
        pfsClose(f)
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   181
    end;
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   182
end;
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   183
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   184
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   185
function getSchemesList: PPChar; cdecl;
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   186
var i, t, l: Longword;
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   187
    scheme: PScheme;
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   188
begin
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   189
    if schemesList = nil then
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   190
        loadSchemes;
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   191
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   192
    t:= schemesNumber;
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   193
    if t >= MAX_SCHEME_NAMES then 
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   194
        t:= MAX_SCHEME_NAMES;
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   195
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   196
    scheme:= schemesList;
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   197
    for i:= 0 to Pred(t) do
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   198
    begin
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   199
        l:= length(scheme^.schemeName);
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   200
        if l >= 255 then l:= 254;
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   201
        scheme^.schemeName[l + 1]:= #0;
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   202
        listOfSchemeNames[i]:= @scheme^.schemeName[1];
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   203
        inc(scheme)
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   204
    end;
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   205
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   206
    listOfSchemeNames[t]:= nil;
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   207
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   208
    getSchemesList:= listOfSchemeNames
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   209
end;
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   210
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   211
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   212
procedure freeSchemesList;
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   213
begin
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   214
    if schemesList <> nil then
10757
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
   215
        FreeMem(schemesList, sizeof(schemesList^) * (schemesNumber + 1))
10616
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   216
end;
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   217
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   218
end.