forked from rosebudai/OpenRCT2-Web
Create enum class for FileMode
This commit is contained in:
29 files changed
+67
-67
No files matched your search
@@ -74,7 +74,7 @@ std::string OpenGLShader::GetPath(const std::string& name)
|
||||
|
||||
std::string OpenGLShader::ReadSourceCode(const std::string& path)
|
||||
{
|
||||
auto fs = FileStream(path, FILE_MODE_OPEN);
|
||||
auto fs = FileStream(path, FileMode::open);
|
||||
|
||||
uint64_t fileLength = fs.GetLength();
|
||||
if (fileLength > kMaxSourceSize)
|
||||
|
||||
@@ -258,7 +258,7 @@ void ShortcutManager::LoadLegacyBindings(const fs::path& path)
|
||||
constexpr int32_t kSupportedFileVersion = 1;
|
||||
constexpr int32_t kMaxLegacyShortcuts = 85;
|
||||
|
||||
auto fs = FileStream(path, FILE_MODE_OPEN);
|
||||
auto fs = FileStream(path, FileMode::open);
|
||||
auto version = fs.ReadValue<uint16_t>();
|
||||
if (version == kSupportedFileVersion)
|
||||
{
|
||||
|
||||
@@ -334,7 +334,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
return;
|
||||
|
||||
auto path = _listItems[selected_list_item].path;
|
||||
auto fs = FileStream(path, FILE_MODE_OPEN);
|
||||
auto fs = FileStream(path, FileMode::open);
|
||||
|
||||
ClassifiedFileInfo info;
|
||||
if (!TryClassifyFile(&fs, &info) || info.Type != ::FileType::park)
|
||||
|
||||
@@ -115,7 +115,7 @@ std::optional<SpriteFile> SpriteFile::Open(const utf8* path)
|
||||
{
|
||||
try
|
||||
{
|
||||
OpenRCT2::FileStream stream(path, OpenRCT2::FILE_MODE_OPEN);
|
||||
OpenRCT2::FileStream stream(path, OpenRCT2::FileMode::open);
|
||||
|
||||
SpriteFile spriteFile;
|
||||
stream.Read(&spriteFile.Header, sizeof(RCTG1Header));
|
||||
@@ -155,7 +155,7 @@ bool SpriteFile::Save(const utf8* path)
|
||||
{
|
||||
try
|
||||
{
|
||||
OpenRCT2::FileStream stream(path, OpenRCT2::FILE_MODE_WRITE);
|
||||
OpenRCT2::FileStream stream(path, OpenRCT2::FileMode::write);
|
||||
stream.Write(&Header, sizeof(RCTG1Header));
|
||||
|
||||
if (Header.num_entries > 0)
|
||||
@@ -628,8 +628,8 @@ static int32_t CommandLineForSpriteCombine(const char** argv, int32_t argc)
|
||||
const utf8* dataFile = argv[2];
|
||||
const utf8* outputPath = argv[3];
|
||||
|
||||
auto fileHeader = OpenRCT2::FileStream(indexFile, OpenRCT2::FILE_MODE_OPEN);
|
||||
auto fileData = OpenRCT2::FileStream(dataFile, OpenRCT2::FILE_MODE_OPEN);
|
||||
auto fileHeader = OpenRCT2::FileStream(indexFile, OpenRCT2::FileMode::open);
|
||||
auto fileData = OpenRCT2::FileStream(dataFile, OpenRCT2::FileMode::open);
|
||||
auto fileHeaderSize = fileHeader.GetLength();
|
||||
auto fileDataSize = fileData.GetLength();
|
||||
|
||||
@@ -638,7 +638,7 @@ static int32_t CommandLineForSpriteCombine(const char** argv, int32_t argc)
|
||||
RCTG1Header header = {};
|
||||
header.num_entries = numEntries;
|
||||
header.total_size = fileDataSize;
|
||||
OpenRCT2::FileStream outputStream(outputPath, OpenRCT2::FILE_MODE_WRITE);
|
||||
OpenRCT2::FileStream outputStream(outputPath, OpenRCT2::FileMode::write);
|
||||
|
||||
outputStream.Write(&header, sizeof(RCTG1Header));
|
||||
auto g1Elements32 = std::make_unique<RCTG1Element[]>(numEntries);
|
||||
|
||||
@@ -738,7 +738,7 @@ namespace OpenRCT2
|
||||
return true;
|
||||
}
|
||||
|
||||
auto fs = FileStream(path, FILE_MODE_OPEN);
|
||||
auto fs = FileStream(path, FileMode::open);
|
||||
if (!LoadParkFromStream(&fs, path, loadTitleScreenOnFail, asScenario))
|
||||
{
|
||||
return false;
|
||||
|
||||
@@ -32,7 +32,7 @@ bool TryClassifyFile(const std::string& path, ClassifiedFileInfo* result)
|
||||
{
|
||||
try
|
||||
{
|
||||
auto fs = OpenRCT2::FileStream(path, OpenRCT2::FILE_MODE_OPEN);
|
||||
auto fs = OpenRCT2::FileStream(path, OpenRCT2::FileMode::open);
|
||||
return TryClassifyFile(&fs, result);
|
||||
}
|
||||
catch (const std::exception&)
|
||||
|
||||
@@ -55,7 +55,7 @@ static exitcode_t HandleObjectsInfo(CommandLineArgEnumerator* argEnumerator)
|
||||
auto context = OpenRCT2::CreateContext();
|
||||
context->Initialise();
|
||||
|
||||
auto stream = OpenRCT2::FileStream(sourcePath, OpenRCT2::FILE_MODE_OPEN);
|
||||
auto stream = OpenRCT2::FileStream(sourcePath, OpenRCT2::FileMode::open);
|
||||
ClassifiedFileInfo info;
|
||||
if (!TryClassifyFile(&stream, &info))
|
||||
{
|
||||
|
||||
@@ -647,7 +647,7 @@ namespace OpenRCT2::Config
|
||||
{
|
||||
try
|
||||
{
|
||||
auto fs = FileStream(path, FILE_MODE_OPEN);
|
||||
auto fs = FileStream(path, FileMode::open);
|
||||
auto reader = CreateIniReader(&fs);
|
||||
ReadGeneral(reader.get());
|
||||
ReadInterface(reader.get());
|
||||
@@ -671,7 +671,7 @@ namespace OpenRCT2::Config
|
||||
auto directory = Path::GetDirectory(path);
|
||||
Path::CreateDirectory(directory);
|
||||
|
||||
auto fs = FileStream(path, FILE_MODE_WRITE);
|
||||
auto fs = FileStream(path, FileMode::write);
|
||||
auto writer = CreateIniWriter(&fs);
|
||||
WriteGeneral(writer.get());
|
||||
WriteInterface(writer.get());
|
||||
|
||||
@@ -124,7 +124,7 @@ namespace OpenRCT2::File
|
||||
|
||||
void WriteAllBytes(u8string_view path, const void* buffer, size_t length)
|
||||
{
|
||||
auto fs = OpenRCT2::FileStream(path, OpenRCT2::FILE_MODE_WRITE);
|
||||
auto fs = OpenRCT2::FileStream(path, OpenRCT2::FileMode::write);
|
||||
fs.Write(buffer, length);
|
||||
}
|
||||
|
||||
|
||||
@@ -219,7 +219,7 @@ private:
|
||||
try
|
||||
{
|
||||
LOG_VERBOSE("FileIndex:Loading index: '%s'", _indexPath.c_str());
|
||||
auto fs = OpenRCT2::FileStream(_indexPath, OpenRCT2::FILE_MODE_OPEN);
|
||||
auto fs = OpenRCT2::FileStream(_indexPath, OpenRCT2::FileMode::open);
|
||||
|
||||
// Read header, check if we need to re-scan
|
||||
auto header = fs.ReadValue<FileIndexHeader>();
|
||||
@@ -260,7 +260,7 @@ private:
|
||||
{
|
||||
LOG_VERBOSE("FileIndex:Writing index: '%s'", _indexPath.c_str());
|
||||
OpenRCT2::Path::CreateDirectory(OpenRCT2::Path::GetDirectory(_indexPath));
|
||||
auto fs = OpenRCT2::FileStream(_indexPath, OpenRCT2::FILE_MODE_WRITE);
|
||||
auto fs = OpenRCT2::FileStream(_indexPath, OpenRCT2::FileMode::write);
|
||||
|
||||
// Write header
|
||||
FileIndexHeader header;
|
||||
|
||||
@@ -27,37 +27,37 @@
|
||||
|
||||
namespace OpenRCT2
|
||||
{
|
||||
FileStream::FileStream(const fs::path& path, int32_t fileMode)
|
||||
FileStream::FileStream(const fs::path& path, FileMode fileMode)
|
||||
: FileStream(path.u8string(), fileMode)
|
||||
{
|
||||
}
|
||||
|
||||
FileStream::FileStream(const std::string& path, int32_t fileMode)
|
||||
FileStream::FileStream(const std::string& path, FileMode fileMode)
|
||||
: FileStream(path.c_str(), fileMode)
|
||||
{
|
||||
}
|
||||
|
||||
FileStream::FileStream(std::string_view path, int32_t fileMode)
|
||||
FileStream::FileStream(std::string_view path, FileMode fileMode)
|
||||
: FileStream(std::string(path), fileMode)
|
||||
{
|
||||
}
|
||||
|
||||
FileStream::FileStream(const utf8* path, int32_t fileMode)
|
||||
FileStream::FileStream(const utf8* path, FileMode fileMode)
|
||||
{
|
||||
const char* mode;
|
||||
switch (fileMode)
|
||||
{
|
||||
case FILE_MODE_OPEN:
|
||||
case FileMode::open:
|
||||
mode = "rb";
|
||||
_canRead = true;
|
||||
_canWrite = false;
|
||||
break;
|
||||
case FILE_MODE_WRITE:
|
||||
case FileMode::write:
|
||||
mode = "w+b";
|
||||
_canRead = true;
|
||||
_canWrite = true;
|
||||
break;
|
||||
case FILE_MODE_APPEND:
|
||||
case FileMode::append:
|
||||
mode = "a";
|
||||
_canRead = false;
|
||||
_canWrite = true;
|
||||
@@ -81,7 +81,7 @@ namespace OpenRCT2
|
||||
auto modeW = String::toWideChar(mode);
|
||||
_file = _wfopen(pathW.c_str(), modeW.c_str());
|
||||
#else
|
||||
if (fileMode == FILE_MODE_OPEN)
|
||||
if (fileMode == FileMode::open)
|
||||
{
|
||||
struct stat fileStat;
|
||||
// Only allow regular files to be opened as its possible to open directories.
|
||||
|
||||
@@ -14,11 +14,11 @@
|
||||
|
||||
namespace OpenRCT2
|
||||
{
|
||||
enum
|
||||
enum class FileMode : uint8_t
|
||||
{
|
||||
FILE_MODE_OPEN,
|
||||
FILE_MODE_WRITE,
|
||||
FILE_MODE_APPEND,
|
||||
open,
|
||||
write,
|
||||
append,
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -35,10 +35,10 @@ namespace OpenRCT2
|
||||
uint64_t _fileSize = 0;
|
||||
|
||||
public:
|
||||
FileStream(const fs::path& path, int32_t fileMode);
|
||||
FileStream(const std::string& path, int32_t fileMode);
|
||||
FileStream(std::string_view path, int32_t fileMode);
|
||||
FileStream(const utf8* path, int32_t fileMode);
|
||||
FileStream(const fs::path& path, FileMode fileMode);
|
||||
FileStream(const std::string& path, FileMode fileMode);
|
||||
FileStream(std::string_view path, FileMode fileMode);
|
||||
FileStream(const utf8* path, FileMode fileMode);
|
||||
~FileStream() override;
|
||||
|
||||
bool CanRead() const override;
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace OpenRCT2::Json
|
||||
{
|
||||
json_t ReadFromFile(u8string_view path, size_t maxSize)
|
||||
{
|
||||
auto fs = OpenRCT2::FileStream(path, OpenRCT2::FILE_MODE_OPEN);
|
||||
auto fs = OpenRCT2::FileStream(path, OpenRCT2::FileMode::open);
|
||||
|
||||
size_t fileLength = static_cast<size_t>(fs.GetLength());
|
||||
if (fileLength > maxSize)
|
||||
@@ -50,7 +50,7 @@ namespace OpenRCT2::Json
|
||||
std::string jsonOutput = jsonData.dump(indentSize);
|
||||
|
||||
// Write to file
|
||||
auto fs = OpenRCT2::FileStream(path, OpenRCT2::FILE_MODE_WRITE);
|
||||
auto fs = OpenRCT2::FileStream(path, OpenRCT2::FileMode::write);
|
||||
fs.Write(jsonOutput.data(), jsonOutput.size());
|
||||
}
|
||||
|
||||
|
||||
@@ -452,7 +452,7 @@ bool GfxLoadG1(const IPlatformEnvironment& env)
|
||||
try
|
||||
{
|
||||
auto path = env.FindFile(DIRBASE::RCT2, DIRID::DATA, u8"g1.dat");
|
||||
auto fs = FileStream(path, FILE_MODE_OPEN);
|
||||
auto fs = FileStream(path, FileMode::open);
|
||||
_g1.header = fs.ReadValue<RCTG1Header>();
|
||||
|
||||
LOG_VERBOSE("g1.dat, number of entries: %u", _g1.header.num_entries);
|
||||
@@ -532,7 +532,7 @@ bool GfxLoadG2()
|
||||
|
||||
try
|
||||
{
|
||||
auto fs = FileStream(path, FILE_MODE_OPEN);
|
||||
auto fs = FileStream(path, FileMode::open);
|
||||
_g2.header = fs.ReadValue<RCTG1Header>();
|
||||
|
||||
// Read element headers
|
||||
@@ -601,8 +601,8 @@ bool GfxLoadCsg()
|
||||
auto pathDataPath = FindCsg1datAtLocation(Config::Get().general.RCT1Path);
|
||||
try
|
||||
{
|
||||
auto fileHeader = FileStream(pathHeaderPath, FILE_MODE_OPEN);
|
||||
auto fileData = FileStream(pathDataPath, FILE_MODE_OPEN);
|
||||
auto fileHeader = FileStream(pathHeaderPath, FileMode::open);
|
||||
auto fileData = FileStream(pathDataPath, FileMode::open);
|
||||
size_t fileHeaderSize = fileHeader.GetLength();
|
||||
size_t fileDataSize = fileData.GetLength();
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
|
||||
try
|
||||
{
|
||||
OpenRCT2::FileStream fs = OpenRCT2::FileStream(path, OpenRCT2::FILE_MODE_OPEN);
|
||||
OpenRCT2::FileStream fs = OpenRCT2::FileStream(path, OpenRCT2::FileMode::open);
|
||||
|
||||
size_t fileLength = static_cast<size_t>(fs.GetLength());
|
||||
if (fileLength > MAX_LANGUAGE_SIZE)
|
||||
|
||||
@@ -302,7 +302,7 @@ bool NetworkBase::BeginClient(const std::string& host, uint16_t port)
|
||||
|
||||
try
|
||||
{
|
||||
auto fs = FileStream(keyPath, FILE_MODE_WRITE);
|
||||
auto fs = FileStream(keyPath, FileMode::write);
|
||||
_key.SavePrivate(&fs);
|
||||
}
|
||||
catch (const std::exception&)
|
||||
@@ -318,7 +318,7 @@ bool NetworkBase::BeginClient(const std::string& host, uint16_t port)
|
||||
|
||||
try
|
||||
{
|
||||
auto fs = FileStream(keyPath, FILE_MODE_WRITE);
|
||||
auto fs = FileStream(keyPath, FileMode::write);
|
||||
_key.SavePublic(&fs);
|
||||
}
|
||||
catch (const std::exception&)
|
||||
@@ -334,7 +334,7 @@ bool NetworkBase::BeginClient(const std::string& host, uint16_t port)
|
||||
try
|
||||
{
|
||||
LOG_VERBOSE("Loading key from %s", keyPath.c_str());
|
||||
auto fs = FileStream(keyPath, FILE_MODE_OPEN);
|
||||
auto fs = FileStream(keyPath, FileMode::open);
|
||||
ok = _key.LoadPrivate(&fs);
|
||||
}
|
||||
catch (const std::exception&)
|
||||
@@ -2212,7 +2212,7 @@ void NetworkBase::Client_Handle_TOKEN(NetworkConnection& connection, NetworkPack
|
||||
|
||||
try
|
||||
{
|
||||
auto fs = FileStream(keyPath, FILE_MODE_OPEN);
|
||||
auto fs = FileStream(keyPath, FileMode::open);
|
||||
if (!_key.LoadPrivate(&fs))
|
||||
{
|
||||
throw std::runtime_error("Failed to load private key.");
|
||||
@@ -3972,7 +3972,7 @@ void NetworkSendPassword(const std::string& password)
|
||||
}
|
||||
try
|
||||
{
|
||||
auto fs = FileStream(keyPath, FILE_MODE_OPEN);
|
||||
auto fs = FileStream(keyPath, FileMode::open);
|
||||
network._key.LoadPrivate(&fs);
|
||||
}
|
||||
catch (const std::exception&)
|
||||
|
||||
@@ -193,7 +193,7 @@ std::vector<ServerListEntry> ServerList::ReadFavourites() const
|
||||
auto path = env->GetFilePath(PATHID::NETWORK_SERVERS);
|
||||
if (File::Exists(path))
|
||||
{
|
||||
auto fs = FileStream(path, FILE_MODE_OPEN);
|
||||
auto fs = FileStream(path, FileMode::open);
|
||||
auto numEntries = fs.ReadValue<uint32_t>();
|
||||
for (size_t i = 0; i < numEntries; i++)
|
||||
{
|
||||
@@ -247,7 +247,7 @@ bool ServerList::WriteFavourites(const std::vector<ServerListEntry>& entries) co
|
||||
|
||||
try
|
||||
{
|
||||
auto fs = FileStream(path, FILE_MODE_WRITE);
|
||||
auto fs = FileStream(path, FileMode::write);
|
||||
fs.WriteValue<uint32_t>(static_cast<uint32_t>(entries.size()));
|
||||
for (const auto& entry : entries)
|
||||
{
|
||||
|
||||
@@ -356,7 +356,7 @@ std::unique_ptr<IStream> ObjectAsset::GetStream() const
|
||||
{
|
||||
if (_zipPath.empty())
|
||||
{
|
||||
return std::make_unique<FileStream>(_path, FILE_MODE_OPEN);
|
||||
return std::make_unique<FileStream>(_path, FileMode::open);
|
||||
}
|
||||
|
||||
auto zipArchive = Zip::TryOpen(_zipPath, ZIP_ACCESS::READ);
|
||||
|
||||
@@ -267,7 +267,7 @@ namespace OpenRCT2::ObjectFactory
|
||||
std::unique_ptr<Object> result;
|
||||
try
|
||||
{
|
||||
auto fs = OpenRCT2::FileStream(path, OpenRCT2::FILE_MODE_OPEN);
|
||||
auto fs = OpenRCT2::FileStream(path, OpenRCT2::FileMode::open);
|
||||
auto chunkReader = SawyerChunkReader(&fs);
|
||||
|
||||
RCTObjectEntry entry = fs.ReadValue<RCTObjectEntry>();
|
||||
|
||||
@@ -540,7 +540,7 @@ private:
|
||||
// Save to file
|
||||
try
|
||||
{
|
||||
auto fs = FileStream(std::string(path), FILE_MODE_WRITE);
|
||||
auto fs = FileStream(std::string(path), FileMode::write);
|
||||
fs.Write(entry, sizeof(RCTObjectEntry));
|
||||
fs.Write(encodedDataBuffer, encodedDataSize);
|
||||
|
||||
@@ -641,7 +641,7 @@ private:
|
||||
}
|
||||
|
||||
// Read object data from file
|
||||
auto fs = OpenRCT2::FileStream(item->Path, OpenRCT2::FILE_MODE_OPEN);
|
||||
auto fs = OpenRCT2::FileStream(item->Path, OpenRCT2::FileMode::open);
|
||||
auto fileEntry = fs.ReadValue<RCTObjectEntry>();
|
||||
if (*entry != fileEntry)
|
||||
{
|
||||
|
||||
@@ -133,7 +133,7 @@ namespace OpenRCT2
|
||||
|
||||
void Load(const std::string_view path)
|
||||
{
|
||||
FileStream fs(path, FILE_MODE_OPEN);
|
||||
FileStream fs(path, FileMode::open);
|
||||
Load(fs);
|
||||
}
|
||||
|
||||
@@ -204,7 +204,7 @@ namespace OpenRCT2
|
||||
|
||||
void Save(GameState_t& gameState, const std::string_view path)
|
||||
{
|
||||
FileStream fs(path, FILE_MODE_WRITE);
|
||||
FileStream fs(path, FileMode::write);
|
||||
Save(gameState, fs);
|
||||
}
|
||||
|
||||
|
||||
@@ -80,8 +80,8 @@ bool CsgAtLocationIsUsable(u8string_view path)
|
||||
return false;
|
||||
}
|
||||
|
||||
auto fileHeader = FileStream(csg1HeaderPath, FILE_MODE_OPEN);
|
||||
auto fileData = FileStream(csg1DataPath, FILE_MODE_OPEN);
|
||||
auto fileHeader = FileStream(csg1HeaderPath, FileMode::open);
|
||||
auto fileData = FileStream(csg1DataPath, FileMode::open);
|
||||
size_t fileHeaderSize = fileHeader.GetLength();
|
||||
size_t fileDataSize = fileData.GetLength();
|
||||
|
||||
|
||||
@@ -162,14 +162,14 @@ namespace OpenRCT2::RCT1
|
||||
|
||||
ParkLoadResult LoadSavedGame(const u8string& path, bool skipObjectCheck = false) override
|
||||
{
|
||||
auto fs = FileStream(path, FILE_MODE_OPEN);
|
||||
auto fs = FileStream(path, FileMode::open);
|
||||
auto result = LoadFromStream(&fs, false, skipObjectCheck, path);
|
||||
return result;
|
||||
}
|
||||
|
||||
ParkLoadResult LoadScenario(const u8string& path, bool skipObjectCheck = false) override
|
||||
{
|
||||
auto fs = FileStream(path, FILE_MODE_OPEN);
|
||||
auto fs = FileStream(path, FileMode::open);
|
||||
auto result = LoadFromStream(&fs, true, skipObjectCheck, path);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace OpenRCT2::RCT1
|
||||
if (String::iequals(extension, ".td4"))
|
||||
{
|
||||
_name = GetNameFromTrackPath(path);
|
||||
auto fs = OpenRCT2::FileStream(path, OpenRCT2::FILE_MODE_OPEN);
|
||||
auto fs = OpenRCT2::FileStream(path, OpenRCT2::FileMode::open);
|
||||
return LoadFromStream(&fs);
|
||||
}
|
||||
|
||||
|
||||
@@ -140,7 +140,7 @@ namespace OpenRCT2::RCT2
|
||||
|
||||
ParkLoadResult LoadSavedGame(const u8string& path, bool skipObjectCheck = false) override
|
||||
{
|
||||
auto fs = OpenRCT2::FileStream(path, OpenRCT2::FILE_MODE_OPEN);
|
||||
auto fs = OpenRCT2::FileStream(path, OpenRCT2::FileMode::open);
|
||||
auto result = LoadFromStream(&fs, false, skipObjectCheck);
|
||||
_s6Path = path;
|
||||
return result;
|
||||
@@ -148,7 +148,7 @@ namespace OpenRCT2::RCT2
|
||||
|
||||
ParkLoadResult LoadScenario(const u8string& path, bool skipObjectCheck = false) override
|
||||
{
|
||||
auto fs = OpenRCT2::FileStream(path, OpenRCT2::FILE_MODE_OPEN);
|
||||
auto fs = OpenRCT2::FileStream(path, OpenRCT2::FileMode::open);
|
||||
auto result = LoadFromStream(&fs, true, skipObjectCheck);
|
||||
_s6Path = path;
|
||||
return result;
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace OpenRCT2::RCT2
|
||||
{
|
||||
try
|
||||
{
|
||||
auto fs = OpenRCT2::FileStream(path, OpenRCT2::FILE_MODE_WRITE);
|
||||
auto fs = OpenRCT2::FileStream(path, OpenRCT2::FileMode::write);
|
||||
return SaveTrack(&fs);
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace OpenRCT2::RCT2
|
||||
if (String::iequals(extension, ".td6"))
|
||||
{
|
||||
_name = GetNameFromTrackPath(path);
|
||||
auto fs = OpenRCT2::FileStream(path, OpenRCT2::FILE_MODE_OPEN);
|
||||
auto fs = OpenRCT2::FileStream(path, OpenRCT2::FileMode::open);
|
||||
return LoadFromStream(&fs);
|
||||
}
|
||||
|
||||
|
||||
@@ -192,7 +192,7 @@ private:
|
||||
return ms;
|
||||
}
|
||||
|
||||
auto fs = std::make_unique<FileStream>(path, FILE_MODE_OPEN);
|
||||
auto fs = std::make_unique<FileStream>(path, FileMode::open);
|
||||
return fs;
|
||||
}
|
||||
|
||||
@@ -534,7 +534,7 @@ private:
|
||||
|
||||
try
|
||||
{
|
||||
auto fs = FileStream(path, FILE_MODE_OPEN);
|
||||
auto fs = FileStream(path, FileMode::open);
|
||||
uint32_t fileVersion = fs.ReadValue<uint32_t>();
|
||||
if (fileVersion != 1 && fileVersion != 2)
|
||||
{
|
||||
@@ -582,7 +582,7 @@ private:
|
||||
bool highscoresDirty = false;
|
||||
try
|
||||
{
|
||||
auto fs = FileStream(path, FILE_MODE_OPEN);
|
||||
auto fs = FileStream(path, FileMode::open);
|
||||
if (fs.GetLength() <= 4)
|
||||
{
|
||||
// Initial value of scores for RCT2, just ignore
|
||||
@@ -673,7 +673,7 @@ private:
|
||||
std::string path = _env->GetFilePath(PATHID::SCORES);
|
||||
try
|
||||
{
|
||||
auto fs = FileStream(path, FILE_MODE_WRITE);
|
||||
auto fs = FileStream(path, FileMode::write);
|
||||
fs.WriteValue<uint32_t>(HighscoreFileVersion);
|
||||
fs.WriteValue<uint32_t>(static_cast<uint32_t>(_highscores.size()));
|
||||
for (size_t i = 0; i < _highscores.size(); i++)
|
||||
|
||||
@@ -133,7 +133,7 @@ namespace OpenRCT2::Title
|
||||
std::unique_ptr<OpenRCT2::IStream> fileStream = nullptr;
|
||||
try
|
||||
{
|
||||
fileStream = std::make_unique<OpenRCT2::FileStream>(absolutePath, OpenRCT2::FILE_MODE_OPEN);
|
||||
fileStream = std::make_unique<OpenRCT2::FileStream>(absolutePath, OpenRCT2::FileMode::open);
|
||||
}
|
||||
catch (const IOException& exception)
|
||||
{
|
||||
@@ -484,7 +484,7 @@ namespace OpenRCT2::Title
|
||||
std::vector<uint8_t> result;
|
||||
try
|
||||
{
|
||||
auto fs = OpenRCT2::FileStream(path, OpenRCT2::FILE_MODE_OPEN);
|
||||
auto fs = OpenRCT2::FileStream(path, OpenRCT2::FileMode::open);
|
||||
auto size = static_cast<size_t>(fs.GetLength());
|
||||
result.resize(size);
|
||||
fs.Read(result.data(), size);
|
||||
|
||||
Reference in new issue
Block a user