diff --git a/cmake/compiler.cmake b/cmake/compiler.cmake index 7acc50e5..c614329e 100644 --- a/cmake/compiler.cmake +++ b/cmake/compiler.cmake @@ -1,6 +1,6 @@ if(UNIX) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1z") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17") # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32") else() add_definitions(-D_WIN32_WINNT=0x601) diff --git a/deps/watchdog/Watchdog.h b/deps/watchdog/Watchdog.h index a9e2de2d..20f90f10 100644 --- a/deps/watchdog/Watchdog.h +++ b/deps/watchdog/Watchdog.h @@ -30,8 +30,8 @@ #include #include -#include -namespace ci { namespace fs = boost::filesystem; } +#include +namespace ci { namespace fs = std::experimental::filesystem; } //! Exception for when Watchdog can't locate a file or parse the wildcard class WatchedFileSystemExc : public std::exception { @@ -72,7 +72,7 @@ public: watchImpl( ci::fs::path() ); } //! Sets the last modification time of a file or directory. by default sets the time to the current time - static void touch( const ci::fs::path &path, std::time_t time = std::time( nullptr ) ) + static void touch( const ci::fs::path &path, ci::fs::file_time_type time = ci::fs::file_time_type::clock::now() ) { // if the file or directory exists change its last write time @@ -308,11 +308,11 @@ protected: }; protected: - ci::fs::path mPath; - std::string mFilter; - std::function mCallback; - std::function&)> mListCallback; - std::map< std::string, std::time_t > mModificationTimes; + ci::fs::path mPath; + std::string mFilter; + std::function mCallback; + std::function&)> mListCallback; + std::map< std::string, std::experimental::filesystem::file_time_type > mModificationTimes; }; std::mutex mMutex; diff --git a/src/servers/sapphire_api/CMakeLists.txt b/src/servers/sapphire_api/CMakeLists.txt index 0c975b41..22a2a294 100644 --- a/src/servers/sapphire_api/CMakeLists.txt +++ b/src/servers/sapphire_api/CMakeLists.txt @@ -18,5 +18,5 @@ set_target_properties(sapphire_api PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../../../bin/" ) -target_link_libraries (sapphire_api common) +target_link_libraries (sapphire_api common stdc++fs) diff --git a/src/servers/sapphire_api/main.cpp b/src/servers/sapphire_api/main.cpp index 0f49f096..c02c5b8a 100644 --- a/src/servers/sapphire_api/main.cpp +++ b/src/servers/sapphire_api/main.cpp @@ -25,8 +25,7 @@ //Added for the default_resource example #include #include -#include -#include +#include #include #include @@ -42,6 +41,8 @@ Core::Db::DbWorkerPool< Core::Db::ZoneDbConnection > g_charaDb; Core::Data::ExdDataGenerated g_exdDataGen; Core::Network::SapphireAPI g_sapphireAPI; +namespace fs = std::experimental::filesystem; + using namespace std; using HttpServer = SimpleWeb::Server< SimpleWeb::HTTP >; @@ -643,13 +644,13 @@ void get_init( shared_ptr< HttpServer::Response > response, shared_ptr< HttpServ print_request_info( request ); try { - auto web_root_path = boost::filesystem::canonical( "web" ); - auto path = boost::filesystem::canonical( web_root_path / "news.xml" ); + auto web_root_path = fs::canonical( "web" ); + auto path = fs::canonical( web_root_path / "news.xml" ); //Check if path is within web_root_path if( distance( web_root_path.begin(), web_root_path.end() ) > distance( path.begin(), path.end() ) || !std::equal( web_root_path.begin(), web_root_path.end(), path.begin() ) ) throw invalid_argument( "path must be within root path" ); - if( !( boost::filesystem::exists( path ) && boost::filesystem::is_regular_file( path ) ) ) + if( !( fs::exists( path ) && fs::is_regular_file( path ) ) ) throw invalid_argument( "file does not exist" ); auto ifs = make_shared< ifstream >(); @@ -678,13 +679,13 @@ void get_headline_all( shared_ptr< HttpServer::Response > response, shared_ptr< print_request_info( request ); try { - auto web_root_path = boost::filesystem::canonical( "web" ); - auto path = boost::filesystem::canonical( web_root_path / "headlines.xml" ); + auto web_root_path = fs::canonical( "web" ); + auto path = fs::canonical( web_root_path / "headlines.xml" ); //Check if path is within web_root_path if( distance( web_root_path.begin(), web_root_path.end() ) > distance( path.begin(), path.end() ) || !std::equal( web_root_path.begin(), web_root_path.end(), path.begin() ) ) throw invalid_argument( "path must be within root path" ); - if( !( boost::filesystem::exists( path ) && boost::filesystem::is_regular_file( path ) ) ) + if( !( fs::exists( path ) && fs::is_regular_file( path ) ) ) throw invalid_argument( "file does not exist" ); auto ifs = make_shared< ifstream >(); @@ -712,15 +713,15 @@ void defaultGet( shared_ptr< HttpServer::Response > response, shared_ptr< HttpSe print_request_info( request ); try { - auto web_root_path = boost::filesystem::canonical( "web" ); - auto path = boost::filesystem::canonical( web_root_path / request->path ); + auto web_root_path = fs::canonical( "web" ); + auto path = fs::canonical( web_root_path / request->path ); //Check if path is within web_root_path if( distance( web_root_path.begin(), web_root_path.end() ) > distance( path.begin(), path.end() ) || !std::equal( web_root_path.begin(), web_root_path.end(), path.begin() ) ) throw invalid_argument( "path must be within root path" ); - if( boost::filesystem::is_directory( path ) ) + if( fs::is_directory( path ) ) path /= "index.html"; - if( !( boost::filesystem::exists( path ) && boost::filesystem::is_regular_file( path ) ) ) + if( !( fs::exists( path ) && fs::is_regular_file( path ) ) ) throw invalid_argument( "file does not exist" ); auto ifs = make_shared< ifstream >(); diff --git a/src/servers/sapphire_zone/Action/ActionCollision.cpp b/src/servers/sapphire_zone/Action/ActionCollision.cpp index f7f3bb89..34d342d0 100644 --- a/src/servers/sapphire_zone/Action/ActionCollision.cpp +++ b/src/servers/sapphire_zone/Action/ActionCollision.cpp @@ -54,7 +54,7 @@ bool ActionCollision::isActorApplicable( Actor& actor, TargetFilter targetFilter std::set< Core::Entity::ActorPtr > ActionCollision::getActorsHitFromAction( FFXIVARR_POSITION3 aoePosition, std::set< ActorPtr > actorsInRange, - boost::shared_ptr< Core::Data::Action > actionInfo, + std::shared_ptr< Core::Data::Action > actionInfo, TargetFilter targetFilter ) { std::set< ActorPtr > actorsCollided; diff --git a/src/servers/sapphire_zone/Action/ActionCollision.h b/src/servers/sapphire_zone/Action/ActionCollision.h index e11ff2c9..1232b58f 100644 --- a/src/servers/sapphire_zone/Action/ActionCollision.h +++ b/src/servers/sapphire_zone/Action/ActionCollision.h @@ -28,7 +28,7 @@ public: static std::set< ActorPtr > getActorsHitFromAction( Common::FFXIVARR_POSITION3 aoePosition, std::set< ActorPtr > actorsInRange, - boost::shared_ptr< Data::Action > actionInfo, + std::shared_ptr< Data::Action > actionInfo, TargetFilter targetFilter ); private: diff --git a/src/servers/sapphire_zone/CMakeLists.txt b/src/servers/sapphire_zone/CMakeLists.txt index 1c61dd00..20a19b66 100644 --- a/src/servers/sapphire_zone/CMakeLists.txt +++ b/src/servers/sapphire_zone/CMakeLists.txt @@ -35,7 +35,7 @@ set_target_properties(sapphire_zone PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../../../bin/" ) -target_link_libraries( sapphire_zone PUBLIC common ) +target_link_libraries( sapphire_zone PUBLIC common stdc++fs ) target_include_directories( sapphire_zone PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}" ) diff --git a/src/servers/sapphire_zone/Network/GameConnection.cpp b/src/servers/sapphire_zone/Network/GameConnection.cpp index c04b2de2..76159e0b 100644 --- a/src/servers/sapphire_zone/Network/GameConnection.cpp +++ b/src/servers/sapphire_zone/Network/GameConnection.cpp @@ -181,7 +181,7 @@ void Core::Network::GameConnection::OnRecv( std::vector< uint8_t >& buffer ) handlePackets( packetHeader, packetList ); } -void Core::Network::GameConnection::OnError( const boost::system::error_code& error ) +void Core::Network::GameConnection::OnError( const asio::error_code& error ) { auto pLog = g_fw.get< Logger >(); pLog->debug( "GameConnection ERROR: " + error.message() ); diff --git a/src/servers/sapphire_zone/Network/GameConnection.h b/src/servers/sapphire_zone/Network/GameConnection.h index e493ee96..462889ca 100644 --- a/src/servers/sapphire_zone/Network/GameConnection.h +++ b/src/servers/sapphire_zone/Network/GameConnection.h @@ -64,7 +64,7 @@ public: void OnRecv( std::vector< uint8_t >& buffer ) override; - void OnError( const boost::system::error_code& error ) override; + void OnError( const asio::error_code& error ) override; void handlePackets( const Packets::FFXIVARR_PACKET_HEADER& ipcHeader, const std::vector< Packets::FFXIVARR_PACKET_RAW >& packetData ); diff --git a/src/servers/sapphire_zone/Script/ScriptLoader.cpp b/src/servers/sapphire_zone/Script/ScriptLoader.cpp index 0b4c3810..35cc7fb9 100644 --- a/src/servers/sapphire_zone/Script/ScriptLoader.cpp +++ b/src/servers/sapphire_zone/Script/ScriptLoader.cpp @@ -7,13 +7,13 @@ #include #include -#include +#include #include "Framework.h" extern Core::Framework g_fw; -namespace fs = boost::filesystem; +namespace fs = std::experimental::filesystem; const std::string Core::Scripting::ScriptLoader::getModuleExtension() { @@ -67,9 +67,9 @@ Core::Scripting::ScriptInfo* Core::Scripting::ScriptLoader::loadModule( const st try { - fs::copy_file( f, dest, fs::copy_option::overwrite_if_exists ); + fs::copy_file( f, dest, fs::copy_options::overwrite_existing ); } - catch( const boost::filesystem::filesystem_error& err ) + catch( const fs::filesystem_error& err ) { pLog->error( "Error copying file to cache: " + err.code().message() ); @@ -78,9 +78,9 @@ Core::Scripting::ScriptInfo* Core::Scripting::ScriptLoader::loadModule( const st #ifdef _WIN32 - ModuleHandle handle = LoadLibrary( dest.string().c_str() ); + ModuleHandle handle = LoadLibrary( dest.c_str() ); #else - ModuleHandle handle = dlopen( dest.string().c_str(), RTLD_LAZY ); + ModuleHandle handle = dlopen( dest.c_str(), RTLD_LAZY ); #endif if( !handle ) diff --git a/src/servers/sapphire_zone/Script/ScriptMgr.cpp b/src/servers/sapphire_zone/Script/ScriptMgr.cpp index 7bc9b216..e46160cb 100644 --- a/src/servers/sapphire_zone/Script/ScriptMgr.cpp +++ b/src/servers/sapphire_zone/Script/ScriptMgr.cpp @@ -8,7 +8,7 @@ #include #include -#include "Watchdog.h" +#include #include "Zone/Zone.h" #include "Zone/InstanceContent.h" @@ -32,6 +32,8 @@ extern Core::Framework g_fw; +namespace fs = std::experimental::filesystem; + Core::Scripting::ScriptMgr::ScriptMgr() : m_firstScriptChangeNotificiation( false ) { @@ -130,20 +132,20 @@ bool Core::Scripting::ScriptMgr::loadDir( const std::string& dirname, std::set< auto pLog = g_fw.get< Logger >(); pLog->info( "ScriptMgr: loading scripts from " + dirname ); - if( !boost::filesystem::exists( dirname ) ) + if( !fs::exists( dirname ) ) { pLog->error( "ScriptMgr: scripts directory doesn't exist" ); return false; } - boost::filesystem::path targetDir( dirname ); + fs::path targetDir( dirname ); - boost::filesystem::directory_iterator iter( targetDir ); - boost::filesystem::directory_iterator eod; + fs::directory_iterator iter( targetDir ); + fs::directory_iterator eod; - BOOST_FOREACH( boost::filesystem::path const& i, std::make_pair( iter, eod ) ) + BOOST_FOREACH( fs::path const& i, std::make_pair( iter, eod ) ) { - if( is_regular_file( i ) && boost::filesystem::extension( i.string() ) == ext ) + if( fs::is_regular_file( i ) && fs::path( i.string() ).extension() == ext ) { files.insert( i.string() ); } diff --git a/src/servers/sapphire_zone/Session.cpp b/src/servers/sapphire_zone/Session.cpp index 642f8bb2..66e0b06b 100644 --- a/src/servers/sapphire_zone/Session.cpp +++ b/src/servers/sapphire_zone/Session.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include @@ -13,6 +13,7 @@ extern Core::Framework g_fw; +namespace fs = std::experimental::filesystem; Core::Session::Session( uint32_t sessionId ) : m_sessionId( sessionId ), @@ -113,7 +114,7 @@ void Core::Session::updateLastSqlTime() void Core::Session::startReplay( const std::string& path ) { auto pLog = g_fw.get< Logger >(); - if( !boost::filesystem::exists( path ) ) + if( !fs::exists( path ) ) { getPlayer()->sendDebug( "Couldn't find folder." ); return; @@ -123,8 +124,8 @@ void Core::Session::startReplay( const std::string& path ) std::vector< std::tuple< uint64_t, std::string > > loadedSets; - for( auto it = boost::filesystem::directory_iterator( boost::filesystem::path( path ) ); - it != boost::filesystem::directory_iterator(); ++it ) + for( auto it = fs::directory_iterator( fs::path( path ) ); + it != fs::directory_iterator(); ++it ) { // Get the filename of the current element auto fileName = it->path().filename().string(); diff --git a/src/servers/sapphire_zone/Watchdog.h b/src/servers/sapphire_zone/Watchdog.h deleted file mode 100644 index a9e2de2d..00000000 --- a/src/servers/sapphire_zone/Watchdog.h +++ /dev/null @@ -1,322 +0,0 @@ -/* - - Watchdog - - Copyright (c) 2014, Simon Geilfus - All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, are permitted provided that - the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this list of conditions and - the following disclaimer. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED - WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. - */ - -#pragma once - -#include -#include -#include -#include -#include -#include - -#include -namespace ci { namespace fs = boost::filesystem; } - -//! Exception for when Watchdog can't locate a file or parse the wildcard -class WatchedFileSystemExc : public std::exception { -public: - WatchedFileSystemExc( const ci::fs::path &path ) - { - m_message = "Failed to find the file or directory at: " + path.string(); - } - - virtual const char* what() const throw() { return m_message.c_str(); } - - std::string m_message; -}; - -//! Watchdog class. -class Watchdog { -public: - - //! Watches a file or directory for modification and call back the specified std::function. The path specified is passed as argument of the callback even if there is multiple files. Use the second watch method if you want to receive a list of all the files that have been modified. - static void watch( const ci::fs::path &path, const std::function &callback ) - { - watchImpl( path, callback, std::function&)>() ); - } - - //! Watches a file or directory for modification and call back the specified std::function. A list of modified files or directory is passed as argument of the callback. Use this version only if you are watching multiple files or a directory. - static void watchMany( const ci::fs::path &path, const std::function&)> &callback ) - { - watchImpl( path, std::function(), callback ); - } - //! Unwatches a previously registrated file or directory - static void unwatch( const ci::fs::path &path ) - { - watchImpl( path ); - } - //! Unwatches all previously registrated file or directory - static void unwatchAll() - { - watchImpl( ci::fs::path() ); - } - //! Sets the last modification time of a file or directory. by default sets the time to the current time - static void touch( const ci::fs::path &path, std::time_t time = std::time( nullptr ) ) - { - - // if the file or directory exists change its last write time - if( ci::fs::exists( path ) ){ - ci::fs::last_write_time( path, time ); - return; - } - // if not, visit each path if there's a wildcard - if( path.string().find( "*" ) != std::string::npos ){ - visitWildCardPath( path, [time]( const ci::fs::path &p ){ - ci::fs::last_write_time( p, time ); - return false; - } ); - } - // otherwise throw an exception - else { - throw WatchedFileSystemExc( path ); - } - } - -protected: - - Watchdog() - : mWatching(false) - { - } - - void close() - { - // remove all watchers - unwatchAll(); - - // stop the thread - mWatching = false; - if( mThread->joinable() ) mThread->join(); - } - - - void start() - { - mWatching = true; - mThread = std::unique_ptr( new std::thread( [this](){ - // keep watching for modifications every ms milliseconds - auto ms = std::chrono::milliseconds( 500 ); - while( mWatching ) { - do { - // iterate through each watcher and check for modification - std::lock_guard lock( mMutex ); - auto end = mFileWatchers.end(); - for( auto it = mFileWatchers.begin(); it != end; ++it ) { - it->second.watch(); - } - // lock will be released before this thread goes to sleep - } while( false ); - - // make this thread sleep for a while - std::this_thread::sleep_for( ms ); - } - } ) ); - } - static void watchImpl( const ci::fs::path &path, const std::function &callback = std::function(), const std::function&)> &listCallback = std::function&)>() ) - { - // create the static Watchdog instance - static Watchdog wd; - // and start its thread - if( !wd.mWatching ) { - wd.start(); - } - - const std::string key = path.string(); - - // add a new watcher - if( callback || listCallback ){ - - std::string filter; - ci::fs::path p = path; - // try to see if there's a match for the wildcard - if( path.string().find( "*" ) != std::string::npos ){ - bool found = false; - std::pair pathFilter = visitWildCardPath( path, [&found]( const ci::fs::path &p ){ - found = true; - return true; - } ); - if( !found ){ - throw WatchedFileSystemExc( path ); - } - else { - p = pathFilter.first; - filter = pathFilter.second; - } - } - - std::lock_guard lock( wd.mMutex ); - if( wd.mFileWatchers.find( key ) == wd.mFileWatchers.end() ){ - wd.mFileWatchers.emplace( make_pair( key, Watcher( p, filter, callback, listCallback ) ) ); - } - } - // if there is no callback that means that we are unwatching - else { - // if the path is empty we unwatch all files - if( path.empty() ){ - std::lock_guard lock( wd.mMutex ); - for( auto it = wd.mFileWatchers.begin(); it != wd.mFileWatchers.end(); ) { - it = wd.mFileWatchers.erase( it ); - } - } - // or the specified file or directory - else { - std::lock_guard lock( wd.mMutex ); - auto watcher = wd.mFileWatchers.find( key ); - if( watcher != wd.mFileWatchers.end() ){ - wd.mFileWatchers.erase( watcher ); - } - } - } - } - - static std::pair getPathFilterPair( const ci::fs::path &path ) - { - // extract wildcard and parent path - std::string key = path.string(); - ci::fs::path p = path; - size_t wildCardPos = key.find( "*" ); - std::string filter; - if( wildCardPos != std::string::npos ){ - filter = path.filename().string(); - p = path.parent_path(); - } - - // throw an exception if the file doesn't exist - if( filter.empty() && !ci::fs::exists( p ) ){ - throw WatchedFileSystemExc( path ); - } - - return std::make_pair( p, filter ); - - } - - static std::pair visitWildCardPath( const ci::fs::path &path, const std::function &visitor ){ - std::pair pathFilter = getPathFilterPair( path ); - if( !pathFilter.second.empty() ){ - std::string full = ( pathFilter.first / pathFilter.second ).string(); - size_t wildcardPos = full.find( "*" ); - std::string before = full.substr( 0, wildcardPos ); - std::string after = full.substr( wildcardPos + 1 ); - ci::fs::directory_iterator end; - for( ci::fs::directory_iterator it( pathFilter.first ); it != end; ++it ){ - std::string current = it->path().string(); - size_t beforePos = current.find( before ); - size_t afterPos = current.find( after ); - if( ( beforePos != std::string::npos || before.empty() ) - && ( afterPos != std::string::npos || after.empty() ) ) { - if( visitor( it->path() ) ){ - break; - } - } - } - } - return pathFilter; - } - - class Watcher { - public: - Watcher( const ci::fs::path &path, const std::string &filter, const std::function &callback, const std::function&)> &listCallback ) - : mPath(path), mFilter(filter), mCallback(callback), mListCallback(listCallback) - { - // make sure we store all initial write time - if( !mFilter.empty() ) { - std::vector paths; - visitWildCardPath( path / filter, [this,&paths]( const ci::fs::path &p ){ - hasChanged( p ); - paths.push_back( p ); - return false; - } ); - // this means that the first watch won't call the callback function - // so we have to manually call it here - if( mCallback ){ - mCallback( mPath / mFilter ); - } - else { - mListCallback( paths ); - } - } - } - - void watch() - { - // if there's no filter we just check for one item - if( mFilter.empty() && hasChanged( mPath ) && mCallback ){ - mCallback( mPath ); - //#error TODO: still have to figure out an elegant way to do this without cinder - } - // otherwise we check the whole parent directory - else if( !mFilter.empty() ){ - - std::vector paths; - visitWildCardPath( mPath / mFilter, [this,&paths]( const ci::fs::path &p ){ - bool pathHasChanged = hasChanged( p ); - if( pathHasChanged && mCallback ){ - mCallback( mPath / mFilter ); - //#error TODO: still have to figure out an elegant way to do this without cinder - return true; - } - else if( pathHasChanged && mListCallback ){ - paths.push_back( p ); - } - return false; - } ); - if( paths.size() && mListCallback ){ - mListCallback( paths ); - } - } - - } - - bool hasChanged( const ci::fs::path &path ) - { - // get the last modification time - auto time = ci::fs::last_write_time( path ); - // add a new modification time to the map - std::string key = path.string(); - if( mModificationTimes.find( key ) == mModificationTimes.end() ) { - mModificationTimes[ key ] = time; - return true; - } - // or compare with an older one - auto &prev = mModificationTimes[ key ]; - if( prev < time ) { - prev = time; - return true; - } - return false; - }; - - protected: - ci::fs::path mPath; - std::string mFilter; - std::function mCallback; - std::function&)> mListCallback; - std::map< std::string, std::time_t > mModificationTimes; - }; - - std::mutex mMutex; - std::atomic mWatching; - std::unique_ptr mThread; - std::map mFileWatchers; -}; \ No newline at end of file diff --git a/src/servers/sapphire_zone/Zone/InstanceContent.cpp b/src/servers/sapphire_zone/Zone/InstanceContent.cpp index 5e04a430..6f0040e8 100644 --- a/src/servers/sapphire_zone/Zone/InstanceContent.cpp +++ b/src/servers/sapphire_zone/Zone/InstanceContent.cpp @@ -29,7 +29,7 @@ using namespace Core::Network::Packets; using namespace Core::Network::Packets::Server; using namespace Core::Network::ActorControl; -Core::InstanceContent::InstanceContent( boost::shared_ptr< Core::Data::InstanceContent > pInstanceConfiguration, +Core::InstanceContent::InstanceContent( std::shared_ptr< Core::Data::InstanceContent > pInstanceConfiguration, uint16_t territoryType, uint32_t guId, const std::string& internalName, diff --git a/src/servers/sapphire_zone/Zone/InstanceContent.h b/src/servers/sapphire_zone/Zone/InstanceContent.h index eb97e553..c8834d82 100644 --- a/src/servers/sapphire_zone/Zone/InstanceContent.h +++ b/src/servers/sapphire_zone/Zone/InstanceContent.h @@ -20,7 +20,7 @@ public: DutyFinished }; - InstanceContent( boost::shared_ptr< Core::Data::InstanceContent > pInstanceConfiguration, + InstanceContent( std::shared_ptr< Core::Data::InstanceContent > pInstanceConfiguration, uint16_t territoryType, uint32_t guId, const std::string& internalName, @@ -76,7 +76,7 @@ public: InstanceContentState getState() const; - boost::shared_ptr< Core::Data::InstanceContent > getInstanceConfiguration() const; + std::shared_ptr< Core::Data::InstanceContent > getInstanceConfiguration() const; uint32_t getInstanceContentId() const; @@ -95,7 +95,7 @@ public: const uint32_t instanceStartDelay = 1250; private: - boost::shared_ptr< Core::Data::InstanceContent > m_instanceConfiguration; + std::shared_ptr< Core::Data::InstanceContent > m_instanceConfiguration; uint32_t m_instanceContentId; InstanceContentState m_state; uint16_t m_currentBgm; diff --git a/src/servers/sapphire_zone/Zone/TerritoryMgr.h b/src/servers/sapphire_zone/Zone/TerritoryMgr.h index 8519ad48..3ecebdfd 100644 --- a/src/servers/sapphire_zone/Zone/TerritoryMgr.h +++ b/src/servers/sapphire_zone/Zone/TerritoryMgr.h @@ -12,9 +12,9 @@ struct PlaceName; struct TerritoryType; struct InstanceContent; -using PlaceNamePtr = boost::shared_ptr< PlaceName >; -using TerritoryTypePtr = boost::shared_ptr< TerritoryType >; -using InstanceContentPtr = boost::shared_ptr< InstanceContent >; +using PlaceNamePtr = std::shared_ptr< PlaceName >; +using TerritoryTypePtr = std::shared_ptr< TerritoryType >; +using InstanceContentPtr = std::shared_ptr< InstanceContent >; } /*! diff --git a/src/servers/sapphire_zone/Zone/Zone.cpp b/src/servers/sapphire_zone/Zone/Zone.cpp index e1fec325..5cc83a2f 100644 --- a/src/servers/sapphire_zone/Zone/Zone.cpp +++ b/src/servers/sapphire_zone/Zone/Zone.cpp @@ -91,12 +91,12 @@ void Core::Zone::loadWeatherRates() auto weatherRateFields = pExdData->m_WeatherRateDat.get_row( weatherRateId ); for( size_t i = 0; i < 16; ) { - int32_t weatherId = boost::get< int32_t >( weatherRateFields[ i ] ); + int32_t weatherId = std::get< int32_t >( weatherRateFields[ i ] ); if( weatherId == 0 ) break; - sumPc += boost::get< uint8_t >( weatherRateFields[ i + 1 ] ); + sumPc += std::get< uint8_t >( weatherRateFields[ i + 1 ] ); m_weatherRateMap[ sumPc ] = weatherId; i += 2; } diff --git a/src/servers/sapphire_zone/Zone/Zone.h b/src/servers/sapphire_zone/Zone/Zone.h index ddc1e57b..b171c9b0 100644 --- a/src/servers/sapphire_zone/Zone/Zone.h +++ b/src/servers/sapphire_zone/Zone/Zone.h @@ -53,7 +53,7 @@ protected: FestivalPair m_currentFestival; - boost::shared_ptr< Data::TerritoryType > m_territoryTypeInfo; + std::shared_ptr< Data::TerritoryType > m_territoryTypeInfo; std::map< uint8_t, int32_t > m_weatherRateMap; diff --git a/src/tools/event_object_parser/main.cpp b/src/tools/event_object_parser/main.cpp index bd672fdf..1368d76c 100644 --- a/src/tools/event_object_parser/main.cpp +++ b/src/tools/event_object_parser/main.cpp @@ -25,8 +25,12 @@ #include #include +#include + #endif +namespace fs = std::experimental::filesystem; + // garbage to ignore models bool ignoreModels = false; @@ -390,7 +394,7 @@ int main( int argc, char* argv[] ) contentTypeMap[ 11 ] = "events"; contentTypeMap[ 12 ] = "pvp"; - if( !boost::filesystem::exists( "instance.tmpl" ) ) + if( !fs::exists( "instance.tmpl" ) ) throw std::runtime_error( "instance.tmpl is missing in working directory" ); initExd( gamePath ); @@ -663,8 +667,8 @@ int main( int argc, char* argv[] ) if( subdirIt != contentTypeMap.end() ) subdir = subdirIt->second + "/"; - boost::filesystem::path outDir( "instances/" + subdir ); - boost::filesystem::create_directories( outDir ); + fs::path outDir( "instances/" + subdir ); + fs::create_directories( outDir ); std::ofstream outH( outDir.string() + entry.name + ".cpp" ); outH << result; diff --git a/src/tools/mob_parse/main.cpp b/src/tools/mob_parse/main.cpp index 052af653..119e4e67 100644 --- a/src/tools/mob_parse/main.cpp +++ b/src/tools/mob_parse/main.cpp @@ -11,16 +11,17 @@ #include #include #include + #include #include #include #include -#include #include #include -using namespace boost::system; -namespace filesys = boost::filesystem; +#include + +namespace filesys = std::experimental::filesystem; #include #include @@ -171,8 +172,8 @@ std::vector< std::string > getAllFilesInDir( const std::string& dirPath, // Add the name in vector listOfFiles.push_back( iter->path().string() ); } - - error_code ec; + + std::error_code ec; // Increment the iterator to point to next entry in recursive iteration iter.increment( ec ); if( ec ) diff --git a/src/tools/quest_parser/main.cpp b/src/tools/quest_parser/main.cpp index af195a96..99f1c44d 100644 --- a/src/tools/quest_parser/main.cpp +++ b/src/tools/quest_parser/main.cpp @@ -6,7 +6,7 @@ #include #include -#include +#include #include #include @@ -22,6 +22,7 @@ Core::Logger g_log; Core::Data::ExdDataGenerated g_exdDataGen; +namespace fs = std::experimental::filesystem; const std::string onTalkStr( " void onTalk( uint32_t eventId, Entity::Player& player, uint64_t actorId ) override\n" @@ -345,8 +346,8 @@ int main( int argc, char** argv ) auto rows = g_exdDataGen.getQuestIdList(); - if( !boost::filesystem::exists( "./generated" ) ) - boost::filesystem::create_directory( "./generated" ); + if( !fs::exists( "./generated" ) ) + fs::create_directory( "./generated" ); g_log.info( "Export in progress" );