Changeset 130 for trunk/UCity.pas


Ignore:
Timestamp:
May 1, 2023, 4:02:31 PM (13 months ago)
Author:
chronos
Message:
  • Added: Allow to save/load game in multiple slots.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UCity.pas

    r110 r130  
    2828
    2929  TCities = class(TObjectList<TCity>)
     30    function SearchBySysName(SysName: string): TCity;
    3031    function AddNew(SysName, Name: string; Population: Integer): TCity;
    3132    procedure LoadFromRegistry(Context: TRegistryContext);
     
    8182{ TCities }
    8283
     84function TCities.SearchBySysName(SysName: string): TCity;
     85var
     86  I: Integer;
     87begin
     88  I := 0;
     89  while (I < Count) and (Items[I].SysName <> SysName) do Inc(I);
     90  if I < Count then Result := Items[I]
     91    else Result := nil;
     92end;
     93
    8394function TCities.AddNew(SysName, Name: string; Population: Integer): TCity;
    8495begin
Note: See TracChangeset for help on using the changeset viewer.