1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-29 07:37:45 +00:00

57 occurances of boost to go

This commit is contained in:
mordred 2018-10-26 08:25:20 +02:00
parent c5f4bb0659
commit d140acf613
13 changed files with 31 additions and 42 deletions

View file

@ -24,6 +24,12 @@ std::string Core::Util::toLowerCopy( const std::string& inStr )
return out;
}
void Core::Util::eraseAll( std::string& inOutStr, char remove )
{
inOutStr.erase( std::remove( inOutStr.begin(), inOutStr.end(), remove ), inOutStr.end() );
}
std::string Core::Util::intToHexString( uint64_t intValue, uint8_t width )
{
std::string hexStr;

View file

@ -13,6 +13,8 @@ std::string binaryToHexDump( uint8_t* pBinData, uint16_t size );
std::string intToHexString( uint64_t intValue, uint8_t width = 2 );
void eraseAll( std::string& inOutStr, char remove );
std::string toLowerCopy( const std::string& inStr );
uint64_t getTimeMs();

View file

@ -10,10 +10,8 @@
#include <boost/property_tree/xml_parser.hpp>
#include <boost/property_tree/json_parser.hpp>
#include <boost/foreach.hpp>
#include <boost/shared_ptr.hpp>
#include <Database/DatabaseDef.h>
#include <boost/make_shared.hpp>
Core::Network::SapphireAPI::SapphireAPI()
{

View file

@ -21,6 +21,7 @@
#include <Database/ZoneDbConnection.h>
#include <Database/DbWorkerPool.h>
#include <Database/PreparedStatement.h>
#include <Util/Util.h>
//Added for the default_resource example
#include <fstream>
@ -88,7 +89,7 @@ bool loadSettings( int32_t argc, char* argv[] )
try
{
arg = boost::to_lower_copy( std::string( args[ i ] ) );
arg = Util::toLowerCopy( std::string( args[ i ] ) );
val = std::string( args[ i + 1 ] );
// trim '-' from start of arg

View file

@ -15,9 +15,6 @@
#include "Player.h"
#include "Framework.h"
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/clamp.hpp>
#include <Network/PacketDef/Zone/ServerZoneDef.h>
#include <Exd/ExdDataGenerated.h>
@ -850,7 +847,7 @@ uint16_t Core::Entity::Player::calculateEquippedGearItemLevel()
it++;
}
return boost::algorithm::clamp( iLvlResult / 13, 0, 9999 );
return std::max( iLvlResult / 13, 9999 );
}

View file

@ -1,5 +1,3 @@
#include <boost/format.hpp>
#include <Common.h>
#include <Network/CommonNetwork.h>
#include <Exd/ExdDataGenerated.h>
@ -8,6 +6,7 @@
#include <Network/CommonActorControl.h>
#include <Network/PacketDef/Zone/ClientZoneDef.h>
#include <Logging/Logger.h>
#include <Util/Util.h>
#include "Network/GameConnection.h"
#include "Network/PacketWrappers/ServerNoticePacket.h"
@ -57,7 +56,7 @@ void Core::Network::GameConnection::actionHandler( const Packets::FFXIVARR_PACKE
if( action < 1000000 ) // normal action
{
std::string actionIdStr = boost::str( boost::format( "%|04X|" ) % action );
std::string actionIdStr = Util::intToHexString( action, 4 );
player.sendDebug( "---------------------------------------" );
player.sendDebug( "ActionHandler ( " + actionIdStr + " | " +
pExdData->get< Core::Data::Action >( action )->name +

View file

@ -1,5 +1,3 @@
#include <boost/format.hpp>
#include <Common.h>
#include <Network/CommonNetwork.h>
#include <Network/GamePacketNew.h>
@ -8,6 +6,7 @@
#include <Network/PacketContainer.h>
#include <Network/CommonActorControl.h>
#include <Network/PacketDef/Zone/ClientZoneDef.h>
#include <Util/Util.h>
#include "Zone/Zone.h"
#include "Zone/ZonePosition.h"
@ -80,10 +79,10 @@ void Core::Network::GameConnection::clientTriggerHandler( const Packets::FFXIVAR
const auto param3 = packet.data().param3;
pLog->debug( "[" + std::to_string( m_pSession->getId() ) + "] Incoming action: " +
boost::str( boost::format( "%|04X|" ) % ( uint32_t ) ( commandId & 0xFFFF ) ) +
"\nparam1: " + boost::str( boost::format( "%|016X|" ) % ( uint64_t ) ( param1 & 0xFFFFFFFFFFFFFFF ) ) +
"\nparam2: " + boost::str( boost::format( "%|08X|" ) % ( uint32_t ) ( param2 & 0xFFFFFFFF ) ) +
"\nparam3: " + boost::str( boost::format( "%|016X|" ) % ( uint64_t ) ( param3 & 0xFFFFFFFFFFFFFFF ) )
Util::intToHexString( static_cast< uint32_t >( commandId & 0xFFFF ), 4 ) +
"\nparam1: " + Util::intToHexString( static_cast< uint64_t >( param1 & 0xFFFFFFFFFFFFFFF ), 16 ) +
"\nparam2: " + Util::intToHexString( static_cast< uint32_t >( param2 & 0xFFFFFFFF ), 8 ) +
"\nparam3: " + Util::intToHexString( static_cast< uint64_t >( param3 & 0xFFFFFFFFFFFFFFF ), 16 )
);
@ -313,7 +312,7 @@ void Core::Network::GameConnection::clientTriggerHandler( const Packets::FFXIVAR
default:
{
pLog->debug( "[" + std::to_string( m_pSession->getId() ) + "] Unhandled action: " +
boost::str( boost::format( "%|04X|" ) % ( uint32_t ) ( commandId & 0xFFFF ) ) );
Util::intToHexString( static_cast< uint32_t >( commandId & 0xFFFF ), 4 ) );
break;
}
}

View file

@ -1,5 +1,3 @@
#include <boost/format.hpp>
#include <Common.h>
#include <Exd/ExdDataGenerated.h>
#include <Network/CommonNetwork.h>
@ -16,6 +14,8 @@
#include "Script/ScriptMgr.h"
#include <Util/Util.h>
#include "Event/EventHandler.h"
#include "Event/EventHelper.h"
@ -52,8 +52,7 @@ void Core::Network::GameConnection::eventHandlerTalk( const Packets::FFXIVARR_PA
std::to_string( Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ) ) +
" \neventId: " +
std::to_string( eventId ) +
" (0x" + boost::str( boost::format( "%|08X|" )
% static_cast< uint64_t >( eventId & 0xFFFFFFF ) ) + ")" );
" (0x" + Util::intToHexString( static_cast< uint64_t >( eventId & 0xFFFFFFF ), 8 ) + ")" );
player.sendDebug( "Calling: " + objName + "." + eventName );
@ -97,8 +96,7 @@ void Core::Network::GameConnection::eventHandlerEmote( const Packets::FFXIVARR_P
std::to_string( Event::mapEventActorToRealActor( static_cast< uint32_t >( actorId ) ) ) +
" \neventId: " +
std::to_string( eventId ) +
" (0x" + boost::str( boost::format( "%|08X|" )
% static_cast< uint64_t >( eventId & 0xFFFFFFF ) ) + ")" );
" (0x" + Util::intToHexString( static_cast< uint64_t >( eventId & 0xFFFFFFF ), 8 ) + ")" );
player.sendDebug( "Calling: " + objName + "." + eventName );
@ -206,7 +204,7 @@ void Core::Network::GameConnection::eventHandlerReturn( const Packets::FFXIVARR_
player.sendDebug( "eventId: " +
std::to_string( eventId ) +
" ( 0x" + boost::str( boost::format( "%|08X|" ) % ( uint64_t ) ( eventId & 0xFFFFFFF ) ) + " ) " +
" ( 0x" + Util::intToHexString( static_cast< uint64_t >( eventId & 0xFFFFFFF ), 8 ) + " ) " +
" scene: " + std::to_string( scene ) +
" p1: " + std::to_string( param1 ) +
" p2: " + std::to_string( param2 ) +

View file

@ -1,5 +1,3 @@
#include <boost/format.hpp>
#include <Common.h>
#include <Network/CommonNetwork.h>
#include <Network/GamePacketNew.h>

View file

@ -1,5 +1,3 @@
#include <boost/format.hpp>
#include <Common.h>
#include <Network/CommonNetwork.h>
#include <Network/GamePacketNew.h>

View file

@ -1,5 +1,3 @@
#include <boost/format.hpp>
#include <Common.h>
#include <Network/CommonNetwork.h>
#include <Network/GamePacketNew.h>

View file

@ -28,8 +28,7 @@
#include "ForwardsZone.h"
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string/case_conv.hpp>
#include <Util/Util.h>
#include <thread>
#include "Framework.h"
@ -75,7 +74,7 @@ bool Core::ServerZone::loadSettings( int32_t argc, char* argv[] )
try
{
arg = boost::to_lower_copy( std::string( args[ i ] ) );
arg = Util::toLowerCopy( std::string( args[ i ] ) );
val = std::string( args[ i + 1 ] );
// trim '-' from start of arg

View file

@ -1,12 +1,8 @@
#include <boost/algorithm/string.hpp>
#include <algorithm>
#include <Exd/ExdDataGenerated.h>
#include <Util/Util.h>
#include <Network/PacketDef/Zone/ServerZoneDef.h>
#include <Logging/Logger.h>
#include <boost/algorithm/string.hpp>
#include <algorithm>
#include "Actor/Chara.h"
@ -37,11 +33,11 @@ Core::StatusEffect::StatusEffect::StatusEffect( uint32_t id, Entity::CharaPtr so
std::replace( m_name.begin(), m_name.end(), ':', '_' );
std::replace( m_name.begin(), m_name.end(), '&', '_' );
std::replace( m_name.begin(), m_name.end(), '+', 'p' );
boost::erase_all( m_name, "\'" );
boost::erase_all( m_name, "&" );
boost::erase_all( m_name, "-" );
boost::erase_all( m_name, "(" );
boost::erase_all( m_name, ")" );
Util::eraseAll( m_name, '\'' );
Util::eraseAll( m_name, '&' );
Util::eraseAll( m_name, '-' );
Util::eraseAll( m_name, '(' );
Util::eraseAll( m_name, ')' );
}