No longer using pointers for Vector3(f/d/i) in cEntity's and cTracer
git-svn-id: http://mc-server.googlecode.com/svn/trunk@268 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
@@ -32,9 +32,8 @@ cEntity::cEntity(const double & a_X, const double & a_Y, const double & a_Z)
|
||||
, m_ChunkX( 0 )
|
||||
, m_ChunkY( 0 )
|
||||
, m_ChunkZ( 0 )
|
||||
, m_Pos( new Vector3d( a_X, a_Y, a_Z ) )
|
||||
, m_Pos( a_X, a_Y, a_Z )
|
||||
, m_bDirtyPosition( true )
|
||||
, m_Rot( new Vector3f() )
|
||||
, m_bDirtyOrientation( true )
|
||||
, m_bDestroyed( false )
|
||||
, m_EntityType( E_ENTITY )
|
||||
@@ -54,8 +53,8 @@ cEntity::~cEntity()
|
||||
{
|
||||
LOG("Deleting entity %d at pos {%.2f, %.2f} ~ [%d, %d]; ptr %p",
|
||||
m_UniqueID,
|
||||
m_Pos->x, m_Pos->z,
|
||||
(int)(m_Pos->x / 16), (int)(m_Pos->z / 16),
|
||||
m_Pos.x, m_Pos.z,
|
||||
(int)(m_Pos.x / 16), (int)(m_Pos.z / 16),
|
||||
this
|
||||
);
|
||||
|
||||
@@ -65,8 +64,6 @@ cEntity::~cEntity()
|
||||
}
|
||||
delete m_Referencers;
|
||||
delete m_References;
|
||||
delete m_Pos;
|
||||
delete m_Rot;
|
||||
}
|
||||
|
||||
|
||||
@@ -87,10 +84,10 @@ void cEntity::Initialize( cWorld* a_World )
|
||||
|
||||
void cEntity::WrapRotation()
|
||||
{
|
||||
while (m_Rot->x > 180.f) m_Rot->x-=360.f; // Wrap it
|
||||
while (m_Rot->x < -180.f) m_Rot->x+=360.f;
|
||||
while (m_Rot->y > 180.f) m_Rot->y-=360.f;
|
||||
while (m_Rot->y < -180.f) m_Rot->y+=360.f;
|
||||
while (m_Rot.x > 180.f) m_Rot.x-=360.f; // Wrap it
|
||||
while (m_Rot.x < -180.f) m_Rot.x+=360.f;
|
||||
while (m_Rot.y > 180.f) m_Rot.y-=360.f;
|
||||
while (m_Rot.y < -180.f) m_Rot.y+=360.f;
|
||||
}
|
||||
|
||||
|
||||
@@ -103,7 +100,7 @@ void cEntity::MoveToCorrectChunk(bool a_bIgnoreOldChunk)
|
||||
if( !m_World ) return;
|
||||
|
||||
int ChunkX = 0, ChunkY = 0, ChunkZ = 0;
|
||||
cWorld::BlockToChunk( (int)m_Pos->x, (int)m_Pos->y, (int)m_Pos->z, ChunkX, ChunkY, ChunkZ );
|
||||
cWorld::BlockToChunk( (int)m_Pos.x, (int)m_Pos.y, (int)m_Pos.z, ChunkX, ChunkY, ChunkZ );
|
||||
if (!a_bIgnoreOldChunk && (m_ChunkX == ChunkX) && (m_ChunkY == ChunkY) && (m_ChunkZ == ChunkZ))
|
||||
{
|
||||
return;
|
||||
@@ -215,7 +212,7 @@ bool cEntity::IsA( const char* a_EntityType )
|
||||
// Set orientations
|
||||
void cEntity::SetRot( const Vector3f & a_Rot )
|
||||
{
|
||||
*m_Rot = a_Rot;
|
||||
m_Rot = a_Rot;
|
||||
m_bDirtyOrientation = true;
|
||||
}
|
||||
|
||||
@@ -225,7 +222,7 @@ void cEntity::SetRot( const Vector3f & a_Rot )
|
||||
|
||||
void cEntity::SetRotation( float a_Rotation )
|
||||
{
|
||||
m_Rot->x = a_Rotation;
|
||||
m_Rot.x = a_Rotation;
|
||||
m_bDirtyOrientation = true;
|
||||
}
|
||||
|
||||
@@ -235,7 +232,7 @@ void cEntity::SetRotation( float a_Rotation )
|
||||
|
||||
void cEntity::SetPitch( float a_Pitch )
|
||||
{
|
||||
m_Rot->y = a_Pitch;
|
||||
m_Rot.y = a_Pitch;
|
||||
m_bDirtyOrientation = true;
|
||||
}
|
||||
|
||||
@@ -245,7 +242,7 @@ void cEntity::SetPitch( float a_Pitch )
|
||||
|
||||
void cEntity::SetRoll( float a_Roll )
|
||||
{
|
||||
m_Rot->z = a_Roll;
|
||||
m_Rot.z = a_Roll;
|
||||
m_bDirtyOrientation = true;
|
||||
}
|
||||
|
||||
@@ -258,7 +255,7 @@ void cEntity::SetRoll( float a_Roll )
|
||||
Vector3f cEntity::GetLookVector()
|
||||
{
|
||||
Matrix4f m;
|
||||
m.Init( Vector3f(), 0, m_Rot->x, -m_Rot->y );
|
||||
m.Init( Vector3f(), 0, m_Rot.x, -m_Rot.y );
|
||||
Vector3f Look = m.Transform( Vector3f(0, 0, 1) );
|
||||
LOG("Look: %0.1f %0.1f %0.1f", Look.x, Look.y, Look.z );
|
||||
return Look;
|
||||
@@ -272,7 +269,7 @@ Vector3f cEntity::GetLookVector()
|
||||
// Set position
|
||||
void cEntity::SetPosition( const Vector3d & a_Pos )
|
||||
{
|
||||
*m_Pos = a_Pos;
|
||||
m_Pos = a_Pos;
|
||||
MoveToCorrectChunk();
|
||||
m_bDirtyPosition = true;
|
||||
}
|
||||
@@ -283,7 +280,7 @@ void cEntity::SetPosition( const Vector3d & a_Pos )
|
||||
|
||||
void cEntity::SetPosition( const double & a_PosX, const double & a_PosY, const double & a_PosZ )
|
||||
{
|
||||
m_Pos->Set( a_PosX, a_PosY, a_PosZ );
|
||||
m_Pos.Set( a_PosX, a_PosY, a_PosZ );
|
||||
MoveToCorrectChunk();
|
||||
m_bDirtyPosition = true;
|
||||
}
|
||||
@@ -294,7 +291,7 @@ void cEntity::SetPosition( const double & a_PosX, const double & a_PosY, const d
|
||||
|
||||
void cEntity::SetPosX( const double & a_PosX )
|
||||
{
|
||||
m_Pos->x = a_PosX;
|
||||
m_Pos.x = a_PosX;
|
||||
MoveToCorrectChunk();
|
||||
m_bDirtyPosition = true;
|
||||
}
|
||||
@@ -305,7 +302,7 @@ void cEntity::SetPosX( const double & a_PosX )
|
||||
|
||||
void cEntity::SetPosY( const double & a_PosY )
|
||||
{
|
||||
m_Pos->y = a_PosY;
|
||||
m_Pos.y = a_PosY;
|
||||
MoveToCorrectChunk();
|
||||
m_bDirtyPosition = true;
|
||||
}
|
||||
@@ -316,7 +313,7 @@ void cEntity::SetPosY( const double & a_PosY )
|
||||
|
||||
void cEntity::SetPosZ( const double & a_PosZ )
|
||||
{
|
||||
m_Pos->z = a_PosZ;
|
||||
m_Pos.z = a_PosZ;
|
||||
MoveToCorrectChunk();
|
||||
m_bDirtyPosition = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user