Changeset 133
- Timestamp:
- May 2, 2023, 10:29:11 AM (19 months ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormMain.pas
r129 r133 119 119 procedure TFormMain.FormClose(Sender: TObject; var CloseAction: TCloseAction); 120 120 begin 121 //Engine.SaveToFile('Game.bmg');122 121 Core.PersistentForm1.Save(Self); 123 122 end; -
trunk/Languages/TransLines.cs.po
r130 r133 68 68 msgstr "Automaticky" 69 69 70 #: uengine.sautosave 71 msgid "Auto save" 72 msgstr "Automaticky uložené" 73 70 74 #: uengine.sback 71 75 msgctxt "uengine.sback" -
trunk/Languages/TransLines.de.po
r130 r133 70 70 msgstr "Automatisch" 71 71 72 #: uengine.sautosave 73 msgid "Auto save" 74 msgstr "" 75 72 76 #: uengine.sback 73 77 msgctxt "uengine.sback" -
trunk/Languages/TransLines.fr.po
r130 r133 71 71 msgstr "Automatique" 72 72 73 #: uengine.sautosave 74 msgid "Auto save" 75 msgstr "" 76 73 77 #: uengine.sback 74 78 msgctxt "uengine.sback" -
trunk/Languages/TransLines.pot
r130 r133 58 58 msgstr "" 59 59 60 #: uengine.sautosave 61 msgid "Auto save" 62 msgstr "" 63 60 64 #: uengine.sback 61 65 msgctxt "uengine.sback" -
trunk/UEngine.pas
r132 r133 311 311 procedure ReloadGameSlots(Save: Boolean); 312 312 function GetGameSlotFileName(Index: Integer): string; 313 procedure AutoSave; 313 314 public 314 315 // Test … … 473 474 SStationStyle = 'Station style'; 474 475 SSlot = 'Slot'; 476 SAutoSave = 'Auto save'; 475 477 476 478 // Cities … … 2296 2298 procedure TEngine.MenuItemGameExit(Sender: TObject); 2297 2299 begin 2300 AutoSave; 2298 2301 State := gsMenu; 2299 2302 Clear; … … 2322 2325 begin 2323 2326 LoadFromFile(GetGameSlotFileName(Integer(TMenuItemButton(Sender).Ref))); 2324 State := gsRunning; 2327 if State in [gsMenu] then State := gsRunning; 2328 Redraw; 2325 2329 end; 2326 2330 … … 2470 2474 ControlName: string; 2471 2475 const 2472 GameSlotCount = 6;2476 GameSlotCount = 5; 2473 2477 begin 2474 2478 with MenuGameSlots, Items do begin … … 2477 2481 if Save then Action := MenuItemGameSlotSave 2478 2482 else Action := MenuItemGameSlotLoad; 2479 for I := 1to GameSlotCount do begin2483 for I := 0 to GameSlotCount do begin 2480 2484 FileName := GetGameSlotFileName(Integer(I)); 2481 ControlName := SSlot + ' ' + IntToStr(I); 2485 if I = 0 then ControlName := SAutoSave 2486 else ControlName := SSlot + ' ' + IntToStr(I); 2482 2487 if FileExists(FileName) then begin 2483 2488 FileAge(FileName, FileDateTime); … … 2486 2491 with AddButton(ControlName, Action) do begin 2487 2492 Ref := TObject(I); 2488 Enabled := FileExists(FileName) or Save;2493 Enabled := FileExists(FileName) or (Save and (I > 0)); 2489 2494 TextSize := 40; 2490 2495 TextColor := Colors.MenuItemText; … … 2508 2513 begin 2509 2514 Result := GetAppConfigDir(False) + 'Saved game ' + IntToStr(Index) + TransLinesExt; 2515 end; 2516 2517 procedure TEngine.AutoSave; 2518 begin 2519 if (State = gsNotStarted) or ((State = gsMenu) and (LastState = gsNotStarted)) then Exit; 2520 SaveToFile(GetGameSlotFileName(0)); 2510 2521 end; 2511 2522 … … 4112 4123 WriteInteger(Node, 'ServedPassengerCount', ServedPassengerCount); 4113 4124 WriteInteger(Node, 'DestinationCount', DestinationCount); 4114 WriteInteger(Node, 'State', Integer(State)); 4125 if State = gsMenu then WriteInteger(Node, 'State', Integer(LastState)) 4126 else WriteInteger(Node, 'State', Integer(State)); 4115 4127 WriteDateTime(Node, 'Time', FTime); 4116 4128 if Assigned(City) then WriteString(Node, 'CityName', City.SysName); … … 4253 4265 destructor TEngine.Destroy; 4254 4266 begin 4267 AutoSave; 4255 4268 FreeAndNil(MetaCanvas); 4256 4269 FreeAndNil(Trains);
Note:
See TracChangeset
for help on using the changeset viewer.