diff --git a/rwengine/src/engine/GameData.cpp b/rwengine/src/engine/GameData.cpp index 48c1e121..defd8c2c 100644 --- a/rwengine/src/engine/GameData.cpp +++ b/rwengine/src/engine/GameData.cpp @@ -20,6 +20,7 @@ #include #include #include +#include // Yet another hack function to fix these paths std::string fixPath(std::string path) { @@ -159,17 +160,15 @@ bool GameData::loadObjects(const std::string& name) return false; } -#include uint16_t GameData::findModelObject(const std::string model) { - // Dear C++ Why do I have to resort to strcasecmp this isn't C. auto defit = std::find_if(objectTypes.begin(), objectTypes.end(), [&](const decltype(objectTypes)::value_type& d) { if(d.second->class_type == ObjectInformation::_class("OBJS")) { auto dat = static_cast(d.second.get()); - return strcasecmp(dat->modelName.c_str(), model.c_str()) == 0; + return boost::iequals(dat->modelName, model); } return false; }); diff --git a/rwgame/CMakeLists.txt b/rwgame/CMakeLists.txt index 95c655ce..f28ee8d1 100644 --- a/rwgame/CMakeLists.txt +++ b/rwgame/CMakeLists.txt @@ -1,3 +1,5 @@ +find_package(Boost REQUIRED) + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/GitSHA1.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/GitSHA1.cpp" @ONLY) set(RWGAME_SOURCES diff --git a/rwgame/RWGame.cpp b/rwgame/RWGame.cpp index 2ff82d0c..cd4b0491 100644 --- a/rwgame/RWGame.cpp +++ b/rwgame/RWGame.cpp @@ -25,6 +25,8 @@ #include #include +#include + #include "GitSHA1.h" // Use first 8 chars of git hash as the build string @@ -53,15 +55,15 @@ RWGame::RWGame(int argc, char* argv[]) for( int i = 1; i < argc; ++i ) { - if( strcasecmp( "-w", argv[i] ) == 0 && i+1 < argc ) + if( boost::iequals( "-w", argv[i] ) && i+1 < argc ) { w = std::atoi(argv[i+1]); } - if( strcasecmp( "-h", argv[i] ) == 0 && i+1 < argc ) + if( boost::iequals( "-h", argv[i] ) && i+1 < argc ) { h = std::atoi(argv[i+1]); } - if( strcasecmp( "-f", argv[i] ) == 0 ) + if( boost::iequals( "-f", argv[i] )) { fullscreen = true; } diff --git a/rwlib/source/loaders/LoaderIMG.cpp b/rwlib/source/loaders/LoaderIMG.cpp index 510781e1..ee58d282 100644 --- a/rwlib/source/loaders/LoaderIMG.cpp +++ b/rwlib/source/loaders/LoaderIMG.cpp @@ -1,6 +1,6 @@ #include -#include +#include LoaderIMG::LoaderIMG() : m_version(GTAIIIVC) @@ -50,7 +50,7 @@ bool LoaderIMG::findAssetInfo(const std::string& assetname, LoaderIMGFile& out) { for(size_t i = 0; i < m_assets.size(); ++i) { - if(strcasecmp(m_assets[i].name, assetname.c_str()) == 0) + if(boost::iequals(m_assets[i].name, assetname)) { out = m_assets[i]; return true;