Changeset 171 for trunk/UMap.pas
- Timestamp:
- Nov 23, 2017, 7:05:37 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UMap.pas
r170 r171 6 6 7 7 uses 8 Classes, SysUtils, UGame, XMLRead, XMLWrite, DOM, Contnrs,UGeometryClasses,9 UGeometry ;8 Classes, SysUtils, UGame, XMLRead, XMLWrite, DOM, UGeometryClasses, 9 UGeometry, fgl; 10 10 11 11 type … … 64 64 function THexMap.GetHexagonPolygon(Pos: TPoint; Size: TPoint): TPolygon; 65 65 var 66 Shift: T FloatPoint;67 begin 68 Shift := FloatPoint(0.5 * cos(30 / 180 * Pi), 0.5 * sin(30 / 180 * Pi));66 Shift: TPointF; 67 begin 68 Shift := TPointF.Create(0.5 * cos(30 / 180 * Pi), 0.5 * sin(30 / 180 * Pi)); 69 69 SetLength(Result.Points, 6); 70 70 Result.Points[0] := TPoint.Create(Trunc(Pos.X + 0 * Size.X), Trunc(Pos.Y - 0.5 * Size.Y)); … … 246 246 end; 247 247 248 function CompareDistanceReverse( C1, C2: Pointer): Integer;249 begin 250 if TCellsDistance(C1).Distance > TCellsDistance(C2).Distance then Result := -1251 else if TCellsDistance(C1).Distance < TCellsDistance(C2).Distance then Result := 1248 function CompareDistanceReverse(const C1, C2: TCellsDistance): Integer; 249 begin 250 if C1.Distance > C2.Distance then Result := -1 251 else if C1.Distance < C2.Distance then Result := 1 252 252 else Result := 0; 253 253 end; … … 258 258 I1, I2: Integer; 259 259 NewCell: TCell; 260 CellsDistance: T ObjectList; // TObjectList<TCellsDistance>260 CellsDistance: TFPGObjectList<TCellsDistance>; 261 261 NewCellDist: TCellsDistance; 262 SelectedCells: T ObjectList; // TObjectList<TCellsDistance>262 SelectedCells: TFPGObjectList<TCellsDistance>; 263 263 I, J: Integer; 264 264 Intersected: Boolean; … … 312 312 313 313 // Calculate distance between all cells 314 CellsDistance := T ObjectList.Create;314 CellsDistance := TFPGObjectList<TCellsDistance>.Create; 315 315 for I1 := 1 to Cells.Count - 1 do 316 316 for I2 := I1 + 1 to Cells.Count - 1 do begin … … 324 324 325 325 // Keep shortest non-intersected cell pairs 326 SelectedCells := T ObjectList.Create;327 SelectedCells. OwnsObjects := False;326 SelectedCells := TFPGObjectList<TCellsDistance>.Create; 327 SelectedCells.FreeObjects := False; 328 328 I := CellsDistance.Count - 1; 329 329 while I >= 0 do begin
Note:
See TracChangeset
for help on using the changeset viewer.