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

@@ -643,11 +643,11 @@ struct ScriptTextfileWindow : public TextfileWindow {
void OnInvalidateData(int data = 0, bool gui_scope = true) override
{
const char *textfile = GetConfig(slot)->GetTextfile(file_type, slot);
if (textfile == nullptr) {
auto textfile = GetConfig(slot)->GetTextfile(file_type, slot);
if (!textfile.has_value()) {
this->Close();
} else {
this->LoadTextfile(textfile, (slot == OWNER_DEITY) ? GAME_DIR : AI_DIR);
this->LoadTextfile(textfile.value(), (slot == OWNER_DEITY) ? GAME_DIR : AI_DIR);
}
}
};