Changeset 346 for trunk/ServerList.pas


Ignore:
Timestamp:
Dec 25, 2024, 11:04:56 AM (27 hours ago)
Author:
chronos
Message:
  • Fixed: Build on Linux.
  • Modified: Improved internal code structure.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ServerList.pas

    r317 r346  
    2323  end;
    2424
     25  { TServerInfos }
     26
    2527  TServerInfos = class(TObjectList<TServerInfo>)
     28    procedure Assign(Source: TServerInfos);
    2629  end;
    2730
     
    6467end;
    6568
     69{ TServerInfos }
     70
     71procedure TServerInfos.Assign(Source: TServerInfos);
     72var
     73  I: Integer;
     74begin
     75  while Count > Source.Count do
     76    Delete(Count - 1);
     77  while Count < Source.Count do
     78    Add(TServerInfo.Create);
     79  for I := 0 to Count - 1 do begin
     80    Items[I].Assign(Source.Items[I]);
     81  end;
     82end;
     83
    6684{ TServerList }
    6785
    6886procedure TServerList.Assign(Source: TServerList);
    69 var
    70   I: Integer;
    7187begin
    72   while Items.Count > Source.Items.Count do
    73     Items.Delete(Items.Count - 1);
    74   while Items.Count < Source.Items.Count do
    75     Items.Add(TServerInfo.Create);
    76   for I := 0 to Items.Count - 1 do begin
    77     Items[I].Assign(Source.Items[I]);
    78   end;
     88  Name := Source.Name;
     89  Address := Source.Address;
     90  Items.Assign(Source.Items);
    7991end;
    8092
Note: See TracChangeset for help on using the changeset viewer.