hedgewars/uFLSchemes.pas
branchqmlfrontend
changeset 10821 efb861d1489e
parent 10819 57e21f7621b0
child 11440 330c14f4ba69
equal deleted inserted replaced
10819:57e21f7621b0 10821:efb861d1489e
   108                 l:= strToInt(copy(s, 1, i - 1));
   108                 l:= strToInt(copy(s, 1, i - 1));
   109                 delete(s, 1, i);
   109                 delete(s, 1, i);
   110 
   110 
   111                 if (l <= schemesNumber) and (l > 0) then
   111                 if (l <= schemesNumber) and (l > 0) then
   112                 begin
   112                 begin
   113                     scheme:= @schemes^[l - 1];
       
   114 
       
   115                     if copy(s, 1, 5) = 'name=' then
   113                     if copy(s, 1, 5) = 'name=' then
   116                         tmpScheme.schemeName:= midStr(s, 6)
   114                         schemes^[l - 1].schemeName:= midStr(s, 6)
   117                     else if copy(s, 1, 12) = 'scriptparam=' then
   115                     else if copy(s, 1, 12) = 'scriptparam=' then
   118                         tmpScheme.scriptparam:= midStr(s, 13) else
   116                         schemes^[l - 1].scriptparam:= midStr(s, 13) else
   119                     begin
   117                     begin
   120                         ii:= 0;
   118                         ii:= 0;
   121                         repeat
   119                         repeat
   122                             isFound:= readInt(ints[ii].name, s, ints[ii].param^);
   120                             isFound:= readInt(ints[ii].name, s, PLongInt(ints[ii].param - @tmpScheme + @schemes^[l - 1])^);
   123                             inc(ii)
   121                             inc(ii)
   124                         until isFound or (ii > High(ints));
   122                         until isFound or (ii > High(ints));
   125 
   123 
   126                         if not isFound then
   124                         if not isFound then
   127                             begin
   125                             begin
   128                                 ii:= 0;
   126                                 ii:= 0;
   129                                 repeat
   127                                 repeat
   130                                     isFound:= readBool(bools[ii].name, s, bools[ii].param^);
   128                                     isFound:= readBool(bools[ii].name, s, PBoolean(bools[ii].param - @tmpScheme + @schemes^[l - 1])^);
   131                                     inc(ii)
   129                                     inc(ii)
   132                                 until isFound or (ii > High(bools));
   130                                 until isFound or (ii > High(bools));
   133                             end;
   131                             end;
   134                     end;
   132                     end;
   135 
       
   136                     scheme^:= tmpScheme
       
   137                 end;
   133                 end;
   138             end;
   134             end;
   139         end;
   135         end;
   140 
   136 
   141         pfsClose(f)
   137         pfsClose(f)
   194 procedure sendSchemeConfig(var scheme: TScheme);
   190 procedure sendSchemeConfig(var scheme: TScheme);
   195 var i: Longword;
   191 var i: Longword;
   196 begin
   192 begin
   197     with scheme do
   193     with scheme do
   198     begin
   194     begin
   199         ipcToEngine('e$turntime ' + inttostr(scheme.turntime));
   195         if scheme.turntime <> 45 then
   200         ipcToEngine('e$minesnum ' + inttostr(scheme.minesnum));
   196             ipcToEngine('e$turntime ' + inttostr(scheme.turntime * 1000));
       
   197         if scheme.minesnum <> 4 then
       
   198             ipcToEngine('e$minesnum ' + inttostr(scheme.minesnum));
   201     end
   199     end
   202 end;
   200 end;
   203 
   201 
   204 end.
   202 end.