Changeset 106 for trunk/History.pas


Ignore:
Timestamp:
Dec 9, 2024, 8:54:41 PM (5 weeks ago)
Author:
chronos
Message:
  • Added: Optionally generated unmergeable movable tiles.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/History.pas

    r104 r106  
    2929    Pos: TPoint;
    3030    Value: Integer;
     31    Unmergable: Boolean;
    3132  end;
    3233
     
    3637    Moves: THistoryMoves;
    3738    InitialTiles: array of TTilePosValue;
     39    DisabledTiles: array of TPoint;
    3840    procedure Clear;
    3941    constructor Create;
     
    148150      WriteInteger('Y' + IntToStr(I), InitialTiles[I].Pos.Y);
    149151      WriteInteger('Value' + IntToStr(I), InitialTiles[I].Value);
    150     end;
     152      WriteBool('Unmergable' + IntToStr(I), InitialTiles[I].Unmergable);
     153    end;
     154
     155    CurrentContext := TRegistryContext.Create(RegContext.RootKey, RegContext.Key + '\DisabledTilesPos');
     156    for I := 0 to Length(DisabledTiles) - 1 do begin
     157      WriteInteger('X' + IntToStr(I), DisabledTiles[I].X);
     158      WriteInteger('Y' + IntToStr(I), DisabledTiles[I].Y);
     159    end;
     160
    151161    Moves.SaveToRegistry(Reg, RegContext);
    152162  end;
     
    164174        ReadIntegerWithDefault('Y' + IntToStr(I), 0));
    165175      InitialTiles[I].Value := ReadIntegerWithDefault('Value' + IntToStr(I), 0);
    166     end;
    167   end;
    168   Moves.LoadFromRegistry(Reg, RegContext);
     176      InitialTiles[I].Unmergable := ReadBoolWithDefault('Unmergable' + IntToStr(I), False);
     177    end;
     178
     179    CurrentContext := TRegistryContext.Create(RegContext.RootKey, RegContext.Key + '\DisabledTilesPos');
     180    SetLength(DisabledTiles, ReadIntegerWithDefault('Count', 0));
     181    for I := 0 to Length(DisabledTiles) - 1 do begin
     182      DisabledTiles[I] := Point(ReadIntegerWithDefault('X' + IntToStr(I), 0),
     183        ReadIntegerWithDefault('Y' + IntToStr(I), 0));
     184    end;
     185
     186    Moves.LoadFromRegistry(Reg, RegContext);
     187  end;
    169188end;
    170189
Note: See TracChangeset for help on using the changeset viewer.