1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-05-02 16:57:47 +00:00

More cleanup for event object parser

This commit is contained in:
mordred 2019-04-15 17:32:51 +02:00
parent 58b37f2c97
commit da4f4cdd15

View file

@ -50,11 +50,11 @@ struct instanceContent
};
std::vector< instanceContent > contentList;
xiv::dat::GameData* data1 = nullptr;
xiv::dat::GameData* g_gameData = nullptr;
void initExd( const std::string& gamePath )
{
data1 = data1 ? data1 : new xiv::dat::GameData( gamePath );
g_gameData = g_gameData ? g_gameData : new xiv::dat::GameData( gamePath );
}
std::unordered_map< std::string, std::string > g_nameMap;
@ -237,23 +237,16 @@ int main( int argc, char* argv[] )
try
{
const auto& zonePath = zoneNameToPath( zoneName );
std::string listPcbPath( zonePath + "/collision/list.pcb" );
std::string bgLgbPath( zonePath + "/level/bg.lgb" );
std::string planmapLgbPath( zonePath + "/level/planmap.lgb" );
std::string collisionFilePath( zonePath + "/collision/" );
std::vector< char > section;
std::vector< char > section2;
const xiv::dat::Cat& test = data1->getCategory( "bg" );
auto bgFile = g_gameData->getFile( bgLgbPath );
auto planmapFile = g_gameData->getFile( planmapLgbPath );
auto bgData = bgFile->access_data_sections().at( 0 );
auto planmapData = planmapFile->access_data_sections().at( 0 );
auto test_file = data1->getFile( bgLgbPath );
auto planmap_file = data1->getFile( planmapLgbPath );
section = test_file->access_data_sections().at( 0 );
section2 = planmap_file->access_data_sections().at( 0 );
LGB_FILE bgLgb( &section[ 0 ], "bg" );
LGB_FILE planmapLgb( &section2[ 0 ], "planmap" );
LGB_FILE bgLgb( &bgData[ 0 ], "bg" );
LGB_FILE planmapLgb( &planmapData[ 0 ], "planmap" );
std::vector< LGB_FILE > lgbList{ bgLgb, planmapLgb };
@ -298,7 +291,7 @@ int main( int argc, char* argv[] )
auto pGObjR = reinterpret_cast< LGB_GIMMICK_ENTRY* >( pGObj );
char* dataSection = nullptr;
auto file = data1->getFile( pGObjR->gimmickFileName );
auto file = g_gameData->getFile( pGObjR->gimmickFileName );
auto sections = file->get_data_sections();
dataSection = &sections.at( 0 )[ 0 ];
auto sgbFile = SGB_FILE( &dataSection[ 0 ] );
@ -434,7 +427,7 @@ int main( int argc, char* argv[] )
Logger::info( "Finished all tasks in {} seconds",
std::chrono::duration_cast< std::chrono::seconds >( std::chrono::system_clock::now() - startTime ).count() );
if( data1 )
delete data1;
if( g_gameData )
delete g_gameData;
return 0;
}