mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-27 06:47:45 +00:00
Add navi mesh folder to world config
This commit is contained in:
parent
86f74da325
commit
25713edbc9
3 changed files with 12 additions and 9 deletions
|
@ -10,7 +10,7 @@ Sapphire::World::Manager::NaviMgr::NaviMgr( FrameworkPtr pFw ) :
|
|||
|
||||
bool Sapphire::World::Manager::NaviMgr::setupTerritory( const std::string& internalName )
|
||||
{
|
||||
auto provider = Navi::make_NaviProvider( internalName );
|
||||
auto provider = Navi::make_NaviProvider( internalName, m_pFw );
|
||||
|
||||
if( provider->init() )
|
||||
{
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
#include <Framework.h>
|
||||
#include <Territory/Zone.h>
|
||||
#include <Logging/Logger.h>
|
||||
#include <Config/ConfigMgr.h>
|
||||
|
||||
|
||||
#include "NaviProvider.h"
|
||||
|
||||
|
@ -11,21 +13,21 @@
|
|||
#include <recastnavigation/Recast/Include/Recast.h>
|
||||
#include <experimental/filesystem>
|
||||
|
||||
|
||||
Sapphire::World::Navi::NaviProvider::NaviProvider( const std::string& internalName ) :
|
||||
Sapphire::World::Navi::NaviProvider::NaviProvider( const std::string& internalName, FrameworkPtr pFw ) :
|
||||
m_naviMesh( nullptr ),
|
||||
m_naviMeshQuery( nullptr ),
|
||||
m_internalName( internalName )
|
||||
m_internalName( internalName ),
|
||||
m_pFw( pFw )
|
||||
{
|
||||
// Set defaults
|
||||
m_polyFindRange[0] = 10;
|
||||
m_polyFindRange[1] = 20;
|
||||
m_polyFindRange[2] = 10;
|
||||
m_polyFindRange[ 0 ] = 10;
|
||||
m_polyFindRange[ 1 ] = 20;
|
||||
m_polyFindRange[ 2 ] = 10;
|
||||
}
|
||||
|
||||
bool Sapphire::World::Navi::NaviProvider::init()
|
||||
{
|
||||
auto meshesFolder = std::experimental::filesystem::path( "navi" );
|
||||
auto meshesFolder = std::experimental::filesystem::path( m_pFw->get< Sapphire::ConfigMgr >()->getValue< std::string >( "Navigation", "MeshPath", "navi" ) );
|
||||
auto meshFolder = meshesFolder / std::experimental::filesystem::path( m_internalName );
|
||||
|
||||
if( std::experimental::filesystem::exists( meshFolder ) )
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace Sapphire::World::Navi
|
|||
};
|
||||
|
||||
public:
|
||||
explicit NaviProvider( const std::string& internalName );
|
||||
explicit NaviProvider( const std::string& internalName, FrameworkPtr pFw );
|
||||
|
||||
bool init();
|
||||
void loadMesh( const std::string& path );
|
||||
|
@ -60,6 +60,7 @@ namespace Sapphire::World::Navi
|
|||
const dtPolyRef* path, const int32_t pathSize, float* steerPos, uint8_t& steerPosFlag,
|
||||
dtPolyRef& steerPosRef, float* outPoints = 0, int32_t* outPointCount = 0 );
|
||||
|
||||
FrameworkPtr m_pFw;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue