From 5a3b22a4a7594c906fc095032d4547357c50b0ba Mon Sep 17 00:00:00 2001 From: Mordred Date: Tue, 22 Feb 2022 23:47:11 +0100 Subject: [PATCH] Removed unused cell logic --- src/world/Territory/Cell.cpp | 33 ++---------------------------- src/world/Territory/Cell.h | 34 +------------------------------ src/world/Territory/Territory.cpp | 13 +++--------- 3 files changed, 6 insertions(+), 74 deletions(-) diff --git a/src/world/Territory/Cell.cpp b/src/world/Territory/Cell.cpp index 0dfb0a93..2eebc7a7 100644 --- a/src/world/Territory/Cell.cpp +++ b/src/world/Territory/Cell.cpp @@ -10,9 +10,7 @@ Sapphire::Cell::Cell() : m_bActive( false ), - m_bLoaded( false ), - m_playerCount( 0 ), - m_bUnloadPending( false ) + m_playerCount( 0 ) { m_bForcedActive = false; } @@ -22,9 +20,8 @@ Sapphire::Cell::~Cell() removeActors(); } -void Sapphire::Cell::init( uint32_t x, uint32_t y, TerritoryPtr pZone ) +void Sapphire::Cell::init( uint32_t x, uint32_t y ) { - m_pZone = pZone; m_posX = static_cast< uint16_t >( x ); m_posY = static_cast< uint16_t >( y ); @@ -57,9 +54,6 @@ void Sapphire::Cell::setActivity( bool state ) //} - if( m_bUnloadPending ) - cancelPendingUnload(); - } else if( m_bActive && !state ) { @@ -94,40 +88,17 @@ void Sapphire::Cell::removeActors() continue; } - if( m_bUnloadPending ) - { - - } - } m_playerCount = 0; - m_bLoaded = false; -} - -void Sapphire::Cell::queueUnloadPending() -{ - if( m_bUnloadPending ) - return; - - m_bUnloadPending = true; - -} - -void Sapphire::Cell::cancelPendingUnload() -{ - if( !m_bUnloadPending ) - return; } void Sapphire::Cell::unload() { - assert( m_bUnloadPending ); if( m_bActive ) return; removeActors(); - m_bUnloadPending = false; } diff --git a/src/world/Territory/Cell.h b/src/world/Territory/Cell.h index 163709e1..07c0cfc3 100644 --- a/src/world/Territory/Cell.h +++ b/src/world/Territory/Cell.h @@ -18,18 +18,15 @@ private: uint16_t m_posY; ActorSet m_actors; bool m_bActive; - bool m_bLoaded; - bool m_bUnloadPending; uint16_t m_playerCount; - TerritoryPtr m_pZone; public: Cell(); ~Cell(); - void init( uint32_t x, uint32_t y, TerritoryPtr pZone ); + void init( uint32_t x, uint32_t y ); void addActor( Entity::GameObjectPtr pAct ); @@ -69,37 +66,8 @@ public: return m_bActive; } - bool isLoaded() const - { - return m_bLoaded; - } - - uint32_t getPlayerCount() const - { - return m_playerCount; - } - - bool isUnloadPending() const - { - return m_bUnloadPending; - } - - void setUnloadPending( bool up ) - { - m_bUnloadPending = up; - } - - void queueUnloadPending(); - - void cancelPendingUnload(); - void unload(); - void setPermanentActivity( bool val ) - { - m_bForcedActive = val; - } - bool isForcedActive() const { return m_bForcedActive; diff --git a/src/world/Territory/Territory.cpp b/src/world/Territory/Territory.cpp index ed9a8ae6..cc1a5db4 100644 --- a/src/world/Territory/Territory.cpp +++ b/src/world/Territory/Territory.cpp @@ -214,7 +214,7 @@ void Territory::pushActor( const Entity::GameObjectPtr& pActor ) if( !pCell ) { pCell = create( cx, cy ); - pCell->init( cx, cy, shared_from_this() ); + pCell->init( cx, cy ); } pCell->addActor( pActor ); @@ -565,12 +565,10 @@ void Territory::updateCellActivity( uint32_t x, uint32_t y, int32_t radius ) if( isCellActive( posX, posY ) ) { pCell = create( posX, posY ); - pCell->init( posX, posY, shared_from_this() ); + pCell->init( posX, posY ); pCell->setActivity( true ); - assert( !pCell->isLoaded() ); - } } else @@ -579,11 +577,6 @@ void Territory::updateCellActivity( uint32_t x, uint32_t y, int32_t radius ) if( isCellActive( posX, posY ) && !pCell->isActive() ) { pCell->setActivity( true ); - - if( !pCell->isLoaded() ) - { - - } } else if( !isCellActive( posX, posY ) && pCell->isActive() ) pCell->setActivity( false ); @@ -612,7 +605,7 @@ void Territory::updateActorPosition( Entity::GameObject& actor ) if( !pCell ) { pCell = create( cellX, cellY ); - pCell->init( cellX, cellY, shared_from_this() ); + pCell->init( cellX, cellY ); } // If object moved cell