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