Codechange: Make FileToSaveLoad's title std::string and simplify assignments

This commit is contained in:
Rubidium
2023-04-16 21:44:53 +02:00
committed by rubidium42
parent f0a1ddd81c
commit ee723f26ba
6 changed files with 14 additions and 28 deletions

View File

@@ -3395,22 +3395,15 @@ void FileToSaveLoad::SetMode(SaveLoadOperation fop, AbstractFileType aft, Detail
this->abstract_ftype = aft;
}
/**
* Set the name of the file.
* @param name Name of the file.
*/
void FileToSaveLoad::SetName(const char *name)
{
this->name = name;
}
/**
* Set the title of the file.
* @param title Title of the file.
*/
void FileToSaveLoad::SetTitle(const char *title)
void FileToSaveLoad::Set(const FiosItem &item)
{
strecpy(this->title, title, lastof(this->title));
this->SetMode(item.type);
this->name = item.name;
this->title = item.title;
}
SaveLoadTable SaveLoadHandler::GetLoadDescription() const

View File

@@ -365,16 +365,15 @@ enum SaveOrLoadResult {
/** Deals with the type of the savegame, independent of extension */
struct FileToSaveLoad {
SaveLoadOperation file_op; ///< File operation to perform.
SaveLoadOperation file_op; ///< File operation to perform.
DetailedFileType detail_ftype; ///< Concrete file type (PNG, BMP, old save, etc).
AbstractFileType abstract_ftype; ///< Abstract type of file (scenario, heightmap, etc).
std::string name; ///< Name of the file.
char title[255]; ///< Internal name of the game.
std::string title; ///< Internal name of the game.
void SetMode(FiosType ft);
void SetMode(SaveLoadOperation fop, AbstractFileType aft, DetailedFileType dft);
void SetName(const char *name);
void SetTitle(const char *title);
void Set(const FiosItem &item);
};
/** Types of save games. */