hedgewars/uFLSchemes.pas
branchqmlfrontend
changeset 11458 8318e841648f
parent 11456 ab77e2ea2f82
equal deleted inserted replaced
11457:55a8322e307d 11458:8318e841648f
    42             , (name: 'ropepct'; param: @tmpScheme.ropepct)
    42             , (name: 'ropepct'; param: @tmpScheme.ropepct)
    43             , (name: 'getawaytime'; param: @tmpScheme.getawaytime)
    43             , (name: 'getawaytime'; param: @tmpScheme.getawaytime)
    44             , (name: 'worldedge'; param: @tmpScheme.worldedge)
    44             , (name: 'worldedge'; param: @tmpScheme.worldedge)
    45             , (name: 'airmines'; param: @tmpScheme.airmines)
    45             , (name: 'airmines'; param: @tmpScheme.airmines)
    46               );
    46               );
    47 const bools: array[0 .. 25] of record
    47 const bools: array[0 .. 24] of record
    48             name: shortstring;
    48             name: shortstring;
    49             param: ^boolean;
    49             param: ^boolean;
       
    50             flag: Longword;
    50         end = (
    51         end = (
    51               (name: 'fortsmode'; param: @tmpScheme.fortsmode)
    52               (name: 'fortsmode'; param: @tmpScheme.fortsmode; flag: $00001000)
    52             , (name: 'divteams'; param: @tmpScheme.divteams)
    53             , (name: 'divteams'; param: @tmpScheme.divteams; flag: $00000010)
    53             , (name: 'solidland'; param: @tmpScheme.solidland)
    54             , (name: 'solidland'; param: @tmpScheme.solidland; flag: $00000004)
    54             , (name: 'border'; param: @tmpScheme.border)
    55             , (name: 'border'; param: @tmpScheme.border; flag: $00000008)
    55             , (name: 'lowgrav'; param: @tmpScheme.lowgrav)
    56             , (name: 'lowgrav'; param: @tmpScheme.lowgrav; flag: $00000020)
    56             , (name: 'laser'; param: @tmpScheme.laser)
    57             , (name: 'laser'; param: @tmpScheme.laser; flag: $00000040)
    57             , (name: 'invulnerability'; param: @tmpScheme.invulnerability)
    58             , (name: 'invulnerability'; param: @tmpScheme.invulnerability; flag: $00000080)
    58             , (name: 'mines'; param: @tmpScheme.mines)
    59             , (name: 'resethealth'; param: @tmpScheme.resethealth; flag: $00000100)
    59             , (name: 'vampiric'; param: @tmpScheme.vampiric)
    60             , (name: 'vampiric'; param: @tmpScheme.vampiric; flag: $00000200)
    60             , (name: 'karma'; param: @tmpScheme.karma)
    61             , (name: 'karma'; param: @tmpScheme.karma; flag: $00000400)
    61             , (name: 'artillery'; param: @tmpScheme.artillery)
    62             , (name: 'artillery'; param: @tmpScheme.artillery; flag: $00000800)
    62             , (name: 'randomorder'; param: @tmpScheme.randomorder)
    63             , (name: 'randomorder'; param: @tmpScheme.randomorder; flag: $00002000)
    63             , (name: 'king'; param: @tmpScheme.king)
    64             , (name: 'king'; param: @tmpScheme.king; flag: $00004000)
    64             , (name: 'placehog'; param: @tmpScheme.placehog)
    65             , (name: 'placehog'; param: @tmpScheme.placehog; flag: $00008000)
    65             , (name: 'sharedammo'; param: @tmpScheme.sharedammo)
    66             , (name: 'sharedammo'; param: @tmpScheme.sharedammo; flag: $00010000)
    66             , (name: 'disablegirders'; param: @tmpScheme.disablegirders)
    67             , (name: 'disablegirders'; param: @tmpScheme.disablegirders; flag: $00020000)
    67             , (name: 'disablewind'; param: @tmpScheme.disablewind)
    68             , (name: 'disablewind'; param: @tmpScheme.disablewind; flag: $00800000)
    68             , (name: 'morewind'; param: @tmpScheme.morewind)
    69             , (name: 'morewind'; param: @tmpScheme.morewind; flag: $01000000)
    69             , (name: 'tagteam'; param: @tmpScheme.tagteam)
    70             , (name: 'tagteam'; param: @tmpScheme.tagteam; flag: $02000000)
    70             , (name: 'bottomborder'; param: @tmpScheme.bottomborder)
    71             , (name: 'bottomborder'; param: @tmpScheme.bottomborder; flag: $04000000)
    71             , (name: 'resethealth'; param: @tmpScheme.resethealth)
    72             , (name: 'disablelandobjects'; param: @tmpScheme.disablelandobjects; flag: $00040000)
    72             , (name: 'disablelandobjects'; param: @tmpScheme.disablelandobjects)
    73             , (name: 'aisurvival'; param: @tmpScheme.aisurvival; flag: $00080000)
    73             , (name: 'aisurvival'; param: @tmpScheme.aisurvival)
    74             , (name: 'infattack'; param: @tmpScheme.infattack; flag: $00100000)
    74             , (name: 'infattack'; param: @tmpScheme.infattack)
    75             , (name: 'resetweps'; param: @tmpScheme.resetweps; flag: $00200000)
    75             , (name: 'resetweps'; param: @tmpScheme.resetweps)
    76             , (name: 'perhogammo'; param: @tmpScheme.perhogammo; flag: $00400000)
    76             , (name: 'perhogammo'; param: @tmpScheme.perhogammo)
       
    77               );
    77               );
    78 
       
    79 
    78 
    80 procedure loadSchemes;
    79 procedure loadSchemes;
    81 var f: PFSFile;
    80 var f: PFSFile;
    82     scheme: PScheme;
       
    83     schemes: PSchemeArray;
    81     schemes: PSchemeArray;
    84     s: shortstring;
    82     s: shortstring;
    85     l, i, ii: Longword;
    83     l, i, ii: Longword;
    86     isFound: boolean;
    84     isFound: boolean;
    87 begin
    85 begin
   194 end;
   192 end;
   195 
   193 
   196 
   194 
   197 procedure sendSchemeConfig(var scheme: TScheme);
   195 procedure sendSchemeConfig(var scheme: TScheme);
   198 var i: Longword;
   196 var i: Longword;
       
   197     gf: Longword;
   199 begin
   198 begin
   200     with scheme do
   199     with scheme do
   201     begin
   200     begin
   202         if scheme.turntime <> 45 then
   201         if turntime <> 45 then
   203             ipcToEngine('e$turntime ' + inttostr(scheme.turntime * 1000));
   202             ipcToEngine('e$turntime ' + inttostr(turntime * 1000));
   204         if scheme.minesnum <> 4 then
   203         if minesnum <> 4 then
   205             ipcToEngine('e$minesnum ' + inttostr(scheme.minesnum));
   204             ipcToEngine('e$minesnum ' + inttostr(minesnum));
       
   205         if damagefactor <> 100 then
       
   206             ipcToEngine('e$damagepct ' + inttostr(damagefactor));
       
   207         if worldedge > 0 then
       
   208             ipcToEngine('e$worldedge ' + inttostr(worldedge));
       
   209         if length(scriptparam) > 0 then
       
   210             ipcToEngine('e$scriptparam ' + scriptparam);
       
   211         if suddendeath <> 15 then
       
   212             ipcToEngine('e$sd_turns ' + inttostr(suddendeath));
       
   213         if waterrise <> 47 then
       
   214             ipcToEngine('e$waterrise ' + inttostr(waterrise));
       
   215         if ropepct <> 100 then
       
   216             ipcToEngine('e$ropepct ' + inttostr(ropepct));
       
   217         if getawaytime <> 100 then
       
   218             ipcToEngine('e$getawaytime ' + inttostr(getawaytime));
       
   219         if caseprobability <> 5 then
       
   220             ipcToEngine('e$casefreq ' + inttostr(caseprobability));
       
   221         if healthprobability <> 35 then
       
   222             ipcToEngine('e$healthprob ' + inttostr(healthprobability));
       
   223         if minestime <> 3 then
       
   224             ipcToEngine('e$minestime ' + inttostr(minestime * 1000));
       
   225         if minedudpct <> 0 then
       
   226             ipcToEngine('e$minedudpct ' + inttostr(minedudpct));
       
   227         if explosives <> 2 then
       
   228             ipcToEngine('e$explosives ' + inttostr(explosives));
       
   229         if airmines <> 0 then
       
   230             ipcToEngine('e$airmines ' + inttostr(airmines));
       
   231         if healthcaseamount <> 25 then
       
   232             ipcToEngine('e$hcaseamount ' + inttostr(healthcaseamount));
       
   233         if healthdecrease <> 5 then
       
   234             ipcToEngine('e$healthdec ' + inttostr(healthdecrease));
       
   235 
       
   236         gf:= 0;
       
   237 
       
   238         for i:= Low(bools) to High(bools) do
       
   239             if PBoolean(bools[i].param - @tmpScheme + @scheme)^ then
       
   240                 gf:= gf or bools[i].flag;
       
   241 
       
   242         ipcToEngine('e$gmflags ' + inttostr(gf));
   206     end
   243     end
   207 end;
   244 end;
   208 
   245 
   209 end.
   246 end.