1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-10-06 09:07:19 +02:00

Fixed .native() and some cast errors

Signed-off-by: PerikiyoXD <perikiyoxd@gmail.com>
This commit is contained in:
PerikiyoXD 2016-09-08 21:17:30 +02:00
parent 53e996aac7
commit 62d0bf796a
5 changed files with 18 additions and 18 deletions

View File

@ -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)
{

View File

@ -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

View File

@ -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;

View File

@ -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);
}

View File

@ -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];