From 62d0bf796a6ee972de1a2a6907982c5084a6106e Mon Sep 17 00:00:00 2001 From: PerikiyoXD Date: Thu, 8 Sep 2016 21:17:30 +0200 Subject: [PATCH] Fixed .native() and some cast errors Signed-off-by: PerikiyoXD --- rwengine/src/engine/GameData.cpp | 26 ++++++++++++------------- rwengine/src/engine/SaveGame.cpp | 2 +- rwlib/source/loaders/RWBinaryStream.hpp | 2 +- rwlib/source/platform/FileIndex.cpp | 4 ++-- rwlib/source/platform/FileIndex.hpp | 2 +- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/rwengine/src/engine/GameData.cpp b/rwengine/src/engine/GameData.cpp index 8182c188..41c563e4 100644 --- a/rwengine/src/engine/GameData.cpp +++ b/rwengine/src/engine/GameData.cpp @@ -68,7 +68,7 @@ void GameData::load() void GameData::loadLevelFile(const std::string& path) { auto datpath = index.findFilePath(path); - std::ifstream datfile(datpath.c_str()); + std::ifstream datfile(datpath.string()); if(!datfile.is_open()) { @@ -111,7 +111,7 @@ void GameData::loadLevelFile(const std::string& path) { auto path = line.substr(space+1); /// @todo improve TXD handling - auto name = index.findFilePath(path).filename().native(); + auto name = index.findFilePath(path).filename().string(); std::transform(name.begin(), name.end(), name.begin(), ::tolower); loadTXD(name); } @@ -121,7 +121,7 @@ void GameData::loadLevelFile(const std::string& path) void GameData::loadIDE(const std::string& path) { - auto systempath = index.findFilePath(path).native(); + auto systempath = index.findFilePath(path).string(); LoaderIDE idel; if(idel.load(systempath)) { @@ -154,7 +154,7 @@ void GameData::loadCOL(const size_t zone, const std::string& name) LoaderCOL col; - auto systempath = index.findFilePath(name).native(); + auto systempath = index.findFilePath(name).string(); if(col.load(systempath)) { for( size_t i = 0; i < col.instances.size(); ++i ) { @@ -165,13 +165,13 @@ void GameData::loadCOL(const size_t zone, const std::string& name) void GameData::loadIMG(const std::string& name) { - auto syspath = index.findFilePath(name).native(); + auto syspath = index.findFilePath(name).string(); index.indexArchive(syspath); } void GameData::loadIPL(const std::string& path) { - auto systempath = index.findFilePath(path).native(); + auto systempath = index.findFilePath(path).string(); iplLocations.insert({path, systempath}); } @@ -206,7 +206,7 @@ enum ColSection { void GameData::loadCarcols(const std::string& path) { auto syspath = index.findFilePath(path); - std::ifstream fstream(syspath.c_str()); + std::ifstream fstream(syspath.string()); std::string line; ColSection currentSection = Unknown; @@ -257,14 +257,14 @@ void GameData::loadCarcols(const std::string& path) void GameData::loadWeather(const std::string &path) { - auto syspath = index.findFilePath(path).native(); + auto syspath = index.findFilePath(path).string(); weatherLoader.load(syspath); } void GameData::loadHandling(const std::string& path) { GenericDATLoader l; - auto syspath = index.findFilePath(path).native(); + auto syspath = index.findFilePath(path).string(); l.loadHandling(syspath, vehicleInfo); } @@ -290,7 +290,7 @@ void GameData::loadGXT(const std::string &name) void GameData::loadWaterpro(const std::string& path) { auto syspath = index.findFilePath(path); - std::ifstream ifstr(syspath.c_str(), std::ios_base::binary); + std::ifstream ifstr((const char*)syspath.c_str(), std::ios_base::binary); if(ifstr.is_open()) { uint32_t numlevels; @@ -405,14 +405,14 @@ void GameData::loadDynamicObjects(const std::string& name) void GameData::loadWeaponDAT(const std::string &path) { GenericDATLoader l; - auto syspath = index.findFilePath(path).native(); + auto syspath = index.findFilePath(path).string(); l.loadWeapons(syspath, weaponData); } bool GameData::loadAudioStream(const std::string &name) { - auto systempath = index.findFilePath("audio/" + name).native(); + auto systempath = index.findFilePath("audio/" + name).string(); if (engine->cutsceneAudio.length() > 0) { engine->sound.stopMusic(engine->cutsceneAudio); @@ -428,7 +428,7 @@ bool GameData::loadAudioStream(const std::string &name) bool GameData::loadAudioClip(const std::string& name, const std::string& fileName) { - auto systempath = index.findFilePath("audio/" + fileName).native(); + auto systempath = index.findFilePath("audio/" + fileName).string(); if (systempath.find(".mp3") != std::string::npos) { diff --git a/rwengine/src/engine/SaveGame.cpp b/rwengine/src/engine/SaveGame.cpp index cc352183..6c15a226 100644 --- a/rwengine/src/engine/SaveGame.cpp +++ b/rwengine/src/engine/SaveGame.cpp @@ -1157,7 +1157,7 @@ bool SaveGame::loadGame(GameState& state, const std::string& file) for(size_t g = 0; g < garageData.garageCount; ++g) { auto& garage = garages[g]; state.garages.push_back({ - g, + (int)g, glm::vec3(garage.x1, garage.y1, garage.z1), glm::vec3(garage.x2, garage.y2, garage.z2), garage.type diff --git a/rwlib/source/loaders/RWBinaryStream.hpp b/rwlib/source/loaders/RWBinaryStream.hpp index 5e783f9c..7dee7132 100644 --- a/rwlib/source/loaders/RWBinaryStream.hpp +++ b/rwlib/source/loaders/RWBinaryStream.hpp @@ -36,7 +36,7 @@ public: ChunkID getNextChunk() { // Check that there's any data left - if( (unsigned)(_dataCur - _data) >= _size ) return 0; + if((_dataCur - _data) >= _size ) return 0; // _nextChunk is initally = to _data, making this a non-op _dataCur = _nextChunk; diff --git a/rwlib/source/platform/FileIndex.cpp b/rwlib/source/platform/FileIndex.cpp index a48fb54a..7a223d01 100644 --- a/rwlib/source/platform/FileIndex.cpp +++ b/rwlib/source/platform/FileIndex.cpp @@ -12,7 +12,7 @@ void FileIndex::indexGameDirectory(const fs::path& base_path) for(const path& entry : boost::make_iterator_range(recursive_directory_iterator(base_path), {})) { if(is_regular_file(entry)) { - std::string name = entry.native(); + std::string name = entry.string(); std::transform(name.begin(), name.end(), name.begin(), ::tolower); filesystemfiles_[name] = entry; @@ -23,7 +23,7 @@ void FileIndex::indexGameDirectory(const fs::path& base_path) FileHandle FileIndex::openFilePath(const std::string &file_path) { auto datapath = findFilePath(file_path); - std::ifstream dfile(datapath.c_str(), std::ios_base::binary | std::ios_base::ate); + std::ifstream dfile((const char*)datapath.c_str(), std::ios_base::binary | std::ios_base::ate); if ( ! dfile.is_open()) { throw std::runtime_error("Unable to open file: " + file_path); } diff --git a/rwlib/source/platform/FileIndex.hpp b/rwlib/source/platform/FileIndex.hpp index 8b3832d6..e8bd04d9 100644 --- a/rwlib/source/platform/FileIndex.hpp +++ b/rwlib/source/platform/FileIndex.hpp @@ -56,7 +56,7 @@ public: path.replace(backslash, 1, "/"); } auto realpath = gamedatapath_ / path; - std::string name = realpath.native(); + std::string name = realpath.string(); std::transform(name.begin(), name.end(), name.begin(), ::tolower); return filesystemfiles_[name];