mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-24 13:47:46 +00:00
Fixed an issue where players were removed from the wrong zone
This commit is contained in:
parent
a0bf531315
commit
c92ee8b7cd
2 changed files with 15 additions and 13 deletions
|
@ -107,17 +107,13 @@ void Core::InstanceContent::onUpdate( uint32_t currTime )
|
||||||
if( m_boundPlayerIds.size() == 0 )
|
if( m_boundPlayerIds.size() == 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for( const auto playerId : m_boundPlayerIds )
|
for( auto playerId : m_boundPlayerIds )
|
||||||
{
|
{
|
||||||
auto it = m_playerMap.find( playerId );
|
auto it = m_playerMap.find( playerId );
|
||||||
if( it == m_playerMap.end() )
|
if( it == m_playerMap.end() )
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
for( const auto& playerIt : m_playerMap )
|
|
||||||
{
|
|
||||||
const auto& player = playerIt.second;
|
|
||||||
|
|
||||||
|
auto player = it->second;
|
||||||
if( !player->isLoadingComplete() ||
|
if( !player->isLoadingComplete() ||
|
||||||
!player->isDirectorInitialized() ||
|
!player->isDirectorInitialized() ||
|
||||||
!player->isOnEnterEventDone() ||
|
!player->isOnEnterEventDone() ||
|
||||||
|
|
|
@ -226,12 +226,14 @@ void Core::Zone::pushActor( Entity::ActorPtr pActor )
|
||||||
void Core::Zone::removeActor( Entity::ActorPtr pActor )
|
void Core::Zone::removeActor( Entity::ActorPtr pActor )
|
||||||
{
|
{
|
||||||
|
|
||||||
auto pCell = pActor->getCellPtr();
|
/* TODO: have to wait and see if removal of this actually breaks anything
|
||||||
if( pCell )
|
this however is potentially removing a player from a zone he does not belong to */
|
||||||
{
|
//auto pCell = pActor->getCellPtr();
|
||||||
pCell->removeActor( pActor );
|
//if( pCell )
|
||||||
pCell = nullptr;
|
//{
|
||||||
}
|
// pCell->removeActor( pActor );
|
||||||
|
// pCell = nullptr;
|
||||||
|
//}
|
||||||
|
|
||||||
if( pActor->isPlayer() )
|
if( pActor->isPlayer() )
|
||||||
{
|
{
|
||||||
|
@ -539,7 +541,11 @@ void Core::Zone::updateActorPosition( Entity::Actor &actor )
|
||||||
{
|
{
|
||||||
|
|
||||||
if( pOldCell )
|
if( pOldCell )
|
||||||
|
{
|
||||||
|
auto pLog = g_fw.get< Logger >();
|
||||||
|
pLog->debug( std::string( __FUNCTION__ ) + "removeActor" );
|
||||||
pOldCell->removeActor( actor.shared_from_this() );
|
pOldCell->removeActor( actor.shared_from_this() );
|
||||||
|
}
|
||||||
|
|
||||||
pCell->addActor( actor.shared_from_this() );
|
pCell->addActor( actor.shared_from_this() );
|
||||||
actor.setCell( pCell );
|
actor.setCell( pCell );
|
||||||
|
|
Loading…
Add table
Reference in a new issue