Changeset 105 for trunk/Tile.pas


Ignore:
Timestamp:
Dec 9, 2024, 4:40:34 PM (5 weeks ago)
Author:
chronos
Message:
  • Added: Set number of randomly generated disabled tiles in new game form.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tile.pas

    r104 r105  
    44
    55uses
    6   Classes, SysUtils, Generics.Collections;
     6  Classes, SysUtils, Generics.Collections, RegistryEx;
    77
    88type
     
    1818    Action: TTileAction;
    1919    Shift: TPoint;
     20    Disabled: Boolean;
     21    procedure Clear;
    2022    procedure Assign(Source: TTile);
     23    procedure SaveToRegistry(Reg: TRegistryEx; RegContext: TRegistryContext);
     24    procedure LoadFromRegistry(Reg: TRegistryEx; RegContext: TRegistryContext);
    2125  end;
    2226
     
    2933{ TTile }
    3034
     35procedure TTile.Clear;
     36begin
     37  Value := 0;
     38  Action := taNone;;
     39  Disabled := False;
     40end;
     41
    3142procedure TTile.Assign(Source: TTile);
    3243begin
     44  Index := Source.Index;
    3345  Value := Source.Value;
    3446  Merged := Source.Merged;
     47  Disabled := Source.Disabled;
    3548end;
    3649
     50procedure TTile.SaveToRegistry(Reg: TRegistryEx; RegContext: TRegistryContext);
     51begin
     52  with Reg do begin
     53    CurrentContext := RegContext;
     54
     55    WriteInteger('Value', Value);
     56    WriteBool('Disabled', Disabled);
     57  end;
     58end;
     59
     60procedure TTile.LoadFromRegistry(Reg: TRegistryEx; RegContext: TRegistryContext
     61  );
     62begin
     63  with Reg do begin
     64    CurrentContext := RegContext;
     65
     66    Value := ReadIntegerWithDefault('Value', Value);
     67    Disabled := ReadBoolWithDefault('Disabled', Disabled);
     68  end;
     69end;
    3770
    3871end.
Note: See TracChangeset for help on using the changeset viewer.