diff --git a/src/scripts/ScriptLoader.cpp.in b/src/scripts/ScriptLoader.cpp.in index c3a220b7..18b44e64 100644 --- a/src/scripts/ScriptLoader.cpp.in +++ b/src/scripts/ScriptLoader.cpp.in @@ -23,6 +23,7 @@ namespace Sapphire::World::Manager { class TerritoryMgr; class LinkshellMgr; + class WarpMgr; } extern "C" EXPORT void win32initExd( std::shared_ptr< Sapphire::Data::ExdData > exdData ) @@ -38,6 +39,11 @@ extern "C" EXPORT void win32initLinkshell( std::shared_ptr< Sapphire::World::Man { Sapphire::Common::Service< Sapphire::World::Manager::LinkshellMgr >::set( lsMgr ); } + +extern "C" EXPORT void win32initWarpMgr( std::shared_ptr< Sapphire::World::Manager::WarpMgr > warpMgr ) +{ + Sapphire::Common::Service< Sapphire::World::Manager::WarpMgr >::set( warpMgr ); +} #endif extern "C" EXPORT const Sapphire::ScriptAPI::ScriptObject** getScripts() diff --git a/src/world/Script/NativeScriptApi.h b/src/world/Script/NativeScriptApi.h index 742cfb47..f6b8eb57 100644 --- a/src/world/Script/NativeScriptApi.h +++ b/src/world/Script/NativeScriptApi.h @@ -8,6 +8,7 @@ #include "Manager/LinkshellMgr.h" #include "Manager/PlayerMgr.h" #include "Manager/TerritoryMgr.h" +#include "Manager/WarpMgr.h" #include "Service.h" #ifdef _MSC_VER @@ -249,6 +250,11 @@ namespace Sapphire::ScriptAPI { return Common::Service< World::Manager::TerritoryMgr >::ref(); } + + World::Manager::WarpMgr& warpMgr() + { + return Common::Service< World::Manager::WarpMgr >::ref(); + } }; /*! diff --git a/src/world/Script/ScriptLoader.cpp b/src/world/Script/ScriptLoader.cpp index a188bf36..9acec86a 100644 --- a/src/world/Script/ScriptLoader.cpp +++ b/src/world/Script/ScriptLoader.cpp @@ -19,6 +19,7 @@ namespace Sapphire::World::Manager #include #include +#include namespace fs = std::filesystem; @@ -116,9 +117,11 @@ Sapphire::ScriptAPI::ScriptObject** Sapphire::Scripting::ScriptLoader::getScript using win32initFunc = void(*)( std::shared_ptr< Sapphire::Data::ExdData > ); using win32initFuncTeri = void(*)( std::shared_ptr< Sapphire::World::Manager::TerritoryMgr > ); using win32initFuncLinkshell = void(*)( std::shared_ptr< Sapphire::World::Manager::LinkshellMgr > ); + using win32initFuncWarpMgr = void(*)( std::shared_ptr< Sapphire::World::Manager::WarpMgr > ); auto win32init = reinterpret_cast< win32initFunc >( GetProcAddress( handle, "win32initExd" ) ); auto win32initTeri = reinterpret_cast< win32initFuncTeri >( GetProcAddress( handle, "win32initTeri" ) ); auto win32initLinkshell = reinterpret_cast< win32initFuncLinkshell >( GetProcAddress( handle, "win32initLinkshell" ) ); + auto win32initWarp = reinterpret_cast< win32initFuncWarpMgr >( GetProcAddress( handle, "win32initWarpMgr" ) ); if( win32init ) { @@ -153,6 +156,17 @@ Sapphire::ScriptAPI::ScriptObject** Sapphire::Scripting::ScriptLoader::getScript { Logger::warn( "did not find a win32initLinkshell export on a windows script target - the server will likely crash!" ); } + + if( win32initWarp ) + { + auto warpMgr = Common::Service< Sapphire::World::Manager::WarpMgr >::get(); + auto wptr = warpMgr.lock(); + win32initWarp( wptr ); + } + else + { + Logger::warn( "did not find a win32initLinkshell export on a windows script target - the server will likely crash!" ); + } #else auto func = reinterpret_cast< getScripts >( dlsym( handle, "getScripts" ) ); #endif