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

sapphire_zone is now boost-free

This commit is contained in:
mordred 2018-10-26 09:40:47 +02:00
parent 10741cdbcc
commit fdbee25d3d
4 changed files with 12 additions and 5 deletions

View file

@ -29,6 +29,12 @@ void Core::Util::eraseAll( std::string& inOutStr, char remove )
inOutStr.erase( std::remove( inOutStr.begin(), inOutStr.end(), remove ), inOutStr.end() ); inOutStr.erase( std::remove( inOutStr.begin(), inOutStr.end(), remove ), inOutStr.end() );
} }
void Core::Util::eraseAllIn( std::string& inOutStr, std::string& remove )
{
for( auto rem : remove )
inOutStr.erase( std::remove( inOutStr.begin(), inOutStr.end(), rem ), inOutStr.end() );
}
std::string Core::Util::intToHexString( uint64_t intValue, uint8_t width ) std::string Core::Util::intToHexString( uint64_t intValue, uint8_t width )
{ {

View file

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

View file

@ -1,6 +1,7 @@
#include <Common.h> #include <Common.h>
#include <Logging/Logger.h> #include <Logging/Logger.h>
#include <Network/CommonActorControl.h> #include <Network/CommonActorControl.h>
#include <algorithm>
#include "Zone/Zone.h" #include "Zone/Zone.h"
@ -847,7 +848,7 @@ uint16_t Core::Entity::Player::calculateEquippedGearItemLevel()
it++; it++;
} }
return std::max( iLvlResult / 13, 9999 ); return std::max( static_cast< int32_t >( iLvlResult / 13 ), 9999 );
} }

View file

@ -1,7 +1,6 @@
#include <Common.h> #include <Common.h>
#include <Exd/ExdDataGenerated.h> #include <Exd/ExdDataGenerated.h>
#include <boost/range/algorithm/remove_if.hpp> #include <Util/Util.h>
#include <boost/algorithm/string/classification.hpp>
#include "Framework.h" #include "Framework.h"
#include "EventHelper.h" #include "EventHelper.h"
@ -62,8 +61,8 @@ std::string Core::Event::getEventName( uint32_t eventId )
{ {
auto contentInfo = pExdData->get< Core::Data::InstanceContent >( eventId & 0xFFFF ); auto contentInfo = pExdData->get< Core::Data::InstanceContent >( eventId & 0xFFFF );
std::string name = contentInfo->name; std::string name = contentInfo->name;
std::string remove( "★_ '()[]-\x1a\x1\x2\x1f\x1\x3.:" );
name.erase( boost::remove_if( name, boost::is_any_of( "★_ '()[]-\x1a\x1\x2\x1f\x1\x3.:" ) ), name.end() ); Util::eraseAllIn( name, remove );
name[ 0 ] = toupper( name[ 0 ] ); name[ 0 ] = toupper( name[ 0 ] );
return name; return name;
} }