Changeset 316
- Timestamp:
- Jun 19, 2024, 11:53:06 PM (6 months ago)
- Location:
- trunk
- Files:
-
- 41 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormCharts.pas
r243 r316 1 1 unit UFormCharts; 2 3 {$mode delphi}4 2 5 3 interface … … 19 17 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction); 20 18 procedure FormShow(Sender: TObject); 21 private22 { private declarations }23 19 public 24 20 procedure Redraw; … … 28 24 var 29 25 FormCharts: TFormCharts; 26 30 27 31 28 implementation -
trunk/Forms/UFormChat.pas
r243 r316 1 1 unit UFormChat; 2 3 {$mode delphi}4 2 5 3 interface -
trunk/Forms/UFormClient.pas
r315 r316 1 1 unit UFormClient; 2 3 {$mode delphi}{$H+}4 2 5 3 interface … … 109 107 MapBackgroundColor = $404040; 110 108 109 111 110 implementation 112 111 -
trunk/Forms/UFormGameSystem.pas
r291 r316 1 1 unit UFormGameSystem; 2 3 {$mode delphi}4 2 5 3 interface -
trunk/Forms/UFormGameSystems.pas
r278 r316 1 1 unit UFormGameSystems; 2 3 {$mode delphi}4 2 5 3 interface … … 47 45 FGameSystems: TGameSystems; 48 46 procedure SetGameSystems(AValue: TGameSystems); 49 50 47 public 51 48 procedure UpdateInterface; -
trunk/Forms/UFormHelp.pas
r245 r316 1 1 unit UFormHelp; 2 3 {$mode delphi}4 2 5 3 interface … … 17 15 procedure FormCreate(Sender: TObject); 18 16 procedure FormShow(Sender: TObject); 19 private20 { private declarations }21 public22 { public declarations }23 17 end; 24 18 -
trunk/Forms/UFormItem.pas
r300 r316 1 1 unit UFormItem; 2 3 {$mode delphi}4 2 5 3 interface … … 7 5 uses 8 6 Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, UItemList, 9 ExtCtrls, ColorBox, Spin, fgl;7 ExtCtrls, ColorBox, Spin, Generics.Collections; 10 8 11 9 type … … 23 21 private 24 22 FItem: TItem; 25 DataControls: T FPGObjectList<TControl>;26 DataLabels: T FPGObjectList<TLabel>;23 DataControls: TObjectList<TControl>; 24 DataLabels: TObjectList<TLabel>; 27 25 procedure ControlChangeExecute(Sender: TObject); 28 26 procedure SetItem(AValue: TItem); … … 62 60 Core.CoolTranslator1.TranslateComponentRecursive(Self); 63 61 Core.ThemeManager1.UseTheme(Self); 64 DataControls := T FPGObjectList<TControl>.Create;65 DataLabels := T FPGObjectList<TLabel>.Create;62 DataControls := TObjectList<TControl>.Create; 63 DataLabels := TObjectList<TLabel>.Create; 66 64 end; 67 65 -
trunk/Forms/UFormKeyShortcuts.pas
r243 r316 1 1 unit UFormKeyShortcuts; 2 3 {$mode delphi}4 2 5 3 interface … … 21 19 procedure FormShow(Sender: TObject); 22 20 procedure MenuItem1Click(Sender: TObject); 23 private24 21 public 25 22 procedure LoadFromComponent(C: TComponent); … … 28 25 var 29 26 FormKeyShortcuts: TFormKeyShortcuts; 27 30 28 31 29 implementation -
trunk/Forms/UFormList.pas
r301 r316 1 1 unit UFormList; 2 3 {$mode delphi}4 2 5 3 interface … … 7 5 uses 8 6 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls, 9 ActnList, Menus, fgl,UItemList;7 ActnList, Menus, UItemList; 10 8 11 9 type -
trunk/Forms/UFormMain.pas
r310 r316 1 1 unit UFormMain; 2 3 {$mode delphi}{$H+}4 2 5 3 interface … … 103 101 FormMain: TFormMain; 104 102 103 105 104 implementation 106 105 -
trunk/Forms/UFormMove.pas
r274 r316 1 1 unit UFormMove; 2 3 {$mode delphi}4 2 5 3 interface … … 42 40 procedure TrackBarOnceChange(Sender: TObject); 43 41 procedure TrackBarRepeatChange(Sender: TObject); 44 private45 { private declarations }46 42 public 47 43 DefendCount: Integer; … … 54 50 var 55 51 FormMove: TFormMove; 52 56 53 57 54 implementation -
trunk/Forms/UFormNew.pas
r304 r316 1 1 unit UFormNew; 2 3 {$mode delphi}4 2 5 3 interface -
trunk/Forms/UFormPlayersStats.pas
r315 r316 1 1 unit UFormPlayersStats; 2 3 {$mode delphi}4 2 5 3 interface … … 26 24 function ListViewSort1CompareItem(Item1, Item2: TObject): Integer; 27 25 procedure ListViewSort1Filter(ListViewSort: TListViewSort); 28 private29 30 26 public 31 27 procedure ReloadList; -
trunk/Forms/UFormServer.pas
r288 r316 1 1 unit UFormServer; 2 3 {$mode delphi}4 2 5 3 interface … … 35 33 var 36 34 FormServer: TFormServer; 35 37 36 38 37 implementation -
trunk/Forms/UFormSettings.pas
r315 r316 1 1 unit UFormSettings; 2 3 {$mode delphi}4 2 5 3 interface … … 40 38 procedure FormCreate(Sender: TObject); 41 39 procedure FormShow(Sender: TObject); 42 private43 { private declarations }44 40 public 45 41 procedure Load; … … 49 45 var 50 46 FormSettings: TFormSettings; 47 51 48 52 49 implementation -
trunk/Forms/UFormUnitMoves.pas
r243 r316 1 1 unit UFormUnitMoves; 2 3 {$mode delphi}4 2 5 3 interface -
trunk/Packages/CoolStreaming/Demo/VarBlockSerializer/UMainForm.pas
r185 r316 1 1 unit UMainForm; 2 3 {$mode Delphi}{$H+}4 2 5 3 interface … … 80 78 MainForm: TMainForm; 81 79 80 82 81 implementation 83 82 -
trunk/Packages/PinConnection/UCommFrame.pas
r214 r316 200 200 end; 201 201 202 203 202 end. -
trunk/Packages/PinConnection/UCommPin.pas
r185 r316 89 89 begin 90 90 Pin.Free; 91 inherited Destroy;91 inherited; 92 92 end; 93 93 … … 177 177 end; 178 178 179 180 179 end. -
trunk/Read me.txt
r313 r316 1 Developed using Lazarus 2.2.0 (http://www.lazarus-ide.org/)1 Developed using Lazarus 3.4.0 (http://www.lazarus-ide.org/) -
trunk/UBuilding.pas
r299 r316 1 1 unit UBuilding; 2 3 {$mode delphi}4 2 5 3 interface -
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 -
trunk/UClientGUI.pas
r299 r316 1 1 unit UClientGUI; 2 3 {$mode delphi}4 2 5 3 interface … … 68 66 end; 69 67 68 70 69 implementation 71 70 … … 98 97 begin 99 98 FreeAndNil(View); 100 inherited Destroy;99 inherited; 101 100 end; 102 101 … … 552 551 destructor TView.Destroy; 553 552 begin 554 inherited Destroy;553 inherited; 555 554 end; 556 555 -
trunk/UCore.pas
r315 r316 1 1 unit UCore; 2 3 {$mode delphi}4 2 5 3 interface … … 9 7 UGame, ApplicationInfo, PersistentForm, ScaleDPI, Translator, DOM, 10 8 RegistryEx, LastOpenedList, Theme, Registry, Menus, 11 UFormClient, UPlayer, UGameServer, UGameClient, fgl, UServerList, UGameSystem,12 Graphics, UUnit;9 UFormClient, UPlayer, UGameServer, UGameClient, Generics.Collections, 10 UServerList, UGameSystem, Graphics, UUnit; 13 11 14 12 type … … 101 99 AutoSaveEnabled: Boolean; 102 100 ReopenLastFile: Boolean; 103 FormClients: T FPGObjectList<TFormClient>;101 FormClients: TObjectList<TFormClient>; 104 102 LocalClients: TClients; 105 103 ServerList: TServerList; … … 495 493 XMLConfig1.Filename := GetAppConfigDir(False) + 'Config.xml'; 496 494 ForceDirectories(GetAppConfigDir(False)); 497 FormClients := T FPGObjectList<TFormClient>.Create;495 FormClients := TObjectList<TFormClient>.Create; 498 496 ServerList := TServerList.Create; 499 497 end; -
trunk/UGame.pas
r315 r316 1 1 unit UGame; 2 3 {$mode delphi}{$H+}4 2 5 3 interface … … 7 5 uses 8 6 Classes, SysUtils, ExtCtrls, Graphics, XMLConf, XMLRead, XMLWrite, Forms, 9 DOM, Math, LazFileUtils, XML, Dialogs, LCLType, LCLIntf, fgl, UBuilding,10 U Geometry, UPlayer, UMap, UMapType, UUnit, UGameSystem;7 DOM, Math, LazFileUtils, XML, Dialogs, LCLType, LCLIntf, UBuilding, UGeometry, 8 UPlayer, UMap, UMapType, UUnit, UGameSystem; 11 9 12 10 const … … 387 385 List := TCells.Create; 388 386 try 389 List. FreeObjects := False;387 List.OwnsObjects := False; 390 388 Map.Cells.GetCellsWithWeight(List, Round(LongestDistance * 0.6), Round(LongestDistance * 0.8)); 391 389 … … 415 413 Player.StartCell.Mark := True; 416 414 List := TCells.Create; 417 List. FreeObjects := False;415 List.OwnsObjects := False; 418 416 List.Add(Player.StartCell); 419 417 PropagatePlayerDistance(List); … … 430 428 begin 431 429 NeighborList := TCells.Create; 432 NeighborList. FreeObjects := False;430 NeighborList.OwnsObjects := False; 433 431 434 432 for Cell in List do begin … … 880 878 FreeAndNil(Units); 881 879 FreeAndNil(GameSystem); 882 inherited Destroy;880 inherited; 883 881 end; 884 882 -
trunk/UGameClient.pas
r315 r316 1 1 unit UGameClient; 2 2 3 {$mode delphi}4 5 3 interface 6 4 7 5 uses 8 Classes, SysUtils, UGame, Forms, fgl, UGameProtocol, UGameServer, UCommThread,9 Threading, UCommFrame, UPlayer;6 Classes, SysUtils, UGame, Forms, Generics.Collections, UGameProtocol, 7 UGameServer, UCommThread, Threading, UCommFrame, UPlayer; 10 8 11 9 type … … 70 68 { TClients } 71 69 72 TClients = class(T FPGObjectList<TClient>)70 TClients = class(TObjectList<TClient>) 73 71 Game: TGame; 74 72 function New(Name: string): TClient; … … 248 246 FreeAndNil(CommThread); 249 247 FreeAndNil(CommFrame); 250 inherited Destroy;248 inherited; 251 249 end; 252 250 -
trunk/UGameConnection.pas
r202 r316 1 1 unit UGameConnection; 2 3 {$mode delphi}4 2 5 3 interface … … 16 14 TConnectParams = class 17 15 NetworkAddress: TNetworkAddress; 16 end; 18 17 19 end;20 18 21 19 implementation -
trunk/UGameProtocol.pas
r220 r316 1 1 unit UGameProtocol; 2 3 {$mode delphi}4 2 5 3 interface … … 124 122 destructor TGameProtocolServer.Destroy; 125 123 begin 126 Pin.Free;127 inherited Destroy;124 FreeAndNil(Pin); 125 inherited; 128 126 end; 129 127 … … 240 238 destructor TGameProtocolClient.Destroy; 241 239 begin 242 Pin.Free;243 inherited Destroy;240 FreeAndNil(Pin); 241 inherited; 244 242 end; 245 243 -
trunk/UGameServer.pas
r287 r316 1 1 unit UGameServer; 2 2 3 {$mode delphi}4 5 3 interface 6 4 7 5 uses 8 Classes, SysUtils, UGame, DOM, XMLConf, fgl, UGameProtocol, UCommFrame, UPlayer; 6 Classes, SysUtils, UGame, DOM, XMLConf, Generics.Collections, UGameProtocol, 7 UCommFrame, UPlayer; 9 8 10 9 type … … 32 31 { TServerClients } 33 32 34 TServerClients = class(T FPGObjectList<TServerClient>)33 TServerClients = class(TObjectList<TServerClient>) 35 34 Game: TGame; 36 35 function SearchByPlayer(Player: TPlayer): TServerClient; … … 73 72 DefaultServerPort = 40009; 74 73 74 75 75 implementation 76 76 … … 120 120 destructor TServerClient.Destroy; 121 121 begin 122 Protocol.Free;123 CommFrame.Free;124 inherited Destroy;122 FreeAndNil(Protocol); 123 FreeAndNil(CommFrame); 124 inherited; 125 125 end; 126 126 … … 278 278 begin 279 279 FreeAndNil(Clients); 280 inherited Destroy;280 inherited; 281 281 end; 282 282 -
trunk/UGameSystem.pas
r315 r316 1 1 unit UGameSystem; 2 2 3 {$mode delphi}4 5 3 interface 6 4 7 5 uses 8 Classes, SysUtils, fgl, UUnit, DOM, XMLRead, XMLWrite, XML, XMLConf,6 Classes, SysUtils, Generics.Collections, UUnit, DOM, XMLRead, XMLWrite, XML, XMLConf, 9 7 FileUtil, LazFileUtils, UMapType, UNation, UBuilding; 10 8 … … 39 37 { TGameSystems } 40 38 41 TGameSystems = class(T FPGObjectList<TGameSystem>)39 TGameSystems = class(TObjectList<TGameSystem>) 42 40 function AddNew(Name: string): TGameSystem; 43 41 function SearchByName(Name: string): TGameSystem; … … 103 101 destructor TGameSystem.Destroy; 104 102 begin 105 Nations.Free;106 BuildingKinds.Free;107 UnitKinds.Free;108 inherited Destroy;103 FreeAndNil(Nations); 104 FreeAndNil(BuildingKinds); 105 FreeAndNil(UnitKinds); 106 inherited; 109 107 end; 110 108 -
trunk/UGeometry.pas
r306 r316 1 1 unit UGeometry; 2 3 {$mode delphi}4 2 5 3 interface -
trunk/UGeometryClasses.pas
r192 r316 1 1 unit UGeometryClasses; 2 3 {$mode delphi}{$H+}4 2 5 3 interface -
trunk/UItemList.pas
r315 r316 1 1 unit UItemList; 2 2 3 {$mode delphi}4 5 3 interface 6 4 7 5 uses 8 Classes, SysUtils, fgl, DOM, XML, Common, Graphics;6 Classes, SysUtils, Generics.Collections, DOM, XML, Common, Graphics; 9 7 10 8 type … … 33 31 { TItemFields } 34 32 35 TItemFields = class(T FPGObjectList<TItemField>)33 TItemFields = class(TObjectList<TItemField>) 36 34 function AddField(Index: Integer; SysName, Name: string; DataType: TDataType): TItemField; 37 35 function SearchByIndex(Index: Integer): TItemField; … … 78 76 { TItemList } 79 77 80 TItemList = class(T FPGObjectList<TItem>)78 TItemList = class(TObjectList<TItem>) 81 79 NewId: Integer; 82 80 class function GetItemClass: TItemClass; virtual; … … 120 118 destructor TItemField.Destroy; 121 119 begin 122 EnumStates.Free;123 inherited Destroy;120 FreeAndNil(EnumStates); 121 inherited; 124 122 end; 125 123 … … 316 314 ReferenceList := GetReferenceList(Field.Index); 317 315 if (ReadId > 0) and Assigned(ReferenceList) then 318 SetValueReference(Field.Index, TItem(ReferenceList .List[ReadId]));316 SetValueReference(Field.Index, TItem(ReferenceList[ReadId])); 319 317 end else 320 318 raise Exception.Create(Format(SUnsupportedDataType, [DataTypeStr[Field.DataType]])); -
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 -
trunk/UMapType.pas
r281 r316 1 1 unit UMapType; 2 2 3 {$mode delphi}4 5 3 interface 6 4 7 5 uses 8 Classes, SysUtils, XMLRead, XMLWrite, DOM, UGeometry, fgl,UMap;6 Classes, SysUtils, XMLRead, XMLWrite, DOM, UGeometry, UMap; 9 7 10 8 type … … 83 81 84 82 TVoronoiMap = class(TMap) 85 private86 83 public 87 84 procedure Generate; override; … … 189 186 Angle: Double; 190 187 begin 191 Result := inherited CalculatePixelRect;188 Result := inherited; 192 189 Angle := 60 / 180 * Pi; 193 190 Shift := TPointF.Create(0.5, 0.5) * TPointF.Create(Cos(Angle), Sin(Angle)); … … 209 206 Doc.Free; 210 207 end; 211 inherited LoadFromFile(FileName);208 inherited; 212 209 end; 213 210 … … 225 222 Doc.Free; 226 223 end; 227 inherited SaveToFile(FileName);224 inherited; 228 225 end; 229 226 … … 346 343 function TIsometricMap.CalculatePixelRect: TRect; 347 344 begin 348 Result := inherited CalculatePixelRect;345 Result := inherited; 349 346 Result.P2 := Result.P2 - TPoint.Create( 350 347 Trunc(0.5 * DefaultCellSize.X / CellMulX), … … 383 380 Angle: Double; 384 381 begin 385 Result := inherited CalculatePixelRect;382 Result := inherited; 386 383 Angle := 30 / 180 * Pi; 387 384 Shift := TPointF.Create(0.5, 0.5) * TPointF.Create(Cos(Angle), Sin(Angle)); … … 423 420 Doc.Free; 424 421 end; 425 inherited LoadFromFile(FileName);422 inherited; 426 423 end; 427 424 … … 439 436 Doc.Free; 440 437 end; 441 inherited SaveToFile(FileName);438 inherited; 442 439 end; 443 440 … … 766 763 function TTriangleMap.CalculatePixelRect: TRect; 767 764 begin 768 Result := inherited CalculatePixelRect;765 Result := inherited; 769 766 Result.P2 := Result.P2 + TPoint.Create( 770 767 Trunc(- 0.25 * DefaultCellSize.X / CellMulX), -
trunk/UNation.pas
r315 r316 1 1 unit UNation; 2 3 {$mode delphi}4 2 5 3 interface -
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; -
trunk/UServerList.pas
r199 r316 1 1 unit UServerList; 2 3 {$mode delphi}4 2 5 3 interface 6 4 7 5 uses 8 Classes, SysUtils, fgl, XMLConf;6 Classes, SysUtils, Generics.Collections, XMLConf; 9 7 10 8 type … … 25 23 end; 26 24 27 TServerInfos = class(T FPGObjectList<TServerInfo>)25 TServerInfos = class(TObjectList<TServerInfo>) 28 26 end; 29 27 … … 88 86 destructor TServerList.Destroy; 89 87 begin 90 Items.Free;91 inherited Destroy;88 FreeAndNil(Items); 89 inherited; 92 90 end; 93 91 -
trunk/UTCP.pas
r179 r316 1 1 unit UTCP; 2 3 {$mode Delphi}{$H+}4 2 5 3 interface … … 46 44 procedure Execute; override; 47 45 end; 48 49 46 50 47 { TTCPServer } … … 124 121 begin 125 122 Active := False; 126 FSocket.Free;127 inherited Destroy;123 DestroyFSocket); 124 inherited; 128 125 end; 129 126 … … 169 166 ThreadPool.Destroy; 170 167 Active := False; 171 inherited Destroy;168 inherited; 172 169 end; 173 170 -
trunk/UUnit.pas
r315 r316 1 1 unit UUnit; 2 2 3 {$mode delphi}4 5 3 interface 6 4 7 5 uses 8 Classes, SysUtils, fgl, UGeometry, DOM, XML, UItemList;6 Classes, SysUtils, Generics.Collections, UGeometry, DOM, XML, UItemList; 9 7 10 8 type … … 64 62 { TUnits } 65 63 66 TUnits = class(T FPGObjectList<TUnit>)64 TUnits = class(TObjectList<TUnit>) 67 65 NewId: Integer; 68 66 Game: TObject; //TGame; … … 304 302 destructor TUnit.Destroy; 305 303 begin 306 inherited Destroy;304 inherited; 307 305 end; 308 306 -
trunk/xtactics.lpr
r313 r316 29 29 30 30 RequireDerivedFormResource := True; 31 Application.Scaled :=True;31 Application.Scaled:=True; 32 32 Application.Initialize; 33 33 Application.CreateForm(TCore, Core);
Note:
See TracChangeset
for help on using the changeset viewer.