mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-27 22:57:45 +00:00
Merge pull request #559 from NotAdam/develop
fix a crash where !instance bind is used incorrectly, better getter name
This commit is contained in:
commit
1a5ab3ec10
5 changed files with 19 additions and 12 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 );
|
||||
|
|
|
@ -261,8 +261,9 @@ Sapphire::ZonePtr Sapphire::World::Manager::TerritoryMgr::createTerritoryInstanc
|
|||
if( !isValidTerritory( territoryTypeId ) )
|
||||
return nullptr;
|
||||
|
||||
if( isInstanceContentTerritory( territoryTypeId ) )
|
||||
return nullptr;
|
||||
// nb: disabled for now because there's not a real reason to have this constraint, makes testing some stuff easier too
|
||||
// if( isInstanceContentTerritory( territoryTypeId ) )
|
||||
// return nullptr;
|
||||
|
||||
auto pExdData = framework()->get< Data::ExdDataGenerated >();
|
||||
auto pTeri = getTerritoryDetail( territoryTypeId );
|
||||
|
@ -436,7 +437,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 +456,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 +647,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