mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2026-07-24 20:12:42 +00:00
Codechange: make Subdirectory a scoped enum
This commit is contained in:
committed by
Peter Nelson
parent
93a6aa77c6
commit
5aae8e2d64
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user