Changeset 178 for trunk/UCore.pas


Ignore:
Timestamp:
Jan 30, 2018, 10:23:49 PM (7 years ago)
Author:
chronos
Message:
  • Fixed: Open/Save dialog with file filter and initial directory and name from current game.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UCore.pas

    r176 r178  
    111111  SRestartGameQuestion = 'Do you want to restart current game?';
    112112  SPlayersNotInitialized = 'Not all players were initialized with start cell. Needed %d, initialized %d. Change map parameters to have more terrain cells.';
     113  SFileDialogFilter = 'xTactics games (.xtg)|*.xtg|All files|*.*';
    113114
    114115
     
    307308procedure TCore.AGameLoadExecute(Sender: TObject);
    308309begin
    309   if (Game.FileName = '') and (LastOpenedList1.Items.Count > 0) then
    310     OpenDialog1.FileName := LastOpenedList1.Items[0]
    311     else OpenDialog1.FileName := Game.FileName;
     310  OpenDialog1.Filter := SFileDialogFilter;
     311  OpenDialog1.InitialDir := ExtractFileDir(Game.FileName);
     312  OpenDialog1.FileName := ExtractFileName(Game.FileName);
    312313  if OpenDialog1.Execute then begin
    313314    LoadGame(OpenDialog1.FileName);
     
    333334procedure TCore.AGameSaveExecute(Sender: TObject);
    334335begin
    335   if (Game.FileName = '') and (LastOpenedList1.Items.Count > 0) then
    336     SaveDialog1.FileName := ExtractFileDir(LastOpenedList1.Items[0])
    337     else SaveDialog1.FileName := Game.FileName;
     336  SaveDialog1.Filter := SFileDialogFilter;
     337  SaveDialog1.InitialDir := ExtractFileDir(Game.FileName);
     338  SaveDialog1.FileName := ExtractFileName(Game.FileName);
    338339  if SaveDialog1.Execute then begin
    339340    Game.SaveToFile(SaveDialog1.FileName);
Note: See TracChangeset for help on using the changeset viewer.