Changeset 96


Ignore:
Timestamp:
Dec 21, 2014, 11:14:58 PM (10 years ago)
Author:
chronos
Message:
  • Modified: Removed old function GetAllCells which was used previously when Cells were arranged in Matrix rather then in generic list. Removed unnecessary all cells copy in Game.New.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UGame.pas

    r91 r96  
    153153    procedure Paint(Canvas: TCanvas; View: TView); virtual;
    154154    function GetPixelRect: TRect; virtual;
    155     function GetAllCells: TCellArray; virtual;
    156155    procedure ForEachCells(Method: TMethod); virtual;
    157156    property Size: TPoint read GetSize write SetSize;
     
    13431342end;
    13441343
    1345 function TMap.GetAllCells: TCellArray;
    1346 var
    1347   I: Integer;
    1348 begin
    1349   SetLength(Result, Cells.Count);
    1350   for I := 0 to Cells.Count - 1do
    1351     Result[I] := TCell(Cells[I]);
    1352 end;
    1353 
    13541344procedure TMap.ForEachCells(Method: TMethod);
    13551345begin
     
    26642654  I: Integer;
    26652655  Counter: Integer;
    2666   AllCells: TCellArray;
    26672656  C: Integer;
    26682657begin
     
    26752664    Map.Image.Picture.LoadFromFile(MapImageFileName);
    26762665  end;
    2677   AllCells := Map.GetAllCells;
    2678   for C := 0 to Length(AllCells) - 1 do
    2679   with AllCells[C] do begin
     2666  for C := 0 to Map.Cells.Count - 1 do
     2667  with TCell(Map.Cells[C]) do begin
    26802668    if (VoidEnabled and (Random < VoidPercentage / 100)) or
    26812669    (Map.IsOutsideShape(PosPx)) then Terrain := ttVoid
     
    27072695      while not Assigned(StartCell) or Assigned(StartCell.Player) or
    27082696     (StartCell.Terrain = ttVoid) do begin
    2709         StartCell := AllCells[Random(Length(AllCells))];
     2697        StartCell := TCell(Map.Cells[Random(Map.Cells.Count)]);
    27102698        Inc(Counter);
    27112699        if Counter > 100 then
Note: See TracChangeset for help on using the changeset viewer.