close Warning: Can't synchronize with repository "(default)" (No changeset 184 in the repository). Look in the Trac log for more information.

Changeset 167 for trunk/UGame.pas


Ignore:
Timestamp:
Nov 23, 2017, 9:57:48 AM (7 years ago)
Author:
chronos
Message:
  • Fixed: Generate map only once on application start.
  • Modified: Use const function parameter modifier in Geometry unit.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UGame.pas

    r166 r167  
    188188  private
    189189    FSize: TPoint;
    190     FUpdateCount: Integer;
    191190    function GetSize: TPoint; virtual;
    192191    procedure PaintCell(Canvas: TCanvas; Pos: TPoint; Text: string; View: TView;
     
    229228    procedure CreateLinks;
    230229    procedure Clear;
    231     procedure BeginUpdate;
    232     procedure EndUpdate;
    233230    constructor Create; virtual;
    234231    destructor Destroy; override;
     
    13881385  if (FSize.X <> AValue.X) or (FSize.Y <> AValue.Y) then begin
    13891386    FSize := AValue;
    1390     if FUpdateCount = 0 then Generate;
    13911387  end;
    13921388end;
     
    15041500//  I: Integer;
    15051501begin
    1506   FUpdateCount := Source.FUpdateCount;
    15071502  MaxPower := Source.MaxPower;
    15081503  Game := Source.Game;
     
    17841779  Cells.Clear;
    17851780  FNewCellId := 1;
    1786 end;
    1787 
    1788 procedure TMap.BeginUpdate;
    1789 begin
    1790   Inc(FUpdateCount);
    1791 end;
    1792 
    1793 procedure TMap.EndUpdate;
    1794 begin
    1795   if FUpdateCount > 0 then Dec(FUpdateCount);
    1796   if FUpdateCount = 0 then Generate;
    17971781end;
    17981782
     
    33173301begin
    33183302  with Config do begin
    3319     try
    3320       Map.BeginUpdate;
    3321       MapType := TMapType(GetValue(DOMString(Path + '/GridType'), Integer(mtHexagon)));
    3322       Map.Size := Point(GetValue(DOMString(Path + '/MapSizeX'), 10),
    3323         GetValue(DOMString(Path + '/MapSizeY'), 10));
    3324     finally
    3325       Map.EndUpdate;
    3326     end;
     3303    MapType := TMapType(GetValue(DOMString(Path + '/GridType'), Integer(mtHexagon)));
     3304    Map.Size := Point(GetValue(DOMString(Path + '/MapSizeX'), 10),
     3305      GetValue(DOMString(Path + '/MapSizeY'), 10));
    33273306    MapImageFileName := string(GetValue(DOMString(Path + '/MapImage'), DOMString(MapImageFileName)));
    33283307    SymetricMap := GetValue(DOMString(Path + '/SymetricMap'), False);
Note: See TracChangeset for help on using the changeset viewer.