Codechange: make Subdirectory a scoped enum

This commit is contained in:
Peter Nelson
2026-04-05 21:46:07 +01:00
committed by Peter Nelson
parent 93a6aa77c6
commit 5aae8e2d64
52 changed files with 218 additions and 216 deletions
+1 -1
View File
@@ -179,7 +179,7 @@ std::optional<std::string> ScriptConfig::GetTextfile(TextfileType type, CompanyI
{
if (slot == CompanyID::Invalid() || this->GetInfo() == nullptr) return std::nullopt;
return ::GetTextfile(type, (slot == OWNER_DEITY) ? GAME_DIR : AI_DIR, this->GetInfo()->GetMainScript());
return ::GetTextfile(type, (slot == OWNER_DEITY) ? Subdirectory::Gs : Subdirectory::Ai, this->GetInfo()->GetMainScript());
}
void ScriptConfig::SetToLoadData(ScriptInstance::ScriptData *data)
+1 -1
View File
@@ -618,7 +618,7 @@ struct ScriptTextfileWindow : public TextfileWindow {
if (!textfile.has_value()) {
this->Close();
} else {
this->LoadTextfile(textfile.value(), (this->slot == OWNER_DEITY) ? GAME_DIR : AI_DIR);
this->LoadTextfile(textfile.value(), (this->slot == OWNER_DEITY) ? Subdirectory::Gs : Subdirectory::Ai);
}
}
};
+4 -4
View File
@@ -647,11 +647,11 @@ SQRESULT Squirrel::LoadFile(HSQUIRRELVM vm, const std::string &filename, SQBool
std::optional<FileHandle> file = std::nullopt;
size_t size;
if (this->GetAPIName().starts_with("AI")) {
file = FioFOpenFile(filename, "rb", AI_DIR, &size);
if (!file.has_value()) file = FioFOpenFile(filename, "rb", AI_LIBRARY_DIR, &size);
file = FioFOpenFile(filename, "rb", Subdirectory::Ai, &size);
if (!file.has_value()) file = FioFOpenFile(filename, "rb", Subdirectory::AiLibrary, &size);
} else if (this->GetAPIName().starts_with("GS")) {
file = FioFOpenFile(filename, "rb", GAME_DIR, &size);
if (!file.has_value()) file = FioFOpenFile(filename, "rb", GAME_LIBRARY_DIR, &size);
file = FioFOpenFile(filename, "rb", Subdirectory::Gs, &size);
if (!file.has_value()) file = FioFOpenFile(filename, "rb", Subdirectory::GsLibrary, &size);
} else {
NOT_REACHED();
}