hedgewars/uFLSchemes.pas
author unc0rr
Thu, 16 Apr 2015 23:31:13 +0300
branchqmlfrontend
changeset 10896 5a74923120d5
parent 10821 efb861d1489e
child 11440 330c14f4ba69
permissions -rw-r--r--
Start network support: only setting up a connection for now
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
10757
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
   113
                    if copy(s, 1, 5) = 'name=' then
10821
efb861d1489e Fix schemes loading
unc0rr
parents: 10819
diff changeset
   114
                        schemes^[l - 1].schemeName:= midStr(s, 6)
10757
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
   115
                    else if copy(s, 1, 12) = 'scriptparam=' then
10821
efb861d1489e Fix schemes loading
unc0rr
parents: 10819
diff changeset
   116
                        schemes^[l - 1].scriptparam:= midStr(s, 13) else
10757
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
   117
                    begin
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
   118
                        ii:= 0;
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
   119
                        repeat
10821
efb861d1489e Fix schemes loading
unc0rr
parents: 10819
diff changeset
   120
                            isFound:= readInt(ints[ii].name, s, PLongInt(ints[ii].param - @tmpScheme + @schemes^[l - 1])^);
10757
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
   121
                            inc(ii)
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
   122
                        until isFound or (ii > High(ints));
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
   123
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
   124
                        if not isFound then
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
   125
                            begin
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
   126
                                ii:= 0;
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
   127
                                repeat
10821
efb861d1489e Fix schemes loading
unc0rr
parents: 10819
diff changeset
   128
                                    isFound:= readBool(bools[ii].name, s, PBoolean(bools[ii].param - @tmpScheme + @schemes^[l - 1])^);
10757
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
   129
                                    inc(ii)
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
   130
                                until isFound or (ii > High(bools));
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
   131
                            end;
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
   132
                    end;
10616
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   133
                end;
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   134
            end;
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   135
        end;
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   136
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   137
        pfsClose(f)
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
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   142
function getSchemesList: PPChar; cdecl;
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   143
var i, t, l: Longword;
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   144
    scheme: PScheme;
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   145
begin
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   146
    if schemesList = nil then
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   147
        loadSchemes;
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   148
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   149
    t:= schemesNumber;
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   150
    if t >= MAX_SCHEME_NAMES then 
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   151
        t:= MAX_SCHEME_NAMES;
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   152
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   153
    scheme:= schemesList;
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   154
    for i:= 0 to Pred(t) do
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   155
    begin
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   156
        l:= length(scheme^.schemeName);
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   157
        if l >= 255 then l:= 254;
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   158
        scheme^.schemeName[l + 1]:= #0;
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   159
        listOfSchemeNames[i]:= @scheme^.schemeName[1];
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   160
        inc(scheme)
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   161
    end;
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   162
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   163
    listOfSchemeNames[t]:= nil;
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   164
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   165
    getSchemesList:= listOfSchemeNames
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   166
end;
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   167
10819
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10757
diff changeset
   168
function schemeByName(s: shortstring): PScheme;
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10757
diff changeset
   169
var i: Longword;
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10757
diff changeset
   170
    scheme: PScheme;
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10757
diff changeset
   171
begin
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10757
diff changeset
   172
    scheme:= schemesList;
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10757
diff changeset
   173
    i:= 0;
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10757
diff changeset
   174
    while (i < schemesNumber) and (scheme^.schemeName <> s) do
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
        inc(scheme);
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10757
diff changeset
   177
        inc(i)
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10757
diff changeset
   178
    end;
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10757
diff changeset
   179
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10757
diff changeset
   180
    if i < schemesNumber then schemeByName:= scheme else schemeByName:= nil
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10757
diff changeset
   181
end;
10616
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   182
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   183
procedure freeSchemesList;
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   184
begin
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   185
    if schemesList <> nil then
10757
f71275973737 Scheme parsing
unc0rr
parents: 10754
diff changeset
   186
        FreeMem(schemesList, sizeof(schemesList^) * (schemesNumber + 1))
10616
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   187
end;
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   188
10819
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10757
diff changeset
   189
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10757
diff changeset
   190
procedure sendSchemeConfig(var scheme: TScheme);
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10757
diff changeset
   191
var i: Longword;
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10757
diff changeset
   192
begin
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10757
diff changeset
   193
    with scheme do
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10757
diff changeset
   194
    begin
10821
efb861d1489e Fix schemes loading
unc0rr
parents: 10819
diff changeset
   195
        if scheme.turntime <> 45 then
efb861d1489e Fix schemes loading
unc0rr
parents: 10819
diff changeset
   196
            ipcToEngine('e$turntime ' + inttostr(scheme.turntime * 1000));
efb861d1489e Fix schemes loading
unc0rr
parents: 10819
diff changeset
   197
        if scheme.minesnum <> 4 then
efb861d1489e Fix schemes loading
unc0rr
parents: 10819
diff changeset
   198
            ipcToEngine('e$minesnum ' + inttostr(scheme.minesnum));
10819
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10757
diff changeset
   199
    end
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10757
diff changeset
   200
end;
57e21f7621b0 Send selected scheme config on engine initialization (WIP)
unc0rr
parents: 10757
diff changeset
   201
10616
20a2d5e6930a Schemes list combobox with their names
unc0rr
parents:
diff changeset
   202
end.