Changeset 316


Ignore:
Timestamp:
Jun 19, 2024, 11:53:06 PM (5 months ago)
Author:
chronos
Message:
  • Modified: Code cleanup.
Location:
trunk
Files:
41 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormCharts.pas

    r243 r316  
    11unit UFormCharts;
    2 
    3 {$mode delphi}
    42
    53interface
     
    1917    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
    2018    procedure FormShow(Sender: TObject);
    21   private
    22     { private declarations }
    2319  public
    2420    procedure Redraw;
     
    2824var
    2925  FormCharts: TFormCharts;
     26
    3027
    3128implementation
  • trunk/Forms/UFormChat.pas

    r243 r316  
    11unit UFormChat;
    2 
    3 {$mode delphi}
    42
    53interface
  • trunk/Forms/UFormClient.pas

    r315 r316  
    11unit UFormClient;
    2 
    3 {$mode delphi}{$H+}
    42
    53interface
     
    109107  MapBackgroundColor = $404040;
    110108
     109
    111110implementation
    112111
  • trunk/Forms/UFormGameSystem.pas

    r291 r316  
    11unit UFormGameSystem;
    2 
    3 {$mode delphi}
    42
    53interface
  • trunk/Forms/UFormGameSystems.pas

    r278 r316  
    11unit UFormGameSystems;
    2 
    3 {$mode delphi}
    42
    53interface
     
    4745    FGameSystems: TGameSystems;
    4846    procedure SetGameSystems(AValue: TGameSystems);
    49 
    5047  public
    5148    procedure UpdateInterface;
  • trunk/Forms/UFormHelp.pas

    r245 r316  
    11unit UFormHelp;
    2 
    3 {$mode delphi}
    42
    53interface
     
    1715    procedure FormCreate(Sender: TObject);
    1816    procedure FormShow(Sender: TObject);
    19   private
    20     { private declarations }
    21   public
    22     { public declarations }
    2317  end;
    2418
  • trunk/Forms/UFormItem.pas

    r300 r316  
    11unit UFormItem;
    2 
    3 {$mode delphi}
    42
    53interface
     
    75uses
    86  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, UItemList,
    9   ExtCtrls, ColorBox, Spin, fgl;
     7  ExtCtrls, ColorBox, Spin, Generics.Collections;
    108
    119type
     
    2321  private
    2422    FItem: TItem;
    25     DataControls: TFPGObjectList<TControl>;
    26     DataLabels: TFPGObjectList<TLabel>;
     23    DataControls: TObjectList<TControl>;
     24    DataLabels: TObjectList<TLabel>;
    2725    procedure ControlChangeExecute(Sender: TObject);
    2826    procedure SetItem(AValue: TItem);
     
    6260  Core.CoolTranslator1.TranslateComponentRecursive(Self);
    6361  Core.ThemeManager1.UseTheme(Self);
    64   DataControls := TFPGObjectList<TControl>.Create;
    65   DataLabels := TFPGObjectList<TLabel>.Create;
     62  DataControls := TObjectList<TControl>.Create;
     63  DataLabels := TObjectList<TLabel>.Create;
    6664end;
    6765
  • trunk/Forms/UFormKeyShortcuts.pas

    r243 r316  
    11unit UFormKeyShortcuts;
    2 
    3 {$mode delphi}
    42
    53interface
     
    2119    procedure FormShow(Sender: TObject);
    2220    procedure MenuItem1Click(Sender: TObject);
    23   private
    2421  public
    2522    procedure LoadFromComponent(C: TComponent);
     
    2825var
    2926  FormKeyShortcuts: TFormKeyShortcuts;
     27
    3028
    3129implementation
  • trunk/Forms/UFormList.pas

    r301 r316  
    11unit UFormList;
    2 
    3 {$mode delphi}
    42
    53interface
     
    75uses
    86  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls,
    9   ActnList, Menus, fgl, UItemList;
     7  ActnList, Menus, UItemList;
    108
    119type
  • trunk/Forms/UFormMain.pas

    r310 r316  
    11unit UFormMain;
    2 
    3 {$mode delphi}{$H+}
    42
    53interface
     
    103101  FormMain: TFormMain;
    104102
     103
    105104implementation
    106105
  • trunk/Forms/UFormMove.pas

    r274 r316  
    11unit UFormMove;
    2 
    3 {$mode delphi}
    42
    53interface
     
    4240    procedure TrackBarOnceChange(Sender: TObject);
    4341    procedure TrackBarRepeatChange(Sender: TObject);
    44   private
    45     { private declarations }
    4642  public
    4743    DefendCount: Integer;
     
    5450var
    5551  FormMove: TFormMove;
     52
    5653
    5754implementation
  • trunk/Forms/UFormNew.pas

    r304 r316  
    11unit UFormNew;
    2 
    3 {$mode delphi}
    42
    53interface
  • trunk/Forms/UFormPlayersStats.pas

    r315 r316  
    11unit UFormPlayersStats;
    2 
    3 {$mode delphi}
    42
    53interface
     
    2624    function ListViewSort1CompareItem(Item1, Item2: TObject): Integer;
    2725    procedure ListViewSort1Filter(ListViewSort: TListViewSort);
    28   private
    29 
    3026  public
    3127    procedure ReloadList;
  • trunk/Forms/UFormServer.pas

    r288 r316  
    11unit UFormServer;
    2 
    3 {$mode delphi}
    42
    53interface
     
    3533var
    3634  FormServer: TFormServer;
     35
    3736
    3837implementation
  • trunk/Forms/UFormSettings.pas

    r315 r316  
    11unit UFormSettings;
    2 
    3 {$mode delphi}
    42
    53interface
     
    4038    procedure FormCreate(Sender: TObject);
    4139    procedure FormShow(Sender: TObject);
    42   private
    43     { private declarations }
    4440  public
    4541    procedure Load;
     
    4945var
    5046  FormSettings: TFormSettings;
     47
    5148
    5249implementation
  • trunk/Forms/UFormUnitMoves.pas

    r243 r316  
    11unit UFormUnitMoves;
    2 
    3 {$mode delphi}
    42
    53interface
  • trunk/Packages/CoolStreaming/Demo/VarBlockSerializer/UMainForm.pas

    r185 r316  
    11unit UMainForm;
    2 
    3 {$mode Delphi}{$H+}
    42
    53interface
     
    8078  MainForm: TMainForm;
    8179
     80
    8281implementation
    8382
  • trunk/Packages/PinConnection/UCommFrame.pas

    r214 r316  
    200200end;
    201201
    202 
    203202end.
  • trunk/Packages/PinConnection/UCommPin.pas

    r185 r316  
    8989begin
    9090  Pin.Free;
    91   inherited Destroy;
     91  inherited;
    9292end;
    9393
     
    177177end;
    178178
    179 
    180179end.
  • trunk/Read me.txt

    r313 r316  
    1 Developed using Lazarus 2.2.0 (http://www.lazarus-ide.org/)
     1Developed using Lazarus 3.4.0 (http://www.lazarus-ide.org/)
  • trunk/UBuilding.pas

    r299 r316  
    11unit UBuilding;
    2 
    3 {$mode delphi}
    42
    53interface
  • trunk/UClientAI.pas

    r274 r316  
    11unit UClientAI;
    22
    3 {$mode delphi}
    4 
    53interface
    64
    75uses
    8   Classes, SysUtils, UGameClient, UGame, Math, UPlayer, UMap;
     6  Classes, SysUtils, UGameClient, UGame, Math, UPlayer, UMap, Generics.Defaults;
    97
    108type
     
    5351  AllCells := ControlPlayer.PlayerMap.Cells;
    5452  TargetCells := TPlayerCells.Create;
    55   TargetCells.FreeObjects := False;
     53  TargetCells.OwnsObjects := False;
    5654
    5755  // Get list of all attack target cells
     
    7068  // Sort ascending to attack cells with lower power first
    7169  // Low power cells are better for expanding our territory
    72   TargetCells.Sort(CellCompare);
     70  TargetCells.Sort(TComparer<TPlayerCell>.Construct(CellCompare));
    7371
    7472  for Cell in TargetCells do
     
    113111  DefendCount: Integer;
    114112begin
    115 if ControlPlayer.Defensive then Exit;
     113  if ControlPlayer.Defensive then Exit;
    116114
    117115  AllCells := ControlPlayer.PlayerMap.Cells;
    118116  TargetCells := TPlayerCells.Create;
    119   TargetCells.FreeObjects := False;
     117  TargetCells.OwnsObjects := False;
    120118
    121119  // Get list of all attack target cells
     
    134132  // Sort descending to attack cells with higher power first
    135133  // Higher power enemy cells can grow faster and is more dangerous
    136   TargetCells.Sort(CellCompareDescending);
     134  TargetCells.Sort(TComparer<TPlayerCell>.Construct(CellCompareDescending));
    137135
    138136  for TargetCell in TargetCells do begin
     
    188186  AllCells := ControlPlayer.PlayerMap.Cells;
    189187  TargetCells := TPlayerCells.Create;
    190   TargetCells.FreeObjects := False;
     188  TargetCells.OwnsObjects := False;
    191189  NewTargetCells := TPlayerCells.Create;
    192   NewTargetCells.FreeObjects := False;
     190  NewTargetCells.OwnsObjects := False;
    193191
    194192  // Get list of all enemy border cells
     
    252250    TargetCells := NewTargetCells;
    253251    NewTargetCells := TPlayerCells.Create;
    254     NewTargetCells.FreeObjects := False;
     252    NewTargetCells.OwnsObjects := False;
    255253  end;
    256254
     
    293291begin
    294292  BorderCells := TPlayerCells.Create;
    295   BorderCells.FreeObjects := False;
     293  BorderCells.OwnsObjects := False;
    296294  AllCells := ControlPlayer.PlayerMap.Cells;
    297295
  • trunk/UClientGUI.pas

    r299 r316  
    11unit UClientGUI;
    2 
    3 {$mode delphi}
    42
    53interface
     
    6866  end;
    6967
     68
    7069implementation
    7170
     
    9897begin
    9998  FreeAndNil(View);
    100   inherited Destroy;
     99  inherited;
    101100end;
    102101
     
    552551destructor TView.Destroy;
    553552begin
    554   inherited Destroy;
     553  inherited;
    555554end;
    556555
  • trunk/UCore.pas

    r315 r316  
    11unit UCore;
    2 
    3 {$mode delphi}
    42
    53interface
     
    97  UGame, ApplicationInfo, PersistentForm, ScaleDPI, Translator, DOM,
    108  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;
    1311
    1412type
     
    10199    AutoSaveEnabled: Boolean;
    102100    ReopenLastFile: Boolean;
    103     FormClients: TFPGObjectList<TFormClient>;
     101    FormClients: TObjectList<TFormClient>;
    104102    LocalClients: TClients;
    105103    ServerList: TServerList;
     
    495493  XMLConfig1.Filename := GetAppConfigDir(False) + 'Config.xml';
    496494  ForceDirectories(GetAppConfigDir(False));
    497   FormClients := TFPGObjectList<TFormClient>.Create;
     495  FormClients := TObjectList<TFormClient>.Create;
    498496  ServerList := TServerList.Create;
    499497end;
  • trunk/UGame.pas

    r315 r316  
    11unit UGame;
    2 
    3 {$mode delphi}{$H+}
    42
    53interface
     
    75uses
    86  Classes, SysUtils, ExtCtrls, Graphics, XMLConf, XMLRead, XMLWrite, Forms,
    9   DOM, Math, LazFileUtils, XML, Dialogs, LCLType, LCLIntf, fgl, UBuilding,
    10   UGeometry, UPlayer, UMap, UMapType, UUnit, UGameSystem;
     7  DOM, Math, LazFileUtils, XML, Dialogs, LCLType, LCLIntf, UBuilding, UGeometry,
     8  UPlayer, UMap, UMapType, UUnit, UGameSystem;
    119
    1210const
     
    387385    List := TCells.Create;
    388386    try
    389       List.FreeObjects := False;
     387      List.OwnsObjects := False;
    390388      Map.Cells.GetCellsWithWeight(List, Round(LongestDistance * 0.6), Round(LongestDistance * 0.8));
    391389
     
    415413      Player.StartCell.Mark := True;
    416414      List := TCells.Create;
    417       List.FreeObjects := False;
     415      List.OwnsObjects := False;
    418416      List.Add(Player.StartCell);
    419417      PropagatePlayerDistance(List);
     
    430428begin
    431429  NeighborList := TCells.Create;
    432   NeighborList.FreeObjects := False;
     430  NeighborList.OwnsObjects := False;
    433431
    434432  for Cell in List do begin
     
    880878  FreeAndNil(Units);
    881879  FreeAndNil(GameSystem);
    882   inherited Destroy;
     880  inherited;
    883881end;
    884882
  • trunk/UGameClient.pas

    r315 r316  
    11unit UGameClient;
    22
    3 {$mode delphi}
    4 
    53interface
    64
    75uses
    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;
    108
    119type
     
    7068  { TClients }
    7169
    72   TClients = class(TFPGObjectList<TClient>)
     70  TClients = class(TObjectList<TClient>)
    7371    Game: TGame;
    7472    function New(Name: string): TClient;
     
    248246  FreeAndNil(CommThread);
    249247  FreeAndNil(CommFrame);
    250   inherited Destroy;
     248  inherited;
    251249end;
    252250
  • trunk/UGameConnection.pas

    r202 r316  
    11unit UGameConnection;
    2 
    3 {$mode delphi}
    42
    53interface
     
    1614  TConnectParams = class
    1715    NetworkAddress: TNetworkAddress;
     16  end;
    1817
    19   end;
    2018
    2119implementation
  • trunk/UGameProtocol.pas

    r220 r316  
    11unit UGameProtocol;
    2 
    3 {$mode delphi}
    42
    53interface
     
    124122destructor TGameProtocolServer.Destroy;
    125123begin
    126   Pin.Free;
    127   inherited Destroy;
     124  FreeAndNil(Pin);
     125  inherited;
    128126end;
    129127
     
    240238destructor TGameProtocolClient.Destroy;
    241239begin
    242   Pin.Free;
    243   inherited Destroy;
     240  FreeAndNil(Pin);
     241  inherited;
    244242end;
    245243
  • trunk/UGameServer.pas

    r287 r316  
    11unit UGameServer;
    22
    3 {$mode delphi}
    4 
    53interface
    64
    75uses
    8   Classes, SysUtils, UGame, DOM, XMLConf, fgl, UGameProtocol, UCommFrame, UPlayer;
     6  Classes, SysUtils, UGame, DOM, XMLConf, Generics.Collections, UGameProtocol,
     7  UCommFrame, UPlayer;
    98
    109type
     
    3231  { TServerClients }
    3332
    34   TServerClients = class(TFPGObjectList<TServerClient>)
     33  TServerClients = class(TObjectList<TServerClient>)
    3534    Game: TGame;
    3635    function SearchByPlayer(Player: TPlayer): TServerClient;
     
    7372  DefaultServerPort = 40009;
    7473
     74
    7575implementation
    7676
     
    120120destructor TServerClient.Destroy;
    121121begin
    122   Protocol.Free;
    123   CommFrame.Free;
    124   inherited Destroy;
     122  FreeAndNil(Protocol);
     123  FreeAndNil(CommFrame);
     124  inherited;
    125125end;
    126126
     
    278278begin
    279279  FreeAndNil(Clients);
    280   inherited Destroy;
     280  inherited;
    281281end;
    282282
  • trunk/UGameSystem.pas

    r315 r316  
    11unit UGameSystem;
    22
    3 {$mode delphi}
    4 
    53interface
    64
    75uses
    8   Classes, SysUtils, fgl, UUnit, DOM, XMLRead, XMLWrite, XML, XMLConf,
     6  Classes, SysUtils, Generics.Collections, UUnit, DOM, XMLRead, XMLWrite, XML, XMLConf,
    97  FileUtil, LazFileUtils, UMapType, UNation, UBuilding;
    108
     
    3937  { TGameSystems }
    4038
    41   TGameSystems = class(TFPGObjectList<TGameSystem>)
     39  TGameSystems = class(TObjectList<TGameSystem>)
    4240    function AddNew(Name: string): TGameSystem;
    4341    function SearchByName(Name: string): TGameSystem;
     
    103101destructor TGameSystem.Destroy;
    104102begin
    105   Nations.Free;
    106   BuildingKinds.Free;
    107   UnitKinds.Free;
    108   inherited Destroy;
     103  FreeAndNil(Nations);
     104  FreeAndNil(BuildingKinds);
     105  FreeAndNil(UnitKinds);
     106  inherited;
    109107end;
    110108
  • trunk/UGeometry.pas

    r306 r316  
    11unit UGeometry;
    2 
    3 {$mode delphi}
    42
    53interface
  • trunk/UGeometryClasses.pas

    r192 r316  
    11unit UGeometryClasses;
    2 
    3 {$mode delphi}{$H+}
    42
    53interface
  • trunk/UItemList.pas

    r315 r316  
    11unit UItemList;
    22
    3 {$mode delphi}
    4 
    53interface
    64
    75uses
    8   Classes, SysUtils, fgl, DOM, XML, Common, Graphics;
     6  Classes, SysUtils, Generics.Collections, DOM, XML, Common, Graphics;
    97
    108type
     
    3331  { TItemFields }
    3432
    35   TItemFields = class(TFPGObjectList<TItemField>)
     33  TItemFields = class(TObjectList<TItemField>)
    3634    function AddField(Index: Integer; SysName, Name: string; DataType: TDataType): TItemField;
    3735    function SearchByIndex(Index: Integer): TItemField;
     
    7876  { TItemList }
    7977
    80   TItemList = class(TFPGObjectList<TItem>)
     78  TItemList = class(TObjectList<TItem>)
    8179    NewId: Integer;
    8280    class function GetItemClass: TItemClass; virtual;
     
    120118destructor TItemField.Destroy;
    121119begin
    122   EnumStates.Free;
    123   inherited Destroy;
     120  FreeAndNil(EnumStates);
     121  inherited;
    124122end;
    125123
     
    316314    ReferenceList := GetReferenceList(Field.Index);
    317315    if (ReadId > 0) and Assigned(ReferenceList) then
    318       SetValueReference(Field.Index, TItem(ReferenceList.List[ReadId]));
     316      SetValueReference(Field.Index, TItem(ReferenceList[ReadId]));
    319317  end else
    320318    raise Exception.Create(Format(SUnsupportedDataType, [DataTypeStr[Field.DataType]]));
  • trunk/UMap.pas

    r315 r316  
    11unit UMap;
    22
    3 {$mode delphi}
    4 
    53interface
    64
    75uses
    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;
    108
    119const
     
    7876  { TCells }
    7977
    80   TCells = class(TFPGObjectList<TCell>)
     78  TCells = class(TObjectList<TCell>)
    8179    Map: TMap;
    8280    procedure FixRefId;
     
    105103  { TCellLinks }
    106104
    107   TCellLinks = class(TFPGObjectList<TCellLink>)
     105  TCellLinks = class(TObjectList<TCellLink>)
    108106    Map: TMap;
    109107    function FindByCells(Cell1, Cell2: TCell): TCellLink;
     
    136134  end;
    137135
    138   TMapAreas = class(TFPGObjectList<TMapArea>)
     136  TMapAreas = class(TObjectList<TMapArea>)
    139137  end;
    140138
     
    239237begin
    240238  Cells := TCells.Create;
    241   Cells.FreeObjects := False;
     239  Cells.OwnsObjects := False;
    242240end;
    243241
     
    253251  end;
    254252  FreeAndNil(Cells);
    255   inherited Destroy;
     253  inherited;
    256254end;
    257255
     
    336334begin
    337335  Cells := TCells.Create;
    338   Cells.FreeObjects := False;
     336  Cells.OwnsObjects := False;
    339337end;
    340338
     
    342340begin
    343341  FreeAndNil(Cells);
    344   inherited Destroy;
     342  inherited;
    345343end;
    346344
     
    456454end;
    457455
    458 function CompareCellAngle(const C1, C2: TCell): Integer;
     456function CompareCellAngle(constref C1, C2: TCell): Integer;
    459457begin
    460458  if C1.Angle < C2.Angle then Result := -1
     
    472470      NeighborCell.Angle := TLine.Create(Cell.PosPx, NeighborCell.PosPx).GetAngle;
    473471
    474     Cell.Neighbors.Sort(CompareCellAngle);
     472    Cell.Neighbors.Sort(TComparer<TCell>.Construct(CompareCellAngle));
    475473  end;
    476474end;
     
    770768  FreeAndNil(Image);
    771769  FreeAndNil(Cells);
    772   inherited Destroy;
     770  inherited;
    773771end;
    774772
     
    803801  Result := nil;
    804802  NewList := TCells.Create;
    805   NewList.FreeObjects := False;
     803  NewList.OwnsObjects := False;
    806804  NewListVoid := TCells.Create;
    807   NewListVoid.FreeObjects := False;
     805  NewListVoid.OwnsObjects := False;
    808806
    809807  for C := 0 to List.Count - 1 do
     
    845843begin
    846844  List := TCells.Create;
    847   List.FreeObjects := False;
     845  List.OwnsObjects := False;
    848846
    849847  BorderList := TCells.Create;
    850   BorderList.FreeObjects := False;
     848  BorderList.OwnsObjects := False;
    851849
    852850  // Build area bridges
     
    11331131  Player := nil;
    11341132  Neighbors := TCells.Create;
    1135   Neighbors.FreeObjects := False;
     1133  Neighbors.OwnsObjects := False;
    11361134  Links := TCellLinks.Create;
    1137   Links.FreeObjects := False;
     1135  Links.OwnsObjects := False;
    11381136end;
    11391137
     
    11501148      raise Exception.Create(SCellRemoveNeighborError);
    11511149  FreeAndNil(Neighbors);
    1152   inherited Destroy;
     1150  inherited;
    11531151end;
    11541152
  • trunk/UMapType.pas

    r281 r316  
    11unit UMapType;
    22
    3 {$mode delphi}
    4 
    53interface
    64
    75uses
    8   Classes, SysUtils, XMLRead, XMLWrite, DOM, UGeometry, fgl, UMap;
     6  Classes, SysUtils, XMLRead, XMLWrite, DOM, UGeometry, UMap;
    97
    108type
     
    8381
    8482  TVoronoiMap = class(TMap)
    85   private
    8683  public
    8784    procedure Generate; override;
     
    189186  Angle: Double;
    190187begin
    191   Result := inherited CalculatePixelRect;
     188  Result := inherited;
    192189  Angle := 60 / 180 * Pi;
    193190  Shift := TPointF.Create(0.5, 0.5) * TPointF.Create(Cos(Angle), Sin(Angle));
     
    209206    Doc.Free;
    210207  end;
    211   inherited LoadFromFile(FileName);
     208  inherited;
    212209end;
    213210
     
    225222    Doc.Free;
    226223  end;
    227   inherited SaveToFile(FileName);
     224  inherited;
    228225end;
    229226
     
    346343function TIsometricMap.CalculatePixelRect: TRect;
    347344begin
    348   Result := inherited CalculatePixelRect;
     345  Result := inherited;
    349346  Result.P2 := Result.P2 - TPoint.Create(
    350347    Trunc(0.5 * DefaultCellSize.X / CellMulX),
     
    383380  Angle: Double;
    384381begin
    385   Result := inherited CalculatePixelRect;
     382  Result := inherited;
    386383  Angle := 30 / 180 * Pi;
    387384  Shift := TPointF.Create(0.5, 0.5) * TPointF.Create(Cos(Angle), Sin(Angle));
     
    423420    Doc.Free;
    424421  end;
    425   inherited LoadFromFile(FileName);
     422  inherited;
    426423end;
    427424
     
    439436    Doc.Free;
    440437  end;
    441   inherited SaveToFile(FileName);
     438  inherited;
    442439end;
    443440
     
    766763function TTriangleMap.CalculatePixelRect: TRect;
    767764begin
    768   Result := inherited CalculatePixelRect;
     765  Result := inherited;
    769766  Result.P2 := Result.P2 + TPoint.Create(
    770767    Trunc(- 0.25 * DefaultCellSize.X / CellMulX),
  • trunk/UNation.pas

    r315 r316  
    11unit UNation;
    2 
    3 {$mode delphi}
    42
    53interface
  • trunk/UPlayer.pas

    r315 r316  
    11unit UPlayer;
    22
    3 {$mode delphi}
    4 
    53interface
    64
    75uses
    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;
    108
    119type
     
    3836  { TPlayerCells }
    3937
    40   TPlayerCells = class(TFPGObjectList<TPlayerCell>)
     38  TPlayerCells = class(TObjectList<TPlayerCell>)
    4139    Map: TPlayerMap;
    4240    function FindByCellId(Id: Integer): TPlayerCell;
     
    8482  { TGameTurnStats }
    8583
    86   TGameTurnStats = class(TFPGObjectList<TGameTurnStat>)
     84  TGameTurnStats = class(TObjectList<TGameTurnStat>)
    8785    procedure LoadFromNode(Node: TDOMNode);
    8886    procedure SaveToNode(Node: TDOMNode);
     
    192190  { TUnitMoves }
    193191
    194   TUnitMoves = class(TFPGObjectList<TUnitMove>)
     192  TUnitMoves = class(TObjectList<TUnitMove>)
    195193    Game: TObject; //TGame;
    196194    Player: TPlayer;
     
    200198  end;
    201199
    202 function CellCompare(const Item1, Item2: TPlayerCell): Integer;
    203 function CellCompareDescending(const Item1, Item2: TPlayerCell): Integer;
     200function CellCompare(constref Item1, Item2: TPlayerCell): Integer;
     201function CellCompareDescending(constref Item1, Item2: TPlayerCell): Integer;
    204202
    205203
     
    225223  SDefensive = 'Defensive';
    226224
    227 function ComparePointer(const Item1, Item2: Integer): Integer;
     225function ComparePointer(constref Item1, Item2: Integer): Integer;
    228226begin
    229227  Result := -CompareValue(Item1, Item2);
     
    311309begin
    312310  MovesFrom := TUnitMoves.Create;
    313   MovesFrom.FreeObjects := False;
     311  MovesFrom.OwnsObjects := False;
    314312  MovesTo := TUnitMoves.Create;
    315   MovesTo.FreeObjects := False;
     313  MovesTo.OwnsObjects := False;
    316314  Neighbors := TPlayerCells.Create;
    317   Neighbors.FreeObjects := False;
     315  Neighbors.OwnsObjects := False;
    318316end;
    319317
     
    334332      raise Exception.Create(SCellRemoveNeighborError);
    335333  FreeAndNil(Neighbors);
    336   inherited Destroy;
     334  inherited;
    337335end;
    338336
     
    480478begin
    481479  FreeAndNil(Cells);
    482   inherited Destroy;
     480  inherited;
    483481end;
    484482
     
    718716  CellTo := nil;
    719717  List := nil;
    720   inherited Destroy;
     718  inherited;
    721719end;
    722720
     
    864862  S: string;
    865863  I: Integer;
    866   AttackRolls: TFPGList<Integer>;
    867   DefendRolls: TFPGList<Integer>;
    868 begin
    869   AttackRolls := TFPGList<Integer>.Create;
    870   DefendRolls := TFPGList<Integer>.Create;
     864  AttackRolls: TList<Integer>;
     865  DefendRolls: TList<Integer>;
     866begin
     867  AttackRolls := TList<Integer>.Create;
     868  DefendRolls := TList<Integer>.Create;
    871869  if AttackPower < 1 then
    872870    raise Exception.Create(SAttackerPowerPositive);
     
    884882      AttackRolls[I] := Random(7);
    885883    end;
    886     AttackRolls.Sort(ComparePointer);
     884    AttackRolls.Sort(TComparer<Integer>.Construct(ComparePointer));
    887885    S := 'Att:';
    888886    for I := 0 to AttackerDiceCount - 1 do
     
    892890      DefendRolls[I] := Random(7);
    893891    end;
    894     DefendRolls.Sort(ComparePointer);
     892    DefendRolls.Sort(TComparer<Integer>.Construct(ComparePointer));
    895893    S := S + ' Def:';
    896894    for I := 0 to DefenderDiceCount - 1 do
     
    905903end;
    906904
    907 function CellCompare(const Item1, Item2: TPlayerCell): Integer;
     905function CellCompare(constref Item1, Item2: TPlayerCell): Integer;
    908906var
    909907  Stack1, Stack2: Integer;
     
    918916end;
    919917
    920 function CellCompareDescending(const Item1, Item2: TPlayerCell): Integer;
     918function CellCompareDescending(constref Item1, Item2: TPlayerCell): Integer;
    921919var
    922920  Stack1, Stack2: Integer;
  • trunk/UServerList.pas

    r199 r316  
    11unit UServerList;
    2 
    3 {$mode delphi}
    42
    53interface
    64
    75uses
    8   Classes, SysUtils, fgl, XMLConf;
     6  Classes, SysUtils, Generics.Collections, XMLConf;
    97
    108type
     
    2523  end;
    2624
    27   TServerInfos = class(TFPGObjectList<TServerInfo>)
     25  TServerInfos = class(TObjectList<TServerInfo>)
    2826  end;
    2927
     
    8886destructor TServerList.Destroy;
    8987begin
    90   Items.Free;
    91   inherited Destroy;
     88  FreeAndNil(Items);
     89  inherited;
    9290end;
    9391
  • trunk/UTCP.pas

    r179 r316  
    11unit UTCP;
    2 
    3 {$mode Delphi}{$H+}
    42
    53interface
     
    4644    procedure Execute; override;
    4745  end;
    48 
    4946
    5047  { TTCPServer }
     
    124121begin
    125122  Active := False;
    126   FSocket.Free;
    127   inherited Destroy;
     123  DestroyFSocket);
     124  inherited;
    128125end;
    129126
     
    169166  ThreadPool.Destroy;
    170167  Active := False;
    171   inherited Destroy;
     168  inherited;
    172169end;
    173170
  • trunk/UUnit.pas

    r315 r316  
    11unit UUnit;
    22
    3 {$mode delphi}
    4 
    53interface
    64
    75uses
    8   Classes, SysUtils, fgl, UGeometry, DOM, XML, UItemList;
     6  Classes, SysUtils, Generics.Collections, UGeometry, DOM, XML, UItemList;
    97
    108type
     
    6462  { TUnits }
    6563
    66   TUnits = class(TFPGObjectList<TUnit>)
     64  TUnits = class(TObjectList<TUnit>)
    6765    NewId: Integer;
    6866    Game: TObject; //TGame;
     
    304302destructor TUnit.Destroy;
    305303begin
    306   inherited Destroy;
     304  inherited;
    307305end;
    308306
  • trunk/xtactics.lpr

    r313 r316  
    2929
    3030  RequireDerivedFormResource := True;
    31   Application.Scaled := True;
     31  Application.Scaled:=True;
    3232  Application.Initialize;
    3333  Application.CreateForm(TCore, Core);
Note: See TracChangeset for help on using the changeset viewer.