mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-10 17:42:29 +01:00
Rename DIRID and its members
This commit is contained in:
@@ -59,7 +59,7 @@ GLuint OpenGLShader::GetShaderId()
|
||||
std::string OpenGLShader::GetPath(const std::string& name)
|
||||
{
|
||||
auto env = GetContext()->GetPlatformEnvironment();
|
||||
auto shadersPath = env->GetDirectoryPath(DirBase::openrct2, DIRID::SHADER);
|
||||
auto shadersPath = env->GetDirectoryPath(DirBase::openrct2, DirId::shaders);
|
||||
auto path = Path::Combine(shadersPath, name);
|
||||
if (_type == GL_VERTEX_SHADER)
|
||||
{
|
||||
|
||||
@@ -120,27 +120,27 @@ namespace OpenRCT2::Ui::FileBrowser
|
||||
|
||||
u8string GetInitialDirectoryByType(const LoadSaveType type)
|
||||
{
|
||||
std::optional<DIRID> subdir = std::nullopt;
|
||||
std::optional<DirId> subdir = std::nullopt;
|
||||
switch (type)
|
||||
{
|
||||
case LoadSaveType::park:
|
||||
subdir = DIRID::SAVE;
|
||||
subdir = DirId::saves;
|
||||
break;
|
||||
|
||||
case LoadSaveType::landscape:
|
||||
subdir = DIRID::LANDSCAPE;
|
||||
subdir = DirId::landscapes;
|
||||
break;
|
||||
|
||||
case LoadSaveType::scenario:
|
||||
subdir = DIRID::SCENARIO;
|
||||
subdir = DirId::scenarios;
|
||||
break;
|
||||
|
||||
case LoadSaveType::track:
|
||||
subdir = DIRID::TRACK;
|
||||
subdir = DirId::trackDesigns;
|
||||
break;
|
||||
|
||||
case LoadSaveType::heightmap:
|
||||
subdir = DIRID::HEIGHTMAP;
|
||||
subdir = DirId::heightmaps;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -688,7 +688,7 @@ static constexpr UIThemeWindowEntry PredefinedThemeRCT1_Entries[] =
|
||||
{
|
||||
auto context = GetContext();
|
||||
auto env = context->GetPlatformEnvironment();
|
||||
return env->GetDirectoryPath(DirBase::user, DIRID::THEME);
|
||||
return env->GetDirectoryPath(DirBase::user, DirId::themes);
|
||||
}
|
||||
} // namespace ThemeManager
|
||||
|
||||
|
||||
@@ -368,7 +368,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
void InstallTrackDesign()
|
||||
{
|
||||
auto env = OpenRCT2::GetContext()->GetPlatformEnvironment();
|
||||
auto destPath = env->GetDirectoryPath(OpenRCT2::DirBase::user, OpenRCT2::DIRID::TRACK);
|
||||
auto destPath = env->GetDirectoryPath(OpenRCT2::DirBase::user, OpenRCT2::DirId::trackDesigns);
|
||||
if (!Path::CreateDirectory(destPath))
|
||||
{
|
||||
LOG_ERROR("Unable to create directory '%s'", destPath.c_str());
|
||||
|
||||
@@ -70,10 +70,10 @@ void AssetPackManager::Scan()
|
||||
auto context = GetContext();
|
||||
auto env = context->GetPlatformEnvironment();
|
||||
|
||||
auto openrct2Dir = fs::u8path(env->GetDirectoryPath(DirBase::openrct2, DIRID::ASSET_PACK));
|
||||
auto openrct2Dir = fs::u8path(env->GetDirectoryPath(DirBase::openrct2, DirId::assetPacks));
|
||||
Scan(openrct2Dir);
|
||||
|
||||
auto userDirectory = fs::u8path(env->GetDirectoryPath(DirBase::user, DIRID::ASSET_PACK));
|
||||
auto userDirectory = fs::u8path(env->GetDirectoryPath(DirBase::user, DirId::assetPacks));
|
||||
Path::CreateDirectory(userDirectory.u8string());
|
||||
Scan(userDirectory);
|
||||
}
|
||||
|
||||
@@ -1431,22 +1431,22 @@ namespace OpenRCT2
|
||||
EnsureDirectoriesExist(
|
||||
DirBase::user,
|
||||
{
|
||||
DIRID::OBJECT,
|
||||
DIRID::SAVE,
|
||||
DIRID::SCENARIO,
|
||||
DIRID::TRACK,
|
||||
DIRID::LANDSCAPE,
|
||||
DIRID::HEIGHTMAP,
|
||||
DIRID::PLUGIN,
|
||||
DIRID::THEME,
|
||||
DIRID::SEQUENCE,
|
||||
DIRID::REPLAY,
|
||||
DIRID::LOG_DESYNCS,
|
||||
DIRID::CRASH,
|
||||
DirId::objects,
|
||||
DirId::saves,
|
||||
DirId::scenarios,
|
||||
DirId::trackDesigns,
|
||||
DirId::landscapes,
|
||||
DirId::heightmaps,
|
||||
DirId::plugins,
|
||||
DirId::themes,
|
||||
DirId::sequences,
|
||||
DirId::replayRecordings,
|
||||
DirId::desyncLogs,
|
||||
DirId::crashDumps,
|
||||
});
|
||||
}
|
||||
|
||||
void EnsureDirectoriesExist(const DirBase dirBase, const std::initializer_list<DIRID>& dirIds)
|
||||
void EnsureDirectoriesExist(const DirBase dirBase, const std::initializer_list<DirId>& dirIds)
|
||||
{
|
||||
for (const auto& dirId : dirIds)
|
||||
{
|
||||
@@ -1461,11 +1461,11 @@ namespace OpenRCT2
|
||||
*/
|
||||
void CopyOriginalUserFilesOver()
|
||||
{
|
||||
CopyOriginalUserFilesOver(DIRID::SAVE, "*.sv6");
|
||||
CopyOriginalUserFilesOver(DIRID::LANDSCAPE, "*.sc6");
|
||||
CopyOriginalUserFilesOver(DirId::saves, "*.sv6");
|
||||
CopyOriginalUserFilesOver(DirId::landscapes, "*.sc6");
|
||||
}
|
||||
|
||||
void CopyOriginalUserFilesOver(DIRID dirid, const std::string& pattern)
|
||||
void CopyOriginalUserFilesOver(DirId dirid, const std::string& pattern)
|
||||
{
|
||||
auto src = _env->GetDirectoryPath(DirBase::rct2, dirid);
|
||||
auto dst = _env->GetDirectoryPath(DirBase::user, dirid);
|
||||
|
||||
@@ -475,7 +475,7 @@ void SaveGameCmd(u8string_view name /* = {} */)
|
||||
else
|
||||
{
|
||||
auto env = GetContext()->GetPlatformEnvironment();
|
||||
auto savePath = Path::Combine(env->GetDirectoryPath(DirBase::user, DIRID::SAVE), u8string(name) + u8".park");
|
||||
auto savePath = Path::Combine(env->GetDirectoryPath(DirBase::user, DirId::saves), u8string(name) + u8".park");
|
||||
SaveGameWithName(savePath);
|
||||
}
|
||||
}
|
||||
@@ -518,11 +518,11 @@ static void LimitAutosaveCount(const size_t numberOfFilesToKeep, bool processLan
|
||||
size_t numAutosavesToDelete = 0;
|
||||
|
||||
auto environment = GetContext()->GetPlatformEnvironment();
|
||||
auto folderDirectory = environment->GetDirectoryPath(DirBase::user, DIRID::SAVE);
|
||||
auto folderDirectory = environment->GetDirectoryPath(DirBase::user, DirId::saves);
|
||||
char const* fileFilter = "autosave_*.park";
|
||||
if (processLandscapeFolder)
|
||||
{
|
||||
folderDirectory = environment->GetDirectoryPath(DirBase::user, DIRID::LANDSCAPE);
|
||||
folderDirectory = environment->GetDirectoryPath(DirBase::user, DirId::landscapes);
|
||||
fileFilter = "autosave_*.park";
|
||||
}
|
||||
|
||||
@@ -573,12 +573,12 @@ static void LimitAutosaveCount(const size_t numberOfFilesToKeep, bool processLan
|
||||
|
||||
void GameAutosave()
|
||||
{
|
||||
auto subDirectory = DIRID::SAVE;
|
||||
auto subDirectory = DirId::saves;
|
||||
const char* fileExtension = ".park";
|
||||
uint32_t saveFlags = 0x80000000;
|
||||
if (isInEditorMode())
|
||||
{
|
||||
subDirectory = DIRID::LANDSCAPE;
|
||||
subDirectory = DirId::landscapes;
|
||||
fileExtension = ".park";
|
||||
saveFlags |= 2;
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ public:
|
||||
return _basePath[EnumValue(base)];
|
||||
}
|
||||
|
||||
u8string GetDirectoryPath(DirBase base, DIRID did) const override
|
||||
u8string GetDirectoryPath(DirBase base, DirId did) const override
|
||||
{
|
||||
auto basePath = GetDirectoryPath(base);
|
||||
u8string_view directoryName;
|
||||
@@ -131,12 +131,12 @@ public:
|
||||
return Path::Combine(basePath, fileName);
|
||||
}
|
||||
|
||||
u8string FindFile(DirBase base, DIRID did, u8string_view fileName) const override
|
||||
u8string FindFile(DirBase base, DirId did, u8string_view fileName) const override
|
||||
{
|
||||
auto dataPath = GetDirectoryPath(base, did);
|
||||
|
||||
std::string alternativeFilename;
|
||||
if (_usingRCTClassic && base == DirBase::rct2 && did == DIRID::DATA)
|
||||
if (_usingRCTClassic && base == DirBase::rct2 && did == DirId::data)
|
||||
{
|
||||
// Special case, handle RCT Classic css ogg files
|
||||
if (String::startsWith(fileName, "css", true) && String::endsWith(fileName, ".dat", true))
|
||||
@@ -148,7 +148,7 @@ public:
|
||||
}
|
||||
|
||||
auto path = Path::ResolveCasing(Path::Combine(dataPath, fileName));
|
||||
if (base == DirBase::rct1 && did == DIRID::DATA && !File::Exists(path))
|
||||
if (base == DirBase::rct1 && did == DirId::data && !File::Exists(path))
|
||||
{
|
||||
// Special case, handle RCT1 steam layout where some data files are under a CD root
|
||||
auto basePath = GetDirectoryPath(base);
|
||||
|
||||
@@ -29,29 +29,29 @@ namespace OpenRCT2
|
||||
constexpr size_t kDirBaseCount = 7;
|
||||
using DirBaseValues = u8string[kDirBaseCount];
|
||||
|
||||
enum class DIRID
|
||||
enum class DirId
|
||||
{
|
||||
DATA, // Contains g1.dat, music etc.
|
||||
LANDSCAPE, // Contains scenario editor landscapes (SC6).
|
||||
LANGUAGE, // Contains language packs.
|
||||
LOG_CHAT, // Contains chat logs.
|
||||
LOG_SERVER, // Contains server logs.
|
||||
NETWORK_KEY, // Contains the user's public and private keys.
|
||||
OBJECT, // Contains objects.
|
||||
PLUGIN, // Contains plugins (.js).
|
||||
SAVE, // Contains saved games (SV6).
|
||||
SCENARIO, // Contains scenarios (SC6).
|
||||
SCREENSHOT, // Contains screenshots.
|
||||
SEQUENCE, // Contains title sequences.
|
||||
SHADER, // Contains OpenGL shaders.
|
||||
THEME, // Contains interface themes.
|
||||
TRACK, // Contains track designs.
|
||||
HEIGHTMAP, // Contains heightmap data.
|
||||
REPLAY, // Contains recorded replays.
|
||||
LOG_DESYNCS, // Contains desync reports.
|
||||
CRASH, // Contains crash dumps.
|
||||
ASSET_PACK, // Contains asset packs.
|
||||
SCENARIO_PATCHES, // Contains scenario patches.
|
||||
data, // Contains g1.dat, music etc.
|
||||
landscapes, // Contains scenario editor landscapes (SC6).
|
||||
languages, // Contains language packs.
|
||||
chatLogs, // Contains chat logs.
|
||||
serverLogs, // Contains server logs.
|
||||
networkKeys, // Contains the user's public and private keys.
|
||||
objects, // Contains objects.
|
||||
plugins, // Contains plugins (.js).
|
||||
saves, // Contains saved games (SV6).
|
||||
scenarios, // Contains scenarios (SC6).
|
||||
screenshots, // Contains screenshots.
|
||||
sequences, // Contains title sequences.
|
||||
shaders, // Contains OpenGL shaders.
|
||||
themes, // Contains interface themes.
|
||||
trackDesigns, // Contains track designs.
|
||||
heightmaps, // Contains heightmap data.
|
||||
replayRecordings, // Contains recorded replays.
|
||||
desyncLogs, // Contains desync reports.
|
||||
crashDumps, // Contains crash dumps.
|
||||
assetPacks, // Contains asset packs.
|
||||
scenarioPatches, // Contains scenario patches.
|
||||
};
|
||||
|
||||
enum class PATHID
|
||||
@@ -81,9 +81,9 @@ namespace OpenRCT2
|
||||
virtual ~IPlatformEnvironment() = default;
|
||||
|
||||
virtual u8string GetDirectoryPath(DirBase base) const = 0;
|
||||
virtual u8string GetDirectoryPath(DirBase base, DIRID did) const = 0;
|
||||
virtual u8string GetDirectoryPath(DirBase base, DirId did) const = 0;
|
||||
virtual u8string GetFilePath(PATHID pathid) const = 0;
|
||||
virtual u8string FindFile(DirBase base, DIRID did, u8string_view fileName) const = 0;
|
||||
virtual u8string FindFile(DirBase base, DirId did, u8string_view fileName) const = 0;
|
||||
virtual void SetBasePath(DirBase base, u8string_view path) = 0;
|
||||
virtual bool IsUsingClassic() const = 0;
|
||||
};
|
||||
|
||||
@@ -414,7 +414,7 @@ namespace OpenRCT2
|
||||
if (res != cmpData.spriteChanges.end())
|
||||
{
|
||||
std::string outputPath = GetContext()->GetPlatformEnvironment()->GetDirectoryPath(
|
||||
DirBase::user, DIRID::LOG_DESYNCS);
|
||||
DirBase::user, DirId::desyncLogs);
|
||||
char uniqueFileName[128] = {};
|
||||
snprintf(uniqueFileName, sizeof(uniqueFileName), "replay_desync_%u.txt", currentTicks);
|
||||
|
||||
@@ -624,7 +624,8 @@ namespace OpenRCT2
|
||||
fileName += ".parkrep";
|
||||
}
|
||||
|
||||
std::string outPath = GetContext()->GetPlatformEnvironment()->GetDirectoryPath(DirBase::user, DIRID::REPLAY);
|
||||
std::string outPath = GetContext()->GetPlatformEnvironment()->GetDirectoryPath(
|
||||
DirBase::user, DirId::replayRecordings);
|
||||
std::string outFile = Path::Combine(outPath, fileName);
|
||||
|
||||
bool loaded = false;
|
||||
|
||||
@@ -451,7 +451,7 @@ bool GfxLoadG1(const IPlatformEnvironment& env)
|
||||
LOG_VERBOSE("GfxLoadG1(...)");
|
||||
try
|
||||
{
|
||||
auto path = env.FindFile(DirBase::rct2, DIRID::DATA, u8"g1.dat");
|
||||
auto path = env.FindFile(DirBase::rct2, DirId::data, u8"g1.dat");
|
||||
auto fs = FileStream(path, FileMode::open);
|
||||
_g1.header = fs.ReadValue<RCTG1Header>();
|
||||
|
||||
|
||||
@@ -1318,7 +1318,7 @@ static void ConsoleCommandLoadPark([[maybe_unused]] InteractiveConsole& console,
|
||||
{
|
||||
// no / or \ was included. File should be in save dir.
|
||||
auto env = OpenRCT2::GetContext()->GetPlatformEnvironment();
|
||||
auto directory = env->GetDirectoryPath(OpenRCT2::DirBase::user, OpenRCT2::DIRID::SAVE);
|
||||
auto directory = env->GetDirectoryPath(OpenRCT2::DirBase::user, OpenRCT2::DirId::saves);
|
||||
savePath = Path::Combine(directory, argv[0]);
|
||||
}
|
||||
else
|
||||
@@ -1391,7 +1391,7 @@ static void ConsoleCommandReplayStartRecord(InteractiveConsole& console, const a
|
||||
name += ".parkrep";
|
||||
}
|
||||
std::string outPath = OpenRCT2::GetContext()->GetPlatformEnvironment()->GetDirectoryPath(
|
||||
OpenRCT2::DirBase::user, OpenRCT2::DIRID::REPLAY);
|
||||
OpenRCT2::DirBase::user, OpenRCT2::DirId::replayRecordings);
|
||||
name = Path::Combine(outPath, name);
|
||||
|
||||
// If ticks are specified by user use that otherwise maximum ticks specified by const.
|
||||
@@ -1517,7 +1517,7 @@ static void ConsoleCommandReplayNormalise(InteractiveConsole& console, const arg
|
||||
outputFile += ".parkrep";
|
||||
}
|
||||
std::string outPath = OpenRCT2::GetContext()->GetPlatformEnvironment()->GetDirectoryPath(
|
||||
OpenRCT2::DirBase::user, OpenRCT2::DIRID::REPLAY);
|
||||
OpenRCT2::DirBase::user, OpenRCT2::DirId::replayRecordings);
|
||||
outputFile = Path::Combine(outPath, outputFile);
|
||||
|
||||
auto* replayManager = OpenRCT2::GetContext()->GetReplayManager();
|
||||
|
||||
@@ -118,7 +118,7 @@ static std::string ScreenshotGetParkName()
|
||||
static std::string ScreenshotGetDirectory()
|
||||
{
|
||||
auto env = GetContext()->GetPlatformEnvironment();
|
||||
return env->GetDirectoryPath(DirBase::user, DIRID::SCREENSHOT);
|
||||
return env->GetDirectoryPath(DirBase::user, DirId::screenshots);
|
||||
}
|
||||
|
||||
static std::pair<RealWorldDate, RealWorldTime> ScreenshotGetDateTime()
|
||||
|
||||
@@ -70,7 +70,7 @@ const char* LocalisationService::GetString(StringId id) const
|
||||
std::string LocalisationService::GetLanguagePath(uint32_t languageId) const
|
||||
{
|
||||
auto locale = std::string(LanguagesDescriptors[languageId].locale);
|
||||
auto languageDirectory = _env->GetDirectoryPath(DirBase::openrct2, DIRID::LANGUAGE);
|
||||
auto languageDirectory = _env->GetDirectoryPath(DirBase::openrct2, DirId::languages);
|
||||
auto languagePath = Path::Combine(languageDirectory, locale + u8".txt");
|
||||
return languagePath;
|
||||
}
|
||||
|
||||
@@ -1166,7 +1166,7 @@ void NetworkBase::AppendLog(std::ostream& fs, std::string_view s)
|
||||
void NetworkBase::BeginChatLog()
|
||||
{
|
||||
auto env = GetContext().GetPlatformEnvironment();
|
||||
auto directory = env->GetDirectoryPath(DirBase::user, DIRID::LOG_CHAT);
|
||||
auto directory = env->GetDirectoryPath(DirBase::user, DirId::chatLogs);
|
||||
_chatLogPath = BeginLog(directory, "", _chatLogFilenameFormat);
|
||||
_chat_log_fs.open(fs::u8path(_chatLogPath), std::ios::out | std::ios::app);
|
||||
}
|
||||
@@ -1187,7 +1187,7 @@ void NetworkBase::CloseChatLog()
|
||||
void NetworkBase::BeginServerLog()
|
||||
{
|
||||
auto env = GetContext().GetPlatformEnvironment();
|
||||
auto directory = env->GetDirectoryPath(DirBase::user, DIRID::LOG_SERVER);
|
||||
auto directory = env->GetDirectoryPath(DirBase::user, DirId::serverLogs);
|
||||
_serverLogPath = BeginLog(directory, ServerName, _serverLogFilenameFormat);
|
||||
_server_log_fs.open(fs::u8path(_serverLogPath), std::ios::out | std::ios::app | std::ios::binary);
|
||||
|
||||
@@ -2556,7 +2556,7 @@ void NetworkBase::Client_Handle_GAMESTATE(NetworkConnection& connection, Network
|
||||
{
|
||||
GameStateCompareData cmpData = snapshots->Compare(serverSnapshot, *desyncSnapshot);
|
||||
|
||||
std::string outputPath = GetContext().GetPlatformEnvironment()->GetDirectoryPath(DirBase::user, DIRID::LOG_DESYNCS);
|
||||
std::string outputPath = GetContext().GetPlatformEnvironment()->GetDirectoryPath(DirBase::user, DirId::desyncLogs);
|
||||
|
||||
Path::CreateDirectory(outputPath);
|
||||
|
||||
|
||||
@@ -380,7 +380,7 @@ std::vector<int32_t> ImageTable::ParseRange(std::string s)
|
||||
std::string ImageTable::FindLegacyObject(const std::string& name)
|
||||
{
|
||||
const auto env = GetContext()->GetPlatformEnvironment();
|
||||
auto objectsPath = env->GetDirectoryPath(DirBase::rct2, DIRID::OBJECT);
|
||||
auto objectsPath = env->GetDirectoryPath(DirBase::rct2, DirId::objects);
|
||||
auto objectPath = Path::Combine(objectsPath, name);
|
||||
if (File::Exists(objectPath))
|
||||
{
|
||||
|
||||
@@ -227,7 +227,7 @@ ObjectAsset MusicObject::GetAsset(IReadObjectContext& context, std::string_view
|
||||
if (path.find("$RCT2:DATA/") == 0)
|
||||
{
|
||||
auto env = GetContext()->GetPlatformEnvironment();
|
||||
auto path2 = env->FindFile(DirBase::rct2, DIRID::DATA, path.substr(11));
|
||||
auto path2 = env->FindFile(DirBase::rct2, DirId::data, path.substr(11));
|
||||
return ObjectAsset(path2);
|
||||
}
|
||||
|
||||
|
||||
@@ -86,8 +86,8 @@ public:
|
||||
: FileIndex(
|
||||
"object index", MAGIC_NUMBER, VERSION, env.GetFilePath(PATHID::CACHE_OBJECTS), std::string(PATTERN),
|
||||
std::vector<std::string>{
|
||||
env.GetDirectoryPath(DirBase::openrct2, DIRID::OBJECT),
|
||||
env.GetDirectoryPath(DirBase::user, DIRID::OBJECT),
|
||||
env.GetDirectoryPath(DirBase::openrct2, DirId::objects),
|
||||
env.GetDirectoryPath(DirBase::user, DirId::objects),
|
||||
})
|
||||
, _objectRepository(objectRepository)
|
||||
{
|
||||
@@ -586,7 +586,7 @@ private:
|
||||
std::string GetPathForNewObject(ObjectGeneration generation, std::string_view name)
|
||||
{
|
||||
// Get object directory and create it if it doesn't exist
|
||||
auto userObjPath = _env->GetDirectoryPath(DirBase::user, DIRID::OBJECT);
|
||||
auto userObjPath = _env->GetDirectoryPath(DirBase::user, DirId::objects);
|
||||
Path::CreateDirectory(userObjPath);
|
||||
|
||||
// Find a unique file name
|
||||
|
||||
@@ -79,34 +79,34 @@ ResourceTable::SourceInfo ResourceTable::ParseSource(std::string_view source)
|
||||
else if (String::startsWith(base, "$G1"))
|
||||
{
|
||||
auto env = GetContext()->GetPlatformEnvironment();
|
||||
auto dataPath = env->GetDirectoryPath(DirBase::rct2, DIRID::DATA);
|
||||
auto dataPath = env->GetDirectoryPath(DirBase::rct2, DirId::data);
|
||||
info.Kind = SourceKind::G1;
|
||||
// info.Path = env->FindFile(DirBase::rct2, DIRID::DATA, "g1.dat");
|
||||
// info.Path = env->FindFile(DirBase::rct2, DirId::data, "g1.dat");
|
||||
}
|
||||
else if (String::startsWith(base, "$CSG"))
|
||||
{
|
||||
auto env = GetContext()->GetPlatformEnvironment();
|
||||
auto dataPath = env->GetDirectoryPath(DirBase::rct2, DIRID::DATA);
|
||||
auto dataPath = env->GetDirectoryPath(DirBase::rct2, DirId::data);
|
||||
info.Kind = SourceKind::Csg;
|
||||
// info.Path = env->FindFile(DirBase::rct2, DIRID::DATA, "g1.dat");
|
||||
// info.Path = env->FindFile(DirBase::rct2, DirId::data, "g1.dat");
|
||||
}
|
||||
else if (String::startsWith(base, "$RCT1:DATA/"))
|
||||
{
|
||||
auto env = GetContext()->GetPlatformEnvironment();
|
||||
info.Kind = SourceKind::Data;
|
||||
info.Path = env->FindFile(DirBase::rct1, DIRID::DATA, fileName);
|
||||
info.Path = env->FindFile(DirBase::rct1, DirId::data, fileName);
|
||||
}
|
||||
else if (String::startsWith(base, "$RCT2:DATA/"))
|
||||
{
|
||||
auto env = GetContext()->GetPlatformEnvironment();
|
||||
info.Kind = SourceKind::Data;
|
||||
info.Path = env->FindFile(DirBase::rct2, DIRID::DATA, fileName);
|
||||
info.Path = env->FindFile(DirBase::rct2, DirId::data, fileName);
|
||||
}
|
||||
else if (String::startsWith(base, "$RCT2:OBJDATA/"))
|
||||
{
|
||||
auto env = GetContext()->GetPlatformEnvironment();
|
||||
info.Kind = SourceKind::ObjData;
|
||||
info.Path = env->FindFile(DirBase::rct2, DIRID::OBJECT, fileName);
|
||||
info.Path = env->FindFile(DirBase::rct2, DirId::objects, fileName);
|
||||
}
|
||||
else if (!String::startsWith(base, "$"))
|
||||
{
|
||||
|
||||
@@ -317,7 +317,7 @@ static bool OnCrash(
|
||||
static std::wstring GetDumpDirectory()
|
||||
{
|
||||
auto env = GetContext()->GetPlatformEnvironment();
|
||||
auto crashPath = env->GetDirectoryPath(DirBase::user, DIRID::CRASH);
|
||||
auto crashPath = env->GetDirectoryPath(DirBase::user, DirId::crashDumps);
|
||||
|
||||
auto result = String::toWideChar(crashPath);
|
||||
return result;
|
||||
|
||||
@@ -683,7 +683,7 @@ static u8string getScenarioSHA256(u8string_view scenarioPath)
|
||||
static u8string GetPatchFileName(u8string_view scenarioHash)
|
||||
{
|
||||
auto env = OpenRCT2::GetContext()->GetPlatformEnvironment();
|
||||
auto scenarioPatches = env->GetDirectoryPath(OpenRCT2::DirBase::openrct2, OpenRCT2::DIRID::SCENARIO_PATCHES);
|
||||
auto scenarioPatches = env->GetDirectoryPath(OpenRCT2::DirBase::openrct2, OpenRCT2::DirId::scenarioPatches);
|
||||
auto scenarioPatchFile = OpenRCT2::Path::WithExtension(scenarioHash.substr(0, 7), ".parkpatch");
|
||||
return OpenRCT2::Path::Combine(scenarioPatches, scenarioPatchFile);
|
||||
}
|
||||
|
||||
@@ -62,9 +62,9 @@ public:
|
||||
: FileIndex(
|
||||
"track design index", MAGIC_NUMBER, VERSION, env.GetFilePath(PATHID::CACHE_TRACKS), std::string(PATTERN),
|
||||
std::vector<std::string>({
|
||||
env.GetDirectoryPath(DirBase::rct1, DIRID::TRACK),
|
||||
env.GetDirectoryPath(DirBase::rct2, DIRID::TRACK),
|
||||
env.GetDirectoryPath(DirBase::user, DIRID::TRACK),
|
||||
env.GetDirectoryPath(DirBase::rct1, DirId::trackDesigns),
|
||||
env.GetDirectoryPath(DirBase::rct2, DirId::trackDesigns),
|
||||
env.GetDirectoryPath(DirBase::user, DirId::trackDesigns),
|
||||
}))
|
||||
{
|
||||
}
|
||||
@@ -257,7 +257,7 @@ public:
|
||||
std::string Install(const std::string& path, const std::string& name) override
|
||||
{
|
||||
std::string result;
|
||||
std::string installDir = _env->GetDirectoryPath(DirBase::user, DIRID::TRACK);
|
||||
std::string installDir = _env->GetDirectoryPath(DirBase::user, DirId::trackDesigns);
|
||||
|
||||
std::string newPath = Path::Combine(installDir, name + Path::GetExtension(path));
|
||||
if (File::Copy(path, newPath, false))
|
||||
|
||||
@@ -121,7 +121,7 @@ void ScenarioReset(GameState_t& gameState)
|
||||
|
||||
// Set the last saved game path
|
||||
auto env = GetContext()->GetPlatformEnvironment();
|
||||
auto savePath = env->GetDirectoryPath(DirBase::user, DIRID::SAVE);
|
||||
auto savePath = env->GetDirectoryPath(DirBase::user, DirId::saves);
|
||||
gScenarioSavePath = Path::Combine(savePath, gameState.park.Name + u8".park");
|
||||
|
||||
gameState.currentExpenditure = 0;
|
||||
|
||||
@@ -132,9 +132,9 @@ public:
|
||||
: FileIndex(
|
||||
"scenario index", MAGIC_NUMBER, VERSION, env.GetFilePath(PATHID::CACHE_SCENARIOS), std::string(PATTERN),
|
||||
std::vector<std::string>({
|
||||
env.GetDirectoryPath(DirBase::rct1, DIRID::SCENARIO),
|
||||
env.GetDirectoryPath(DirBase::rct2, DIRID::SCENARIO),
|
||||
env.GetDirectoryPath(DirBase::user, DIRID::SCENARIO),
|
||||
env.GetDirectoryPath(DirBase::rct1, DirId::scenarios),
|
||||
env.GetDirectoryPath(DirBase::rct2, DirId::scenarios),
|
||||
env.GetDirectoryPath(DirBase::user, DirId::scenarios),
|
||||
}))
|
||||
{
|
||||
}
|
||||
@@ -437,10 +437,10 @@ private:
|
||||
*/
|
||||
void ImportMegaPark()
|
||||
{
|
||||
auto mpdatPath = _env->FindFile(DirBase::rct1, DIRID::DATA, "mp.dat");
|
||||
auto mpdatPath = _env->FindFile(DirBase::rct1, DirId::data, "mp.dat");
|
||||
if (File::Exists(mpdatPath))
|
||||
{
|
||||
auto scenarioDirectory = _env->GetDirectoryPath(DirBase::user, DIRID::SCENARIO);
|
||||
auto scenarioDirectory = _env->GetDirectoryPath(DirBase::user, DirId::scenarios);
|
||||
auto expectedSc21Path = Path::Combine(scenarioDirectory, "sc21.sc4");
|
||||
auto sc21Path = Path::ResolveCasing(expectedSc21Path);
|
||||
if (!File::Exists(sc21Path))
|
||||
|
||||
@@ -255,13 +255,13 @@ namespace OpenRCT2::TitleSequenceManager
|
||||
static std::string GetDataSequencesPath()
|
||||
{
|
||||
auto env = GetContext()->GetPlatformEnvironment();
|
||||
return env->GetDirectoryPath(DirBase::openrct2, DIRID::SEQUENCE);
|
||||
return env->GetDirectoryPath(DirBase::openrct2, DirId::sequences);
|
||||
}
|
||||
|
||||
static std::string GetUserSequencesPath()
|
||||
{
|
||||
auto env = GetContext()->GetPlatformEnvironment();
|
||||
return env->GetDirectoryPath(DirBase::user, DIRID::SEQUENCE);
|
||||
return env->GetDirectoryPath(DirBase::user, DirId::sequences);
|
||||
}
|
||||
|
||||
static bool IsNameReserved(const std::string& name)
|
||||
|
||||
@@ -592,7 +592,7 @@ std::vector<std::string> ScriptEngine::GetPluginFiles() const
|
||||
{
|
||||
// Scan for .js files in plugin directory
|
||||
std::vector<std::string> pluginFiles;
|
||||
auto base = _env.GetDirectoryPath(DirBase::user, DIRID::PLUGIN);
|
||||
auto base = _env.GetDirectoryPath(DirBase::user, DirId::plugins);
|
||||
if (Path::DirectoryExists(base))
|
||||
{
|
||||
auto pattern = Path::Combine(base, u8"*.js");
|
||||
@@ -794,7 +794,7 @@ void ScriptEngine::SetupHotReloading()
|
||||
{
|
||||
try
|
||||
{
|
||||
auto base = _env.GetDirectoryPath(DirBase::user, DIRID::PLUGIN);
|
||||
auto base = _env.GetDirectoryPath(DirBase::user, DirId::plugins);
|
||||
if (Path::DirectoryExists(base))
|
||||
{
|
||||
_pluginFileWatcher = std::make_unique<FileWatcher>(base);
|
||||
|
||||
@@ -32,7 +32,7 @@ TEST(FetchAndApplyScenarioPatch, expected_json_format)
|
||||
ASSERT_TRUE(initialised);
|
||||
|
||||
auto env = context->GetPlatformEnvironment();
|
||||
auto scenarioPatches = env->GetDirectoryPath(OpenRCT2::DirBase::openrct2, OpenRCT2::DIRID::SCENARIO_PATCHES);
|
||||
auto scenarioPatches = env->GetDirectoryPath(OpenRCT2::DirBase::openrct2, OpenRCT2::DirId::scenarioPatches);
|
||||
|
||||
std::error_code ec;
|
||||
OpenRCT2::RCT12::SetDryRun(true);
|
||||
|
||||
Reference in New Issue
Block a user