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

Boost removed from all tools

This commit is contained in:
Mordred 2018-10-27 22:51:16 +02:00
parent d6111ebc3c
commit f391fe3c99
11 changed files with 98 additions and 108 deletions

View file

@ -7,7 +7,8 @@
// #include <iostream>
namespace Core {
namespace Core
{
Logger::Logger()
@ -34,7 +35,8 @@ void Logger::init()
std::vector<spdlog::sink_ptr> sinks { stdout_sink, daily_sink };
auto logger = std::make_shared< spdlog::async_logger >( "logger", sinks.begin(), sinks.end(), spdlog::thread_pool(), spdlog::async_overflow_policy::block );
auto logger = std::make_shared< spdlog::async_logger >( "logger", sinks.begin(), sinks.end(),
spdlog::thread_pool(), spdlog::async_overflow_policy::block );
spdlog::register_logger( logger );

View file

@ -2,11 +2,8 @@ cmake_minimum_required(VERSION 2.6)
cmake_policy(SET CMP0015 NEW)
project(Tool_discovery_parser)
set(SAPPHIRE_BOOST_VER 1.63.0)
set(SAPPHIRE_BOOST_FOLDER_NAME boost_1_63_0)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../bin/")
file(GLOB SERVER_PUBLIC_INCLUDE_FILES
"${CMAKE_CURRENT_SOURCE_DIR}/*"
"${CMAKE_CURRENT_SOURCE_DIR}/BMP-DDS_Converter/*"
@ -30,10 +27,10 @@ set_target_properties(discovery_parser PROPERTIES
)
if (UNIX)
target_link_libraries (discovery_parser common xivdat pthread mysqlclient dl z)
target_link_libraries (discovery_parser common xivdat pthread mysqlclient dl z stdc++fs)
else()
target_link_libraries (discovery_parser common xivdat libmysql zlib1)
target_link_libraries (discovery_parser common xivdat mysql zlib)
endif()
target_link_libraries(discovery_parser ${Boost_LIBRARIES} ${Boost_LIBRARIES})

View file

@ -9,6 +9,9 @@
#include <vector>
#include <set>
#include <memory>
#include <variant>
#include <Util/Util.h>
#include "pcb.h"
#include "lgb.h"
@ -22,7 +25,6 @@
#include <ExdData.h>
#include <ExdCat.h>
#include <Exd.h>
#include <boost/algorithm/string.hpp>
// garbage to ignore models
bool ignoreModels = false;
@ -162,17 +164,17 @@ void getMapExdEntries( uint32_t zoneId )
case DataType::float32: 8
case DataType::uint64: 9
*/
auto territory = *boost::get< uint16_t >( &fields.at( 14 ) );
auto territory = std::get< uint16_t >( fields.at( 14 ) );
if( territory != zoneId )
continue;
auto mapZoneIndex = *boost::get< int8_t >( &fields.at( 2 ) );
auto hierarchy = *boost::get< uint8_t >( &fields.at( 3 ) );
auto pathStr = *boost::get< std::string >( &fields.at( 5 ) );
auto sizeFactor = *boost::get< uint16_t >( &fields.at( 6 ) );
auto mapOffsetX = *boost::get< int16_t >( &fields.at( 7 ) );
auto mapOffsetY = *boost::get< int16_t >( &fields.at( 8 ) );
auto discoveryIdx = *boost::get< int16_t >( &fields.at( 12 ) );
auto discoveryCompleteBitmask = *boost::get< uint32_t >( &fields.at( 13 ) );
auto mapZoneIndex = std::get< int8_t >( fields.at( 2 ) );
auto hierarchy = std::get< uint8_t >( fields.at( 3 ) );
auto pathStr = std::get< std::string >( fields.at( 5 ) );
auto sizeFactor = std::get< uint16_t >( fields.at( 6 ) );
auto mapOffsetX = std::get< int16_t >( fields.at( 7 ) );
auto mapOffsetY = std::get< int16_t >( fields.at( 8 ) );
auto discoveryIdx = std::get< int16_t >( fields.at( 12 ) );
auto discoveryCompleteBitmask = std::get< uint32_t >( fields.at( 13 ) );
char texStr[255];
auto teriStr = pathStr.substr( 0, pathStr.find_first_of( '/' ) );
char discoveryFileName[255];
@ -247,19 +249,19 @@ std::string zoneNameToPath( const std::string& name )
for( auto& row : rows )
{
auto& fields = row.second;
auto teriName = *boost::get< std::string >(
&fields.at( static_cast< size_t >( TerritoryTypeExdIndexes::TerritoryType ) ) );
auto teriName = std::get< std::string >(
fields.at( static_cast< size_t >( TerritoryTypeExdIndexes::TerritoryType ) ) );
if( teriName.empty() )
continue;
auto teriPath = *boost::get< std::string >(
&fields.at( static_cast< size_t >( TerritoryTypeExdIndexes::Path ) ) );
auto teriPath = std::get< std::string >(
fields.at( static_cast< size_t >( TerritoryTypeExdIndexes::Path ) ) );
ZoneInfo info;
info.id = row.first;
info.path = teriPath;
info.name = teriName;
zoneInfoMap[ row.first ] = info;
if( !found && boost::iequals( name, teriName ) )
if( !found && ( Core::Util::toLowerCopy( name ) == Core::Util::toLowerCopy( teriName ) ) )
{
found = true;
path = teriPath;
@ -271,7 +273,7 @@ std::string zoneNameToPath( const std::string& name )
{
for( const auto& entry : zoneInfoMap )
{
if( found = boost::iequals( name, entry.second.name ) )
if( found = Core::Util::toLowerCopy( name ) == Core::Util::toLowerCopy( entry.second.name ) )
{
path = entry.second.path;
zoneId = entry.second.id;
@ -304,7 +306,7 @@ void loadEobjNames()
{
auto id = row.first;
auto& fields = row.second;
auto name = *boost::get< std::string >( &fields.at( 0 ) );
auto name = std::get< std::string >( fields.at( 0 ) );
eobjNameMap[ id ] = name;
}
}

View file

@ -24,10 +24,9 @@ set_target_properties(event_object_parser PROPERTIES
)
if (UNIX)
target_link_libraries (event_object_parser common xivdat pthread mysqlclient dl z)
target_link_libraries (event_object_parser common xivdat pthread mysqlclient dl z stdc++fs)
else()
target_link_libraries (event_object_parser common xivdat libmysql zlib1)
target_link_libraries (event_object_parser common xivdat mysql zlib)
endif()
target_link_libraries(event_object_parser ${Boost_LIBRARIES} ${Boost_LIBRARIES})

View file

@ -8,6 +8,8 @@
#include <map>
#include <vector>
#include <set>
#include <variant>
#include <Util/Util.h>
#include "pcb.h"
#include "lgb.h"
@ -21,9 +23,6 @@
#include <ExdData.h>
#include <ExdCat.h>
#include <Exd.h>
#include <boost/algorithm/string.hpp>
#include <boost/range/algorithm/remove_if.hpp>
#include <boost/algorithm/string/classification.hpp>
#include <experimental/filesystem>
@ -148,14 +147,14 @@ void dumpLevelExdEntries( uint32_t zoneId, const std::string& name = std::string
{
auto id = row.first;
auto& fields = row.second;
auto x = *boost::get< float >( &fields.at( 0 ) );
auto y = *boost::get< float >( &fields.at( 1 ) );
auto z = *boost::get< float >( &fields.at( 2 ) );
auto yaw = *boost::get< float >( &fields.at( 3 ) );
auto radius = *boost::get< float >( &fields.at( 4 ) );
auto type = *boost::get< uint8_t >( &fields.at( 5 ) );
auto objectid = *boost::get< uint32_t >( &fields.at( 6 ) );
auto zone = *boost::get< uint16_t >( &fields.at( 9 ) );
auto x = std::get< float >( fields.at( 0 ) );
auto y = std::get< float >( fields.at( 1 ) );
auto z = std::get< float >( fields.at( 2 ) );
auto yaw = std::get< float >( fields.at( 3 ) );
auto radius = std::get< float >( fields.at( 4 ) );
auto type = std::get< uint8_t >( fields.at( 5 ) );
auto objectid = std::get< uint32_t >( fields.at( 6 ) );
auto zone = std::get< uint16_t >( fields.at( 9 ) );
if( zone == zoneId )
{
@ -205,12 +204,12 @@ std::string zoneNameToPath( const std::string& name )
for( auto& row : exd.get_rows() )
{
auto& fields = row.second;
auto teriName = *boost::get< std::string >(
&fields.at( static_cast< size_t >( TerritoryTypeExdIndexes::TerritoryType ) ) );
auto teriName = std::get< std::string >(
fields.at( static_cast< size_t >( TerritoryTypeExdIndexes::TerritoryType ) ) );
if( teriName.empty() )
continue;
auto teriPath = *boost::get< std::string >( &fields.at( static_cast< size_t >( TerritoryTypeExdIndexes::Path ) ) );
if( !found && boost::iequals( name, teriName ) )
auto teriPath = std::get< std::string >( fields.at( static_cast< size_t >( TerritoryTypeExdIndexes::Path ) ) );
if( !found && ( Core::Util::toLowerCopy( name) == Core::Util::toLowerCopy( teriName ) ) )
{
path = teriPath;
found = true;
@ -244,7 +243,7 @@ void loadEobjNames()
{
auto id = row.first;
auto& fields = row.second;
auto name = *boost::get< std::string >( &fields.at( 0 ) );
auto name = std::get< std::string >( fields.at( 0 ) );
if( !name.empty() )
eobjNameMap[ id ] = name;
@ -316,11 +315,11 @@ void loadAllInstanceContentEntries()
auto id = row.first;
auto& fields = row.second;
auto name = *boost::get< std::string >( &fields.at( 3 ) );
auto name = std::get< std::string >( fields.at( 3 ) );
if( name.empty() )
continue;
auto type = *boost::get< uint8_t >( &fields.at( 0 ) );
auto teri = *boost::get< uint32_t >( &fields.at( 9 ) );
auto type = std::get< uint8_t >( fields.at( 0 ) );
auto teri = std::get< uint32_t >( fields.at( 9 ) );
auto i = 0;
while( ( i = name.find( ' ' ) ) != std::string::npos )
name = name.replace( name.begin() + i, name.begin() + i + 1, { '_' } );
@ -331,7 +330,8 @@ void loadAllInstanceContentEntries()
//zoneInstanceMap[zoneId].push_back( std::make_pair( id, name ) );
zoneDumpList.emplace( zoneNameMap[ teri ] );
name.erase( boost::remove_if( name, boost::is_any_of( "★_ '()[]-\x1a\x1\x2\x1f\x1\x3.:" ) ), name.end() );
std::string remove = "★_ '()[]-\x1a\x1\x2\x1f\x1\x3.:";
Core::Util::eraseAllIn( name, remove );
name[ 0 ] = toupper( name[ 0 ] );
contentList.push_back( { id, name, zoneNameMap[ teri ], type } );
}
@ -584,8 +584,9 @@ int main( int argc, char* argv[] )
if( eobjNameMap.find( id ) != eobjNameMap.end() )
{
name = eobjNameMap[ id ];
name.erase( boost::remove_if( name, boost::is_any_of( "★_ '()[]-\x1a\x1\x2\x1f\x1\x3.:" ) ),
name.end() );
std::string remove = "★_ '()[]-\x1a\x1\x2\x1f\x1\x3.:";
Core::Util::eraseAllIn( name, remove );
name[ 0 ] = toupper( name[ 0 ] );
}
if( name.empty() )

View file

@ -2,15 +2,12 @@ cmake_minimum_required(VERSION 2.6)
cmake_policy(SET CMP0015 NEW)
project(Tool_ExdCommonGen)
set(SAPPHIRE_BOOST_VER 1.63.0)
set(SAPPHIRE_BOOST_FOLDER_NAME boost_1_63_0)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../bin/")
file(GLOB SERVER_PUBLIC_INCLUDE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/*")
file(GLOB SERVER_SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}*.c*")
#set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "../bin/")
add_executable(exd_common_gen ${SERVER_PUBLIC_INCLUDE_FILES} ${SERVER_SOURCE_FILES})
set_target_properties(exd_common_gen PROPERTIES
@ -24,13 +21,10 @@ set_target_properties(exd_common_gen PROPERTIES
)
if (UNIX)
target_link_libraries (exd_common_gen common xivdat pthread mysqlclient dl z)
target_link_libraries (exd_common_gen common xivdat pthread mysqlclient dl z stdc++fs)
else()
target_link_libraries (exd_common_gen common xivdat libmysql zlib)
# ignore unchecked iterators warnings from msvc
add_definitions(-D_SCL_SECURE_NO_WARNINGS)
target_link_libraries (exd_common_gen common xivdat mysql zlib)
endif()
target_link_libraries(exd_common_gen ${Boost_LIBRARIES} ${Boost_LIBRARIES})

View file

@ -10,8 +10,8 @@
#include <set>
#include <Exd/ExdDataGenerated.h>
#include <Logging/Logger.h>
#include <boost/range/algorithm/remove_if.hpp>
#include <algorithm>
#include <Util/Util.h>
#include <fstream>
@ -45,27 +45,34 @@ std::string generateEnum( const std::string& exd, int8_t nameIndex, const std::s
{
auto& fields = row.second;
uint32_t id = row.first;
auto test = std::get< std::string >( fields.at( nameIndex ) );
if( !test )
continue;
auto str = *test;
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 ] );
auto it = nameMap.find( str );
std::string value;
try
{
value = std::get< std::string >( fields.at( nameIndex ) );
}
catch( std::bad_variant_access& )
{
continue;
}
std::string remove = ",_-':!(){} \x02\x1f\x01\x03";
Core::Util::eraseAllIn( value, remove );
value[ 0 ] = std::toupper( value[ 0 ] );
auto it = nameMap.find( value );
if( it != nameMap.end() )
{
nameMap[ str ]++;
str = str + std::to_string( nameMap[ str ] );
nameMap[ value ]++;
value = value + std::to_string( nameMap[ value ] );
}
else
{
nameMap[ str ] = 0;
nameMap[ value ] = 0;
}
result += " " + str + " = " + std::to_string( id ) + ",\n";
result += " " + value + " = " + std::to_string( id ) + ",\n";
}

View file

@ -2,8 +2,6 @@ cmake_minimum_required(VERSION 2.6)
cmake_policy(SET CMP0015 NEW)
project(Tool_mob_parse)
set(SAPPHIRE_BOOST_VER 1.63.0)
set(SAPPHIRE_BOOST_FOLDER_NAME boost_1_63_0)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../bin/")
@ -24,10 +22,8 @@ set_target_properties(mob_parse PROPERTIES
)
if (UNIX)
target_link_libraries (mob_parse common xivdat pthread mysqlclient dl z)
target_link_libraries (mob_parse common xivdat pthread mysqlclient dl z stdc++fs )
else()
target_link_libraries (mob_parse common xivdat libmysql zlib1)
target_link_libraries (mob_parse common xivdat mysql zlib)
endif()
target_link_libraries(mob_parse ${Boost_LIBRARIES} ${Boost_LIBRARIES})

View file

@ -11,13 +11,7 @@
#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/variant/detail/substitute.hpp>
#include <boost/format.hpp>
#include <Util/Util.h>
#include <experimental/filesystem>
@ -126,7 +120,7 @@ std::string binaryToHexString( uint8_t* pBinData, uint16_t size )
for( uint32_t i = 0; i < size; i++ )
{
outStr += boost::str( boost::format( "%|02X|" ) % ( int32_t ) ( pBinData[ i ] & 0xFF ) );
outStr += Core::Util::intToHexString( pBinData[ i ] & 0xFF );
}
return outStr;

View file

@ -2,8 +2,6 @@ cmake_minimum_required(VERSION 2.6)
cmake_policy(SET CMP0015 NEW)
project(Tool_pcb_reader2)
set(SAPPHIRE_BOOST_VER 1.63.0)
set(SAPPHIRE_BOOST_FOLDER_NAME boost_1_63_0)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/../bin/")
@ -24,10 +22,9 @@ set_target_properties(pcb_reader2 PROPERTIES
)
if (UNIX)
target_link_libraries (pcb_reader2 common xivdat pthread mysqlclient dl z)
target_link_libraries (pcb_reader2 common xivdat pthread mysqlclient dl z stdc++fs )
else()
target_link_libraries (pcb_reader2 common xivdat libmysql zlib1)
target_link_libraries (pcb_reader2 common xivdat mysql zlib)
endif()
target_link_libraries(pcb_reader2 ${Boost_LIBRARIES} ${Boost_LIBRARIES})

View file

@ -8,6 +8,8 @@
#include <map>
#include <vector>
#include <set>
#include <variant>
#include <Util/Util.h>
#include "pcb.h"
#include "lgb.h"
@ -21,7 +23,6 @@
#include <ExdData.h>
#include <ExdCat.h>
#include <Exd.h>
#include <boost/algorithm/string.hpp>
#endif
@ -132,14 +133,14 @@ void dumpLevelExdEntries( uint32_t zoneId, const std::string& name = std::string
{
auto id = row.first;
auto& fields = row.second;
auto x = *boost::get< float >( &fields.at( 0 ) );
auto y = *boost::get< float >( &fields.at( 1 ) );
auto z = *boost::get< float >( &fields.at( 2 ) );
auto yaw = *boost::get< float >( &fields.at( 3 ) );
auto radius = *boost::get< float >( &fields.at( 4 ) );
auto type = *boost::get< uint8_t >( &fields.at( 5 ) );
auto objectid = *boost::get< uint32_t >( &fields.at( 6 ) );
auto zone = *boost::get< uint16_t >( &fields.at( 9 ) );
auto x = std::get< float >( fields.at( 0 ) );
auto y = std::get< float >( fields.at( 1 ) );
auto z = std::get< float >( fields.at( 2 ) );
auto yaw = std::get< float >( fields.at( 3 ) );
auto radius = std::get< float >( fields.at( 4 ) );
auto type = std::get< uint8_t >( fields.at( 5 ) );
auto objectid = std::get< uint32_t >( fields.at( 6 ) );
auto zone = std::get< uint16_t >( fields.at( 9 ) );
if( zone == zoneId )
{
@ -189,12 +190,12 @@ std::string zoneNameToPath( const std::string& name )
for( auto& row : exd.get_rows() )
{
auto& fields = row.second;
auto teriName = *boost::get< std::string >(
&fields.at( static_cast< size_t >( TerritoryTypeExdIndexes::TerritoryType ) ) );
auto teriName = std::get< std::string >(
fields.at( static_cast< size_t >( TerritoryTypeExdIndexes::TerritoryType ) ) );
if( teriName.empty() )
continue;
auto teriPath = *boost::get< std::string >( &fields.at( static_cast< size_t >( TerritoryTypeExdIndexes::Path ) ) );
if( !found && boost::iequals( name, teriName ) )
auto teriPath = std::get< std::string >( fields.at( static_cast< size_t >( TerritoryTypeExdIndexes::Path ) ) );
if( !found && ( Core::Util::toLowerCopy( name ) == Core::Util::toLowerCopy( teriName ) ) )
{
path = teriPath;
found = true;
@ -228,7 +229,7 @@ void loadEobjNames()
{
auto id = row.first;
auto& fields = row.second;
auto name = *boost::get< std::string >( &fields.at( 0 ) );
auto name = std::get< std::string >( fields.at( 0 ) );
eobjNameMap[ id ] = name;
}
}
@ -298,10 +299,10 @@ void loadAllInstanceContentEntries()
auto id = row.first;
auto& fields = row.second;
auto name = *boost::get< std::string >( &fields.at( 3 ) );
auto name = std::get< std::string >( fields.at( 3 ) );
if( name.empty() )
continue;
auto teri = *boost::get< uint32_t >( &fields.at( 9 ) );
auto teri = std::get< uint32_t >( fields.at( 9 ) );
auto i = 0;
while( ( i = name.find( ' ' ) ) != std::string::npos )
name = name.replace( name.begin() + i, name.begin() + i + 1, { '_' } );