Changeset 354
- Timestamp:
- Dec 29, 2024, 1:35:37 PM (3 days ago)
- Location:
- trunk
- Files:
-
- 8 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 -
trunk/Forms/FormMain.pas
r337 r354 251 251 procedure TFormMain.FormClose(Sender: TObject; var CloseAction: TCloseAction); 252 252 begin 253 Core.Core.AutoSave; 253 254 Core.Core.Game.Running := False; 254 255 FormClient.Close; -
trunk/Forms/FormSettings.lfm
r325 r354 1 1 object FormSettings: TFormSettings 2 Left = 8512 Left = 545 3 3 Height = 613 4 Top = 4134 Top = 203 5 5 Width = 857 6 6 ActiveControl = ButtonOk … … 14 14 OnShow = FormShow 15 15 Position = poMainFormCenter 16 LCLVersion = '3. 4.0.0'16 LCLVersion = '3.6.0.0' 17 17 object ButtonOk: TButton 18 18 Left = 735 … … 51 51 object TabSheetGeneral: TTabSheet 52 52 Caption = 'General' 53 ClientHeight = 5 1254 ClientWidth = 83 153 ClientHeight = 506 54 ClientWidth = 835 55 55 ParentFont = False 56 56 object Panel1: TPanel 57 57 Left = 0 58 Height = 5 1258 Height = 506 59 59 Top = 0 60 Width = 83 160 Width = 835 61 61 Align = alClient 62 62 BevelOuter = bvNone 63 ClientHeight = 5 1264 ClientWidth = 83 163 ClientHeight = 506 64 ClientWidth = 835 65 65 ParentFont = False 66 66 TabOrder = 0 67 67 object Label1: TLabel 68 68 Left = 20 69 Height = 2 669 Height = 28 70 70 Top = 32 71 Width = 8871 Width = 96 72 72 Caption = 'Language:' 73 73 ParentColor = False … … 76 76 object ComboBoxLanguage: TComboBox 77 77 Left = 178 78 Height = 4 278 Height = 40 79 79 Top = 24 80 80 Width = 196 … … 86 86 object ComboBoxTheme: TComboBox 87 87 Left = 176 88 Height = 4 288 Height = 40 89 89 Top = 72 90 90 Width = 196 … … 96 96 object Label6: TLabel 97 97 Left = 20 98 Height = 2 698 Height = 28 99 99 Top = 80 100 Width = 6 3100 Width = 69 101 101 Caption = 'Theme:' 102 102 ParentColor = False … … 105 105 object SpinEditAnimSpeed: TSpinEdit 106 106 Left = 232 107 Height = 43107 Height = 38 108 108 Top = 120 109 109 Width = 122 … … 113 113 object Label3: TLabel 114 114 Left = 368 115 Height = 2 6115 Height = 28 116 116 Top = 124 117 Width = 1 5117 Width = 17 118 118 Caption = '%' 119 119 ParentColor = False … … 122 122 object Label2: TLabel 123 123 Left = 20 124 Height = 2 6124 Height = 28 125 125 Top = 120 126 Width = 1 49126 Width = 162 127 127 Caption = 'Animation speed:' 128 128 ParentColor = False 129 129 ParentFont = False 130 end131 object CheckBoxAutoSaveTurn: TCheckBox132 Left = 20133 Height = 30134 Top = 154135 Width = 269136 Caption = 'Autosave game on each turn'137 ParentFont = False138 TabOrder = 3139 end140 object CheckBoxReopenLastFile: TCheckBox141 Left = 20142 Height = 30143 Top = 194144 Width = 248145 Caption = 'Reopen last game on start'146 ParentFont = False147 TabOrder = 4148 130 end 149 131 end … … 151 133 object TabSheetDebug: TTabSheet 152 134 Caption = 'Debug' 153 ClientHeight = 5 12154 ClientWidth = 83 1135 ClientHeight = 506 136 ClientWidth = 835 155 137 ParentFont = False 156 138 object Panel2: TPanel 157 139 Left = 0 158 Height = 5 12140 Height = 506 159 141 Top = 0 160 Width = 83 1142 Width = 835 161 143 Align = alClient 162 144 BevelOuter = bvNone 163 ClientHeight = 5 12164 ClientWidth = 83 1145 ClientHeight = 506 146 ClientWidth = 835 165 147 ParentFont = False 166 148 TabOrder = 0 … … 169 151 Height = 24 170 152 Top = 32 171 Width = 799153 Width = 803 172 154 Anchors = [akTop, akLeft, akRight] 173 155 AutoSize = False … … 179 161 object Label4: TLabel 180 162 Left = 14 181 Height = 2 6163 Height = 28 182 164 Top = 67 183 Width = 3 5165 Width = 39 184 166 Caption = 'DPI:' 185 167 ParentColor = False … … 188 170 object SpinEditX: TSpinEdit 189 171 Left = 104 190 Height = 43172 Height = 38 191 173 Top = 64 192 174 Width = 96 … … 199 181 object Label5: TLabel 200 182 Left = 208 201 Height = 2 6183 Height = 28 202 184 Top = 67 203 Width = 1 0185 Width = 11 204 186 Caption = 'x' 205 187 ParentColor = False … … 208 190 object SpinEditY: TSpinEdit 209 191 Left = 232 210 Height = 43192 Height = 38 211 193 Top = 64 212 194 Width = 90 … … 221 203 Height = 26 222 204 Top = 136 223 Width = 80 3205 Width = 807 224 206 Anchors = [akTop, akLeft, akRight] 225 207 AutoSize = False -
trunk/Forms/FormSettings.lrj
r317 r354 8 8 {"hash":37,"name":"tformsettings.label3.caption","sourcebytes":[37],"value":"%"}, 9 9 {"hash":69745274,"name":"tformsettings.label2.caption","sourcebytes":[65,110,105,109,97,116,105,111,110,32,115,112,101,101,100,58],"value":"Animation speed:"}, 10 {"hash":121383118,"name":"tformsettings.checkboxautosaveturn.caption","sourcebytes":[65,117,116,111,115,97,118,101,32,103,97,109,101,32,111,110,32,101,97,99,104,32,116,117,114,110],"value":"Autosave game on each turn"},11 {"hash":47650276,"name":"tformsettings.checkboxreopenlastfile.caption","sourcebytes":[82,101,111,112,101,110,32,108,97,115,116,32,103,97,109,101,32,111,110,32,115,116,97,114,116],"value":"Reopen last game on start"},12 10 {"hash":4897207,"name":"tformsettings.tabsheetdebug.caption","sourcebytes":[68,101,98,117,103],"value":"Debug"}, 13 11 {"hash":37628553,"name":"tformsettings.checkbox2.caption","sourcebytes":[65,117,116,111,109,97,116,105,99,32,68,80,73],"value":"Automatic DPI"}, -
trunk/Forms/FormSettings.pas
r318 r354 15 15 ButtonCancel: TButton; 16 16 CheckBox2: TCheckBox; 17 CheckBoxAutoSaveTurn: TCheckBox;18 17 CheckBoxDevelMode: TCheckBox; 19 CheckBoxReopenLastFile: TCheckBox;20 18 ComboBoxLanguage: TComboBox; 21 19 ComboBoxTheme: TComboBox; … … 85 83 SpinEditX.Value := Core.Core.ScaleDPI1.DPI.X; 86 84 SpinEditY.Value := Core.Core.ScaleDPI1.DPI.Y; 87 CheckBoxAutoSaveTurn.Checked := Core.Core.AutoSaveEnabled;88 CheckBoxReopenLastFile.Checked := Core.Core.ReopenLastFile;89 85 end; 90 86 … … 99 95 Core.Core.ScaleDPI1.AutoDetect := CheckBox2.Checked; 100 96 Core.Core.ScaleDPI1.DPI := Point(SpinEditX.Value, SpinEditY.Value); 101 Core.Core.AutoSaveEnabled := CheckBoxAutoSaveTurn.Checked;102 Core.Core.ReopenLastFile := CheckBoxReopenLastFile.Checked;103 97 end; 104 98 -
trunk/Game.pas
r344 r354 12 12 MinPlayerCount = 1; 13 13 MaxPlayerCount = 8; 14 GameFileExt = '.xtg'; 14 15 15 16 type … … 136 137 SComputer = 'Computer'; 137 138 SWrongFileFormat = 'Wrong file format'; 138 SNewGameFile = 'New game .xtg';139 SNewGameFile = 'New game' + GameFileExt; 139 140 SUnsupportedMapType = 'Unsupported map type'; 140 141 -
trunk/Languages/xtactics.cs.po
r340 r354 1238 1238 msgstr "Automatické DPI" 1239 1239 1240 #: tformsettings.checkboxautosaveturn.caption1241 msgid "Autosave game on each turn"1242 msgstr "Uložit hru po každém tahu"1243 1244 1240 #: tformsettings.checkboxdevelmode.caption 1245 1241 msgid "Developer mode" 1246 1242 msgstr "Vývojářský režim" 1247 1248 #: tformsettings.checkboxreopenlastfile.caption1249 msgid "Reopen last game on start"1250 msgstr "Znovu otevřít poslední hru při startu"1251 1243 1252 1244 #: tformsettings.label1.caption -
trunk/Languages/xtactics.pot
r340 r354 1201 1201 msgstr "" 1202 1202 1203 #: tformsettings.checkboxautosaveturn.caption1204 msgid "Autosave game on each turn"1205 msgstr ""1206 1207 1203 #: tformsettings.checkboxdevelmode.caption 1208 1204 msgid "Developer mode" 1209 msgstr ""1210 1211 #: tformsettings.checkboxreopenlastfile.caption1212 msgid "Reopen last game on start"1213 1205 msgstr "" 1214 1206
Note:
See TracChangeset
for help on using the changeset viewer.