mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-27 22:57:45 +00:00
correctly remove InstanceContent zones
This commit is contained in:
parent
56c6b38966
commit
0d0db3b41c
3 changed files with 25 additions and 8 deletions
|
@ -3,9 +3,11 @@
|
||||||
Core::InstanceContent::InstanceContent( boost::shared_ptr< Core::Data::InstanceContent > pInstanceContent,
|
Core::InstanceContent::InstanceContent( boost::shared_ptr< Core::Data::InstanceContent > pInstanceContent,
|
||||||
uint32_t guId,
|
uint32_t guId,
|
||||||
const std::string& internalName,
|
const std::string& internalName,
|
||||||
const std::string& placeName )
|
const std::string& placeName,
|
||||||
|
const uint32_t instanceContentId )
|
||||||
: Zone( pInstanceContent->territoryType, guId, internalName, placeName ),
|
: Zone( pInstanceContent->territoryType, guId, internalName, placeName ),
|
||||||
m_instanceContentRow( pInstanceContent )
|
m_instanceContentRow( pInstanceContent ),
|
||||||
|
m_instanceContentId( instanceContentId )
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,8 @@ public:
|
||||||
InstanceContent( boost::shared_ptr< Core::Data::InstanceContent > pInstanceContent,
|
InstanceContent( boost::shared_ptr< Core::Data::InstanceContent > pInstanceContent,
|
||||||
uint32_t guId,
|
uint32_t guId,
|
||||||
const std::string& internalName,
|
const std::string& internalName,
|
||||||
const std::string& placeName );
|
const std::string& placeName,
|
||||||
|
const uint32_t instanceContentId );
|
||||||
virtual ~InstanceContent();
|
virtual ~InstanceContent();
|
||||||
|
|
||||||
boost::shared_ptr< Core::Data::InstanceContent > getInstanceContentRow() const
|
boost::shared_ptr< Core::Data::InstanceContent > getInstanceContentRow() const
|
||||||
|
@ -29,9 +30,15 @@ public:
|
||||||
return m_instanceContentRow;
|
return m_instanceContentRow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const uint32_t getInstanceContentId()
|
||||||
|
{
|
||||||
|
return m_instanceContentId;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Event::DirectorPtr m_pDirector;
|
Event::DirectorPtr m_pDirector;
|
||||||
boost::shared_ptr< Core::Data::InstanceContent > m_instanceContentRow;
|
boost::shared_ptr< Core::Data::InstanceContent > m_instanceContentRow;
|
||||||
|
uint32_t m_instanceContentId;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -174,7 +174,7 @@ Core::ZonePtr Core::TerritoryMgr::createInstanceContent( uint32_t instanceConten
|
||||||
|
|
||||||
g_log.debug( "Starting instance for InstanceContent id: " + std::to_string( instanceContentId ) + " (" + pPlaceName->name + ")" );
|
g_log.debug( "Starting instance for InstanceContent id: " + std::to_string( instanceContentId ) + " (" + pPlaceName->name + ")" );
|
||||||
|
|
||||||
ZonePtr pZone = ZonePtr( new InstanceContent( pInstanceContent, getNextInstanceId(), pTeri->name, pPlaceName->name ) );
|
ZonePtr pZone = ZonePtr( new InstanceContent( pInstanceContent, getNextInstanceId(), pTeri->name, pPlaceName->name, instanceContentId ) );
|
||||||
pZone->init();
|
pZone->init();
|
||||||
|
|
||||||
m_instanceContentToInstanceMap[instanceContentId][pZone->getGuId()] = pZone;
|
m_instanceContentToInstanceMap[instanceContentId][pZone->getGuId()] = pZone;
|
||||||
|
@ -185,12 +185,20 @@ Core::ZonePtr Core::TerritoryMgr::createInstanceContent( uint32_t instanceConten
|
||||||
|
|
||||||
bool Core::TerritoryMgr::removeTerritoryInstance( uint32_t instanceId )
|
bool Core::TerritoryMgr::removeTerritoryInstance( uint32_t instanceId )
|
||||||
{
|
{
|
||||||
ZonePtr instance;
|
ZonePtr pZone;
|
||||||
if( ( instance = getInstanceZonePtr( instanceId ) ) == nullptr )
|
if( ( pZone = getInstanceZonePtr( instanceId ) ) == nullptr )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_instanceIdToZonePtrMap.erase( instance->getGuId() );
|
m_instanceIdToZonePtrMap.erase( pZone->getGuId() );
|
||||||
m_territoryInstanceMap[instance->getTerritoryId()].erase( instance->getGuId() );
|
|
||||||
|
if( isInstanceContentTerritory( pZone->getTerritoryId() ) )
|
||||||
|
{
|
||||||
|
auto instance = boost::dynamic_pointer_cast< InstanceContent >( pZone );
|
||||||
|
m_instanceContentToInstanceMap[instance->getInstanceContentId()].erase( pZone->getGuId() );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
m_territoryInstanceMap[pZone->getTerritoryId()].erase( pZone->getGuId() );
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue