mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-27 14:57:44 +00:00
Merge pull request #221 from takhlaq/pcb_reader
reenable pcb_reader build
This commit is contained in:
commit
caec894394
3 changed files with 31 additions and 10 deletions
|
@ -67,6 +67,6 @@ add_subdirectory("src/tools/exd_common_gen")
|
|||
add_subdirectory("src/tools/exd_struct_gen")
|
||||
add_subdirectory("src/tools/exd_struct_test")
|
||||
add_subdirectory("src/tools/quest_parser")
|
||||
#add_subdirectory("src/tools/pcb_reader")
|
||||
add_subdirectory("src/tools/pcb_reader")
|
||||
|
||||
add_subdirectory("scripts/native")
|
||||
|
|
|
@ -6,16 +6,10 @@ 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/")
|
||||
|
||||
include_directories("../../lib/ChaiScript-6.0.0/include/")
|
||||
|
||||
include_directories("../../sapphire/datReader/")
|
||||
include_directories("../../sapphire/")
|
||||
include_directories("../")
|
||||
|
||||
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(pcb_reader2 ${SERVER_PUBLIC_INCLUDE_FILES} ${SERVER_SOURCE_FILES})
|
||||
|
||||
|
@ -30,9 +24,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)
|
||||
else()
|
||||
target_link_libraries (pcb_reader2 Common xivdat libmysql zlib1)
|
||||
target_link_libraries (pcb_reader2 common xivdat libmysql zlib1)
|
||||
endif()
|
||||
|
||||
target_link_libraries(pcb_reader2 ${Boost_LIBRARIES} ${Boost_LIBRARIES})
|
||||
|
|
|
@ -17,9 +17,15 @@
|
|||
#include <ExdData.h>
|
||||
#include <ExdCat.h>
|
||||
#include <Exd.h>
|
||||
//#include <boost/algorithm/string.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#endif
|
||||
|
||||
enum class TerritoryTypeExdIndexes : size_t
|
||||
{
|
||||
TerritoryType = 0,
|
||||
Path = 1
|
||||
};
|
||||
|
||||
std::string gamePath( "C:\\Program Files (x86)\\SquareEnix\\FINAL FANTASY XIV - A Realm Reborn\\game\\sqpack\\ffxiv" );
|
||||
|
||||
using namespace std::chrono_literals;
|
||||
|
@ -88,6 +94,7 @@ int parseBlockEntry( char* data, std::vector<PCB_BLOCK_ENTRY>& entries, int gOff
|
|||
std::string zoneNameToPath( const std::string& name )
|
||||
{
|
||||
std::string path;
|
||||
#ifdef STANDALONE
|
||||
auto inFile = std::ifstream( "territorytype.exh.csv" );
|
||||
if( inFile.good() )
|
||||
{
|
||||
|
@ -107,6 +114,26 @@ std::string zoneNameToPath( const std::string& name )
|
|||
}
|
||||
inFile.close();
|
||||
}
|
||||
#else
|
||||
xiv::dat::GameData dat( gamePath );
|
||||
xiv::exd::ExdData eData( dat );
|
||||
auto& cat = eData.get_category( "TerritoryType" );
|
||||
auto exd = static_cast< xiv::exd::Exd >( cat.get_data_ln( xiv::exd::Language::none ) );
|
||||
for( auto& row : exd.get_rows() )
|
||||
{
|
||||
auto& fields = row.second;
|
||||
auto teriName = *boost::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( boost::iequals( name, teriName ) )
|
||||
{
|
||||
path = teriPath;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if( !path.empty() )
|
||||
{
|
||||
//path = path.substr( path.find_first_of( "/" ) + 1, path.size() - path.find_first_of( "/" ));
|
||||
|
|
Loading…
Add table
Reference in a new issue