1
0

Removed unused ReferenceManager

This commit is contained in:
Tiger Wang 2014-01-24 19:46:45 +00:00
parent d8014d1ed8
commit 2ce26574ef
4 changed files with 1 additions and 122 deletions

View File

@ -4,9 +4,7 @@
#include "../World.h"
#include "../Server.h"
#include "../Root.h"
#include "../Vector3d.h"
#include "../Matrix4f.h"
#include "../ReferenceManager.h"
#include "../ClientHandle.h"
#include "../Chunk.h"
#include "../Simulator/FluidSimulator.h"
@ -32,8 +30,6 @@ cEntity::cEntity(eEntityType a_EntityType, double a_X, double a_Y, double a_Z, d
, m_MaxHealth(1)
, m_AttachedTo(NULL)
, m_Attachee(NULL)
, m_Referencers(new cReferenceManager(cReferenceManager::RFMNGR_REFERENCERS))
, m_References(new cReferenceManager(cReferenceManager::RFMNGR_REFERENCES))
, m_bDirtyHead(true)
, m_bDirtyOrientation(true)
, m_bDirtyPosition(true)
@ -100,8 +96,6 @@ cEntity::~cEntity()
LOGWARNING("ERROR: Entity deallocated without being destroyed");
ASSERT(!"Entity deallocated without being destroyed or unlinked");
}
delete m_Referencers;
delete m_References;
}
@ -1430,33 +1424,3 @@ void cEntity::SetPosZ(double a_PosZ)
//////////////////////////////////////////////////////////////////////////
// Reference stuffs
void cEntity::AddReference(cEntity * & a_EntityPtr)
{
m_References->AddReference(a_EntityPtr);
a_EntityPtr->ReferencedBy(a_EntityPtr);
}
void cEntity::ReferencedBy(cEntity * & a_EntityPtr)
{
m_Referencers->AddReference(a_EntityPtr);
}
void cEntity::Dereference(cEntity * & a_EntityPtr)
{
m_Referencers->Dereference(a_EntityPtr);
}

View File

@ -4,6 +4,7 @@
#include "../Item.h"
#include "../Vector3d.h"
#include "../Vector3f.h"
#include "../Vector3i.h"
@ -33,7 +34,6 @@
class cWorld;
class cReferenceManager;
class cClientHandle;
class cPlayer;
class cChunk;
@ -373,9 +373,6 @@ protected:
/// The entity which is attached to this entity (rider), NULL if none
cEntity * m_Attachee;
cReferenceManager* m_Referencers;
cReferenceManager* m_References;
// Flags that signal that we haven't updated the clients with the latest.
bool m_bDirtyHead;
bool m_bDirtyOrientation;
@ -416,11 +413,6 @@ protected:
void SetWorld(cWorld * a_World) { m_World = a_World; }
friend class cReferenceManager;
void AddReference( cEntity*& a_EntityPtr );
void ReferencedBy( cEntity*& a_EntityPtr );
void Dereference( cEntity*& a_EntityPtr );
private:
// Measured in degrees, [-180, +180)
double m_HeadYaw;

View File

@ -1,43 +0,0 @@
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "ReferenceManager.h"
#include "Entities/Entity.h"
cReferenceManager::cReferenceManager( ENUM_REFERENCE_MANAGER_TYPE a_Type )
: m_Type( a_Type )
{
}
cReferenceManager::~cReferenceManager()
{
if( m_Type == RFMNGR_REFERENCERS )
{
for( std::list< cEntity** >::iterator itr = m_References.begin(); itr != m_References.end(); ++itr )
{
*(*itr) = 0; // Set referenced pointer to 0
}
}
else
{
for( std::list< cEntity** >::iterator itr = m_References.begin(); itr != m_References.end(); ++itr )
{
cEntity* Ptr = (*(*itr));
if( Ptr ) Ptr->Dereference( *(*itr) );
}
}
}
void cReferenceManager::AddReference( cEntity*& a_EntityPtr )
{
m_References.push_back( &a_EntityPtr );
}
void cReferenceManager::Dereference( cEntity*& a_EntityPtr )
{
m_References.remove( &a_EntityPtr );
}

View File

@ -1,34 +0,0 @@
#pragma once
class cEntity;
class cReferenceManager
{
public:
enum ENUM_REFERENCE_MANAGER_TYPE
{
RFMNGR_REFERENCERS,
RFMNGR_REFERENCES,
};
cReferenceManager( ENUM_REFERENCE_MANAGER_TYPE a_Type );
~cReferenceManager();
void AddReference( cEntity*& a_EntityPtr );
void Dereference( cEntity*& a_EntityPtr );
private:
ENUM_REFERENCE_MANAGER_TYPE m_Type;
std::list< cEntity** > m_References;
};