- Timestamp:
- Dec 21, 2014, 11:14:58 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UGame.pas
r91 r96 153 153 procedure Paint(Canvas: TCanvas; View: TView); virtual; 154 154 function GetPixelRect: TRect; virtual; 155 function GetAllCells: TCellArray; virtual;156 155 procedure ForEachCells(Method: TMethod); virtual; 157 156 property Size: TPoint read GetSize write SetSize; … … 1343 1342 end; 1344 1343 1345 function TMap.GetAllCells: TCellArray;1346 var1347 I: Integer;1348 begin1349 SetLength(Result, Cells.Count);1350 for I := 0 to Cells.Count - 1do1351 Result[I] := TCell(Cells[I]);1352 end;1353 1354 1344 procedure TMap.ForEachCells(Method: TMethod); 1355 1345 begin … … 2664 2654 I: Integer; 2665 2655 Counter: Integer; 2666 AllCells: TCellArray;2667 2656 C: Integer; 2668 2657 begin … … 2675 2664 Map.Image.Picture.LoadFromFile(MapImageFileName); 2676 2665 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 2680 2668 if (VoidEnabled and (Random < VoidPercentage / 100)) or 2681 2669 (Map.IsOutsideShape(PosPx)) then Terrain := ttVoid … … 2707 2695 while not Assigned(StartCell) or Assigned(StartCell.Player) or 2708 2696 (StartCell.Terrain = ttVoid) do begin 2709 StartCell := AllCells[Random(Length(AllCells))];2697 StartCell := TCell(Map.Cells[Random(Map.Cells.Count)]); 2710 2698 Inc(Counter); 2711 2699 if Counter > 100 then
Note:
See TracChangeset
for help on using the changeset viewer.