Codechange: use std::string for text file name resolution

This commit is contained in:
Rubidium
2023-05-05 00:04:52 +02:00
committed by rubidium42
parent 0b72297d57
commit 877349c13d
15 changed files with 56 additions and 58 deletions

View File

@@ -137,17 +137,17 @@ struct BaseSet {
/**
* Search a textfile file next to this base media.
* @param type The type of the textfile to search for.
* @return The filename for the textfile, \c nullptr otherwise.
* @return The filename for the textfile.
*/
const char *GetTextfile(TextfileType type) const
std::optional<std::string> GetTextfile(TextfileType type) const
{
for (uint i = 0; i < NUM_FILES; i++) {
const char *textfile = ::GetTextfile(type, BASESET_DIR, this->files[i].filename.c_str());
if (textfile != nullptr) {
auto textfile = ::GetTextfile(type, BASESET_DIR, this->files[i].filename);
if (textfile.has_value()) {
return textfile;
}
}
return nullptr;
return std::nullopt;
}
};