mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-25 05:57:45 +00:00
simplified linkshell loading\n removed old serverId as it is not used anymore
This commit is contained in:
parent
9049784b1a
commit
cd67fe2b52
3 changed files with 15 additions and 29 deletions
|
@ -30,23 +30,26 @@ bool Core::LinkshellMgr::loadLinkshells()
|
||||||
{
|
{
|
||||||
uint32_t linkshellId = field[0].getUInt32();
|
uint32_t linkshellId = field[0].getUInt32();
|
||||||
uint32_t masterId = field[1].getUInt32();
|
uint32_t masterId = field[1].getUInt32();
|
||||||
|
|
||||||
std::string name = field[3].getString();
|
std::string name = field[3].getString();
|
||||||
|
|
||||||
std::vector< uint64_t > characterIdList( field[2].getLength() / 8 );
|
auto func = []( std::set< uint64_t >& outList, Db::Field * pField )
|
||||||
field[2].getBinary( reinterpret_cast< char* >( &characterIdList[0] ), field[2].getLength() );
|
{
|
||||||
std::set< uint64_t > members( characterIdList.begin(), characterIdList.end() );
|
if( pField->getLength() )
|
||||||
|
{
|
||||||
|
std::vector< uint64_t > list( pField->getLength() / 8 );
|
||||||
|
pField->getBinary( reinterpret_cast< char * >( &list[0] ), pField->getLength() );
|
||||||
|
outList.insert( list.begin(), list.end() );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
//std::vector< uint64_t > leaderIdList( field[4].getLength() / 8 );
|
std::set< uint64_t > members;
|
||||||
//field[4].getBinary( reinterpret_cast< char* >( &leaderIdList[0] ), field[4].getLength() );
|
func( members, &field[2] );
|
||||||
//std::set< uint64_t > leaders( leaderIdList.begin(), leaderIdList.end() );
|
|
||||||
|
|
||||||
std::set< uint64_t > leaders;
|
std::set< uint64_t > leaders;
|
||||||
|
func( members, &field[4] );
|
||||||
|
|
||||||
//std::vector< uint64_t > inviteIdList( field[5].getLength() / 8 );
|
|
||||||
//field[5].getBinary( reinterpret_cast< char* >( &leaderIdList[0] ), field[5].getLength() );
|
|
||||||
//std::set< uint64_t > invites( inviteIdList.begin(), inviteIdList.end() );
|
|
||||||
std::set< uint64_t > invites;
|
std::set< uint64_t > invites;
|
||||||
|
func( members, &field[5] );
|
||||||
|
|
||||||
auto lsPtr = boost::make_shared< Linkshell >( linkshellId, name, masterId, members, leaders, invites );
|
auto lsPtr = boost::make_shared< Linkshell >( linkshellId, name, masterId, members, leaders, invites );
|
||||||
m_linkshellIdMap[linkshellId] = lsPtr;
|
m_linkshellIdMap[linkshellId] = lsPtr;
|
||||||
|
|
|
@ -41,8 +41,7 @@ Core::LinkshellMgr g_linkshellMgr;
|
||||||
|
|
||||||
|
|
||||||
Core::ServerZone::ServerZone( const std::string& configPath, uint16_t serverId )
|
Core::ServerZone::ServerZone( const std::string& configPath, uint16_t serverId )
|
||||||
: m_serverId( serverId )
|
: m_configPath( configPath )
|
||||||
, m_configPath( configPath )
|
|
||||||
{
|
{
|
||||||
m_pConfig = XMLConfigPtr( new XMLConfig );
|
m_pConfig = XMLConfigPtr( new XMLConfig );
|
||||||
}
|
}
|
||||||
|
@ -84,12 +83,6 @@ Core::Entity::BattleNpcTemplatePtr Core::ServerZone::getBnpcTemplate( std::strin
|
||||||
return it->second;
|
return it->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Core::ServerZone::setServerId( uint16_t serverId )
|
|
||||||
{
|
|
||||||
m_serverId = serverId;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Core::ServerZone::loadSettings( int32_t argc, char* argv[] )
|
bool Core::ServerZone::loadSettings( int32_t argc, char* argv[] )
|
||||||
{
|
{
|
||||||
g_log.info( "Loading config " + m_configPath );
|
g_log.info( "Loading config " + m_configPath );
|
||||||
|
@ -177,19 +170,16 @@ bool Core::ServerZone::loadSettings( int32_t argc, char* argv[] )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_serverId = m_serverId ? m_serverId : m_pConfig->getValue< uint16_t >( "Settings.General.ServerId" );
|
|
||||||
m_port = m_pConfig->getValue< uint16_t >( "Settings.General.ListenPort", 54992 );
|
m_port = m_pConfig->getValue< uint16_t >( "Settings.General.ListenPort", 54992 );
|
||||||
m_ip = m_pConfig->getValue< std::string >( "Settings.General.ListenIp", "0.0.0.0" );;
|
m_ip = m_pConfig->getValue< std::string >( "Settings.General.ListenIp", "0.0.0.0" );;
|
||||||
|
|
||||||
g_log.info( "Server ID: " + std::to_string( m_serverId ) );
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Core::ServerZone::run( int32_t argc, char* argv[] )
|
void Core::ServerZone::run( int32_t argc, char* argv[] )
|
||||||
{
|
{
|
||||||
// TODO: add more error checks for the entire initialisation
|
// TODO: add more error checks for the entire initialisation
|
||||||
g_log.setLogPath( "log\\SapphireZone_" + std::to_string( m_serverId ) + "_" );
|
g_log.setLogPath( "log\\SapphireZone_" );
|
||||||
g_log.init();
|
g_log.init();
|
||||||
|
|
||||||
g_log.info( "===========================================================" );
|
g_log.info( "===========================================================" );
|
||||||
|
@ -369,9 +359,3 @@ void Core::ServerZone::updateSession( std::string playerName )
|
||||||
it->second->loadPlayer();
|
it->second->loadPlayer();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t Core::ServerZone::getServerId() const
|
|
||||||
{
|
|
||||||
return m_serverId;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,6 @@ namespace Core {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
uint16_t m_serverId;
|
|
||||||
uint16_t m_port;
|
uint16_t m_port;
|
||||||
std::string m_ip;
|
std::string m_ip;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue