OpenTTD Source 20241224-master-gf74b0cf984
FiosNumberedSaveName Struct Reference

A savegame name automatically numbered. More...

#include <fios.h>

Public Member Functions

 FiosNumberedSaveName (const std::string &prefix)
 Constructs FiosNumberedSaveName.
 
std::string Filename ()
 Generate a savegame name and number according to _settings_client.gui.max_num_autosaves.
 
std::string Extension ()
 Generate an extension for a savegame name.
 

Private Attributes

std::string prefix
 
int number
 

Detailed Description

A savegame name automatically numbered.

Definition at line 130 of file fios.h.

Constructor & Destructor Documentation

◆ FiosNumberedSaveName()

FiosNumberedSaveName::FiosNumberedSaveName ( const std::string &  prefix)

Constructs FiosNumberedSaveName.

Initial number is the most recent save, or -1 if not found.

Parameters
prefixThe prefix to use to generate a filename.

< Static as the lambda needs access to it.

Definition at line 727 of file fios.cpp.

References AUTOSAVE_DIR, FileScanner::Scan(), SLO_SAVE, and StrEqualsIgnoreCase().

Member Function Documentation

◆ Extension()

std::string FiosNumberedSaveName::Extension ( )

Generate an extension for a savegame name.

Returns
An extension in format "-<prefix>.sav".

Definition at line 774 of file fios.cpp.

Referenced by DoAutoOrNetsave().

◆ Filename()

std::string FiosNumberedSaveName::Filename ( )

Generate a savegame name and number according to _settings_client.gui.max_num_autosaves.

Returns
A filename in format "<prefix><number>.sav".

Definition at line 764 of file fios.cpp.

References _settings_client, ClientSettings::gui, and GUISettings::max_num_autosaves.

Referenced by DoAutoOrNetsave().

Field Documentation

◆ number

int FiosNumberedSaveName::number
private

Definition at line 136 of file fios.h.

◆ prefix

std::string FiosNumberedSaveName::prefix
private

Definition at line 135 of file fios.h.


The documentation for this struct was generated from the following files: