1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-26 14:37:44 +00:00

reenabled pcb_reader build, removed dumb requirement of territorytype extraction on xivdat build for pcb_reader

This commit is contained in:
Tahir Akhlaq 2018-01-23 13:13:35 +00:00
parent 37f10fb53b
commit 0cac614b96
2 changed files with 29 additions and 2 deletions

View file

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

View file

@ -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( "/" ));