Changeset 306 for trunk


Ignore:
Timestamp:
Sep 5, 2020, 8:10:03 PM (4 years ago)
Author:
chronos
Message:
  • Fixed: Build under Lazarus 2.0.10.
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/Common/URegistry.pas

    r192 r306  
    11unit URegistry;
    22
    3 {$MODE Delphi}
     3{$MODE delphi}
    44
    55interface
     
    1717    RootKey: HKEY;
    1818    Key: string;
     19    class function Create(RootKey: TRegistryRoot; Key: string): TRegistryContext; static; overload;
     20    class function Create(RootKey: HKEY; Key: string): TRegistryContext; static; overload;
    1921    class operator Equal(A, B: TRegistryContext): Boolean;
    20     function Create(RootKey: TRegistryRoot; Key: string): TRegistryContext; overload;
    21     function Create(RootKey: HKEY; Key: string): TRegistryContext; overload;
    2222  end;
    2323
     
    2929    procedure SetCurrentContext(AValue: TRegistryContext);
    3030  public
     31    function ReadChar(const Name: string): Char;
     32    procedure WriteChar(const Name: string; Value: Char);
    3133    function ReadBoolWithDefault(const Name: string;
    3234      DefaultValue: Boolean): Boolean;
    3335    function ReadIntegerWithDefault(const Name: string; DefaultValue: Integer): Integer;
    3436    function ReadStringWithDefault(const Name: string; DefaultValue: string): string;
     37    function ReadCharWithDefault(const Name: string; DefaultValue: Char): Char;
    3538    function ReadFloatWithDefault(const Name: string;
    3639      DefaultValue: Double): Double;
     
    5558end;
    5659
    57 function TRegistryContext.Create(RootKey: TRegistryRoot; Key: string): TRegistryContext;
     60class function TRegistryContext.Create(RootKey: TRegistryRoot; Key: string): TRegistryContext;
    5861begin
    5962  Result.RootKey := RegistryRootHKEY[RootKey];
     
    6164end;
    6265
    63 function TRegistryContext.Create(RootKey: HKEY; Key: string): TRegistryContext;
     66class function TRegistryContext.Create(RootKey: HKEY; Key: string): TRegistryContext;
    6467begin
    6568  Result.RootKey := RootKey;
     
    8588    else begin
    8689      WriteString(Name, DefaultValue);
     90      Result := DefaultValue;
     91    end;
     92end;
     93
     94function TRegistryEx.ReadCharWithDefault(const Name: string; DefaultValue: Char
     95  ): Char;
     96begin
     97  if ValueExists(Name) then Result := ReadChar(Name)
     98    else begin
     99      WriteChar(Name, DefaultValue);
    87100      Result := DefaultValue;
    88101    end;
     
    120133begin
    121134  {$IFDEF Linux}
    122   CloseKey;
     135  //CloseKey;
    123136  {$ENDIF}
    124137  Result := inherited OpenKey(Key, CanCreate);
     
    137150end;
    138151
     152function TRegistryEx.ReadChar(const Name: string): Char;
     153var
     154  S: string;
     155begin
     156  S := ReadString(Name);
     157  if Length(S) > 0 then Result := S[1]
     158    else Result := #0;
     159end;
     160
     161procedure TRegistryEx.WriteChar(const Name: string; Value: Char);
     162begin
     163  WriteString(Name, Value);
     164end;
     165
    139166function TRegistryEx.ReadBoolWithDefault(const Name: string;
    140167  DefaultValue: Boolean): Boolean;
  • trunk/Read me.txt

    r286 r306  
    1 Developed using Lazarus 2.0.0 (http://www.lazarus-ide.org/)
     1Developed using Lazarus 2.0.10 (http://www.lazarus-ide.org/)
  • trunk/Release notes.txt

    r253 r306  
    4343* Added: Map can have rounded shape.
    4444* Added: New Unit moves window available from Tools menu.
    45 * Modified: Improved code for symetric map generation.
     45* Modified: Improved code for symmetric map generation.
    4646* Modified: Store player settings for new game separately to current game players.
    4747* Modified: Implemented better algorithm for initialization of players start cell to maintain minimal distance between players.
     
    4949* Modified: Improved attack to neutral units if computer have more units available when necessary.
    5050* Fixed: Show error message if not all players were placed to the map.
    51 * Fixed: Build cell bridges correctly if symetric map is selected.
    52 * Fixed: Avoid possible negative cell power if player unit was previously unsucessfully attacked and weaken by enemy.
     51* Fixed: Build cell bridges correctly if symmetric map is selected.
     52* Fixed: Avoid possible negative cell power if player unit was previously unsuccessfully attacked and weaken by enemy.
    5353* Fixed: Same game structures were not correctly initialized during load from file.
    5454* Fixed: Show other players cells with normal power and cells of current player with power lowered by unit moves.
     
    9292* Added: Auto save game to file option in settings.
    9393* Added: New game option "Map shape" which can use image in file as base for map generation. Black color is used as void.
    94 * Added: Support for symetric map usable for two players game.
     94* Added: Support for symmetric map usable for two players game.
    9595* Added: Confirmation dialog for ending game.
    9696* Added: Support for switching large icons in toolbar.
  • trunk/UGeometry.pas

    r258 r306  
    2626    //class operator Divide(const A, B: TGPoint<T>): TGPoint<T>;
    2727    //class operator Modulus(A: TGPoint<T>; B: TGPoint<T>): TGPoint<T>;
    28     function Min(const A, B: TGPoint<T>): TGPoint<T>;
    29     function Max(const A, B: TGPoint<T>): TGPoint<T>;
     28    class function Min(const A, B: TGPoint<T>): TGPoint<T>; static;
     29    class function Max(const A, B: TGPoint<T>): TGPoint<T>; static;
    3030    procedure Rotate(Base: TGPoint<T>; Angle: Double);
    3131  end;
     
    500500end;
    501501
    502 function TGPoint<T>.Min(const A, B: TGPoint<T>): TGPoint<T>;
     502class function TGPoint<T>.Min(const A, B: TGPoint<T>): TGPoint<T>;
    503503begin
    504504  if A.X < B.X then Result.X := A.X else Result.X := B.X;
     
    506506end;
    507507
    508 function TGPoint<T>.Max(const A, B: TGPoint<T>): TGPoint<T>;
     508class function TGPoint<T>.Max(const A, B: TGPoint<T>): TGPoint<T>;
    509509begin
    510510  if A.X > B.X then Result.X := A.X else Result.X := B.X;
Note: See TracChangeset for help on using the changeset viewer.