mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-27 14:57:44 +00:00
instance removal command
This commit is contained in:
parent
d54f366712
commit
d1d93c9241
2 changed files with 22 additions and 0 deletions
|
@ -687,4 +687,14 @@ void Core::DebugCommandHandler::instance( char* data, Entity::Player &player, bo
|
|||
auto instance = g_territoryMgr.createTerritoryInstance( terriId );
|
||||
player.sendDebug( "Created instance with guid: " + std::to_string( instance->getGuId() ) );
|
||||
}
|
||||
else if( subCommand == "remove" || subCommand == "rm" )
|
||||
{
|
||||
uint32_t terriId;
|
||||
sscanf( params.c_str(), "%d", &terriId );
|
||||
|
||||
if( g_territoryMgr.removeTerritoryInstance( terriId ) )
|
||||
player.sendDebug( "Removed instance with id: " + std::to_string( terriId ) );
|
||||
else
|
||||
player.sendDebug( "Failed to remove instance with id: " + std::to_string( terriId ) );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -150,6 +150,18 @@ Core::ZonePtr Core::TerritoryMgr::createTerritoryInstance( uint32_t territoryTyp
|
|||
return pZone;
|
||||
}
|
||||
|
||||
bool Core::TerritoryMgr::removeTerritoryInstance( uint32_t territoryTypeId )
|
||||
{
|
||||
ZonePtr instance;
|
||||
if( ( instance = getTerritoryZonePtr( territoryTypeId ) ) == nullptr )
|
||||
return false;
|
||||
|
||||
m_instanceIdToZonePtrMap.erase( instance->getGuId() );
|
||||
m_territoryInstanceMap[instance->getTerritoryId()].erase( instance->getGuId() );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Core::ZonePtr Core::TerritoryMgr::getTerritoryZonePtr( uint32_t instanceId ) const
|
||||
{
|
||||
auto it = m_instanceIdToZonePtrMap.find( instanceId );
|
||||
|
|
Loading…
Add table
Reference in a new issue