1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-26 06:27:45 +00:00

Merge pull request #409 from NotAdam/boost_scrap

add spdlog, remove more boost
This commit is contained in:
Mordred 2018-10-25 08:02:07 +02:00 committed by GitHub
commit dc46fea1b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
74 changed files with 478 additions and 805 deletions

3
.gitmodules vendored
View file

@ -1,3 +1,6 @@
[submodule "deps/asio"]
path = deps/asio
url = https://github.com/chriskohlhoff/asio.git
[submodule "deps/spdlog"]
path = deps/spdlog
url = https://github.com/gabime/spdlog.git

1
deps/spdlog vendored Submodule

@ -0,0 +1 @@
Subproject commit 240a58fd6e8bfe8fa62dd3ea777d1909f6d89a72

View file

@ -30,8 +30,8 @@
#include <atomic>
#include <mutex>
#include <boost/filesystem.hpp>
namespace ci { namespace fs = boost::filesystem; }
#include <experimental/filesystem>
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<void(const ci::fs::path&)> mCallback;
std::function<void(const std::vector<ci::fs::path>&)> mListCallback;
std::map< std::string, std::time_t > mModificationTimes;
ci::fs::path mPath;
std::string mFilter;
std::function<void(const ci::fs::path&)> mCallback;
std::function<void(const std::vector<ci::fs::path>&)> mListCallback;
std::map< std::string, std::experimental::filesystem::file_time_type > mModificationTimes;
};
std::mutex mMutex;

View file

@ -27,7 +27,6 @@ set_target_properties( common PROPERTIES
RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL "${CMAKE_CURRENT_SOURCE_DIR}/../../bin/"
)
target_link_libraries( common PUBLIC ${Boost_LIBRARIES} )
target_link_libraries( common PUBLIC xivdat )
target_link_libraries( common PUBLIC mysqlConnector )
@ -45,8 +44,9 @@ endif()
target_include_directories( common
PUBLIC
"${CMAKE_CURRENT_SOURCE_DIR}/"
"${CMAKE_CURRENT_SOURCE_DIR}/../../deps/asio/asio/include/"
"${CMAKE_CURRENT_SOURCE_DIR}/../../deps/"
"${CMAKE_CURRENT_SOURCE_DIR}/../../deps/"
"${CMAKE_CURRENT_SOURCE_DIR}/../../deps/asio/asio/include/"
"${CMAKE_CURRENT_SOURCE_DIR}/../../deps/spdlog/include/"
PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/src/libraries/external/")

View file

@ -43,10 +43,10 @@ bool Core::ConfigMgr::loadConfig( const std::string& configName )
std::ifstream configFile( localConfig.c_str() );
configStream << configFile.rdbuf();
// parse the tree and we're fuckin done
// parse the trxee and we're fuckin done
//boost::property_tree::read_ini( configStream, m_propTree );
m_pInih = std::unique_ptr< INIReader >(new INIReader( localConfig ) );
m_pInih = std::unique_ptr< INIReader >( new INIReader( localConfig ) );
if( m_pInih->ParseError() < 0 )
return false;

View file

@ -1,18 +1,10 @@
#include "Logger.h"
#include <boost/log/core.hpp>
#include <boost/log/trivial.hpp>
#include <boost/log/expressions.hpp>
#include <boost/log/sinks/text_file_backend.hpp>
#include <boost/log/utility/setup/file.hpp>
#include <boost/log/utility/setup/common_attributes.hpp>
#include <boost/log/sources/severity_logger.hpp>
#include <boost/log/sources/record_ostream.hpp>
#include <boost/log/sources/global_logger_storage.hpp>
#include <boost/log/support/date_time.hpp>
#include <boost/log/utility/manipulators/add_value.hpp>
#include <boost/log/utility/setup/console.hpp>
#include <iostream>
#include <spdlog/spdlog.h>
#include <spdlog/sinks/stdout_color_sinks.h>
#include <spdlog/sinks/daily_file_sink.h>
// #include <iostream>
namespace Core {
@ -35,56 +27,45 @@ void Logger::setLogPath( const std::string& logPath )
void Logger::init()
{
auto format = (
boost::log::expressions::stream <<
boost::log::expressions::format_date_time< boost::posix_time::ptime >(
"TimeStamp", "[%H:%M:%S]" ) <<
"[" << boost::log::trivial::severity << "] " <<
boost::log::expressions::smessage
);
std::vector< spdlog::sink_ptr > sinks;
boost::log::add_file_log
(
boost::log::keywords::file_name =
m_logFile + "%Y-%m-%d.log", /*< file name pattern >*/
boost::log::keywords::rotation_size =
10 * 1024 * 1024, /*< rotate files every 10 MiB... >*/
boost::log::keywords::time_based_rotation = boost::log::sinks::file::rotation_at_time_point( 0, 0,
0 ), /*< ...or at midnight >*/
boost::log::keywords::open_mode = std::ios::app,
boost::log::keywords::format = format,
boost::log::keywords::auto_flush = true
);
sinks.push_back( std::make_shared< spdlog::sinks::stdout_color_sink_mt >() );
sinks.push_back( std::make_shared< spdlog::sinks::daily_file_sink_mt >( m_logFile + ".log", 0, 0 ) );
boost::log::add_console_log( std::cout, boost::log::keywords::format = format );
m_logger = std::make_shared< spdlog::logger >( "logger", std::begin( sinks ), std::end( sinks ) );
boost::log::add_common_attributes();
// always flush the log on criticial messages, otherwise it's done by libc
// see: https://github.com/gabime/spdlog/wiki/7.-Flush-policy
// nb: if the server crashes, log data can be missing from the file unless something logs critical just before it does
m_logger->flush_on( spdlog::level::critical );
//spdlog::set_pattern( "[%H:%M:%S] [%l] %v" );
}
void Logger::Log( LoggingSeverity logSev, const std::string& text )
{
BOOST_LOG_SEV( m_lg, ( boost::log::trivial::severity_level ) logSev ) << text;
// BOOST_LOG_SEV( m_lg, ( boost::log::trivial::severity_level ) logSev ) << text;
}
void Logger::error( const std::string& text )
{
BOOST_LOG_SEV( m_lg, boost::log::trivial::severity_level::error ) << text;
m_logger->error( text );
}
void Logger::info( const std::string& text )
{
BOOST_LOG_SEV( m_lg, boost::log::trivial::severity_level::info ) << text;
m_logger->info( text );
}
void Logger::debug( const std::string& text )
{
BOOST_LOG_SEV( m_lg, boost::log::trivial::severity_level::debug ) << text;
m_logger->debug( text );
}
void Logger::fatal( const std::string& text )
{
BOOST_LOG_SEV( m_lg, boost::log::trivial::severity_level::fatal ) << text;
m_logger->critical( text );
}

View file

@ -1,7 +1,9 @@
#ifndef _LOGGER_H
#define _LOGGER_H
#include <boost/log/trivial.hpp>
// #include <boost/log/trivial.hpp>
#include <spdlog/spdlog.h>
namespace Core {
@ -19,10 +21,10 @@ class Logger
{
private:
boost::log::sources::severity_logger_mt< boost::log::trivial::severity_level > m_lg;
std::string m_logFile;
std::shared_ptr< spdlog::logger > m_logger;
public:
Logger();

View file

@ -41,7 +41,7 @@ foreach(_scriptDir ${children})
if(MSVC)
#target_link_libraries( "script_${_name}" ${Boost_LIBRARIES})
set_target_properties( "script_${_name}" PROPERTIES
CXX_STANDARD 14
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS ON
LIBRARY_OUTPUT_DIRECTORY_DEBUG "${SCRIPT_LIB_DIR}"

View file

@ -8,7 +8,7 @@ file(GLOB SERVER_SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}*.c*")
add_executable(sapphire_api ${SERVER_PUBLIC_INCLUDE_FILES} ${SERVER_SOURCE_FILES})
set_target_properties(sapphire_api PROPERTIES
CXX_STANDARD 14
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS ON
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/../../../bin/"
@ -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)

View file

@ -1,7 +1,7 @@
#ifndef _FORWARDS_H
#define _FORWARDS_H
#include <boost/shared_ptr.hpp>
#include <memory>
namespace Core {
@ -19,20 +19,20 @@ class Session;
class ZonePosition;
typedef boost::shared_ptr< Zone > ZonePtr;
typedef boost::shared_ptr< Item > ItemPtr;
typedef boost::shared_ptr< ItemContainer > ItemContainerPtr;
typedef boost::shared_ptr< Inventory > InventoryPtr;
typedef boost::shared_ptr< Session > SessionPtr;
typedef boost::shared_ptr< ZonePosition > ZonePositionPtr;
typedef std::shared_ptr< Zone > ZonePtr;
typedef std::shared_ptr< Item > ItemPtr;
typedef std::shared_ptr< ItemContainer > ItemContainerPtr;
typedef std::shared_ptr< Inventory > InventoryPtr;
typedef std::shared_ptr< Session > SessionPtr;
typedef std::shared_ptr< ZonePosition > ZonePositionPtr;
namespace StatusEffect {
class StatusEffect;
class StatusEffectContainer;
typedef boost::shared_ptr< StatusEffect > StatusEffectPtr;
typedef boost::shared_ptr< StatusEffectContainer > StatusEffectContainerPtr;
typedef std::shared_ptr< StatusEffect > StatusEffectPtr;
typedef std::shared_ptr< StatusEffectContainer > StatusEffectContainerPtr;
}
namespace Entity {
@ -42,15 +42,15 @@ class Player;
class BattleNpc;
typedef boost::shared_ptr< Chara > ActorPtr;
typedef boost::shared_ptr< Player > PlayerPtr;
typedef boost::shared_ptr< BattleNpc > BattleNpcPtr;
typedef std::shared_ptr< Chara > ActorPtr;
typedef std::shared_ptr< Player > PlayerPtr;
typedef std::shared_ptr< BattleNpc > BattleNpcPtr;
}
namespace Event {
class EventHandler;
typedef boost::shared_ptr< EventHandler > EventPtr;
typedef std::shared_ptr< EventHandler > EventPtr;
}
namespace Action {
@ -60,9 +60,9 @@ class ActionTeleport;
class EventAction;
typedef boost::shared_ptr< Action > ActionPtr;
typedef boost::shared_ptr< ActionTeleport > ActionTeleportPtr;
typedef boost::shared_ptr< EventAction > EventActionPtr;
typedef std::shared_ptr< Action > ActionPtr;
typedef std::shared_ptr< ActionTeleport > ActionTeleportPtr;
typedef std::shared_ptr< EventAction > EventActionPtr;
}
@ -79,18 +79,18 @@ class SessionConnection;
class ZoneConnection;
typedef boost::shared_ptr< Hive > HivePtr;
typedef boost::shared_ptr< Acceptor > AcceptorPtr;
typedef boost::shared_ptr< Connection > ConnectionPtr;
typedef boost::shared_ptr< WorldConnection > WorldConnectionPtr;
typedef boost::shared_ptr< ZoneConnection > ZoneConnectionPtr;
typedef boost::shared_ptr< SessionConnection > SessionConnectionPtr;
typedef std::shared_ptr< Hive > HivePtr;
typedef std::shared_ptr< Acceptor > AcceptorPtr;
typedef std::shared_ptr< Connection > ConnectionPtr;
typedef std::shared_ptr< WorldConnection > WorldConnectionPtr;
typedef std::shared_ptr< ZoneConnection > ZoneConnectionPtr;
typedef std::shared_ptr< SessionConnection > SessionConnectionPtr;
namespace Packets {
class GamePacket;
typedef boost::shared_ptr< GamePacket > GamePacketPtr;
typedef std::shared_ptr< GamePacket > GamePacketPtr;
}

View file

@ -50,7 +50,7 @@ bool Core::Network::SapphireAPI::login( const std::string& username, const std::
}
// create session for the new sessionid and store to sessionlist
auto pSession = boost::make_shared< Session >();
auto pSession = std::make_shared< Session >();
pSession->setAccountId( accountId );
pSession->setSessionId( sid );
@ -75,7 +75,7 @@ bool Core::Network::SapphireAPI::login( const std::string& username, const std::
bool Core::Network::SapphireAPI::insertSession( const uint32_t& accountId, std::string& sId )
{
// create session for the new sessionid and store to sessionlist
auto pSession = boost::make_shared< Session >();
auto pSession = std::make_shared< Session >();
pSession->setAccountId( accountId );
pSession->setSessionId( ( uint8_t* ) sId.c_str() );

View file

@ -20,7 +20,7 @@ public:
~SapphireAPI();
using SessionMap = std::map< std::string, boost::shared_ptr< Session > >;
using SessionMap = std::map< std::string, std::shared_ptr< Session > >;
bool login( const std::string& username, const std::string& pass, std::string& sId );

View file

@ -1,7 +1,7 @@
#ifndef CLIENT_HTTP_HPP
#define CLIENT_HTTP_HPP
#include <boost/asio.hpp>
#include <asio.hpp>
#include <boost/utility/string_ref.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/functional/hash.hpp>
@ -33,7 +33,7 @@ namespace SimpleWeb {
std::unordered_multimap<std::string, std::string, case_insensitive_hash, case_insensitive_equals> header;
private:
boost::asio::streambuf content_buffer;
asio::streambuf content_buffer;
Response(): content(&content_buffer) {}
};
@ -57,10 +57,10 @@ namespace SimpleWeb {
auto corrected_path=path;
if(corrected_path=="")
corrected_path="/";
if(!config.proxy_server.empty() && std::is_same<socket_type, boost::asio::ip::tcp::socket>::value)
if(!config.proxy_server.empty() && std::is_same<socket_type, asio::ip::tcp::socket>::value)
corrected_path="http://"+host+':'+std::to_string(port)+corrected_path;
boost::asio::streambuf write_buffer;
asio::streambuf write_buffer;
std::ostream write_stream(&write_buffer);
write_stream << request_type << " " << corrected_path << " HTTP/1.1\r\n";
write_stream << "Host: " << host << "\r\n";
@ -74,21 +74,21 @@ namespace SimpleWeb {
connect();
auto timer=get_timeout_timer();
boost::asio::async_write(*socket, write_buffer,
[this, &content, timer](const boost::system::error_code &ec, size_t /*bytes_transferred*/) {
asio::async_write(*socket, write_buffer,
[this, &content, timer](const std::error_code &ec, size_t /*bytes_transferred*/) {
if(timer)
timer->cancel();
if(!ec) {
if(!content.empty()) {
auto timer=get_timeout_timer();
boost::asio::async_write(*socket, boost::asio::buffer(content.data(), content.size()),
[this, timer](const boost::system::error_code &ec, size_t /*bytes_transferred*/) {
asio::async_write(*socket, asio::buffer(content.data(), content.size()),
[this, timer](const std::error_code &ec, size_t /*bytes_transferred*/) {
if(timer)
timer->cancel();
if(ec) {
std::lock_guard<std::mutex> lock(socket_mutex);
this->socket=nullptr;
throw boost::system::system_error(ec);
throw std::system_error(ec);
}
});
}
@ -96,7 +96,7 @@ namespace SimpleWeb {
else {
std::lock_guard<std::mutex> lock(socket_mutex);
socket=nullptr;
throw boost::system::system_error(ec);
throw std::system_error(ec);
}
});
io_service.reset();
@ -110,14 +110,14 @@ namespace SimpleWeb {
auto corrected_path=path;
if(corrected_path=="")
corrected_path="/";
if(!config.proxy_server.empty() && std::is_same<socket_type, boost::asio::ip::tcp::socket>::value)
if(!config.proxy_server.empty() && std::is_same<socket_type, asio::ip::tcp::socket>::value)
corrected_path="http://"+host+':'+std::to_string(port)+corrected_path;
content.seekp(0, std::ios::end);
auto content_length=content.tellp();
content.seekp(0, std::ios::beg);
boost::asio::streambuf write_buffer;
asio::streambuf write_buffer;
std::ostream write_stream(&write_buffer);
write_stream << request_type << " " << corrected_path << " HTTP/1.1\r\n";
write_stream << "Host: " << host << "\r\n";
@ -133,14 +133,14 @@ namespace SimpleWeb {
connect();
auto timer=get_timeout_timer();
boost::asio::async_write(*socket, write_buffer,
[this, timer](const boost::system::error_code &ec, size_t /*bytes_transferred*/) {
asio::async_write(*socket, write_buffer,
[this, timer](const std::error_code &ec, size_t /*bytes_transferred*/) {
if(timer)
timer->cancel();
if(ec) {
std::lock_guard<std::mutex> lock(socket_mutex);
socket=nullptr;
throw boost::system::system_error(ec);
throw std::system_error(ec);
}
});
io_service.reset();
@ -152,15 +152,15 @@ namespace SimpleWeb {
void close() {
std::lock_guard<std::mutex> lock(socket_mutex);
if(socket) {
boost::system::error_code ec;
socket->lowest_layer().shutdown(boost::asio::ip::tcp::socket::shutdown_both, ec);
std::error_code ec;
socket->lowest_layer().shutdown(asio::ip::tcp::socket::shutdown_both, ec);
socket->lowest_layer().close();
}
}
protected:
boost::asio::io_service io_service;
boost::asio::ip::tcp::resolver resolver;
asio::io_service io_service;
asio::ip::tcp::resolver resolver;
std::unique_ptr<socket_type> socket;
std::mutex socket_mutex;
@ -190,13 +190,13 @@ namespace SimpleWeb {
virtual void connect()=0;
std::shared_ptr<boost::asio::deadline_timer> get_timeout_timer() {
std::shared_ptr<asio::deadline_timer> get_timeout_timer() {
if(config.timeout==0)
return nullptr;
auto timer=std::make_shared<boost::asio::deadline_timer>(io_service);
auto timer=std::make_shared<asio::deadline_timer>(io_service);
timer->expires_from_now(boost::posix_time::seconds(config.timeout));
timer->async_wait([this](const boost::system::error_code& ec) {
timer->async_wait([this](const std::error_code& ec) {
if(!ec) {
close();
}
@ -233,11 +233,11 @@ namespace SimpleWeb {
std::shared_ptr<Response> request_read() {
std::shared_ptr<Response> response(new Response());
boost::asio::streambuf chunked_streambuf;
asio::streambuf chunked_streambuf;
auto timer=get_timeout_timer();
boost::asio::async_read_until(*socket, response->content_buffer, "\r\n\r\n",
[this, &response, &chunked_streambuf, timer](const boost::system::error_code& ec, size_t bytes_transferred) {
asio::async_read_until(*socket, response->content_buffer, "\r\n\r\n",
[this, &response, &chunked_streambuf, timer](const std::error_code& ec, size_t bytes_transferred) {
if(timer)
timer->cancel();
if(!ec) {
@ -250,15 +250,15 @@ namespace SimpleWeb {
auto content_length=stoull(header_it->second);
if(content_length>num_additional_bytes) {
auto timer=get_timeout_timer();
boost::asio::async_read(*socket, response->content_buffer,
boost::asio::transfer_exactly(content_length-num_additional_bytes),
[this, timer](const boost::system::error_code& ec, size_t /*bytes_transferred*/) {
asio::async_read(*socket, response->content_buffer,
asio::transfer_exactly(content_length-num_additional_bytes),
[this, timer](const std::error_code& ec, size_t /*bytes_transferred*/) {
if(timer)
timer->cancel();
if(ec) {
std::lock_guard<std::mutex> lock(socket_mutex);
this->socket=nullptr;
throw boost::system::system_error(ec);
throw std::system_error(ec);
}
});
}
@ -270,7 +270,7 @@ namespace SimpleWeb {
else {
std::lock_guard<std::mutex> lock(socket_mutex);
socket=nullptr;
throw boost::system::system_error(ec);
throw std::system_error(ec);
}
});
io_service.reset();
@ -279,10 +279,10 @@ namespace SimpleWeb {
return response;
}
void request_read_chunked(const std::shared_ptr<Response> &response, boost::asio::streambuf &streambuf) {
void request_read_chunked(const std::shared_ptr<Response> &response, asio::streambuf &streambuf) {
auto timer=get_timeout_timer();
boost::asio::async_read_until(*socket, response->content_buffer, "\r\n",
[this, &response, &streambuf, timer](const boost::system::error_code& ec, size_t bytes_transferred) {
asio::async_read_until(*socket, response->content_buffer, "\r\n",
[this, &response, &streambuf, timer](const std::error_code& ec, size_t bytes_transferred) {
if(timer)
timer->cancel();
if(!ec) {
@ -316,9 +316,9 @@ namespace SimpleWeb {
if((2+length)>num_additional_bytes) {
auto timer=get_timeout_timer();
boost::asio::async_read(*socket, response->content_buffer,
boost::asio::transfer_exactly(2+length-num_additional_bytes),
[this, post_process, timer](const boost::system::error_code& ec, size_t /*bytes_transferred*/) {
asio::async_read(*socket, response->content_buffer,
asio::transfer_exactly(2+length-num_additional_bytes),
[this, post_process, timer](const std::error_code& ec, size_t /*bytes_transferred*/) {
if(timer)
timer->cancel();
if(!ec) {
@ -327,7 +327,7 @@ namespace SimpleWeb {
else {
std::lock_guard<std::mutex> lock(socket_mutex);
this->socket=nullptr;
throw boost::system::system_error(ec);
throw std::system_error(ec);
}
});
}
@ -337,7 +337,7 @@ namespace SimpleWeb {
else {
std::lock_guard<std::mutex> lock(socket_mutex);
socket=nullptr;
throw boost::system::system_error(ec);
throw std::system_error(ec);
}
});
}
@ -346,7 +346,7 @@ namespace SimpleWeb {
template<class socket_type>
class Client : public ClientBase<socket_type> {};
typedef boost::asio::ip::tcp::socket HTTP;
typedef asio::ip::tcp::socket HTTP;
template<>
class Client<HTTP> : public ClientBase<HTTP> {
@ -356,15 +356,15 @@ namespace SimpleWeb {
protected:
void connect() {
if(!socket || !socket->is_open()) {
std::unique_ptr<boost::asio::ip::tcp::resolver::query> query;
std::unique_ptr<asio::ip::tcp::resolver::query> query;
if(config.proxy_server.empty())
query=std::unique_ptr<boost::asio::ip::tcp::resolver::query>(new boost::asio::ip::tcp::resolver::query(host, std::to_string(port)));
query=std::unique_ptr<asio::ip::tcp::resolver::query>(new asio::ip::tcp::resolver::query(host, std::to_string(port)));
else {
auto proxy_host_port=parse_host_port(config.proxy_server, 8080);
query=std::unique_ptr<boost::asio::ip::tcp::resolver::query>(new boost::asio::ip::tcp::resolver::query(proxy_host_port.first, std::to_string(proxy_host_port.second)));
query=std::unique_ptr<asio::ip::tcp::resolver::query>(new asio::ip::tcp::resolver::query(proxy_host_port.first, std::to_string(proxy_host_port.second)));
}
resolver.async_resolve(*query, [this](const boost::system::error_code &ec,
boost::asio::ip::tcp::resolver::iterator it){
resolver.async_resolve(*query, [this](const std::error_code &ec,
asio::ip::tcp::resolver::iterator it){
if(!ec) {
{
std::lock_guard<std::mutex> lock(socket_mutex);
@ -372,25 +372,25 @@ namespace SimpleWeb {
}
auto timer=get_timeout_timer();
boost::asio::async_connect(*socket, it, [this, timer]
(const boost::system::error_code &ec, boost::asio::ip::tcp::resolver::iterator /*it*/){
asio::async_connect(*socket, it, [this, timer]
(const std::error_code &ec, asio::ip::tcp::resolver::iterator /*it*/){
if(timer)
timer->cancel();
if(!ec) {
boost::asio::ip::tcp::no_delay option(true);
asio::ip::tcp::no_delay option(true);
this->socket->set_option(option);
}
else {
std::lock_guard<std::mutex> lock(socket_mutex);
this->socket=nullptr;
throw boost::system::system_error(ec);
throw std::system_error(ec);
}
});
}
else {
std::lock_guard<std::mutex> lock(socket_mutex);
socket=nullptr;
throw boost::system::system_error(ec);
throw std::system_error(ec);
}
});
io_service.reset();

View file

@ -25,8 +25,7 @@
//Added for the default_resource example
#include <fstream>
#include <string>
#include <boost/filesystem.hpp>
#include <boost/make_shared.hpp>
#include <experimental/filesystem>
#include <vector>
#include <algorithm>
@ -42,8 +41,9 @@ 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 namespace boost::property_tree;
using HttpServer = SimpleWeb::Server< SimpleWeb::HTTP >;
using HttpClient = SimpleWeb::Client< SimpleWeb::HTTP >;
@ -53,13 +53,13 @@ void default_resource_send( const HttpServer& server, const shared_ptr< HttpServ
const shared_ptr< ifstream >& ifs );
auto m_pConfig = boost::make_shared< Core::ConfigMgr >();
auto m_pConfig = std::make_shared< Core::ConfigMgr >();
HttpServer server;
std::string configPath( "rest.ini" );
void reloadConfig()
{
m_pConfig = boost::make_shared< Core::ConfigMgr >();
m_pConfig = std::make_shared< Core::ConfigMgr >();
if( !m_pConfig->loadConfig( configPath ) )
throw "Error loading config ";
@ -644,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 >();
@ -679,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 >();
@ -713,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 >();
@ -747,7 +747,7 @@ void defaultGet( shared_ptr< HttpServer::Response > response, shared_ptr< HttpSe
int main( int argc, char* argv[] )
{
auto pLog = boost::shared_ptr< Core::Logger >( new Core::Logger() );
auto pLog = std::shared_ptr< Core::Logger >( new Core::Logger() );
g_fw.set< Core::Logger >( pLog );
g_log.setLogPath( "log/SapphireAPI" );
g_log.init();
@ -804,7 +804,7 @@ void default_resource_send( const HttpServer& server, const shared_ptr< HttpServ
response->write( &buffer[ 0 ], read_length );
if( read_length == static_cast< streamsize >( buffer.size() ) )
{
server.send( response, [ &server, response, ifs ]( const boost::system::error_code& ec )
server.send( response, [ &server, response, ifs ]( const std::error_code& ec )
{
if( !ec )
default_resource_send( server, response, ifs );

View file

@ -1,7 +1,7 @@
#ifndef SERVER_HTTP_HPP
#define SERVER_HTTP_HPP
#include <boost/asio.hpp>
#include <asio.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/functional/hash.hpp>
@ -64,7 +64,7 @@ namespace SimpleWeb {
class Response : public std::ostream {
friend class ServerBase<socket_type>;
boost::asio::streambuf streambuf;
asio::streambuf streambuf;
std::shared_ptr<socket_type> socket;
@ -88,8 +88,8 @@ namespace SimpleWeb {
return ss.str();
}
private:
boost::asio::streambuf &streambuf;
Content(boost::asio::streambuf &streambuf): std::istream(&streambuf), streambuf(streambuf) {}
asio::streambuf &streambuf;
Content(asio::streambuf &streambuf): std::istream(&streambuf), streambuf(streambuf) {}
};
class Request {
@ -116,7 +116,7 @@ namespace SimpleWeb {
catch(...) {}
}
boost::asio::streambuf streambuf;
asio::streambuf streambuf;
};
class Config {
@ -159,27 +159,27 @@ namespace SimpleWeb {
std::map<std::string,
std::function<void(std::shared_ptr<typename ServerBase<socket_type>::Response>, std::shared_ptr<typename ServerBase<socket_type>::Request>)> > default_resource;
std::function<void(std::shared_ptr<typename ServerBase<socket_type>::Request>, const boost::system::error_code&)> on_error;
std::function<void(std::shared_ptr<typename ServerBase<socket_type>::Request>, const std::error_code&)> on_error;
std::function<void(std::shared_ptr<socket_type> socket, std::shared_ptr<typename ServerBase<socket_type>::Request>)> on_upgrade;
virtual void start() {
if(!io_service)
io_service=std::make_shared<boost::asio::io_service>();
io_service=std::make_shared<asio::io_service>();
if(io_service->stopped())
io_service->reset();
boost::asio::ip::tcp::endpoint endpoint;
asio::ip::tcp::endpoint endpoint;
if(config.address.size()>0)
endpoint=boost::asio::ip::tcp::endpoint(boost::asio::ip::address::from_string(config.address), config.port);
endpoint=asio::ip::tcp::endpoint(asio::ip::address::from_string(config.address), config.port);
else
endpoint=boost::asio::ip::tcp::endpoint(boost::asio::ip::tcp::v4(), config.port);
endpoint=asio::ip::tcp::endpoint(asio::ip::tcp::v4(), config.port);
if(!acceptor)
acceptor=std::unique_ptr<boost::asio::ip::tcp::acceptor>(new boost::asio::ip::tcp::acceptor(*io_service));
acceptor=std::unique_ptr<asio::ip::tcp::acceptor>(new asio::ip::tcp::acceptor(*io_service));
acceptor->open(endpoint.protocol());
acceptor->set_option(boost::asio::socket_base::reuse_address(config.reuse_address));
acceptor->set_option(asio::socket_base::reuse_address(config.reuse_address));
acceptor->bind(endpoint);
acceptor->listen();
@ -210,34 +210,34 @@ namespace SimpleWeb {
}
///Use this function if you need to recursively send parts of a longer message
void send(const std::shared_ptr<Response> &response, const std::function<void(const boost::system::error_code&)>& callback=nullptr) const {
boost::asio::async_write(*response->socket, response->streambuf, [this, response, callback](const boost::system::error_code& ec, size_t /*bytes_transferred*/) {
void send(const std::shared_ptr<Response> &response, const std::function<void(const std::error_code&)>& callback=nullptr) const {
asio::async_write(*response->socket, response->streambuf, [this, response, callback](const std::error_code& ec, size_t /*bytes_transferred*/) {
if(callback)
callback(ec);
});
}
/// If you have your own boost::asio::io_service, store its pointer here before running start().
/// If you have your own asio::io_service, store its pointer here before running start().
/// You might also want to set config.thread_pool_size to 0.
std::shared_ptr<boost::asio::io_service> io_service;
std::shared_ptr<asio::io_service> io_service;
protected:
std::unique_ptr<boost::asio::ip::tcp::acceptor> acceptor;
std::unique_ptr<asio::ip::tcp::acceptor> acceptor;
std::vector<std::thread> threads;
ServerBase(unsigned short port) : config(port) {}
virtual void accept()=0;
std::shared_ptr<boost::asio::deadline_timer> get_timeout_timer(const std::shared_ptr<socket_type> &socket, long seconds) {
std::shared_ptr<asio::deadline_timer> get_timeout_timer(const std::shared_ptr<socket_type> &socket, long seconds) {
if(seconds==0)
return nullptr;
auto timer=std::make_shared<boost::asio::deadline_timer>(*io_service);
auto timer=std::make_shared<asio::deadline_timer>(*io_service);
timer->expires_from_now(boost::posix_time::seconds(seconds));
timer->async_wait([socket](const boost::system::error_code& ec){
timer->async_wait([socket](const std::error_code& ec){
if(!ec) {
boost::system::error_code ec;
socket->lowest_layer().shutdown(boost::asio::ip::tcp::socket::shutdown_both, ec);
std::error_code ec;
socket->lowest_layer().shutdown(asio::ip::tcp::socket::shutdown_both, ec);
socket->lowest_layer().close();
}
});
@ -249,11 +249,11 @@ namespace SimpleWeb {
//shared_ptr is used to pass temporary objects to the asynchronous functions
std::shared_ptr<Request> request(new Request(*socket));
//Set timeout on the following boost::asio::async-read or write function
//Set timeout on the following asio::async-read or write function
auto timer=this->get_timeout_timer(socket, config.timeout_request);
boost::asio::async_read_until(*socket, request->streambuf, "\r\n\r\n",
[this, socket, request, timer](const boost::system::error_code& ec, size_t bytes_transferred) {
asio::async_read_until(*socket, request->streambuf, "\r\n\r\n",
[this, socket, request, timer](const std::error_code& ec, size_t bytes_transferred) {
if(timer)
timer->cancel();
if(!ec) {
@ -275,16 +275,16 @@ namespace SimpleWeb {
}
catch( const std::exception & ) {
if(on_error)
on_error(request, boost::system::error_code(boost::system::errc::protocol_error, boost::system::generic_category()));
on_error( request, std::make_error_code( std::errc::protocol_error ) );
return;
}
if(content_length>num_additional_bytes) {
//Set timeout on the following boost::asio::async-read or write function
//Set timeout on the following asio::async-read or write function
auto timer=this->get_timeout_timer(socket, config.timeout_content);
boost::asio::async_read(*socket, request->streambuf,
boost::asio::transfer_exactly(static_cast< size_t >(content_length-num_additional_bytes)),
asio::async_read(*socket, request->streambuf,
asio::transfer_exactly(static_cast< size_t >(content_length-num_additional_bytes)),
[this, socket, request, timer]
(const boost::system::error_code& ec, size_t /*bytes_transferred*/) {
(const std::error_code& ec, size_t /*bytes_transferred*/) {
if(timer)
timer->cancel();
if(!ec)
@ -375,12 +375,12 @@ namespace SimpleWeb {
void write_response(const std::shared_ptr<socket_type> &socket, const std::shared_ptr<Request> &request,
std::function<void(std::shared_ptr<typename ServerBase<socket_type>::Response>,
std::shared_ptr<typename ServerBase<socket_type>::Request>)>& resource_function) {
//Set timeout on the following boost::asio::async-read or write function
//Set timeout on the following asio::async-read or write function
auto timer=this->get_timeout_timer(socket, config.timeout_content);
auto response=std::shared_ptr<Response>(new Response(socket), [this, request, timer](Response *response_ptr) {
auto response=std::shared_ptr<Response>(response_ptr);
this->send(response, [this, response, request, timer](const boost::system::error_code& ec) {
this->send(response, [this, response, request, timer](const std::error_code& ec) {
if(timer)
timer->cancel();
if(!ec) {
@ -390,7 +390,7 @@ namespace SimpleWeb {
}
catch( const std::exception & ){
if(on_error)
on_error(request, boost::system::error_code(boost::system::errc::protocol_error, boost::system::generic_category()));
on_error( request, std::make_error_code( std::errc::protocol_error ) );
return;
}
@ -412,7 +412,7 @@ namespace SimpleWeb {
}
catch( const std::exception & ) {
if(on_error)
on_error(request, boost::system::error_code(boost::system::errc::operation_canceled, boost::system::generic_category()));
on_error( request, std::make_error_code( std::errc::protocol_error ) );
return;
}
}
@ -421,7 +421,7 @@ namespace SimpleWeb {
template<class socket_type>
class Server : public ServerBase<socket_type> {};
typedef boost::asio::ip::tcp::socket HTTP;
typedef asio::ip::tcp::socket HTTP;
template<>
class Server<HTTP> : public ServerBase<HTTP> {
@ -442,13 +442,13 @@ namespace SimpleWeb {
//Shared_ptr is used to pass temporary objects to the asynchronous functions
auto socket=std::make_shared<HTTP>(*io_service);
acceptor->async_accept(*socket, [this, socket](const boost::system::error_code& ec){
acceptor->async_accept(*socket, [this, socket](const std::error_code& ec){
//Immediately start accepting a new connection (if io_service hasn't been stopped)
if (ec != boost::asio::error::operation_aborted)
if (ec != asio::error::operation_aborted)
accept();
if(!ec) {
boost::asio::ip::tcp::no_delay option(true);
asio::ip::tcp::no_delay option(true);
socket->set_option(option);
this->read_request_and_content(socket);

View file

@ -1,11 +1,12 @@
#ifndef CLIENT_HTTP_HPP
#define CLIENT_HTTP_HPP
#include <boost/asio.hpp>
#include <boost/utility/string_ref.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/functional/hash.hpp>
#include <asio.hpp>
#include <unordered_map>
#include <map>
#include <random>
@ -48,7 +49,7 @@ namespace SimpleWeb {
std::unordered_multimap<std::string, std::string, case_insensitive_hash, case_insensitive_equals> header;
private:
boost::asio::streambuf content_buffer;
asio::streambuf content_buffer;
Response() : content( &content_buffer ) {}
};
@ -72,10 +73,10 @@ namespace SimpleWeb {
auto corrected_path = path;
if( corrected_path == "" )
corrected_path = "/";
if( !config.proxy_server.empty() && std::is_same<socket_type, boost::asio::ip::tcp::socket>::value )
if( !config.proxy_server.empty() && std::is_same<socket_type, asio::ip::tcp::socket>::value )
corrected_path = "http://" + host + ':' + std::to_string( port ) + corrected_path;
boost::asio::streambuf write_buffer;
asio::streambuf write_buffer;
std::ostream write_stream( &write_buffer );
write_stream << request_type << " " << corrected_path << " HTTP/1.1\r\n";
write_stream << "Host: " << host << "\r\n";
@ -89,21 +90,21 @@ namespace SimpleWeb {
connect();
auto timer = get_timeout_timer();
boost::asio::async_write( *socket, write_buffer,
[this, &content, timer]( const boost::system::error_code &ec, size_t /*bytes_transferred*/ ) {
asio::async_write( *socket, write_buffer,
[this, &content, timer]( const std::error_code &ec, size_t /*bytes_transferred*/ ) {
if( timer )
timer->cancel();
if( !ec ) {
if( !content.empty() ) {
auto timer = get_timeout_timer();
boost::asio::async_write( *socket, boost::asio::buffer( content.data(), content.size() ),
[this, timer]( const boost::system::error_code &ec, size_t /*bytes_transferred*/ ) {
asio::async_write( *socket, asio::buffer( content.data(), content.size() ),
[this, timer]( const std::error_code &ec, size_t /*bytes_transferred*/ ) {
if( timer )
timer->cancel();
if( ec ) {
std::lock_guard<std::mutex> lock( socket_mutex );
this->socket = nullptr;
throw boost::system::system_error( ec );
throw std::system_error( ec );
}
} );
}
@ -111,7 +112,7 @@ namespace SimpleWeb {
else {
std::lock_guard<std::mutex> lock( socket_mutex );
socket = nullptr;
throw boost::system::system_error( ec );
throw std::system_error( ec );
}
} );
io_service.reset();
@ -125,14 +126,14 @@ namespace SimpleWeb {
auto corrected_path = path;
if( corrected_path == "" )
corrected_path = "/";
if( !config.proxy_server.empty() && std::is_same<socket_type, boost::asio::ip::tcp::socket>::value )
if( !config.proxy_server.empty() && std::is_same<socket_type, asio::ip::tcp::socket>::value )
corrected_path = "http://" + host + ':' + std::to_string( port ) + corrected_path;
content.seekp( 0, std::ios::end );
auto content_length = content.tellp();
content.seekp( 0, std::ios::beg );
boost::asio::streambuf write_buffer;
asio::streambuf write_buffer;
std::ostream write_stream( &write_buffer );
write_stream << request_type << " " << corrected_path << " HTTP/1.1\r\n";
write_stream << "Host: " << host << "\r\n";
@ -148,14 +149,14 @@ namespace SimpleWeb {
connect();
auto timer = get_timeout_timer();
boost::asio::async_write( *socket, write_buffer,
[this, timer]( const boost::system::error_code &ec, size_t /*bytes_transferred*/ ) {
asio::async_write( *socket, write_buffer,
[this, timer]( const std::error_code &ec, size_t /*bytes_transferred*/ ) {
if( timer )
timer->cancel();
if( ec ) {
std::lock_guard<std::mutex> lock( socket_mutex );
socket = nullptr;
throw boost::system::system_error( ec );
throw std::system_error( ec );
}
} );
io_service.reset();
@ -167,15 +168,15 @@ namespace SimpleWeb {
void close() {
std::lock_guard<std::mutex> lock( socket_mutex );
if( socket ) {
boost::system::error_code ec;
socket->lowest_layer().shutdown( boost::asio::ip::tcp::socket::shutdown_both, ec );
std::error_code ec;
socket->lowest_layer().shutdown( asio::ip::tcp::socket::shutdown_both, ec );
socket->lowest_layer().close();
}
}
protected:
boost::asio::io_service io_service;
boost::asio::ip::tcp::resolver resolver;
asio::io_service io_service;
asio::ip::tcp::resolver resolver;
std::unique_ptr<socket_type> socket;
std::mutex socket_mutex;
@ -205,13 +206,13 @@ namespace SimpleWeb {
virtual void connect() = 0;
std::shared_ptr<boost::asio::deadline_timer> get_timeout_timer() {
std::shared_ptr< asio::deadline_timer > get_timeout_timer() {
if( config.timeout == 0 )
return nullptr;
auto timer = std::make_shared<boost::asio::deadline_timer>( io_service );
auto timer = std::make_shared< asio::deadline_timer >( io_service );
timer->expires_from_now( boost::posix_time::seconds( config.timeout ) );
timer->async_wait( [this]( const boost::system::error_code& ec ) {
timer->async_wait( [this]( const std::error_code& ec ) {
if( !ec ) {
close();
}
@ -248,11 +249,11 @@ namespace SimpleWeb {
std::shared_ptr<Response> request_read() {
std::shared_ptr<Response> response( new Response() );
boost::asio::streambuf chunked_streambuf;
asio::streambuf chunked_streambuf;
auto timer = get_timeout_timer();
boost::asio::async_read_until( *socket, response->content_buffer, "\r\n\r\n",
[this, &response, &chunked_streambuf, timer]( const boost::system::error_code& ec, size_t bytes_transferred ) {
asio::async_read_until( *socket, response->content_buffer, "\r\n\r\n",
[this, &response, &chunked_streambuf, timer]( const std::error_code& ec, size_t bytes_transferred ) {
if( timer )
timer->cancel();
if( !ec ) {
@ -265,15 +266,15 @@ namespace SimpleWeb {
auto content_length = stoull( header_it->second );
if( content_length>num_additional_bytes ) {
auto timer = get_timeout_timer();
boost::asio::async_read( *socket, response->content_buffer,
boost::asio::transfer_exactly( static_cast< size_t >( content_length - num_additional_bytes ) ),
[this, timer]( const boost::system::error_code& ec, size_t /*bytes_transferred*/ ) {
asio::async_read( *socket, response->content_buffer,
asio::transfer_exactly( static_cast< size_t >( content_length - num_additional_bytes ) ),
[this, timer]( const std::error_code& ec, size_t /*bytes_transferred*/ ) {
if( timer )
timer->cancel();
if( ec ) {
std::lock_guard<std::mutex> lock( socket_mutex );
this->socket = nullptr;
throw boost::system::system_error( ec );
throw std::system_error( ec );
}
} );
}
@ -285,7 +286,7 @@ namespace SimpleWeb {
else {
std::lock_guard<std::mutex> lock( socket_mutex );
socket = nullptr;
throw boost::system::system_error( ec );
throw std::system_error( ec );
}
} );
io_service.reset();
@ -294,10 +295,10 @@ namespace SimpleWeb {
return response;
}
void request_read_chunked( const std::shared_ptr<Response> &response, boost::asio::streambuf &streambuf ) {
void request_read_chunked( const std::shared_ptr<Response> &response, asio::streambuf &streambuf ) {
auto timer = get_timeout_timer();
boost::asio::async_read_until( *socket, response->content_buffer, "\r\n",
[this, &response, &streambuf, timer]( const boost::system::error_code& ec, size_t bytes_transferred ) {
asio::async_read_until( *socket, response->content_buffer, "\r\n",
[this, &response, &streambuf, timer]( const std::error_code& ec, size_t bytes_transferred ) {
if( timer )
timer->cancel();
if( !ec ) {
@ -331,9 +332,9 @@ namespace SimpleWeb {
if( ( 2 + length )>num_additional_bytes ) {
auto timer = get_timeout_timer();
boost::asio::async_read( *socket, response->content_buffer,
boost::asio::transfer_exactly( static_cast< size_t >( 2 + length - num_additional_bytes ) ),
[this, post_process, timer]( const boost::system::error_code& ec, size_t /*bytes_transferred*/ ) {
asio::async_read( *socket, response->content_buffer,
asio::transfer_exactly( static_cast< size_t >( 2 + length - num_additional_bytes ) ),
[this, post_process, timer]( const std::error_code& ec, size_t /*bytes_transferred*/ ) {
if( timer )
timer->cancel();
if( !ec ) {
@ -342,7 +343,7 @@ namespace SimpleWeb {
else {
std::lock_guard<std::mutex> lock( socket_mutex );
this->socket = nullptr;
throw boost::system::system_error( ec );
throw std::system_error( ec );
}
} );
}
@ -352,7 +353,7 @@ namespace SimpleWeb {
else {
std::lock_guard<std::mutex> lock( socket_mutex );
socket = nullptr;
throw boost::system::system_error( ec );
throw std::system_error( ec );
}
} );
}
@ -361,7 +362,7 @@ namespace SimpleWeb {
template<class socket_type>
class Client : public ClientBase<socket_type> {};
typedef boost::asio::ip::tcp::socket HTTP;
typedef asio::ip::tcp::socket HTTP;
template<>
class Client<HTTP> : public ClientBase<HTTP> {
@ -371,15 +372,15 @@ namespace SimpleWeb {
protected:
void connect() {
if( !socket || !socket->is_open() ) {
std::unique_ptr<boost::asio::ip::tcp::resolver::query> query;
std::unique_ptr<asio::ip::tcp::resolver::query> query;
if( config.proxy_server.empty() )
query = std::unique_ptr<boost::asio::ip::tcp::resolver::query>( new boost::asio::ip::tcp::resolver::query( host, std::to_string( port ) ) );
query = std::unique_ptr<asio::ip::tcp::resolver::query>( new asio::ip::tcp::resolver::query( host, std::to_string( port ) ) );
else {
auto proxy_host_port = parse_host_port( config.proxy_server, 8080 );
query = std::unique_ptr<boost::asio::ip::tcp::resolver::query>( new boost::asio::ip::tcp::resolver::query( proxy_host_port.first, std::to_string( proxy_host_port.second ) ) );
query = std::unique_ptr<asio::ip::tcp::resolver::query>( new asio::ip::tcp::resolver::query( proxy_host_port.first, std::to_string( proxy_host_port.second ) ) );
}
resolver.async_resolve( *query, [this]( const boost::system::error_code &ec,
boost::asio::ip::tcp::resolver::iterator it ) {
resolver.async_resolve( *query, [this]( const std::error_code &ec,
asio::ip::tcp::resolver::iterator it ) {
if( !ec ) {
{
std::lock_guard<std::mutex> lock( socket_mutex );
@ -387,25 +388,25 @@ namespace SimpleWeb {
}
auto timer = get_timeout_timer();
boost::asio::async_connect( *socket, it, [this, timer]
( const boost::system::error_code &ec, boost::asio::ip::tcp::resolver::iterator /*it*/ ) {
asio::async_connect( *socket, it, [this, timer]
( const std::error_code &ec, asio::ip::tcp::resolver::iterator /*it*/ ) {
if( timer )
timer->cancel();
if( !ec ) {
boost::asio::ip::tcp::no_delay option( true );
asio::ip::tcp::no_delay option( true );
this->socket->set_option( option );
}
else {
std::lock_guard<std::mutex> lock( socket_mutex );
this->socket = nullptr;
throw boost::system::system_error( ec );
throw std::system_error( ec );
}
} );
}
else {
std::lock_guard<std::mutex> lock( socket_mutex );
socket = nullptr;
throw boost::system::system_error( ec );
throw std::system_error( ec );
}
} );
io_service.reset();

View file

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

View file

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

View file

@ -74,7 +74,7 @@ void Core::Action::ActionMount::onFinish()
pPlayer->unsetStateFlag( PlayerStateFlag::Casting );
auto effectPacket = boost::make_shared< Server::EffectPacket >( getId(), pPlayer->getId(), 4 );
auto effectPacket = std::make_shared< Server::EffectPacket >( getId(), pPlayer->getId(), 4 );
effectPacket->setRotation( Math::Util::floatToUInt16Rot( pPlayer->getRot() ) );
Server::EffectEntry effectEntry{};

View file

@ -86,7 +86,7 @@ void Core::Action::ActionTeleport::onFinish()
pPlayer->setZoningType( ZoneingType::Teleport );
auto effectPacket = boost::make_shared< Server::EffectPacket >( getId(), pPlayer->getId(), 5 );
auto effectPacket = std::make_shared< Server::EffectPacket >( getId(), pPlayer->getId(), 5 );
effectPacket->setRotation( Math::Util::floatToUInt16Rot( pPlayer->getRot() ) );

View file

@ -71,7 +71,7 @@ void Core::Action::EventItemAction::onFinish()
try
{
auto effectPacket = boost::make_shared< Server::EffectPacket >( m_pSource->getId(), m_additional, m_id );
auto effectPacket = std::make_shared< Server::EffectPacket >( m_pSource->getId(), m_additional, m_id );
effectPacket->setAnimationId( 1 );
effectPacket->setRotation( Math::Util::floatToUInt16Rot( m_pSource->getRot() ) );

View file

@ -136,7 +136,7 @@ Core::Entity::CharaPtr Core::Entity::Actor::getAsChara()
{
if( !isChara() )
return nullptr;
return boost::dynamic_pointer_cast< Entity::Chara, Entity::Actor >( shared_from_this() );
return std::dynamic_pointer_cast< Entity::Chara, Entity::Actor >( shared_from_this() );
}
/*! \return pointer to this instance as PlayerPtr */
@ -144,7 +144,7 @@ Core::Entity::PlayerPtr Core::Entity::Actor::getAsPlayer()
{
if( !isPlayer() )
return nullptr;
return boost::dynamic_pointer_cast< Entity::Player, Entity::Actor >( shared_from_this() );
return std::dynamic_pointer_cast< Entity::Player, Entity::Actor >( shared_from_this() );
}
/*! \return pointer to this instance as EventObjPtr */
@ -152,7 +152,7 @@ Core::Entity::EventObjectPtr Core::Entity::Actor::getAsEventObj()
{
if( !isEventObj() )
return nullptr;
return boost::dynamic_pointer_cast< Entity::EventObject, Entity::Actor >( shared_from_this() );
return std::dynamic_pointer_cast< Entity::EventObject, Entity::Actor >( shared_from_this() );
}
/*! \return pointer to this instance as BNpcPtr */
@ -160,7 +160,7 @@ Core::Entity::BNpcPtr Core::Entity::Actor::getAsBNpc()
{
if( !isBattleNpc() )
return nullptr;
return boost::dynamic_pointer_cast< Entity::BNpc, Entity::Actor >( shared_from_this() );
return std::dynamic_pointer_cast< Entity::BNpc, Entity::Actor >( shared_from_this() );
}
/*!

View file

@ -2,7 +2,7 @@
#define _GAME_OBJECT_H_
#include <Common.h>
#include <boost/enable_shared_from_this.hpp>
#include <memory>
#include "ForwardsZone.h"
#include <set>
@ -17,7 +17,7 @@ namespace Entity {
\brief Base class for all actor/objects
*/
class Actor : public boost::enable_shared_from_this< Actor >
class Actor : public std::enable_shared_from_this< Actor >
{
protected:

View file

@ -117,5 +117,5 @@ uint32_t Core::Entity::BNpc::getBNpcNameId() const
void Core::Entity::BNpc::spawn( PlayerPtr pTarget )
{
pTarget->queuePacket( boost::make_shared< NpcSpawnPacket >( *getAsBNpc(), *pTarget ) );
pTarget->queuePacket( std::make_shared< NpcSpawnPacket >( *getAsBNpc(), *pTarget ) );
}

View file

@ -363,7 +363,7 @@ so players can have their own version and we can abolish the param.
*/
void Core::Entity::Chara::sendStatusUpdate( bool toSelf )
{
FFXIVPacketBasePtr packet = boost::make_shared< UpdateHpMpTpPacket >( *this );
FFXIVPacketBasePtr packet = std::make_shared< UpdateHpMpTpPacket >( *this );
sendToInRangeSet( packet );
}
@ -402,7 +402,7 @@ void Core::Entity::Chara::autoAttack( CharaPtr pTarget )
uint16_t damage = static_cast< uint16_t >( 10 + rand() % 12 );
uint32_t variation = static_cast< uint32_t >( 0 + rand() % 4 );
auto effectPacket = boost::make_shared< Server::EffectPacket >( getId(), pTarget->getId(), 0x336 );
auto effectPacket = std::make_shared< Server::EffectPacket >( getId(), pTarget->getId(), 0x336 );
effectPacket->setRotation( Math::Util::floatToUInt16Rot( getRot() ) );
Server::EffectEntry effectEntry{};
@ -442,7 +442,7 @@ void Core::Entity::Chara::handleScriptSkill( uint32_t type, uint16_t actionId, u
// Todo: Effect packet generator. 90% of this is basically setting params and it's basically unreadable.
// Prepare packet. This is seemingly common for all packets in the action handler.
auto effectPacket = boost::make_shared< Server::EffectPacket >( getId(), target.getId(), actionId );
auto effectPacket = std::make_shared< Server::EffectPacket >( getId(), target.getId(), actionId );
effectPacket->setRotation( Math::Util::floatToUInt16Rot( getRot() ) );
// Todo: for each actor, calculate how much damage the calculated value should deal to them - 2-step damage calc. we only have 1-step

View file

@ -369,14 +369,14 @@ void Core::Entity::Player::teleport( uint16_t aetheryteId, uint8_t type )
setZoningType( Common::ZoneingType::Return );
}
m_queuedZoneing = boost::make_shared< QueuedZoning >( data->territory, pos, Util::getTimeMs(), rot );
m_queuedZoneing = std::make_shared< QueuedZoning >( data->territory, pos, Util::getTimeMs(), rot );
}
void Core::Entity::Player::forceZoneing( uint32_t zoneId )
{
m_queuedZoneing = boost::make_shared< QueuedZoning >( zoneId, getPos(), Util::getTimeMs(), 0.f );
m_queuedZoneing = std::make_shared< QueuedZoning >( zoneId, getPos(), Util::getTimeMs(), 0.f );
//performZoning( zoneId, Common::ZoneingType::None, getPos() );
}
@ -571,7 +571,7 @@ void Core::Entity::Player::changePosition( float x, float y, float z, float o )
pos.x = x;
pos.y = y;
pos.z = z;
m_queuedZoneing = boost::make_shared< QueuedZoning >( getZoneId(), pos, Util::getTimeMs(), o );
m_queuedZoneing = std::make_shared< QueuedZoning >( getZoneId(), pos, Util::getTimeMs(), o );
}
void Core::Entity::Player::learnAction( uint16_t actionId )
@ -683,7 +683,7 @@ void Core::Entity::Player::gainLevel()
void Core::Entity::Player::sendStatusUpdate( bool toSelf )
{
sendToInRangeSet( boost::make_shared< UpdateHpMpTpPacket >( *this ), true );
sendToInRangeSet( std::make_shared< UpdateHpMpTpPacket >( *this ), true );
}
uint8_t Core::Entity::Player::getLevel() const
@ -775,7 +775,7 @@ void Core::Entity::Player::setLevelForClass( uint8_t level, Common::ClassJob cla
void Core::Entity::Player::sendModel()
{
sendToInRangeSet( boost::make_shared< ModelEquipPacket >( *getAsPlayer() ), true );
sendToInRangeSet( std::make_shared< ModelEquipPacket >( *getAsPlayer() ), true );
}
uint32_t Core::Entity::Player::getModelForSlot( Common::GearModelSlot slot )
@ -838,7 +838,7 @@ void Core::Entity::Player::spawn( Entity::PlayerPtr pTarget )
getName() + " for " +
pTarget->getName() );
pTarget->queuePacket( boost::make_shared< PlayerSpawnPacket >( *getAsPlayer(), *pTarget ) );
pTarget->queuePacket( std::make_shared< PlayerSpawnPacket >( *getAsPlayer(), *pTarget ) );
}
// despawn
@ -961,7 +961,7 @@ void Core::Entity::Player::setStateFlags( std::vector< Common::PlayerStateFlag >
void Core::Entity::Player::sendStateFlags()
{
queuePacket( boost::make_shared< PlayerStateFlagsPacket >( *getAsPlayer() ) );
queuePacket( std::make_shared< PlayerStateFlagsPacket >( *getAsPlayer() ) );
}
void Core::Entity::Player::unsetStateFlag( Common::PlayerStateFlag flag )
@ -1259,17 +1259,17 @@ uint8_t Core::Entity::Player::getSearchSelectClass() const
void Core::Entity::Player::sendNotice( const std::string& message ) //Purple Text
{
queuePacket( boost::make_shared< ServerNoticePacket >( getId(), message ) );
queuePacket( std::make_shared< ServerNoticePacket >( getId(), message ) );
}
void Core::Entity::Player::sendUrgent( const std::string& message ) //Red Text
{
queuePacket( boost::make_shared< ChatPacket >( *getAsPlayer(), ChatType::ServerUrgent, message ) );
queuePacket( std::make_shared< ChatPacket >( *getAsPlayer(), ChatType::ServerUrgent, message ) );
}
void Core::Entity::Player::sendDebug( const std::string& message ) //Grey Text
{
queuePacket( boost::make_shared< ChatPacket >( *getAsPlayer(), ChatType::ServerDebug, message ) );
queuePacket( std::make_shared< ChatPacket >( *getAsPlayer(), ChatType::ServerDebug, message ) );
}
void Core::Entity::Player::updateHowtosSeen( uint32_t howToId )
@ -1412,7 +1412,7 @@ void Core::Entity::Player::autoAttack( CharaPtr pTarget )
if( getClass() == ClassJob::Machinist || getClass() == ClassJob::Bard || getClass() == ClassJob::Archer )
{
auto effectPacket = boost::make_shared< Server::EffectPacket >( getId(), pTarget->getId(), 8 );
auto effectPacket = std::make_shared< Server::EffectPacket >( getId(), pTarget->getId(), 8 );
effectPacket->setRotation( Math::Util::floatToUInt16Rot( getRot() ) );
Server::EffectEntry entry;
@ -1426,7 +1426,7 @@ void Core::Entity::Player::autoAttack( CharaPtr pTarget )
}
else
{
auto effectPacket = boost::make_shared< Server::EffectPacket >( getId(), pTarget->getId(), 7 );
auto effectPacket = std::make_shared< Server::EffectPacket >( getId(), pTarget->getId(), 7 );
effectPacket->setRotation( Math::Util::floatToUInt16Rot( getRot() ) );
Server::EffectEntry entry;
@ -1546,7 +1546,7 @@ void Core::Entity::Player::sendZonePackets()
}
queuePacket( contentFinderList );
queuePacket( boost::make_shared< InitUIPacket >( *this ) );
queuePacket( std::make_shared< InitUIPacket >( *this ) );
auto classInfoPacket = makeZonePacket< FFXIVIpcPlayerClassInfo >( getId() );
classInfoPacket->data().classId = static_cast< uint8_t >( getClass() );

View file

@ -200,7 +200,7 @@ public:
bool giveQuestRewards( uint32_t questId, uint32_t optionalChoice );
boost::shared_ptr< Common::QuestActive > getQuestActive( uint16_t index );
std::shared_ptr< Common::QuestActive > getQuestActive( uint16_t index );
uint8_t getQuestUI8A( uint16_t questId );
@ -984,7 +984,7 @@ private:
std::map< uint32_t, uint8_t > m_questIdToQuestIdx; // quest mapping, quest id to quest container index
std::map< uint8_t, uint32_t > m_questIdxToQuestId; // quest mapping, quest container index to questId
boost::shared_ptr< Common::QuestActive > m_activeQuests[30];
std::shared_ptr< Common::QuestActive > m_activeQuests[30];
int16_t m_questTracking[5];
uint8_t m_stateFlags[12];
@ -1003,7 +1003,7 @@ private:
bool m_bMarkedForZoning;
bool m_bNewAdventurer;
uint64_t m_onlineStatus;
boost::shared_ptr< QueuedZoning > m_queuedZoneing;
std::shared_ptr< QueuedZoning > m_queuedZoneing;
// search info
char m_searchMessage[193]; // searchmessage to show in profile

View file

@ -84,7 +84,7 @@ void Core::Entity::Player::directorPlayScene( uint32_t eventId, uint32_t scene,
pEvent->setPlayedScene( true );
pEvent->setEventReturnCallback( nullptr );
auto eventPlay = boost::make_shared< DirectorPlayScenePacket >( getId(), getId(), pEvent->getId(),
auto eventPlay = std::make_shared< DirectorPlayScenePacket >( getId(), getId(), pEvent->getId(),
scene, flags, eventParam3, eventParam4, eventParam5 );
queuePacket( eventPlay );
@ -101,7 +101,7 @@ void Core::Entity::Player::eventStart( uint64_t actorId, uint32_t eventId,
setStateFlag( PlayerStateFlag::InNpcEvent );
auto eventStart = boost::make_shared< EventStartPacket >( getId(), actorId, eventId,
auto eventStart = std::make_shared< EventStartPacket >( getId(), actorId, eventId,
eventType, eventParam1, eventParam2 );
queuePacket( eventStart );
@ -188,7 +188,7 @@ void Core::Entity::Player::playScene( uint32_t eventId, uint32_t scene,
pEvent->setPlayedScene( true );
pEvent->setEventReturnCallback( eventCallback );
pEvent->setSceneChainCallback( nullptr );
auto eventPlay = boost::make_shared< EventPlayPacket >( getId(), pEvent->getActorId(), pEvent->getId(),
auto eventPlay = std::make_shared< EventPlayPacket >( getId(), pEvent->getActorId(), pEvent->getId(),
scene, flags, eventParam2, eventParam3, eventParam4 );
queuePacket( eventPlay );
@ -205,7 +205,7 @@ void Core::Entity::Player::playSceneChain( uint32_t eventId, uint32_t scene, uin
pEvent->setPlayedScene( true );
pEvent->setSceneChainCallback( sceneChainCallback );
pEvent->setEventReturnCallback( nullptr );
auto eventPlay = boost::make_shared< EventPlayPacket >( getId(), pEvent->getActorId(), pEvent->getId(),
auto eventPlay = std::make_shared< EventPlayPacket >( getId(), pEvent->getActorId(), pEvent->getId(),
scene, flags, eventParam2, eventParam3, eventParam4 );
queuePacket( eventPlay );
@ -245,7 +245,7 @@ void Core::Entity::Player::eventFinish( uint32_t eventId, uint32_t freePlayer )
{
case Event::EventHandler::Nest:
{
queuePacket( boost::make_shared< EventFinishPacket >( getId(), pEvent->getId(),
queuePacket( std::make_shared< EventFinishPacket >( getId(), pEvent->getId(),
pEvent->getEventType(), pEvent->getEventParam() ) );
removeEvent( pEvent->getId() );
@ -257,7 +257,7 @@ void Core::Entity::Player::eventFinish( uint32_t eventId, uint32_t freePlayer )
if( it.second->hasPlayedScene() == false )
{
// TODO: not happy with this, this is also prone to break wit more than one remaining event in there
queuePacket( boost::make_shared< EventFinishPacket >( getId(), it.second->getId(),
queuePacket( std::make_shared< EventFinishPacket >( getId(), it.second->getId(),
it.second->getEventType(),
it.second->getEventParam() ) );
removeEvent( it.second->getId() );
@ -268,7 +268,7 @@ void Core::Entity::Player::eventFinish( uint32_t eventId, uint32_t freePlayer )
}
default:
{
queuePacket( boost::make_shared< EventFinishPacket >( getId(), pEvent->getId(),
queuePacket( std::make_shared< EventFinishPacket >( getId(), pEvent->getId(),
pEvent->getEventType(), pEvent->getEventParam() ) );
break;
}

View file

@ -276,7 +276,7 @@ void Core::Entity::Player::addCurrency( CurrencyType type, uint32_t amount )
updateContainer( Currency, slot, currItem );
auto invUpdate = boost::make_shared< UpdateInventorySlotPacket >( getId(),
auto invUpdate = std::make_shared< UpdateInventorySlotPacket >( getId(),
static_cast< uint8_t >( type ) - 1,
Common::InventoryType::Currency,
*currItem );
@ -298,7 +298,7 @@ void Core::Entity::Player::removeCurrency( Common::CurrencyType type, uint32_t a
currItem->setStackSize( currentAmount - amount );
writeItem( currItem );
auto invUpdate = boost::make_shared< UpdateInventorySlotPacket >( getId(),
auto invUpdate = std::make_shared< UpdateInventorySlotPacket >( getId(),
static_cast< uint8_t >( type ) - 1,
Common::InventoryType::Currency,
*currItem );
@ -326,7 +326,7 @@ void Core::Entity::Player::addCrystal( Common::CrystalType type, uint32_t amount
writeInventory( Crystal );
auto invUpdate = boost::make_shared< UpdateInventorySlotPacket >( getId(),
auto invUpdate = std::make_shared< UpdateInventorySlotPacket >( getId(),
static_cast< uint8_t >( type ) - 1,
Common::InventoryType::Crystal,
*currItem );
@ -349,7 +349,7 @@ void Core::Entity::Player::removeCrystal( Common::CrystalType type, uint32_t amo
writeItem( currItem );
auto invUpdate = boost::make_shared< UpdateInventorySlotPacket >( getId(),
auto invUpdate = std::make_shared< UpdateInventorySlotPacket >( getId(),
static_cast< uint8_t >( type ) - 1,
Common::InventoryType::Crystal,
*currItem );
@ -595,7 +595,7 @@ Core::ItemPtr Core::Entity::Player::addItem( uint32_t catalogId, uint32_t quanti
item->setStackSize( newStackSize );
writeItem( item );
auto slotUpdate = boost::make_shared< UpdateInventorySlotPacket >( getId(), slot, bag, *item );
auto slotUpdate = std::make_shared< UpdateInventorySlotPacket >( getId(), slot, bag, *item );
queuePacket( slotUpdate );
// return existing stack if we have no overflow - items fit into a preexisting stack
@ -629,7 +629,7 @@ Core::ItemPtr Core::Entity::Player::addItem( uint32_t catalogId, uint32_t quanti
if( !silent )
{
auto invUpdate = boost::make_shared< UpdateInventorySlotPacket >( getId(), freeBagSlot.second, freeBagSlot.first,
auto invUpdate = std::make_shared< UpdateInventorySlotPacket >( getId(), freeBagSlot.second, freeBagSlot.first,
*item );
queuePacket( invUpdate );

View file

@ -59,7 +59,7 @@ void Core::Entity::Player::removeQuest( uint16_t questId )
m_questTracking[ ii ] = -1;
}
boost::shared_ptr< QuestActive > pQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pQuest = m_activeQuests[ idx ];
m_activeQuests[ idx ].reset();
m_questIdToQuestIdx.erase( questId );
@ -92,7 +92,7 @@ bool Core::Entity::Player::getQuestBitFlag8( uint16_t questId, uint8_t index )
uint8_t value = 0;
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
return pNewQuest->a.BitFlag8 & ( 1 << index );
}
@ -105,7 +105,7 @@ bool Core::Entity::Player::getQuestBitFlag16( uint16_t questId, uint8_t index )
uint8_t value = 0;
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
return pNewQuest->a.BitFlag16 & ( 1 << index );
}
@ -118,7 +118,7 @@ bool Core::Entity::Player::getQuestBitFlag24( uint16_t questId, uint8_t index )
uint8_t value = 0;
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
return pNewQuest->a.BitFlag24 & ( 1 << index );
}
@ -131,7 +131,7 @@ bool Core::Entity::Player::getQuestBitFlag32( uint16_t questId, uint8_t index )
uint8_t value = 0;
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
return pNewQuest->a.BitFlag32 & ( 1 << index );
}
@ -144,7 +144,7 @@ bool Core::Entity::Player::getQuestBitFlag40( uint16_t questId, uint8_t index )
uint8_t value = 0;
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
return pNewQuest->a.BitFlag40 & ( 1 << index );
}
@ -157,7 +157,7 @@ bool Core::Entity::Player::getQuestBitFlag48( uint16_t questId, uint8_t index )
uint8_t value = 0;
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
return pNewQuest->a.BitFlag48 & ( 1 << index );
}
@ -170,7 +170,7 @@ uint8_t Core::Entity::Player::getQuestUI8A( uint16_t questId )
uint8_t value = 0;
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
value = pNewQuest->c.UI8A;
}
@ -183,7 +183,7 @@ uint8_t Core::Entity::Player::getQuestUI8B( uint16_t questId )
uint8_t value = 0;
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
value = pNewQuest->c.UI8B;
}
@ -196,7 +196,7 @@ uint8_t Core::Entity::Player::getQuestUI8C( uint16_t questId )
uint8_t value = 0;
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
value = pNewQuest->c.UI8C;
}
@ -209,7 +209,7 @@ uint8_t Core::Entity::Player::getQuestUI8D( uint16_t questId )
uint8_t value = 0;
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
value = pNewQuest->c.UI8D;
}
@ -222,7 +222,7 @@ uint8_t Core::Entity::Player::getQuestUI8E( uint16_t questId )
uint8_t value = 0;
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
value = pNewQuest->c.UI8E;
}
@ -235,7 +235,7 @@ uint8_t Core::Entity::Player::getQuestUI8F( uint16_t questId )
uint8_t value = 0;
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
value = pNewQuest->c.UI8F;
}
@ -248,7 +248,7 @@ uint8_t Core::Entity::Player::getQuestUI8AH( uint16_t questId )
uint8_t value = 0;
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
value = pNewQuest->b.UI8AH;
}
@ -261,7 +261,7 @@ uint8_t Core::Entity::Player::getQuestUI8BH( uint16_t questId )
uint8_t value = 0;
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
value = pNewQuest->b.UI8BH;
}
@ -274,7 +274,7 @@ uint8_t Core::Entity::Player::getQuestUI8CH( uint16_t questId )
uint8_t value = 0;
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
value = pNewQuest->b.UI8CH;
}
@ -287,7 +287,7 @@ uint8_t Core::Entity::Player::getQuestUI8DH( uint16_t questId )
uint8_t value = 0;
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
value = pNewQuest->b.UI8DH;
}
@ -300,7 +300,7 @@ uint8_t Core::Entity::Player::getQuestUI8EH( uint16_t questId )
uint8_t value = 0;
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
value = pNewQuest->b.UI8EH;
}
@ -313,7 +313,7 @@ uint8_t Core::Entity::Player::getQuestUI8FH( uint16_t questId )
uint8_t value = 0;
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
value = pNewQuest->b.UI8FH;
}
@ -326,7 +326,7 @@ uint8_t Core::Entity::Player::getQuestUI8AL( uint16_t questId )
uint8_t value = 0;
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
value = pNewQuest->b.UI8AL;
}
@ -339,7 +339,7 @@ uint8_t Core::Entity::Player::getQuestUI8BL( uint16_t questId )
uint8_t value = 0;
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
value = pNewQuest->b.UI8BL;
}
@ -352,7 +352,7 @@ uint8_t Core::Entity::Player::getQuestUI8CL( uint16_t questId )
uint8_t value = 0;
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
value = pNewQuest->b.UI8CL;
}
@ -365,7 +365,7 @@ uint8_t Core::Entity::Player::getQuestUI8DL( uint16_t questId )
uint8_t value = 0;
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
value = pNewQuest->b.UI8DL;
}
@ -378,7 +378,7 @@ uint8_t Core::Entity::Player::getQuestUI8EL( uint16_t questId )
uint8_t value = 0;
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
value = pNewQuest->b.UI8EL;
}
@ -391,7 +391,7 @@ uint8_t Core::Entity::Player::getQuestUI8FL( uint16_t questId )
uint8_t value = 0;
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
value = pNewQuest->b.UI8FL;
}
@ -404,7 +404,7 @@ uint16_t Core::Entity::Player::getQuestUI16A( uint16_t questId )
uint16_t value = 0;
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
// value = pNewQuest->d.UI16A;
}
@ -417,7 +417,7 @@ uint16_t Core::Entity::Player::getQuestUI16B( uint16_t questId )
uint16_t value = 0;
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
// value = pNewQuest->d.UI16B;
}
@ -430,7 +430,7 @@ uint16_t Core::Entity::Player::getQuestUI16C( uint16_t questId )
uint16_t value = 0;
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
// value = pNewQuest->d.UI16C;
}
@ -443,7 +443,7 @@ uint32_t Core::Entity::Player::getQuestUI32A( uint16_t questId )
uint32_t value = 0;
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
// value = pNewQuest->e.UI32A;
}
@ -456,7 +456,7 @@ void Core::Entity::Player::setQuestUI8A( uint16_t questId, uint8_t val )
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
pNewQuest->c.UI8A = val;
@ -470,7 +470,7 @@ void Core::Entity::Player::setQuestUI8B( uint16_t questId, uint8_t val )
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
pNewQuest->c.UI8B = val;
@ -484,7 +484,7 @@ void Core::Entity::Player::setQuestUI8C( uint16_t questId, uint8_t val )
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
pNewQuest->c.UI8C = val;
@ -498,7 +498,7 @@ void Core::Entity::Player::setQuestUI8D( uint16_t questId, uint8_t val )
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
pNewQuest->c.UI8D = val;
@ -512,7 +512,7 @@ void Core::Entity::Player::setQuestUI8E( uint16_t questId, uint8_t val )
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
pNewQuest->c.UI8E = val;
@ -526,7 +526,7 @@ void Core::Entity::Player::setQuestUI8F( uint16_t questId, uint8_t val )
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
pNewQuest->c.UI8F = val;
@ -540,7 +540,7 @@ void Core::Entity::Player::setQuestUI8AH( uint16_t questId, uint8_t val )
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
pNewQuest->b.UI8AH = val;
@ -554,7 +554,7 @@ void Core::Entity::Player::setQuestUI8BH( uint16_t questId, uint8_t val )
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
pNewQuest->b.UI8BH = val;
@ -568,7 +568,7 @@ void Core::Entity::Player::setQuestUI8CH( uint16_t questId, uint8_t val )
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
pNewQuest->b.UI8CH = val;
@ -582,7 +582,7 @@ void Core::Entity::Player::setQuestUI8DH( uint16_t questId, uint8_t val )
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
pNewQuest->b.UI8DH = val;
@ -596,7 +596,7 @@ void Core::Entity::Player::setQuestUI8EH( uint16_t questId, uint8_t val )
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
pNewQuest->b.UI8EH = val;
@ -610,7 +610,7 @@ void Core::Entity::Player::setQuestUI8FH( uint16_t questId, uint8_t val )
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
pNewQuest->b.UI8FH = val;
@ -624,7 +624,7 @@ void Core::Entity::Player::setQuestUI8AL( uint16_t questId, uint8_t val )
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
pNewQuest->b.UI8AL = val;
@ -638,7 +638,7 @@ void Core::Entity::Player::setQuestUI8BL( uint16_t questId, uint8_t val )
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
pNewQuest->b.UI8BL = val;
@ -652,7 +652,7 @@ void Core::Entity::Player::setQuestUI8CL( uint16_t questId, uint8_t val )
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
pNewQuest->b.UI8CL = val;
@ -666,7 +666,7 @@ void Core::Entity::Player::setQuestUI8DL( uint16_t questId, uint8_t val )
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
pNewQuest->b.UI8DL = val;
@ -680,7 +680,7 @@ void Core::Entity::Player::setQuestUI8EL( uint16_t questId, uint8_t val )
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
pNewQuest->b.UI8EL = val;
@ -694,7 +694,7 @@ void Core::Entity::Player::setQuestUI8FL( uint16_t questId, uint8_t val )
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
pNewQuest->b.UI8FL = val;
@ -708,7 +708,7 @@ void Core::Entity::Player::setQuestUI16A( uint16_t questId, uint16_t val )
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
// pNewQuest->d.UI16A = val;
@ -722,7 +722,7 @@ void Core::Entity::Player::setQuestUI16B( uint16_t questId, uint16_t val )
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
// pNewQuest->d.UI16B = val;
@ -736,7 +736,7 @@ void Core::Entity::Player::setQuestUI16C( uint16_t questId, uint16_t val )
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
// pNewQuest->d.UI16C = val;
@ -750,7 +750,7 @@ void Core::Entity::Player::setQuestUI32A( uint16_t questId, uint32_t val )
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
// pNewQuest->e.UI32A = val;
@ -764,7 +764,7 @@ void Core::Entity::Player::setQuestBitFlag8( uint16_t questId, uint8_t index, bo
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
if( val )
pNewQuest->a.BitFlag8 |= ( 1 << index );
@ -781,7 +781,7 @@ void Core::Entity::Player::setQuestBitFlag16( uint16_t questId, uint8_t index, b
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
if( val )
pNewQuest->a.BitFlag16 |= ( 1 << index );
@ -798,7 +798,7 @@ void Core::Entity::Player::setQuestBitFlag24( uint16_t questId, uint8_t index, b
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
if( val )
pNewQuest->a.BitFlag24 |= ( 1 << index );
@ -815,7 +815,7 @@ void Core::Entity::Player::setQuestBitFlag32( uint16_t questId, uint8_t index, b
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
if( val )
pNewQuest->a.BitFlag32 |= ( 1 << index );
@ -832,7 +832,7 @@ void Core::Entity::Player::setQuestBitFlag40( uint16_t questId, uint8_t index, b
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
if( val )
pNewQuest->a.BitFlag40 |= ( 1 << index );
@ -849,7 +849,7 @@ void Core::Entity::Player::setQuestBitFlag48( uint16_t questId, uint8_t index, b
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
if( val )
pNewQuest->a.BitFlag48 |= ( 1 << index );
@ -867,7 +867,7 @@ uint8_t Core::Entity::Player::getQuestSeq( uint16_t questId )
if( idx != -1 )
{
boost::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
std::shared_ptr< QuestActive > pNewQuest = m_activeQuests[ idx ];
return pNewQuest->c.sequence;
}
return 0;
@ -902,7 +902,7 @@ void Core::Entity::Player::updateQuest( uint16_t questId, uint8_t sequence )
if( !hasFreeSlot )
return;
boost::shared_ptr< QuestActive > pNewQuest( new QuestActive() );
std::shared_ptr< QuestActive > pNewQuest( new QuestActive() );
pNewQuest->c.questId = questId;
pNewQuest->c.sequence = sequence;
pNewQuest->c.padding = 0;
@ -1003,7 +1003,7 @@ void Core::Entity::Player::sendQuestInfo()
void
Core::Entity::Player::sendQuestMessage( uint32_t questId, int8_t msgId, uint8_t type, uint32_t var1, uint32_t var2 )
{
queuePacket( boost::make_shared< QuestMessagePacket >( getAsPlayer(), questId, msgId, type, var1, var2 ) );
queuePacket( std::make_shared< QuestMessagePacket >( getAsPlayer(), questId, msgId, type, var1, var2 ) );
}
@ -1076,7 +1076,7 @@ bool Core::Entity::Player::giveQuestRewards( uint32_t questId, uint32_t optional
return true;
}
boost::shared_ptr< QuestActive > Core::Entity::Player::getQuestActive( uint16_t index )
std::shared_ptr< QuestActive > Core::Entity::Player::getQuestActive( uint16_t index )
{
return m_activeQuests[ index ];
}

View file

@ -254,7 +254,7 @@ bool Core::Entity::Player::loadActiveQuests()
auto slotId = res->getUInt8( 2 );
boost::shared_ptr< QuestActive > pActiveQuest( new QuestActive() );
std::shared_ptr< QuestActive > pActiveQuest( new QuestActive() );
pActiveQuest->c.questId = res->getUInt16( 3 );
pActiveQuest->c.sequence = res->getUInt8( 4 );
pActiveQuest->c.flags = res->getUInt8( 5 );

View file

@ -23,7 +23,7 @@ file(GLOB SERVER_SOURCE_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
add_executable( sapphire_zone ${SERVER_SOURCE_FILES} )
set_target_properties(sapphire_zone PROPERTIES
CXX_STANDARD 14
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS ON
ENABLE_EXPORTS ON
@ -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}" )

View file

@ -13,7 +13,7 @@ class DebugCommand
{
public:
using pFunc = void ( DebugCommandHandler::* )( char*, Entity::Player&, boost::shared_ptr< DebugCommand > );
using pFunc = void ( DebugCommandHandler::* )( char*, Entity::Player&, std::shared_ptr< DebugCommand > );
// String for the command
std::string m_commandName;

View file

@ -71,7 +71,7 @@ Core::DebugCommandHandler::~DebugCommandHandler()
void Core::DebugCommandHandler::registerCommand( const std::string& n, DebugCommand::pFunc functionPtr,
const std::string& hText, uint8_t uLevel )
{
m_commandMap[ std::string( n ) ] = boost::make_shared< DebugCommand >( n, functionPtr, hText, uLevel );
m_commandMap[ std::string( n ) ] = std::make_shared< DebugCommand >( n, functionPtr, hText, uLevel );
}
// try to retrieve the command in question, execute if found
@ -79,7 +79,7 @@ void Core::DebugCommandHandler::execCommand( char* data, Entity::Player& player
{
// define callback pointer
void ( DebugCommandHandler::*pf )( char*, Entity::Player&, boost::shared_ptr< DebugCommand > );
void ( DebugCommandHandler::*pf )( char*, Entity::Player&, std::shared_ptr< DebugCommand > );
std::string commandString;
@ -122,7 +122,7 @@ void Core::DebugCommandHandler::execCommand( char* data, Entity::Player& player
// Definition of the commands
///////////////////////////////////////////////////////////////////////////////////////
void Core::DebugCommandHandler::help( char* data, Entity::Player& player, boost::shared_ptr< DebugCommand > command )
void Core::DebugCommandHandler::help( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command )
{
player.sendDebug( "Registered debug commands:" );
for( auto cmd : m_commandMap )
@ -134,7 +134,7 @@ void Core::DebugCommandHandler::help( char* data, Entity::Player& player, boost:
}
}
void Core::DebugCommandHandler::set( char* data, Entity::Player& player, boost::shared_ptr< DebugCommand > command )
void Core::DebugCommandHandler::set( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command )
{
auto pLog = g_fw.get< Logger >();
auto pTerriMgr = g_fw.get< TerritoryMgr >();
@ -232,7 +232,7 @@ void Core::DebugCommandHandler::set( char* data, Entity::Player& player, boost::
else if( subCommand == "discovery_reset" )
{
player.resetDiscovery();
player.queuePacket( boost::make_shared< InitUIPacket >( player ) );
player.queuePacket( std::make_shared< InitUIPacket >( player ) );
}
else if( subCommand == "classjob" )
{
@ -373,7 +373,7 @@ void Core::DebugCommandHandler::set( char* data, Entity::Player& player, boost::
}
void Core::DebugCommandHandler::add( char* data, Entity::Player& player, boost::shared_ptr< DebugCommand > command )
void Core::DebugCommandHandler::add( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command )
{
auto pLog = g_fw.get< Logger >();
std::string subCommand;
@ -428,7 +428,7 @@ void Core::DebugCommandHandler::add( char* data, Entity::Player& player, boost::
if( !bNpcTemplate )
player.sendNotice( "Template " + params + " not found in cache!" );
auto pBNpc = boost::make_shared< Entity::BNpc >( bNpcTemplate,
auto pBNpc = std::make_shared< Entity::BNpc >( bNpcTemplate,
player.getPos().x,
player.getPos().y,
player.getPos().z, 1 );
@ -507,7 +507,7 @@ void Core::DebugCommandHandler::add( char* data, Entity::Player& player, boost::
}
void Core::DebugCommandHandler::get( char* data, Entity::Player& player, boost::shared_ptr< DebugCommand > command )
void Core::DebugCommandHandler::get( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command )
{
auto pLog = g_fw.get< Logger >();
auto pExdData = g_fw.get< Data::ExdDataGenerated >();
@ -554,7 +554,7 @@ void Core::DebugCommandHandler::get( char* data, Entity::Player& player, boost::
}
void
Core::DebugCommandHandler::injectPacket( char* data, Entity::Player& player, boost::shared_ptr< DebugCommand > command )
Core::DebugCommandHandler::injectPacket( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command )
{
auto pServerZone = g_fw.get< ServerZone >();
auto pSession = pServerZone->getSession( player.getId() );
@ -563,7 +563,7 @@ Core::DebugCommandHandler::injectPacket( char* data, Entity::Player& player, boo
}
void Core::DebugCommandHandler::injectChatPacket( char* data, Entity::Player& player,
boost::shared_ptr< DebugCommand > command )
std::shared_ptr< DebugCommand > command )
{
auto pServerZone = g_fw.get< ServerZone >();
auto pSession = pServerZone->getSession( player.getId() );
@ -571,7 +571,7 @@ void Core::DebugCommandHandler::injectChatPacket( char* data, Entity::Player& pl
pSession->getChatConnection()->injectPacket( data + 8, player );
}
void Core::DebugCommandHandler::replay( char* data, Entity::Player& player, boost::shared_ptr< DebugCommand > command )
void Core::DebugCommandHandler::replay( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command )
{
auto pLog = g_fw.get< Logger >();
auto pServerZone = g_fw.get< ServerZone >();
@ -623,7 +623,7 @@ void Core::DebugCommandHandler::replay( char* data, Entity::Player& player, boos
}
void Core::DebugCommandHandler::nudge( char* data, Entity::Player& player, boost::shared_ptr< DebugCommand > command )
void Core::DebugCommandHandler::nudge( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command )
{
std::string subCommand;
@ -670,7 +670,7 @@ void Core::DebugCommandHandler::nudge( char* data, Entity::Player& player, boost
}
void
Core::DebugCommandHandler::serverInfo( char* data, Entity::Player& player, boost::shared_ptr< DebugCommand > command )
Core::DebugCommandHandler::serverInfo( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command )
{
auto pServerZone = g_fw.get< ServerZone >();
player.sendDebug( "SapphireZone " + Version::VERSION + "\nRev: " + Version::GIT_HASH );
@ -678,7 +678,7 @@ Core::DebugCommandHandler::serverInfo( char* data, Entity::Player& player, boost
player.sendDebug( "Sessions: " + std::to_string( pServerZone->getSessionCount() ) );
}
void Core::DebugCommandHandler::script( char* data, Entity::Player& player, boost::shared_ptr< DebugCommand > command )
void Core::DebugCommandHandler::script( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command )
{
auto pLog = g_fw.get< Logger >();
auto pScriptMgr = g_fw.get< Scripting::ScriptMgr >();
@ -768,7 +768,7 @@ void Core::DebugCommandHandler::script( char* data, Entity::Player& player, boos
}
void
Core::DebugCommandHandler::instance( char* data, Entity::Player& player, boost::shared_ptr< DebugCommand > command )
Core::DebugCommandHandler::instance( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command )
{
auto pTeriMgr = g_fw.get< TerritoryMgr >();
std::string cmd( data ), params, subCommand;
@ -875,7 +875,7 @@ Core::DebugCommandHandler::instance( char* data, Entity::Player& player, boost::
sscanf( params.c_str(), "%d %d", &index, &value );
auto instance = boost::dynamic_pointer_cast< InstanceContent >( player.getCurrentZone() );
auto instance = std::dynamic_pointer_cast< InstanceContent >( player.getCurrentZone() );
if( !instance )
return;
@ -888,7 +888,7 @@ Core::DebugCommandHandler::instance( char* data, Entity::Player& player, boost::
sscanf( params.c_str(), "%s %hhu", objName, &state );
auto instance = boost::dynamic_pointer_cast< InstanceContent >( player.getCurrentZone() );
auto instance = std::dynamic_pointer_cast< InstanceContent >( player.getCurrentZone() );
if( !instance )
return;
@ -906,7 +906,7 @@ Core::DebugCommandHandler::instance( char* data, Entity::Player& player, boost::
sscanf( params.c_str(), "%s %i %i", objName, &state1, &state2 );
auto instance = boost::dynamic_pointer_cast< InstanceContent >( player.getCurrentZone() );
auto instance = std::dynamic_pointer_cast< InstanceContent >( player.getCurrentZone() );
if( !instance )
return;
@ -925,7 +925,7 @@ Core::DebugCommandHandler::instance( char* data, Entity::Player& player, boost::
sscanf( params.c_str(), "%hhu", &seq );
auto instance = boost::dynamic_pointer_cast< InstanceContent >( player.getCurrentZone() );
auto instance = std::dynamic_pointer_cast< InstanceContent >( player.getCurrentZone() );
if( !instance )
return;
@ -937,7 +937,7 @@ Core::DebugCommandHandler::instance( char* data, Entity::Player& player, boost::
sscanf( params.c_str(), "%hhu", &branch );
auto instance = boost::dynamic_pointer_cast< InstanceContent >( player.getCurrentZone() );
auto instance = std::dynamic_pointer_cast< InstanceContent >( player.getCurrentZone() );
if( !instance )
return;
@ -945,7 +945,7 @@ Core::DebugCommandHandler::instance( char* data, Entity::Player& player, boost::
}
else if( subCommand == "qte_start" )
{
auto instance = boost::dynamic_pointer_cast< InstanceContent >( player.getCurrentZone() );
auto instance = std::dynamic_pointer_cast< InstanceContent >( player.getCurrentZone() );
if( !instance )
return;
@ -954,7 +954,7 @@ Core::DebugCommandHandler::instance( char* data, Entity::Player& player, boost::
}
else if( subCommand == "event_start" )
{
auto instance = boost::dynamic_pointer_cast< InstanceContent >( player.getCurrentZone() );
auto instance = std::dynamic_pointer_cast< InstanceContent >( player.getCurrentZone() );
if( !instance )
return;
@ -963,7 +963,7 @@ Core::DebugCommandHandler::instance( char* data, Entity::Player& player, boost::
}
else if( subCommand == "event_end" )
{
auto instance = boost::dynamic_pointer_cast< InstanceContent >( player.getCurrentZone() );
auto instance = std::dynamic_pointer_cast< InstanceContent >( player.getCurrentZone() );
if( !instance )
return;

View file

@ -15,7 +15,7 @@ class DebugCommandHandler
{
private:
// container mapping command string to command object
std::map< std::string, boost::shared_ptr< DebugCommand > > m_commandMap;
std::map< std::string, std::shared_ptr< DebugCommand > > m_commandMap;
public:
DebugCommandHandler();
@ -29,31 +29,31 @@ public:
void execCommand( char* data, Entity::Player& player );
// help command
void help( char* data, Entity::Player& player, boost::shared_ptr< DebugCommand > command );
void help( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command );
// command handler callbacks
void set( char* data, Entity::Player& player, boost::shared_ptr< DebugCommand > command );
void set( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command );
void get( char* data, Entity::Player& player, boost::shared_ptr< DebugCommand > command );
void get( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command );
void add( char* data, Entity::Player& player, boost::shared_ptr< DebugCommand > command );
//void debug( char * data, Entity::Player& player, boost::shared_ptr< DebugCommand > command );
void add( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command );
//void debug( char * data, Entity::Player& player, std::shared_ptr< DebugCommand > command );
void injectPacket( char* data, Entity::Player& player, boost::shared_ptr< DebugCommand > command );
void injectPacket( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command );
void injectChatPacket( char* data, Entity::Player& player, boost::shared_ptr< DebugCommand > command );
void injectChatPacket( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command );
void replay( char* data, Entity::Player& player, boost::shared_ptr< DebugCommand > command );
void replay( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command );
void nudge( char* data, Entity::Player& player, boost::shared_ptr< DebugCommand > command );
void nudge( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command );
void serverInfo( char* data, Entity::Player& player, boost::shared_ptr< DebugCommand > command );
void serverInfo( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command );
void unlockCharacter( char* data, Entity::Player& player, boost::shared_ptr< DebugCommand > command );
void unlockCharacter( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command );
void instance( char* data, Entity::Player& player, boost::shared_ptr< DebugCommand > command );
void instance( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command );
void script( char* data, Entity::Player& player, boost::shared_ptr< DebugCommand > command );
void script( char* data, Entity::Player& player, std::shared_ptr< DebugCommand > command );
};

View file

@ -2,19 +2,17 @@
#define _FORWARDS_H
#include <utility>
#include <boost/shared_ptr.hpp>
#include <memory>
#include <boost/make_shared.hpp>
#include <vector>
#include "Common.h"
#define TYPE_FORWARD( x ) \
class x; \
typedef boost::shared_ptr< x > x ## Ptr; \
typedef std::shared_ptr< x > x ## Ptr; \
typedef std::unique_ptr< x > x ## UPtr; \
template< typename...Args > \
x ## Ptr make_ ## x( Args &&...args ) { \
return boost::make_shared< x >( std::forward< Args >( args ) ... ); }\
return std::make_shared< x >( std::forward< Args >( args ) ... ); }\
typedef std::vector< x > x ## PtrList;
namespace Core {

View file

@ -53,7 +53,7 @@ bool Core::LinkshellMgr::loadLinkshells()
invitesBin = res->getBlobVector( 6 );
func( members, invitesBin );
auto lsPtr = boost::make_shared< Linkshell >( linkshellId, name, masterId, members, leaders, invites );
auto lsPtr = std::make_shared< Linkshell >( linkshellId, name, masterId, members, leaders, invites );
m_linkshellIdMap[ linkshellId ] = lsPtr;
m_linkshellNameMap[ name ] = lsPtr;

View file

@ -1,13 +1,13 @@
#ifndef CORE_LINKSHELLMGR_H
#define CORE_LINKSHELLMGR_H
#include <boost/shared_ptr.hpp>
#include <memory>
#include <map>
namespace Core {
class Linkshell;
using LinkshellPtr = boost::shared_ptr< Linkshell >;
using LinkshellPtr = std::shared_ptr< Linkshell >;
class LinkshellMgr
{

View file

@ -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() );
@ -402,7 +402,7 @@ void Core::Network::GameConnection::handlePackets( const Core::Network::Packets:
{
char* id = ( char* ) &( inPacket.data[ 4 ] );
uint32_t playerId = std::stoi( id );
auto pCon = boost::static_pointer_cast< GameConnection, Connection >( shared_from_this() );
auto pCon = std::static_pointer_cast< GameConnection, Connection >( shared_from_this() );
// try to retrieve the session for this id
auto session = pServerZone->getSession( playerId );
@ -430,7 +430,7 @@ void Core::Network::GameConnection::handlePackets( const Core::Network::Packets:
if( !m_pSession && session )
m_pSession = session;
auto pe = boost::make_shared< FFXIVRawPacket >( 0x07, 0x18, 0, 0 );
auto pe = std::make_shared< FFXIVRawPacket >( 0x07, 0x18, 0, 0 );
*( unsigned int* ) ( &pe->data()[ 0 ] ) = 0xE0037603;
*( unsigned int* ) ( &pe->data()[ 4 ] ) = static_cast< uint32_t >( time( nullptr ) );
sendSinglePacket( pe );
@ -438,7 +438,7 @@ void Core::Network::GameConnection::handlePackets( const Core::Network::Packets:
// main connection, assinging it to the session
if( ipcHeader.connectionType == ConnectionType::Zone )
{
auto pe1 = boost::make_shared< FFXIVRawPacket >( 0x02, 0x38, 0, 0 );
auto pe1 = std::make_shared< FFXIVRawPacket >( 0x02, 0x38, 0, 0 );
*( unsigned int* ) ( &pe1->data()[ 0 ] ) = playerId;
sendSinglePacket( pe1 );
pLog->info( "[" + std::string( id ) + "] Setting session for zone connection" );
@ -447,11 +447,11 @@ void Core::Network::GameConnection::handlePackets( const Core::Network::Packets:
// chat connection, assinging it to the session
else if( ipcHeader.connectionType == ConnectionType::Chat )
{
auto pe2 = boost::make_shared< FFXIVRawPacket >( 0x02, 0x38, 0, 0 );
auto pe2 = std::make_shared< FFXIVRawPacket >( 0x02, 0x38, 0, 0 );
*( unsigned int* ) ( &pe2->data()[ 0 ] ) = playerId;
sendSinglePacket( pe2 );
auto pe3 = boost::make_shared< FFXIVRawPacket >( 0x03, 0x28, playerId, playerId );
auto pe3 = std::make_shared< FFXIVRawPacket >( 0x03, 0x28, playerId, playerId );
*( unsigned short* ) ( &pe3->data()[ 2 ] ) = 0x02;
sendSinglePacket( pe3 );
@ -472,7 +472,7 @@ void Core::Network::GameConnection::handlePackets( const Core::Network::Packets:
uint32_t id = *( uint32_t* ) &inPacket.data[ 0 ];
uint32_t timeStamp = *( uint32_t* ) &inPacket.data[ 4 ];
auto pe4 = boost::make_shared< FFXIVRawPacket >( 0x08, 0x18, 0, 0 );
auto pe4 = std::make_shared< FFXIVRawPacket >( 0x08, 0x18, 0, 0 );
*( unsigned int* ) ( &pe4->data()[ 0 ] ) = id;
*( unsigned int* ) ( &pe4->data()[ 4 ] ) = timeStamp;
sendSinglePacket( pe4 );

View file

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

View file

@ -59,7 +59,7 @@ void examineHandler( Core::Entity::Player& player, uint32_t targetId )
}
else
{
player.queuePacket( boost::make_shared< ExaminePacket >( player, pTarget ) );
player.queuePacket( std::make_shared< ExaminePacket >( player, pTarget ) );
}
}
}

View file

@ -421,7 +421,7 @@ void Core::Network::GameConnection::gm1Handler( const Packets::FFXIVARR_PACKET_R
case GmCommand::Wireframe:
{
player.queuePacket(
boost::make_shared< ActorControlPacket143 >( player.getId(), ActorControlType::ToggleWireframeRendering ) );
std::make_shared< ActorControlPacket143 >( player.getId(), ActorControlType::ToggleWireframeRendering ) );
player.sendNotice( "Wireframe Rendering for " + player.getName() + " was toggled" );
break;
}

View file

@ -297,7 +297,7 @@ void Core::Network::GameConnection::updatePositionHandler( const Core::Network::
player.m_lastMoveTime = currentTime;
player.m_lastMoveflag = moveState;
auto movePacket = boost::make_shared< MoveActorPacket >( player, unk1, unk2, moveState, unk4 );
auto movePacket = std::make_shared< MoveActorPacket >( player, unk1, unk2, moveState, unk4 );
player.sendToInRangeSet( movePacket );
}
@ -426,7 +426,7 @@ void Core::Network::GameConnection::pingHandler( const Core::Network::Packets::F
{
const auto packet = ZoneChannelPacket< Client::FFXIVIpcPingHandler >( inPacket );
queueOutPacket( boost::make_shared< Server::PingPacket >( player, packet.data().timestamp ) );
queueOutPacket( std::make_shared< Server::PingPacket >( player, packet.data().timestamp ) );
player.setLastPing( static_cast< uint32_t >( time( nullptr ) ) );
}
@ -529,7 +529,7 @@ void Core::Network::GameConnection::chatHandler( const Core::Network::Packets::F
auto chatType = packet.data().chatType;
//ToDo, need to implement sending GM chat types.
auto chatPacket = boost::make_shared< Server::ChatPacket >( player, chatType, packet.data().message );
auto chatPacket = std::make_shared< Server::ChatPacket >( player, chatType, packet.data().message );
switch( chatType )
{

View file

@ -42,9 +42,9 @@ private:
};
template< typename... Args >
boost::shared_ptr< ActorControlPacket142 > makeActorControl142( Args... args )
std::shared_ptr< ActorControlPacket142 > makeActorControl142( Args... args )
{
return boost::make_shared< ActorControlPacket142 >( args... );
return std::make_shared< ActorControlPacket142 >( args... );
}
}

View file

@ -46,9 +46,9 @@ private:
};
template< typename... Args >
boost::shared_ptr< ActorControlPacket143 > makeActorControl143( Args... args )
std::shared_ptr< ActorControlPacket143 > makeActorControl143( Args... args )
{
return boost::make_shared< ActorControlPacket143 >( args... );
return std::make_shared< ActorControlPacket143 >( args... );
}
}

View file

@ -44,9 +44,9 @@ private:
};
template< typename... Args >
boost::shared_ptr< ActorControlPacket144 > makeActorControl144( Args... args )
std::shared_ptr< ActorControlPacket144 > makeActorControl144( Args... args )
{
return boost::make_shared< ActorControlPacket144 >( args... );
return std::make_shared< ActorControlPacket144 >( args... );
}
}

View file

@ -118,9 +118,9 @@ bool NativeScriptMgr::isModuleLoaded( const std::string& name )
}
boost::shared_ptr< NativeScriptMgr > createNativeScriptMgr()
std::shared_ptr< NativeScriptMgr > createNativeScriptMgr()
{
return boost::make_shared< NativeScriptMgr >();
return std::make_shared< NativeScriptMgr >();
}
}
}

View file

@ -127,7 +127,7 @@ public:
*
* @return a boost::shared_ptr to NativeScriptMgr
*/
boost::shared_ptr< NativeScriptMgr > createNativeScriptMgr();
std::shared_ptr< NativeScriptMgr > createNativeScriptMgr();
}
}

View file

@ -7,13 +7,13 @@
#include <boost/format.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include <boost/filesystem.hpp>
#include <experimental/filesystem>
#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 )

View file

@ -8,7 +8,7 @@
#include <Exd/ExdDataGenerated.h>
#include <Config/ConfigMgr.h>
#include "Watchdog.h"
#include <watchdog/Watchdog.h>
#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() );
}

View file

@ -1,7 +1,7 @@
#ifndef _ScriptMgr_H_
#define _ScriptMgr_H_
#include <boost/shared_ptr.hpp>
#include <memory>
#include <mutex>
#include <set>
@ -17,7 +17,7 @@ private:
/*!
* @brief A shared ptr to NativeScriptMgr, used for accessing and managing the native script system.
*/
boost::shared_ptr< NativeScriptMgr > m_nativeScriptMgr;
std::shared_ptr< NativeScriptMgr > m_nativeScriptMgr;
std::function< std::string( Entity::Player & ) > m_onFirstEnterWorld;

View file

@ -308,7 +308,7 @@ bool Core::ServerZone::createSession( uint32_t sessionId )
pLog->info( "[" + session_id_str + "] Creating new session" );
boost::shared_ptr< Session > newSession( new Session( sessionId ) );
std::shared_ptr< Session > newSession( new Session( sessionId ) );
m_sessionMapById[ sessionId ] = newSession;
if( !newSession->loadPlayer() )
@ -393,7 +393,7 @@ void Core::ServerZone::loadBNpcTemplates()
auto look = res->getBlobVector( 12 );
auto models = res->getBlobVector( 13 );
auto bnpcTemplate = boost::make_shared< Entity::BNpcTemplate >(
auto bnpcTemplate = std::make_shared< Entity::BNpcTemplate >(
id, bNPCBaseId, bNPCNameId, mainWeaponModel, secWeaponModel,
aggressionMode, enemyType, 0, pose, modelChara, displayFlags,
reinterpret_cast< uint32_t* >( &models[ 0 ] ),

View file

@ -1,4 +1,4 @@
#include <boost/filesystem/operations.hpp>
#include <experimental/filesystem>
#include <time.h>
#include <Util/Util.h>
@ -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();

View file

@ -1,15 +1,14 @@
#ifndef _SESSION_H_
#define _SESSION_H_
#include <boost/enable_shared_from_this.hpp>
#include <boost/shared_ptr.hpp>
#include <memory>
#include "ForwardsZone.h"
namespace Core {
class Session :
public boost::enable_shared_from_this< Session >
public std::enable_shared_from_this< Session >
{
public:
Session( uint32_t sessionId );

View file

@ -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 <map>
#include <string>
#include <thread>
#include <memory>
#include <atomic>
#include <mutex>
#include <boost/filesystem.hpp>
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<void(const ci::fs::path&)> &callback )
{
watchImpl( path, callback, std::function<void(const std::vector<ci::fs::path>&)>() );
}
//! 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<void(const std::vector<ci::fs::path>&)> &callback )
{
watchImpl( path, std::function<void(const ci::fs::path&)>(), 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<std::thread>( 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<std::mutex> 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<void(const ci::fs::path&)> &callback = std::function<void(const ci::fs::path&)>(), const std::function<void(const std::vector<ci::fs::path>&)> &listCallback = std::function<void(const std::vector<ci::fs::path>&)>() )
{
// 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<ci::fs::path,std::string> 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<std::mutex> 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<std::mutex> 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<std::mutex> lock( wd.mMutex );
auto watcher = wd.mFileWatchers.find( key );
if( watcher != wd.mFileWatchers.end() ){
wd.mFileWatchers.erase( watcher );
}
}
}
}
static std::pair<ci::fs::path,std::string> 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<ci::fs::path,std::string> visitWildCardPath( const ci::fs::path &path, const std::function<bool(const ci::fs::path&)> &visitor ){
std::pair<ci::fs::path, std::string> 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<void(const ci::fs::path&)> &callback, const std::function<void(const std::vector<ci::fs::path>&)> &listCallback )
: mPath(path), mFilter(filter), mCallback(callback), mListCallback(listCallback)
{
// make sure we store all initial write time
if( !mFilter.empty() ) {
std::vector<ci::fs::path> 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<ci::fs::path> 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<void(const ci::fs::path&)> mCallback;
std::function<void(const std::vector<ci::fs::path>&)> mListCallback;
std::map< std::string, std::time_t > mModificationTimes;
};
std::mutex mMutex;
std::atomic<bool> mWatching;
std::unique_ptr<std::thread> mThread;
std::map<std::string,Watcher> mFileWatchers;
};

View file

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

View file

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

View file

@ -267,7 +267,7 @@ bool Core::TerritoryMgr::removeTerritoryInstance( uint32_t instanceId )
if( isInstanceContentTerritory( pZone->getTerritoryId() ) )
{
auto instance = boost::dynamic_pointer_cast< InstanceContent >( pZone );
auto instance = std::dynamic_pointer_cast< InstanceContent >( pZone );
m_instanceContentToInstanceMap[ instance->getInstanceContentId() ].erase( pZone->getGuId() );
}
else

View file

@ -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 >;
}
/*!

View file

@ -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;
}
@ -719,7 +719,7 @@ Core::Entity::EventObjectPtr Core::Zone::getEObj( uint32_t objId )
Core::InstanceContentPtr Core::Zone::getAsInstanceContent()
{
return boost::dynamic_pointer_cast< InstanceContent, Zone >( shared_from_this() );
return std::dynamic_pointer_cast< InstanceContent, Zone >( shared_from_this() );
}
uint32_t Core::Zone::getNextEObjId()

View file

@ -11,7 +11,7 @@
#include <set>
#include <map>
#include <boost/enable_shared_from_this.hpp>
#include <memory>
#include <stdio.h>
#include <string.h>
@ -31,7 +31,7 @@ struct TerritoryType;
}
class Zone :
public CellHandler< Cell >, public boost::enable_shared_from_this< Zone >
public CellHandler< Cell >, public std::enable_shared_from_this< Zone >
{
protected:
uint32_t m_territoryId;
@ -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;

View file

@ -19,15 +19,15 @@ using namespace Core;
bool setupFramework()
{
auto pServer = boost::make_shared< ServerZone >( "zone.ini" );
auto pLogger = boost::make_shared< Logger >();
auto pExdData = boost::make_shared< Data::ExdDataGenerated >();
auto pScript = boost::make_shared< Scripting::ScriptMgr >();
auto pDb = boost::make_shared< Db::DbWorkerPool< Db::ZoneDbConnection > >();
auto pLsMgr = boost::make_shared< LinkshellMgr >();
auto pTeriMgr = boost::make_shared< TerritoryMgr >();
auto pDebugCom = boost::make_shared< DebugCommandHandler >();
auto pConfig = boost::make_shared< ConfigMgr >();
auto pServer = std::make_shared< ServerZone >( "zone.ini" );
auto pLogger = std::make_shared< Logger >();
auto pExdData = std::make_shared< Data::ExdDataGenerated >();
auto pScript = std::make_shared< Scripting::ScriptMgr >();
auto pDb = std::make_shared< Db::DbWorkerPool< Db::ZoneDbConnection > >();
auto pLsMgr = std::make_shared< LinkshellMgr >();
auto pTeriMgr = std::make_shared< TerritoryMgr >();
auto pDebugCom = std::make_shared< DebugCommandHandler >();
auto pConfig = std::make_shared< ConfigMgr >();
pLogger->setLogPath( "log/SapphireZone_" );
pLogger->init();

View file

@ -20,7 +20,7 @@ file(GLOB SERVER_SOURCE_FILES
add_executable(discovery_parser ${SERVER_PUBLIC_INCLUDE_FILES} ${SERVER_SOURCE_FILES})
set_target_properties(discovery_parser PROPERTIES
CXX_STANDARD 14
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS ON
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/../bin/"

View file

@ -14,7 +14,7 @@ file(GLOB SERVER_SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}*.c*")
add_executable(event_object_parser ${SERVER_PUBLIC_INCLUDE_FILES} ${SERVER_SOURCE_FILES})
set_target_properties(event_object_parser PROPERTIES
CXX_STANDARD 14
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS ON
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/../bin/"

View file

@ -25,8 +25,12 @@
#include <boost/range/algorithm/remove_if.hpp>
#include <boost/algorithm/string/classification.hpp>
#include <experimental/filesystem>
#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;

View file

@ -14,7 +14,7 @@ file(GLOB SERVER_SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}*.c*")
add_executable(exd_common_gen ${SERVER_PUBLIC_INCLUDE_FILES} ${SERVER_SOURCE_FILES})
set_target_properties(exd_common_gen PROPERTIES
CXX_STANDARD 14
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS ON
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/../bin/"

View file

@ -8,16 +8,17 @@
#include <iostream>
#include <cctype>
#include <set>
#include <Exd/ExdData.h>
#include <Exd/ExdDataGenerated.h>
#include <Logging/Logger.h>
#include <boost/range/algorithm/remove_if.hpp>
#include <boost/algorithm/string/classification.hpp>
#include <algorithm>
#include <fstream>
Core::Logger g_log;
Core::Data::ExdData g_exdData;
Core::Data::ExdDataGenerated g_exdData;
//const std::string datLocation( "/opt/sapphire_3_15_0/bin/sqpack" );
@ -44,11 +45,11 @@ std::string generateEnum( const std::string& exd, int8_t nameIndex, const std::s
{
auto& fields = row.second;
uint32_t id = row.first;
auto test = boost::get< std::string >( &fields.at( nameIndex ) );
auto test = std::get< std::string >( fields.at( nameIndex ) );
if( !test )
continue;
auto str = *test;
str.erase( boost::remove_if( str, boost::is_any_of( ",_-':!(){} \x02\x1f\x01\x03" ) ), str.end() );
str.erase( std::remove_if( str.begin(), str.end(), std::is_any_of( ",_-':!(){} \x02\x1f\x01\x03" ) ) );
if( str.empty() )
continue;
str[ 0 ] = std::toupper( str[ 0 ] );

View file

@ -14,7 +14,7 @@ file(GLOB SERVER_SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}*.c*")
add_executable(exd_struct_gen ${SERVER_PUBLIC_INCLUDE_FILES} ${SERVER_SOURCE_FILES})
set_target_properties(exd_struct_gen PROPERTIES
CXX_STANDARD 14
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS ON
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/../bin/"

View file

@ -14,7 +14,7 @@ file(GLOB SERVER_SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}*.c*")
add_executable(exd_struct_test ${SERVER_PUBLIC_INCLUDE_FILES} ${SERVER_SOURCE_FILES})
set_target_properties(exd_struct_test PROPERTIES
CXX_STANDARD 14
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS ON
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/../bin/"

View file

@ -14,7 +14,7 @@ file(GLOB SERVER_SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}*.c*")
add_executable(mob_parse ${SERVER_PUBLIC_INCLUDE_FILES} ${SERVER_SOURCE_FILES})
set_target_properties(mob_parse PROPERTIES
CXX_STANDARD 14
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS ON
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/../bin/"

View file

@ -11,16 +11,17 @@
#include <set>
#include <Exd/ExdDataGenerated.h>
#include <Logging/Logger.h>
#include <boost/range/algorithm/remove_if.hpp>
#include <boost/algorithm/string/classification.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/make_shared.hpp>
#include <boost/filesystem.hpp>
#include <boost/variant/detail/substitute.hpp>
#include <boost/format.hpp>
using namespace boost::system;
namespace filesys = boost::filesystem;
#include <experimental/filesystem>
namespace filesys = std::experimental::filesystem;
#include <fstream>
#include <streambuf>
@ -172,7 +173,7 @@ std::vector< std::string > getAllFilesInDir( const std::string& dirPath,
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 )

View file

@ -14,7 +14,7 @@ file(GLOB SERVER_SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}*.c*")
add_executable(pcb_reader2 ${SERVER_PUBLIC_INCLUDE_FILES} ${SERVER_SOURCE_FILES})
set_target_properties(pcb_reader2 PROPERTIES
CXX_STANDARD 14
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS ON
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/../bin/"

View file

@ -20,7 +20,7 @@ file(GLOB SERVER_SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}*.c*")
add_executable(quest_parse ${SERVER_PUBLIC_INCLUDE_FILES} ${SERVER_SOURCE_FILES})
set_target_properties(quest_parse PROPERTIES
CXX_STANDARD 14
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS ON
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/../bin/"

View file

@ -6,7 +6,7 @@
#include <string>
#include <boost/algorithm/string.hpp>
#include <boost/filesystem.hpp>
#include <experimental/filesystem>
#include <Exd.h>
#include <ExdCat.h>
@ -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" );