AMFP Enhanced
C++ reference: the code this unofficial fork added
Loading...
Searching...
No Matches
LuxAutoSave.h File Reference

autosave and manual saves (Enhanced option "Autosave"). More...

#include <string>

Go to the source code of this file.

Classes

class  cLuxAutoSaveTimer
 When the extra autosaves are due. More...

Enumerations

enum  eLuxAutoSave {
  eLuxAutoSave_Off , eLuxAutoSave_MapChange , eLuxAutoSave_Every5 , eLuxAutoSave_Every10 ,
  eLuxAutoSave_Every15 , eLuxAutoSave_LastEnum
}
enum  eLuxSaveKind { eLuxSaveKind_Auto , eLuxSaveKind_Manual , eLuxSaveKind_Other }

Functions

bool LuxAutoSaveOnMapChange (int alLevel)
int LuxAutoSavesToKeep (int alLevel, int alShippedMax)
 How many autosaves to keep, the new one included.
float LuxAutoSaveInterval (int alLevel)
 Seconds between timed saves, 0 = none.
bool LuxStartsWithI (const std::wstring &s, const std::wstring &p)
int LuxSaveKind (const std::wstring &asFile)
 Which kind a save file name is ("AutoSave_\<map\>_...sav", "Save_\<map\>_...sav").
bool LuxAutoSaveSafe (bool abPlayerActive, bool abDead, bool abStoryScene, bool abInDanger, bool abInMenu)
 A moment the game can be saved without surprising the player on load.

Variables

static const wchar_t *const kLuxAutoSavePrefix = L"AutoSave"
static const wchar_t *const kLuxManualSavePrefix = L"Save"
static const int kLuxAutoSavesKept = 5

Detailed Description

autosave and manual saves (Enhanced option "Autosave").

Pure, unit tested in tests/cpp/test_autosave.cpp.

  • Two kinds of save file, side by side in the profile folder: autosaves ("AutoSave_...", the game's own name) rotate among themselves; manual saves ("Save_...", pause menu "Save game") are never deleted by the game.
  • Option levels: Off (as shipped: only the saves the map scripts make), On map change (plus a save after every map change), Every 5 / 10 / 15 minutes (plus a timed save).
  • How many autosaves are kept: Off keeps the shipped count (game.cfg MaxAutoSaves, 20); any other level keeps the newest kLuxAutoSavesKept (5), so frequent saves do not pile up.
  • Extra saves happen only at a safe moment: playing freely (no story scene, menu or journal), alive, and no enemy hunting or searching. A pending save waits for one.

Definition in file LuxAutoSave.h.

Enumeration Type Documentation

◆ eLuxAutoSave

Enumerator
eLuxAutoSave_Off 
eLuxAutoSave_MapChange 
eLuxAutoSave_Every5 
eLuxAutoSave_Every10 
eLuxAutoSave_Every15 
eLuxAutoSave_LastEnum 

Definition at line 20 of file LuxAutoSave.h.

◆ eLuxSaveKind

Enumerator
eLuxSaveKind_Auto 
eLuxSaveKind_Manual 
eLuxSaveKind_Other 

Definition at line 30 of file LuxAutoSave.h.

Function Documentation

◆ LuxAutoSaveOnMapChange()

bool LuxAutoSaveOnMapChange ( int alLevel)
inline

Definition at line 40 of file LuxAutoSave.h.

◆ LuxAutoSavesToKeep()

int LuxAutoSavesToKeep ( int alLevel,
int alShippedMax )
inline

How many autosaves to keep, the new one included.

Off = as shipped (alShippedMax).

Definition at line 45 of file LuxAutoSave.h.

◆ LuxAutoSaveInterval()

float LuxAutoSaveInterval ( int alLevel)
inline

Seconds between timed saves, 0 = none.

Definition at line 52 of file LuxAutoSave.h.

◆ LuxStartsWithI()

bool LuxStartsWithI ( const std::wstring & s,
const std::wstring & p )
inline

Definition at line 63 of file LuxAutoSave.h.

◆ LuxSaveKind()

int LuxSaveKind ( const std::wstring & asFile)
inline

Which kind a save file name is ("AutoSave_\<map\>_...sav", "Save_\<map\>_...sav").

Definition at line 77 of file LuxAutoSave.h.

◆ LuxAutoSaveSafe()

bool LuxAutoSaveSafe ( bool abPlayerActive,
bool abDead,
bool abStoryScene,
bool abInDanger,
bool abInMenu )
inline

A moment the game can be saved without surprising the player on load.

Definition at line 85 of file LuxAutoSave.h.

Variable Documentation

◆ kLuxAutoSavePrefix

const wchar_t* const kLuxAutoSavePrefix = L"AutoSave"
static

Definition at line 37 of file LuxAutoSave.h.

◆ kLuxManualSavePrefix

const wchar_t* const kLuxManualSavePrefix = L"Save"
static

Definition at line 38 of file LuxAutoSave.h.

◆ kLuxAutoSavesKept

const int kLuxAutoSavesKept = 5
static

Definition at line 42 of file LuxAutoSave.h.