Changeset 316 for trunk/UClientAI.pas
- Timestamp:
- Jun 19, 2024, 11:53:06 PM (5 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UClientAI.pas
r274 r316 1 1 unit UClientAI; 2 2 3 {$mode delphi}4 5 3 interface 6 4 7 5 uses 8 Classes, SysUtils, UGameClient, UGame, Math, UPlayer, UMap ;6 Classes, SysUtils, UGameClient, UGame, Math, UPlayer, UMap, Generics.Defaults; 9 7 10 8 type … … 53 51 AllCells := ControlPlayer.PlayerMap.Cells; 54 52 TargetCells := TPlayerCells.Create; 55 TargetCells. FreeObjects := False;53 TargetCells.OwnsObjects := False; 56 54 57 55 // Get list of all attack target cells … … 70 68 // Sort ascending to attack cells with lower power first 71 69 // Low power cells are better for expanding our territory 72 TargetCells.Sort( CellCompare);70 TargetCells.Sort(TComparer<TPlayerCell>.Construct(CellCompare)); 73 71 74 72 for Cell in TargetCells do … … 113 111 DefendCount: Integer; 114 112 begin 115 if ControlPlayer.Defensive then Exit;113 if ControlPlayer.Defensive then Exit; 116 114 117 115 AllCells := ControlPlayer.PlayerMap.Cells; 118 116 TargetCells := TPlayerCells.Create; 119 TargetCells. FreeObjects := False;117 TargetCells.OwnsObjects := False; 120 118 121 119 // Get list of all attack target cells … … 134 132 // Sort descending to attack cells with higher power first 135 133 // Higher power enemy cells can grow faster and is more dangerous 136 TargetCells.Sort( CellCompareDescending);134 TargetCells.Sort(TComparer<TPlayerCell>.Construct(CellCompareDescending)); 137 135 138 136 for TargetCell in TargetCells do begin … … 188 186 AllCells := ControlPlayer.PlayerMap.Cells; 189 187 TargetCells := TPlayerCells.Create; 190 TargetCells. FreeObjects := False;188 TargetCells.OwnsObjects := False; 191 189 NewTargetCells := TPlayerCells.Create; 192 NewTargetCells. FreeObjects := False;190 NewTargetCells.OwnsObjects := False; 193 191 194 192 // Get list of all enemy border cells … … 252 250 TargetCells := NewTargetCells; 253 251 NewTargetCells := TPlayerCells.Create; 254 NewTargetCells. FreeObjects := False;252 NewTargetCells.OwnsObjects := False; 255 253 end; 256 254 … … 293 291 begin 294 292 BorderCells := TPlayerCells.Create; 295 BorderCells. FreeObjects := False;293 BorderCells.OwnsObjects := False; 296 294 AllCells := ControlPlayer.PlayerMap.Cells; 297 295
Note:
See TracChangeset
for help on using the changeset viewer.