Ignore:
Timestamp:
Feb 3, 2019, 11:55:30 PM (6 years ago)
Author:
chronos
Message:
  • Fixed: Load/save game syste name correctly from/to file.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormGameSystem.pas

    r275 r276  
    77uses
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
    9   UGameSystem;
     9  ComCtrls, UGameSystem;
    1010
    1111type
     
    1818    ButtonSave: TButton;
    1919    ButtonLoad: TButton;
     20    CheckBoxEmptyCellsNeutral: TCheckBox;
     21    CheckBoxUnitsMoveImmediately: TCheckBox;
     22    CheckBoxUnitsSplitMerge: TCheckBox;
    2023    OpenDialog1: TOpenDialog;
     24    PageControl1: TPageControl;
    2125    SaveDialog1: TSaveDialog;
     26    TabSheetGeneral: TTabSheet;
     27    TabSheetUnits: TTabSheet;
    2228    procedure ButtonLoadClick(Sender: TObject);
    2329    procedure ButtonSaveClick(Sender: TObject);
     30    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
     31    procedure FormCreate(Sender: TObject);
     32    procedure FormShow(Sender: TObject);
    2433  private
    2534    FGameSystem: TGameSystem;
     
    3847implementation
    3948
     49{$R *.lfm}
     50
     51uses
     52  UCore;
     53
    4054resourcestring
    4155  SFileDialogFilter = 'xTactics game system (.xts)|*.xts|All files|*.*';
    42 
    43 
    44 {$R *.lfm}
    4556
    4657{ TFormGameSystem }
     
    6273  SaveDialog1.InitialDir := ExtractFileDir(GameSystem.FileName);
    6374  SaveDialog1.FileName := ExtractFileName(GameSystem.FileName);
     75  SaveDialog1.DefaultExt := GameSystemExt;
    6476  if SaveDialog1.Execute then begin
    6577    GameSystem.SaveToFile(SaveDialog1.FileName);
    6678  end;
     79end;
     80
     81procedure TFormGameSystem.FormClose(Sender: TObject;
     82  var CloseAction: TCloseAction);
     83begin
     84  Core.PersistentForm.Save(Self);
     85end;
     86
     87procedure TFormGameSystem.FormCreate(Sender: TObject);
     88begin
     89  Core.ThemeManager1.UseTheme(Self);
     90  Core.CoolTranslator1.TranslateComponentRecursive(Self);
     91end;
     92
     93procedure TFormGameSystem.FormShow(Sender: TObject);
     94begin
     95  Core.PersistentForm.Load(Self);
    6796end;
    6897
     
    75104procedure TFormGameSystem.LoadData(GameSystem: TGameSystem);
    76105begin
    77 
     106  Self.GameSystem := GameSystem;
     107  CheckBoxEmptyCellsNeutral.Checked := GameSystem.EmptyCellsNeutral;
     108  CheckBoxUnitsSplitMerge.Checked := GameSystem.UnitsSplitMerge;
     109  CheckBoxUnitsMoveImmediately.Checked := GameSystem.UnitsMoveImmediately;
    78110end;
    79111
    80112procedure TFormGameSystem.SaveData(GameSystem: TGameSystem);
    81113begin
    82 
     114  GameSystem.EmptyCellsNeutral := CheckBoxEmptyCellsNeutral.Checked;
     115  GameSystem.UnitsSplitMerge := CheckBoxUnitsSplitMerge.Checked;
     116  GameSystem.UnitsMoveImmediately := CheckBoxUnitsMoveImmediately.Checked;
    83117end;
    84118
Note: See TracChangeset for help on using the changeset viewer.