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

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.