Ignore:
Timestamp:
Mar 10, 2019, 6:19:51 PM (6 years ago)
Author:
chronos
Message:
  • Modified: TNation and TNations classes now uses generic TItem and TItemList classes.
  • Added: Translation files for LCL.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormNations.pas

    r283 r284  
    77uses
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls,
    9   ActnList, Menus, UGameSystem, UNation;
     9  ActnList, Menus, UNation;
    1010
    1111type
     
    3333    ToolButton4: TToolButton;
    3434    procedure AAddExecute(Sender: TObject);
     35    procedure ACloneExecute(Sender: TObject);
    3536    procedure AModifyExecute(Sender: TObject);
    3637    procedure ARemoveExecute(Sender: TObject);
     
    137138end;
    138139
     140procedure TFormNations.ACloneExecute(Sender: TObject);
     141var
     142  TempEntry: TNation;
     143begin
     144  if Assigned(ListView1.Selected) then
     145  with TNation(ListView1.Selected.Data) do begin
     146    TempEntry := TNation.Create;
     147    TempEntry.Assign(TNation(ListView1.Selected.Data));
     148    FormNation := TFormNation.Create(Self);
     149    try
     150      TempEntry.Name := Nations.GetNextAvailableName(TempEntry.Name);
     151      FormNation.Load(TempEntry);
     152      if FormNation.ShowModal = mrOk then begin
     153        FormNation.Save(TempEntry);
     154        Nations.Add(TempEntry);
     155        TempEntry := nil;
     156        UpdateList;
     157        UpdateInterface;
     158      end;
     159    finally
     160      FreeAndNil(FormNation);
     161    end;
     162    TempEntry.Free;
     163  end;
     164end;
     165
    139166procedure TFormNations.ASelectAllExecute(Sender: TObject);
    140167var
Note: See TracChangeset for help on using the changeset viewer.