mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-27 22:57:45 +00:00
fix a crash where !instance bind is used incorrectly, better getter name
This commit is contained in:
parent
5cc390d772
commit
591f57cec2
5 changed files with 16 additions and 10 deletions
|
@ -430,7 +430,7 @@ bool Sapphire::Entity::Player::setInstance( uint32_t instanceContentId )
|
|||
m_onEnterEventDone = false;
|
||||
auto pTeriMgr = m_pFw->get< TerritoryMgr >();
|
||||
|
||||
auto instance = pTeriMgr->getInstanceZonePtr( instanceContentId );
|
||||
auto instance = pTeriMgr->getTerritoryByGuId( instanceContentId );
|
||||
if( !instance )
|
||||
return false;
|
||||
|
||||
|
|
|
@ -822,10 +822,16 @@ void Sapphire::World::Manager::DebugCommandMgr::instance( char* data, Entity::Pl
|
|||
uint32_t instanceId;
|
||||
sscanf( params.c_str(), "%d", &instanceId );
|
||||
|
||||
auto instance = pTeriMgr->getInstanceZonePtr( instanceId );
|
||||
if( instance )
|
||||
auto terri = pTeriMgr->getTerritoryByGuId( instanceId );
|
||||
if( terri )
|
||||
{
|
||||
auto pInstanceContent = instance->getAsInstanceContent();
|
||||
auto pInstanceContent = terri->getAsInstanceContent();
|
||||
if( !pInstanceContent )
|
||||
{
|
||||
player.sendDebug( "Instance id#{} is not an InstanceContent territory.", instanceId );
|
||||
return;
|
||||
}
|
||||
|
||||
pInstanceContent->bindPlayer( player.getId() );
|
||||
player.sendDebug(
|
||||
"Now bound to instance with id: " + std::to_string( pInstanceContent->getGuId() ) +
|
||||
|
@ -839,7 +845,7 @@ void Sapphire::World::Manager::DebugCommandMgr::instance( char* data, Entity::Pl
|
|||
uint32_t instanceId;
|
||||
sscanf( params.c_str(), "%d", &instanceId );
|
||||
|
||||
auto instance = pTeriMgr->getInstanceZonePtr( instanceId );
|
||||
auto instance = pTeriMgr->getTerritoryByGuId( instanceId );
|
||||
if( !instance )
|
||||
{
|
||||
player.sendDebug( "Unknown instance with id#{0} ", instanceId );
|
||||
|
|
|
@ -436,7 +436,7 @@ Sapphire::ZonePtr Sapphire::World::Manager::TerritoryMgr::findOrCreateHousingInt
|
|||
bool Sapphire::World::Manager::TerritoryMgr::removeTerritoryInstance( uint32_t guId )
|
||||
{
|
||||
ZonePtr pZone;
|
||||
if( ( pZone = getInstanceZonePtr( guId ) ) == nullptr )
|
||||
if( ( pZone = getTerritoryByGuId( guId ) ) == nullptr )
|
||||
return false;
|
||||
|
||||
m_guIdToZonePtrMap.erase( pZone->getGuId() );
|
||||
|
@ -455,7 +455,7 @@ bool Sapphire::World::Manager::TerritoryMgr::removeTerritoryInstance( uint32_t g
|
|||
return true;
|
||||
}
|
||||
|
||||
Sapphire::ZonePtr Sapphire::World::Manager::TerritoryMgr::getInstanceZonePtr( uint32_t guId ) const
|
||||
Sapphire::ZonePtr Sapphire::World::Manager::TerritoryMgr::getTerritoryByGuId( uint32_t guId ) const
|
||||
{
|
||||
auto it = m_guIdToZonePtrMap.find( guId );
|
||||
if( it == m_guIdToZonePtrMap.end() )
|
||||
|
@ -646,7 +646,7 @@ Sapphire::ZonePtr Sapphire::World::Manager::TerritoryMgr::getLinkedInstance( uin
|
|||
auto it = m_playerIdToInstanceMap.find( playerId );
|
||||
if( it != m_playerIdToInstanceMap.end() )
|
||||
{
|
||||
return getInstanceZonePtr( it->second );
|
||||
return getTerritoryByGuId( it->second );
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -116,7 +116,7 @@ namespace Sapphire::World::Manager
|
|||
bool removeTerritoryInstance( uint32_t guId );
|
||||
|
||||
/*! returns a ZonePtr to the instance or nullptr if not found */
|
||||
ZonePtr getInstanceZonePtr( uint32_t guId ) const;
|
||||
ZonePtr getTerritoryByGuId( uint32_t guId ) const;
|
||||
|
||||
/*! returns the cached detail of a territory, nullptr if not found */
|
||||
Data::TerritoryTypePtr getTerritoryDetail( uint32_t territoryTypeId ) const;
|
||||
|
|
|
@ -465,7 +465,7 @@ void Sapphire::Network::GameConnection::gm1Handler( FrameworkPtr pFw,
|
|||
case GmCommand::Teri:
|
||||
{
|
||||
auto pTeriMgr = pFw->get< TerritoryMgr >();
|
||||
if( auto instance = pTeriMgr->getInstanceZonePtr( param1 ) )
|
||||
if( auto instance = pTeriMgr->getTerritoryByGuId( param1 ) )
|
||||
{
|
||||
player.sendDebug( "Found instance: {0}, id#{1}", instance->getName(), param1 );
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue