Changeset 189


Ignore:
Timestamp:
May 7, 2020, 12:46:55 AM (4 years ago)
Author:
chronos
Message:
  • Added: New Global unit with global constants.
  • Modified: Multiple occurence of string constants used for subdirectories replaced by functions.
Location:
trunk
Files:
1 added
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/Back.pas

    r188 r189  
    4242  if FullScreen then begin
    4343    if not Assigned(Img) then begin
    44       FileName := HomeDir + 'Graphics' + DirectorySeparator + 'Background.png';
     44      FileName := GetGraphicsDir + DirectorySeparator + 'Background.png';
    4545      if FileExists(FileName) then begin
    4646        Img := TBitmap.Create;
  • trunk/Integrated.lpi

    r166 r189  
    9595      </Item2>
    9696    </RequiredPackages>
    97     <Units Count="40">
     97    <Units Count="41">
    9898      <Unit0>
    9999        <Filename Value="Integrated.lpr"/>
     
    328328        <IsPartOfProject Value="True"/>
    329329      </Unit39>
     330      <Unit40>
     331        <Filename Value="Global.pas"/>
     332        <IsPartOfProject Value="True"/>
     333      </Unit40>
    330334    </Units>
    331335  </ProjectOptions>
  • trunk/Integrated.lpr

    r166 r189  
    5858  Application.Initialize;
    5959  Application.Title := 'c-evo';
    60   Directories.InitUnit;
     60  Directories.UnitInit;
    6161  ScreenTools.UnitInit;
    6262  Application.CreateForm(TDirectDlg, DirectDlg);
  • trunk/LocalPlayer/CityScreen.pas

    r188 r189  
    216216  Template := TBitmap.Create;
    217217  Template.PixelFormat := pf24bit;
    218   LoadGraphicFile(Template, HomeDir + 'Graphics' + DirectorySeparator + 'City.png', gfNoGamma);
     218  LoadGraphicFile(Template, GetGraphicsDir + DirectorySeparator + 'City.png', gfNoGamma);
    219219  CityMapTemplate := TBitmap.Create;
    220220  CityMapTemplate.PixelFormat := pf24bit;
    221   LoadGraphicFile(CityMapTemplate, HomeDir + 'Graphics' + DirectorySeparator + 'BigCityMap.png', gfNoGamma);
     221  LoadGraphicFile(CityMapTemplate, GetGraphicsDir + DirectorySeparator + 'BigCityMap.png', gfNoGamma);
    222222  SmallCityMapTemplate := TBitmap.Create;
    223223  SmallCityMapTemplate.PixelFormat := pf24bit;
    224   LoadGraphicFile(SmallCityMapTemplate, HomeDir + 'Graphics' + DirectorySeparator + 'SmallCityMap.png',
     224  LoadGraphicFile(SmallCityMapTemplate, GetGraphicsDir + DirectorySeparator + 'SmallCityMap.png',
    225225    gfNoGamma);
    226226  SmallCityMap := TBitmap.Create;
  • trunk/LocalPlayer/Draft.pas

    r188 r189  
    9292  Template := TBitmap.Create;
    9393  Template.PixelFormat := pf24bit;
    94   LoadGraphicFile(Template, HomeDir + 'Graphics' + DirectorySeparator + 'MiliRes.png', gfNoGamma);
     94  LoadGraphicFile(Template, GetGraphicsDir + DirectorySeparator + 'MiliRes.png', gfNoGamma);
    9595end;
    9696
  • trunk/LocalPlayer/Help.pas

    r188 r189  
    55
    66uses
    7   Protocol, ScreenTools, BaseWin, StringTables, Math,
    8   LCLIntf, LCLType, LMessages, Messages, SysUtils, Classes, Graphics, Controls, Forms,
    9   ExtCtrls, ButtonB, PVSB, Types, fgl;
     7  Protocol, ScreenTools, BaseWin, StringTables, Math, LCLIntf, LCLType,
     8  LMessages, Messages, SysUtils, Classes, Graphics, Controls, Forms, ExtCtrls,
     9  ButtonB, PVSB, Types, fgl;
    1010
    1111const
     
    123123  HelpDlg: THelpDlg;
    124124
     125
    125126implementation
    126127
    127128uses
    128   Directories, ClientTools, Term, Tribes, Inp, Messg, PixelPointer;
     129  Directories, ClientTools, Term, Tribes, Inp, Messg, PixelPointer, Global;
    129130
    130131{$R *.lfm}
     
    12291230    List := TStringList.Create;
    12301231    Plus := TStringList.Create;
    1231     if FindFirst(HomeDir + 'Graphics' + DirectorySeparator + '*.credits.txt', $27, sr) = 0 then
     1232    if FindFirst(GetGraphicsDir + DirectorySeparator + '*.credits.txt', $27, sr) = 0 then
    12321233      repeat
    1233         Plus.LoadFromFile(HomeDir + 'Graphics' + DirectorySeparator + sr.Name);
     1234        Plus.LoadFromFile(GetGraphicsDir + DirectorySeparator + sr.Name);
    12341235        List.AddStrings(Plus);
    12351236      until FindNext(sr) <> 0;
     
    12621263  begin
    12631264    List := TStringList.Create;
    1264     List.LoadFromFile(HomeDir + 'Sounds' + DirectorySeparator + 'sound.credits.txt');
     1265    List.LoadFromFile(GetSoundsDir + DirectorySeparator + 'sound.credits.txt');
    12651266    for i := 0 to List.Count - 1 do begin
    12661267      s := List[i];
     
    19481949        case Link and $FF of
    19491950          1: OpenDocument(pchar(HomeDir + 'AI Template' + DirectorySeparator + 'AI development manual.html'));
    1950           2: OpenURL('http://c-evo.org');
    1951           3: OpenURL('http://c-evo.org/_sg/contact');
     1951          2: OpenURL(CevoHomepage);
     1952          3: OpenURL(CevoHomepageContact);
    19521953        end
    19531954      else
  • trunk/LocalPlayer/IsoEngine.pas

    r188 r189  
    620620      if Flags and unFortified <> 0 then
    621621      begin
    622         { DataDC:=GrExt[HGrTerrain].Data.Canvas.Handle;
    623           MaskDC:=GrExt[HGrTerrain].Mask.Canvas.Handle;
     622        { DataCanvas:=GrExt[HGrTerrain].Data.Canvas;
     623          MaskCanvas:=GrExt[HGrTerrain].Mask.Canvas;
    624624          TSprite(x,y+16,12*9+7); }
    625625        Sprite(HGrStdUnits, x, y, xxu * 2, yyu * 2, 1 + 6 * (xxu * 2 + 1), 1);
  • trunk/LocalPlayer/NatStat.pas

    r188 r189  
    9393  Template := TBitmap.Create;
    9494  Template.PixelFormat := pf24bit;
    95   LoadGraphicFile(Template, HomeDir + 'Graphics' + DirectorySeparator + 'Nation.png', gfNoGamma);
     95  LoadGraphicFile(Template, GetGraphicsDir + DirectorySeparator + 'Nation.png', gfNoGamma);
    9696end;
    9797
  • trunk/LocalPlayer/Term.pas

    r188 r189  
    273273    procedure RectInvalidate(Left, Top, Rigth, Bottom: integer);
    274274    procedure SmartRectInvalidate(Left, Top, Rigth, Bottom: integer);
     275    procedure LoadSettings;
    275276    procedure SaveSettings;
    276277    procedure OnScroll(var m: TMessage); message WM_VSCROLL;
     
    467468  Directories, IsoEngine, CityScreen, Draft, MessgEx, Select, CityType, Help,
    468469  UnitStat, Log, Diagram, NatStat, Wonders, Enhance, Nego, PixelPointer, Sound,
    469   Battle, Rates, TechTree, Registry;
     470  Battle, Rates, TechTree, Registry, Global;
    470471
    471472{$R *.lfm}
     
    34073408procedure TMainScreen.FormCreate(Sender: TObject);
    34083409var
    3409   DefaultOptionChecked: integer;
    3410   Reg: TRegistry;
    34113410  i, j: integer;
    34123411begin
     
    34373436  SaveOption[20] := mAlFastMoves.Tag;
    34383437  SaveOption[21] := mAlNoMoves.Tag;
    3439   DefaultOptionChecked := 1 shl 1 + 1 shl 7 + 1 shl 10 + 1 shl 12 + 1 shl 14 +
    3440     1 shl 18 + 1 shl 19;
    3441 
    3442   Reg := TRegistry.Create;
    3443   with Reg do
    3444   try
    3445     OpenKey(AppRegistryKey, false);
    3446     if ValueExists('TileWidth') then xxt := ReadInteger('TileWidth') div 2
    3447       else xxt := 48;
    3448     if ValueExists('TileHeight') then yyt := ReadInteger('TileHeight') div 2
    3449       else yyt := 24;
    3450     if ValueExists('OptionChecked') then OptionChecked := ReadInteger('OptionChecked')
    3451       else OptionChecked := DefaultOptionChecked;
    3452     if ValueExists('MapOptionChecked') then MapOptionChecked := ReadInteger('MapOptionChecked')
    3453       else MapOptionChecked := 1 shl moCityNames;
    3454     if ValueExists('CityReport') then CityRepMask := Cardinal(ReadInteger('CityReport'))
    3455       else CityRepMask := Cardinal(not chPopIncrease and not chNoGrowthWarning and
    3456           not chCaptured);
    3457     if OptionChecked and (7 shl 16) = 0 then
    3458       OptionChecked := OptionChecked or (1 shl 16);
    3459       // old regver with no scrolling
    3460   finally
    3461     Free;
    3462   end;
    3463 
    3464   if 1 shl 13 and OptionChecked <> 0 then
    3465     SoundMode := smOff
    3466   else if 1 shl 15 and OptionChecked <> 0 then
    3467     SoundMode := smOnAlt
    3468   else
    3469     SoundMode := smOn;
     3438
     3439  LoadSettings;
    34703440
    34713441  Screen.Cursors[crImpDrag] := LoadCursor(HInstance, 'DRAG');
     
    77777747end;
    77787748
     7749procedure TMainScreen.LoadSettings;
     7750var
     7751  Reg: TRegistry;
     7752  DefaultOptionChecked: Integer;
     7753begin
     7754  DefaultOptionChecked := 1 shl 1 + 1 shl 7 + 1 shl 10 + 1 shl 12 + 1 shl 14 +
     7755    1 shl 18 + 1 shl 19;
     7756  Reg := TRegistry.Create;
     7757  with Reg do try
     7758    OpenKey(AppRegistryKey, False);
     7759    if ValueExists('TileWidth') then xxt := ReadInteger('TileWidth') div 2
     7760      else xxt := 48;
     7761    if ValueExists('TileHeight') then yyt := ReadInteger('TileHeight') div 2
     7762      else yyt := 24;
     7763    if ValueExists('OptionChecked') then OptionChecked := ReadInteger('OptionChecked')
     7764      else OptionChecked := DefaultOptionChecked;
     7765    if ValueExists('MapOptionChecked') then MapOptionChecked := ReadInteger('MapOptionChecked')
     7766      else MapOptionChecked := 1 shl moCityNames;
     7767    if ValueExists('CityReport') then CityRepMask := Cardinal(ReadInteger('CityReport'))
     7768      else CityRepMask := Cardinal(not chPopIncrease and not chNoGrowthWarning and
     7769          not chCaptured);
     7770    if OptionChecked and (7 shl 16) = 0 then
     7771      OptionChecked := OptionChecked or (1 shl 16);
     7772      // old regver with no scrolling
     7773  finally
     7774    Free;
     7775  end;
     7776
     7777  if 1 shl 13 and OptionChecked <> 0 then
     7778    SoundMode := smOff
     7779  else if 1 shl 15 and OptionChecked <> 0 then
     7780    SoundMode := smOnAlt
     7781  else
     7782    SoundMode := smOn;
     7783end;
     7784
    77797785procedure TMainScreen.mRepClicked(Sender: TObject);
    77807786begin
  • trunk/LocalPlayer/UnitStat.pas

    r188 r189  
    8383  Template := TBitmap.Create;
    8484  Template.PixelFormat := pf24bit;
    85   LoadGraphicFile(Template, HomeDir + 'Graphics' + DirectorySeparator + 'Unit.png', gfNoGamma);
     85  LoadGraphicFile(Template, GetGraphicsDir + DirectorySeparator + 'Unit.png', gfNoGamma);
    8686end;
    8787
  • trunk/Messg.pas

    r173 r189  
    8282  if OpenSound <> '' then
    8383    PostMessage(Handle, WM_PLAYSOUND, 0, 0);
    84 end; { FormPaint }
     84end;
    8585
    8686procedure TMessgDlg.Button1Click(Sender: TObject);
     
    9797begin
    9898  if Key = #13 then
    99     ModalResult := mrOK
     99    ModalResult := mrOK;
    100100    // else if (Key=#27) and (Button2.Visible) then ModalResult:=mrCancel
    101101end;
     
    108108    Kind := mkOK;
    109109    ShowModal;
    110   end
     110  end;
    111111end;
    112112
     
    119119    Kind := mkOK;
    120120    ShowModal;
    121   end
     121  end;
    122122end;
    123123
  • trunk/Packages/CevoComponents/Directories.pas

    r169 r189  
    1010
    1111function LocalizedFilePath(const Path: string): string;
    12 procedure InitUnit;
     12procedure UnitInit;
    1313function GetSavedDir(Home: Boolean = False): string;
    1414function GetMapsDir(Home: Boolean = False): string;
     15function GetGraphicsDir: string;
     16function GetSoundsDir: string;
    1517
    1618
     
    3032
    3133  if Lang = '' then begin
    32       for i := 1 to Paramcount - 1 do
    33         if (ParamStrUTF8(i) = '--LANG') or (ParamStrUTF8(i) = '-l') or
    34           (ParamStrUTF8(i) = '--lang') then
     34    for i := 1 to Paramcount - 1 do
     35      if (ParamStrUTF8(i) = '--LANG') or (ParamStrUTF8(i) = '-l') or
     36        (ParamStrUTF8(i) = '--lang') then
    3537          Lang := ParamStrUTF8(i + 1);
    3638  end;
     
    5961end;
    6062
    61 procedure InitUnit;
     63procedure UnitInit;
    6264var
    6365  AppDataDir: string;
     
    113115end;
    114116
     117function GetGraphicsDir: string;
     118begin
     119  Result := HomeDir + 'Graphics';
     120end;
     121
     122function GetSoundsDir: string;
     123begin
     124  Result := HomeDir + 'Sounds';
     125end;
     126
    115127end.
  • trunk/Packages/CevoComponents/DrawDlg.pas

    r174 r189  
    176176  // ButtonDownSound, ButtonUpSound: string;
    177177begin
    178   // ButtonDownSound:=Sounds.Lookup('BUTTON_DOWN');
    179   // ButtonUpSound:=Sounds.Lookup('BUTTON_UP');
     178  // ButtonDownSound := Sounds.Lookup('BUTTON_DOWN');
     179  // ButtonUpSound := Sounds.Lookup('BUTTON_UP');
    180180  for cix := 0 to ComponentCount - 1 do
    181181    if Components[cix] is TButtonBase then
    182182    begin
    183183      TButtonBase(Components[cix]).Graphic := GrExt[HGrSystem].Data;
    184       // if ButtonDownSound<>'*' then
    185       // DownSound:=HomeDir+'Sounds' + DirectorySeparator + ButtonDownSound + '.wav';
    186       // if ButtonUpSound<>'*' then
    187       // UpSound:=HomeDir+'Sounds' + DirectorySeparator + ButtonUpSound + '.wav';
     184      // if ButtonDownSound <> '*' then
     185      // DownSound := GetSoundsDir + DirectorySeparator + ButtonDownSound + '.wav';
     186      // if ButtonUpSound <> '*' then
     187      // UpSound := GetSoundsDir + DirectorySeparator + ButtonUpSound + '.wav';
    188188      if Components[cix] is TButtonA then
    189189        TButtonA(Components[cix]).Font := UniFont[ftButton];
  • trunk/Packages/CevoComponents/ScreenTools.pas

    r188 r189  
    188188
    189189  UniFont: array [TFontType] of TFont;
    190   AppRegistryKey: string = '\SOFTWARE\C-evo';
     190  Gamma: Integer; // global gamma correction (cent)
    191191
    192192procedure UnitInit;
    193193procedure UnitDone;
     194procedure InitGammaLookupTable;
     195
    194196
    195197implementation
     
    204206  {$ENDIF}
    205207
    206   Gamma: Integer; // global gamma correction (cent)
    207   GammaLookupTable: array [0 .. 255] of Byte;
     208  GammaLookupTable: array [0..255] of Byte;
    208209
    209210{$IFDEF WINDOWS}
     
    468469    Source := TBitmap.Create;
    469470    Source.PixelFormat := pf24bit;
    470     FileName := HomeDir + 'Graphics' + DirectorySeparator + Name;
     471    FileName := GetGraphicsDir + DirectorySeparator + Name;
    471472    if not LoadGraphicFile(Source, FileName) then begin
    472473      Result := -1;
     
    13521353    with MainTexture do begin
    13531354      MainTextureAge := Age;
    1354       LoadGraphicFile(Image, HomeDir + 'Graphics' + DirectorySeparator +
     1355      LoadGraphicFile(Image, GetGraphicsDir + DirectorySeparator +
    13551356        'Texture' + IntToStr(Age + 1) + '.jpg');
    13561357      clBevelLight := Colors.Canvas.Pixels[clkAge0 + Age, cliBevelLight];
     
    13911392
    13921393  if Sounds = nil then Sounds := TStringTable.Create;
    1393   if not Sounds.LoadFromFile(HomeDir + 'Sounds' + DirectorySeparator + 'sound.txt') then
     1394  if not Sounds.LoadFromFile(GetSoundsDir + DirectorySeparator + 'sound.txt') then
    13941395  begin
    13951396    FreeAndNil(Sounds);
     
    14701471
    14711472procedure UnitInit;
    1472 var
    1473   Reg: TRegistry;
    1474 begin
    1475   Reg := TRegistry.Create;
    1476   with Reg do
    1477     try
    1478       OpenKey(AppRegistryKey, True);
    1479       if ValueExists('Gamma') then
    1480         Gamma := ReadInteger('Gamma')
    1481       else
    1482       begin
    1483         Gamma := 100;
    1484         WriteInteger('Gamma', Gamma);
    1485       end;
    1486       if ValueExists('Locale') then
    1487         LocaleCode := ReadString('Locale')
    1488       else
    1489         LocaleCode := '';
    1490     finally
    1491       Free;
    1492     end;
    1493 
    1494   if Gamma <> 100 then InitGammaLookupTable;
     1473begin
     1474  Gamma := 100;
     1475  InitGammaLookupTable;
    14951476
    14961477  {$IFDEF WINDOWS}
     
    15121493  Templates := TBitmap.Create;
    15131494  Templates.PixelFormat := pf24bit;
    1514   LoadGraphicFile(Templates, HomeDir + 'Graphics' + DirectorySeparator +
     1495  LoadGraphicFile(Templates, GetGraphicsDir + DirectorySeparator +
    15151496    'Templates.png', gfNoGamma);
    15161497  Colors := TBitmap.Create;
    15171498  Colors.PixelFormat := pf24bit;
    1518   LoadGraphicFile(Colors, HomeDir + 'Graphics' + DirectorySeparator + 'Colors.png');
     1499  LoadGraphicFile(Colors, GetGraphicsDir + DirectorySeparator + 'Colors.png');
    15191500  Paper := TBitmap.Create;
    15201501  Paper.PixelFormat := pf24bit;
    1521   LoadGraphicFile(Paper, HomeDir + 'Graphics' + DirectorySeparator + 'Paper.jpg');
     1502  LoadGraphicFile(Paper, GetGraphicsDir + DirectorySeparator + 'Paper.jpg');
    15221503  BigImp := TBitmap.Create;
    15231504  BigImp.PixelFormat := pf24bit;
    1524   LoadGraphicFile(BigImp, HomeDir + 'Graphics' + DirectorySeparator + 'Icons.png');
     1505  LoadGraphicFile(BigImp, GetGraphicsDir + DirectorySeparator + 'Icons.png');
    15251506  MainTexture.Image := TBitmap.Create;
    15261507  MainTextureAge := -2;
     
    15321513procedure UnitDone;
    15331514var
    1534   Reg: TRegistry;
    15351515  I: integer;
    15361516begin
    1537   Reg := TRegistry.Create;
    1538   with Reg do
    1539     try
    1540       OpenKey(AppRegistryKey, True);
    1541       WriteString('Locale', LocaleCode);
    1542       WriteInteger('Gamma', Gamma);
    1543       if FullScreen then WriteInteger('ScreenMode', 1)
    1544         else WriteInteger('ScreenMode', 0);
    1545     finally
    1546       Free;
    1547     end;
    1548 
    15491517  RestoreResolution;
    15501518  for I := 0 to nGrExt - 1 do begin
  • trunk/Packages/CevoComponents/Sound.pas

    r174 r189  
    290290  Result := (WavFileName <> '') and (WavFileName[1] <> '[') and (WavFileName <> '*');
    291291  if Result then
    292     // SndPlaySound(pchar(HomeDir+'Sounds' +DirectorySeparator+WavFileName+'.wav'),SND_ASYNC)
    293     PlaySound(HomeDir + 'Sounds' + DirectorySeparator + WavFileName);
     292    // SndPlaySound(pchar(GetSoundsDir + DirectorySeparator + WavFileName + '.wav'), SND_ASYNC)
     293    PlaySound(GetSoundsDir + DirectorySeparator + WavFileName);
    294294{$ENDIF}
    295295end;
     
    307307  Assert(WavFileName[1] <> '[');
    308308  if (WavFileName <> '') and (WavFileName[1] <> '[') and (WavFileName <> '*') then
    309     PrepareSound(HomeDir + 'Sounds' + DirectorySeparator + WavFileName);
     309    PrepareSound(GetSoundsDir + DirectorySeparator + WavFileName);
    310310{$ENDIF}
    311311end;
  • trunk/Start.pas

    r188 r189  
    153153      invalidateTab0: boolean = false); overload;
    154154    procedure LoadConfig;
     155    procedure SaveConfig;
    155156  end;
    156157
     
    162163
    163164uses
    164   Directories, Direct, ScreenTools, Inp, Back, Locale, PixelPointer;
     165  Global, Directories, Direct, ScreenTools, Inp, Back, Locale, PixelPointer;
    165166
    166167{$R *.lfm}
    167168
    168169const
    169   CevoExt = '.cevo';
    170   CevoMapExt = '.cevo map';
    171170  // predefined world size
    172171  // attention: lx*ly+1 must be prime!
     
    467466  DirectDlg.Top := (Screen.Height - DirectDlg.Height) div 2;
    468467
    469   if FullScreen then
    470   begin
     468  if FullScreen then begin
    471469    Location := Point((Screen.Width - 800) * 3 div 8,
    472470      Screen.Height - Height - (Screen.Height - 600) div 3);
     
    484482    SetWindowRgn(Handle, r0, False);
    485483    DeleteObject(r0); // causes crash with Windows 95
    486   end
    487   else
    488   begin
     484  end else begin
    489485    Left := (Screen.Width - Width) div 2;
    490486    Top := (Screen.Height - Height) div 2;
     
    599595procedure TStartDlg.FormDestroy(Sender: TObject);
    600596begin
     597  SaveConfig;
    601598  FreeAndNil(FormerGames);
    602599  FreeAndNil(Maps);
     
    622619      DeleteObject(r1);
    623620    end;
    624   if not invalidateTab0 then
    625   begin
     621  if not invalidateTab0 then begin
    626622    r1 := CreateRectRgn(0, 0, 6 + 36, 3 + 38); // tab 0 icon
    627623    CombineRgn(r0, r0, r1, RGN_DIFF);
     
    652648        WriteInteger('Diff' + IntToStr(I), 2);
    653649    end;
    654     WriteInteger('MultiControl', 0);
    655650
    656651    OpenKey(AppRegistryKey, True);
     652    if ValueExists('Gamma') then Gamma := ReadInteger('Gamma')
     653      else Gamma := 100;
     654    if Gamma <> 100 then InitGammaLookupTable;
     655    if ValueExists('Locale') then LocaleCode := ReadString('Locale')
     656      else LocaleCode := '';
    657657    if ValueExists('WorldSize') then WorldSize := Reg.ReadInteger('WorldSize')
    658658      else WorldSize := DefaultWorldSize;
     
    680680    if ValueExists('ResolutionFreq') then
    681681      ResolutionFreq := ReadInteger('ResolutionFreq');
     682    if ValueExists('MultiControl') then
     683      MultiControl := ReadInteger('MultiControl')
     684      else MultiControl := 0;
    682685    {$IFDEF WINDOWS}
    683686    if ScreenMode = 2 then
     
    685688        ResolutionFreq);
    686689    {$ENDIF}
     690  finally
     691    Free;
     692  end;
     693end;
     694
     695procedure TStartDlg.SaveConfig;
     696var
     697  Reg: TRegistry;
     698begin
     699  Reg := TRegistry.Create;
     700  with Reg do try
     701    OpenKey(AppRegistryKey, True);
     702    WriteInteger('WorldSize', WorldSize);
     703    WriteInteger('LandMass', StartLandMass);
     704    WriteString('Locale', LocaleCode);
     705    WriteInteger('Gamma', Gamma);
     706    if FullScreen then WriteInteger('ScreenMode', 1)
     707      else WriteInteger('ScreenMode', 0);
     708    WriteInteger('MultiControl', MultiControl);
    687709  finally
    688710    Free;
     
    11631185          end;
    11641186
    1165           // save settings and AI assignment
     1187          // Save settings and AI assignment
    11661188          if Page = pgStartRandom then begin
    1167             WriteInteger('WorldSize', WorldSize);
    1168             WriteInteger('LandMass', StartLandMass);
    1169 
     1189            SaveConfig;
    11701190            OpenKey(AppRegistryKey + '\AI', True);
    11711191            if AutoDiff < 0 then
     
    11771197                WriteInteger('Diff' + IntToStr(I), Difficulty[I]);
    11781198              end;
    1179             WriteInteger('MultiControl', MultiControl);
    11801199          end;
    11811200
     
    12371256        MapFileName := Format(Phrases.Lookup('MAP'), [MapCount]) + CevoMapExt;
    12381257        EditMap(MapFileName, WorldSizes[WorldSize].X, WorldSizes[WorldSize].Y, StartLandMass);
    1239       end
    1240   end
     1258      end;
     1259  end;
    12411260end;
    12421261
     
    15051524                      PlayersBrain[p1] := Brains[j];
    15061525              end;
    1507               MultiControl := Reg.ReadInteger('MultiControl');
    15081526            finally
    15091527              Free;
     
    16551673        OpenDocument(pchar(HomeDir + 'AI Template' + DirectorySeparator + 'AI development manual.html'));
    16561674      maWeb:
    1657         OpenURL('http://c-evo.org')
     1675        OpenURL(CevoHomepage);
    16581676    end;
    16591677  end
Note: See TracChangeset for help on using the changeset viewer.