Changeset 354 for trunk/Core.pas
- Timestamp:
- Dec 29, 2024, 1:35:37 PM (6 days ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Core.pas
r352 r354 83 83 procedure Delay(Time: Integer); 84 84 procedure GameNewTurnExecute(Sender: TObject); 85 procedure AutoSave;86 85 procedure CommandLineParams; 87 86 procedure SelectClient; … … 89 88 procedure FormClientActions; 90 89 procedure LoadGameSystems; 90 function GetAutoSaveFileName: string; 91 91 public 92 92 Game: TGame; … … 98 98 CellGridVisible: Boolean; 99 99 UnitShapeVisible: Boolean; 100 AutoSaveEnabled: Boolean;101 ReopenLastFile: Boolean;102 100 FormClients: TFormClients; 103 101 LocalClients: TClients; … … 105 103 GameSystems: TGameSystems; 106 104 FormMain: TFormMain; 105 procedure AutoSave; 107 106 procedure ReopenGameOnInit; 108 107 procedure LoadConfig; … … 145 144 SRestartGameQuestion = 'Do you want to restart current game?'; 146 145 SPlayersNotInitialized = 'Not all players were initialized with start cell. Needed %d, initialized %d. Change map parameters to have more terrain cells.'; 147 SFileDialogFilter = 'xTactics games ( .xtg)|*.xtg|All files|*.*';146 SFileDialogFilter = 'xTactics games (' + GameFileExt + ')|*' + GameFileExt + '|All files|*.*'; 148 147 SMissingServerClientForPlayer = 'Server client for current player not found.'; 149 148 … … 188 187 procedure TCore.GameNewTurnExecute(Sender: TObject); 189 188 begin 190 if AutoSaveEnabled thenAutoSave;189 AutoSave; 191 190 end; 192 191 … … 196 195 begin 197 196 OldFileName := Game.FileName; 198 Game.SaveToFile(GetA ppConfigDir(False) + 'AutoSave.xtg');197 Game.SaveToFile(GetAutoSaveFileName); 199 198 Game.FileName := OldFileName; 200 199 end; … … 210 209 DevelMode := XMLConfig1.GetValue('DevelMode', false); 211 210 AnimationSpeed := XMLConfig1.GetValue('AnimationSpeed', 50); 212 AutoSaveEnabled := XMLConfig1.GetValue('AutoSave', True);213 ReopenLastFile := XMLConfig1.GetValue('ReopenLastFile', True);214 211 Translator1.Language := Translator1.Languages.SearchByCode(String(XMLConfig1.GetValue('Language', ''))); 215 212 ScaleDPI1.DPI := Point(XMLConfig1.GetValue('DPIX', 96), XMLConfig1.GetValue('DPIY', 96)); … … 227 224 XMLConfig1.SetValue('DevelMode', DevelMode); 228 225 XMLConfig1.SetValue('AnimationSpeed', AnimationSpeed); 229 XMLConfig1.SetValue('AutoSave', AutoSaveEnabled);230 XMLConfig1.SetValue('ReopenLastFile', ReopenLastFile);231 226 XMLConfig1.SetValue('DPIX', ScaleDPI1.DPI.X); 232 227 XMLConfig1.SetValue('DPIY', ScaleDPI1.DPI.Y); … … 695 690 end; 696 691 692 function TCore.GetAutoSaveFileName: string; 693 begin 694 Result := GetAppConfigDir(False) + 'AutoSave' + GameFileExt; 695 end; 696 697 697 procedure TCore.ReopenGameOnInit; 698 var 699 OldFileName: string; 698 700 begin 699 701 CommandLineParams; 700 if not GameLoaded and ReopenLastFile and(LastOpenedList1.Items.Count > 0) and702 if not GameLoaded and (LastOpenedList1.Items.Count > 0) and 701 703 FileExists(LastOpenedList1.Items[0]) then 702 LoadGame(LastOpenedList1.Items[0]); 704 Game.FileName := LastOpenedList1.Items[0]; 705 706 if not GameLoaded and FileExists(GetAutoSaveFileName) then begin 707 OldFileName := Game.FileName; 708 LoadGame(GetAutoSaveFileName); 709 LastOpenedList1.Items.Delete(0); 710 Game.FileName := OldFileName; 711 end; 703 712 704 713 if Game.FileName = '' then begin
Note:
See TracChangeset
for help on using the changeset viewer.