Changeset 316 for trunk/UMap.pas
- Timestamp:
- Jun 19, 2024, 11:53:06 PM (5 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UMap.pas
r315 r316 1 1 unit UMap; 2 2 3 {$mode delphi}4 5 3 interface 6 4 7 5 uses 8 Classes, SysUtils, Graphics, ExtCtrls, UGeometry, DOM, fgl, UBuilding,9 XML, UUnit;6 Classes, SysUtils, Graphics, ExtCtrls, UGeometry, DOM, Generics.Collections, 7 Generics.Defaults, UBuilding, XML, UUnit; 10 8 11 9 const … … 78 76 { TCells } 79 77 80 TCells = class(T FPGObjectList<TCell>)78 TCells = class(TObjectList<TCell>) 81 79 Map: TMap; 82 80 procedure FixRefId; … … 105 103 { TCellLinks } 106 104 107 TCellLinks = class(T FPGObjectList<TCellLink>)105 TCellLinks = class(TObjectList<TCellLink>) 108 106 Map: TMap; 109 107 function FindByCells(Cell1, Cell2: TCell): TCellLink; … … 136 134 end; 137 135 138 TMapAreas = class(T FPGObjectList<TMapArea>)136 TMapAreas = class(TObjectList<TMapArea>) 139 137 end; 140 138 … … 239 237 begin 240 238 Cells := TCells.Create; 241 Cells. FreeObjects := False;239 Cells.OwnsObjects := False; 242 240 end; 243 241 … … 253 251 end; 254 252 FreeAndNil(Cells); 255 inherited Destroy;253 inherited; 256 254 end; 257 255 … … 336 334 begin 337 335 Cells := TCells.Create; 338 Cells. FreeObjects := False;336 Cells.OwnsObjects := False; 339 337 end; 340 338 … … 342 340 begin 343 341 FreeAndNil(Cells); 344 inherited Destroy;342 inherited; 345 343 end; 346 344 … … 456 454 end; 457 455 458 function CompareCellAngle(const C1, C2: TCell): Integer;456 function CompareCellAngle(constref C1, C2: TCell): Integer; 459 457 begin 460 458 if C1.Angle < C2.Angle then Result := -1 … … 472 470 NeighborCell.Angle := TLine.Create(Cell.PosPx, NeighborCell.PosPx).GetAngle; 473 471 474 Cell.Neighbors.Sort( CompareCellAngle);472 Cell.Neighbors.Sort(TComparer<TCell>.Construct(CompareCellAngle)); 475 473 end; 476 474 end; … … 770 768 FreeAndNil(Image); 771 769 FreeAndNil(Cells); 772 inherited Destroy;770 inherited; 773 771 end; 774 772 … … 803 801 Result := nil; 804 802 NewList := TCells.Create; 805 NewList. FreeObjects := False;803 NewList.OwnsObjects := False; 806 804 NewListVoid := TCells.Create; 807 NewListVoid. FreeObjects := False;805 NewListVoid.OwnsObjects := False; 808 806 809 807 for C := 0 to List.Count - 1 do … … 845 843 begin 846 844 List := TCells.Create; 847 List. FreeObjects := False;845 List.OwnsObjects := False; 848 846 849 847 BorderList := TCells.Create; 850 BorderList. FreeObjects := False;848 BorderList.OwnsObjects := False; 851 849 852 850 // Build area bridges … … 1133 1131 Player := nil; 1134 1132 Neighbors := TCells.Create; 1135 Neighbors. FreeObjects := False;1133 Neighbors.OwnsObjects := False; 1136 1134 Links := TCellLinks.Create; 1137 Links. FreeObjects := False;1135 Links.OwnsObjects := False; 1138 1136 end; 1139 1137 … … 1150 1148 raise Exception.Create(SCellRemoveNeighborError); 1151 1149 FreeAndNil(Neighbors); 1152 inherited Destroy;1150 inherited; 1153 1151 end; 1154 1152
Note:
See TracChangeset
for help on using the changeset viewer.