Changeset 316 for trunk/UPlayer.pas
- Timestamp:
- Jun 19, 2024, 11:53:06 PM (5 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UPlayer.pas
r315 r316 1 1 unit UPlayer; 2 2 3 {$mode delphi}4 5 3 interface 6 4 7 5 uses 8 Classes, SysUtils, Graphics, UMap, DOM, fgl, XMLConf, XML, Math,9 UGeometry, UUnit, UNation, UItemList;6 Classes, SysUtils, Graphics, UMap, DOM, Generics.Collections, Generics.Defaults, 7 XMLConf, XML, Math, UGeometry, UUnit, UNation, UItemList; 10 8 11 9 type … … 38 36 { TPlayerCells } 39 37 40 TPlayerCells = class(T FPGObjectList<TPlayerCell>)38 TPlayerCells = class(TObjectList<TPlayerCell>) 41 39 Map: TPlayerMap; 42 40 function FindByCellId(Id: Integer): TPlayerCell; … … 84 82 { TGameTurnStats } 85 83 86 TGameTurnStats = class(T FPGObjectList<TGameTurnStat>)84 TGameTurnStats = class(TObjectList<TGameTurnStat>) 87 85 procedure LoadFromNode(Node: TDOMNode); 88 86 procedure SaveToNode(Node: TDOMNode); … … 192 190 { TUnitMoves } 193 191 194 TUnitMoves = class(T FPGObjectList<TUnitMove>)192 TUnitMoves = class(TObjectList<TUnitMove>) 195 193 Game: TObject; //TGame; 196 194 Player: TPlayer; … … 200 198 end; 201 199 202 function CellCompare(const Item1, Item2: TPlayerCell): Integer;203 function CellCompareDescending(const Item1, Item2: TPlayerCell): Integer;200 function CellCompare(constref Item1, Item2: TPlayerCell): Integer; 201 function CellCompareDescending(constref Item1, Item2: TPlayerCell): Integer; 204 202 205 203 … … 225 223 SDefensive = 'Defensive'; 226 224 227 function ComparePointer(const Item1, Item2: Integer): Integer;225 function ComparePointer(constref Item1, Item2: Integer): Integer; 228 226 begin 229 227 Result := -CompareValue(Item1, Item2); … … 311 309 begin 312 310 MovesFrom := TUnitMoves.Create; 313 MovesFrom. FreeObjects := False;311 MovesFrom.OwnsObjects := False; 314 312 MovesTo := TUnitMoves.Create; 315 MovesTo. FreeObjects := False;313 MovesTo.OwnsObjects := False; 316 314 Neighbors := TPlayerCells.Create; 317 Neighbors. FreeObjects := False;315 Neighbors.OwnsObjects := False; 318 316 end; 319 317 … … 334 332 raise Exception.Create(SCellRemoveNeighborError); 335 333 FreeAndNil(Neighbors); 336 inherited Destroy;334 inherited; 337 335 end; 338 336 … … 480 478 begin 481 479 FreeAndNil(Cells); 482 inherited Destroy;480 inherited; 483 481 end; 484 482 … … 718 716 CellTo := nil; 719 717 List := nil; 720 inherited Destroy;718 inherited; 721 719 end; 722 720 … … 864 862 S: string; 865 863 I: Integer; 866 AttackRolls: T FPGList<Integer>;867 DefendRolls: T FPGList<Integer>;868 begin 869 AttackRolls := T FPGList<Integer>.Create;870 DefendRolls := T FPGList<Integer>.Create;864 AttackRolls: TList<Integer>; 865 DefendRolls: TList<Integer>; 866 begin 867 AttackRolls := TList<Integer>.Create; 868 DefendRolls := TList<Integer>.Create; 871 869 if AttackPower < 1 then 872 870 raise Exception.Create(SAttackerPowerPositive); … … 884 882 AttackRolls[I] := Random(7); 885 883 end; 886 AttackRolls.Sort( ComparePointer);884 AttackRolls.Sort(TComparer<Integer>.Construct(ComparePointer)); 887 885 S := 'Att:'; 888 886 for I := 0 to AttackerDiceCount - 1 do … … 892 890 DefendRolls[I] := Random(7); 893 891 end; 894 DefendRolls.Sort( ComparePointer);892 DefendRolls.Sort(TComparer<Integer>.Construct(ComparePointer)); 895 893 S := S + ' Def:'; 896 894 for I := 0 to DefenderDiceCount - 1 do … … 905 903 end; 906 904 907 function CellCompare(const Item1, Item2: TPlayerCell): Integer;905 function CellCompare(constref Item1, Item2: TPlayerCell): Integer; 908 906 var 909 907 Stack1, Stack2: Integer; … … 918 916 end; 919 917 920 function CellCompareDescending(const Item1, Item2: TPlayerCell): Integer;918 function CellCompareDescending(constref Item1, Item2: TPlayerCell): Integer; 921 919 var 922 920 Stack1, Stack2: Integer;
Note:
See TracChangeset
for help on using the changeset viewer.