From afaf104b4086dbc5245f92a209cb68a088780ebb Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Fri, 21 Dec 2012 12:52:14 +0000 Subject: Added more constants into eEntityType; made them a compulsory parameter to the constructor, so that all entities have proper type. Also added a few utility functions to cEntity for distinguishing the types (IsPlayer(), IsPickup() etc.) git-svn-id: http://mc-server.googlecode.com/svn/trunk@1092 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/Chunk.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'source/Chunk.cpp') diff --git a/source/Chunk.cpp b/source/Chunk.cpp index 5dc19915a..165eda831 100644 --- a/source/Chunk.cpp +++ b/source/Chunk.cpp @@ -115,7 +115,7 @@ cChunk::~cChunk() cEntityList Entities; for (cEntityList::const_iterator itr = m_Entities.begin(); itr != m_Entities.end(); ++itr) { - if ((*itr)->GetEntityType() != cEntity::eEntityType_Player) + if (!(*itr)->IsPlayer()) { Entities.push_back(*itr); } @@ -1382,7 +1382,7 @@ void cChunk::CollectPickupsByPlayer(cPlayer * a_Player) for (cEntityList::iterator itr = m_Entities.begin(); itr != m_Entities.end(); ++itr) { - if ( (*itr)->GetEntityType() != cEntity::eEntityType_Pickup ) + if (!(*itr)->IsPickup()) { continue; // Only pickups } @@ -1515,13 +1515,13 @@ bool cChunk::HasAnyClients(void) -void cChunk::AddEntity( cEntity * a_Entity) +void cChunk::AddEntity(cEntity * a_Entity) { - if (a_Entity->GetEntityType() != cEntity::eEntityType_Player) + if (!a_Entity->IsPlayer()) { MarkDirty(); } - m_Entities.push_back( a_Entity ); + m_Entities.push_back(a_Entity); } @@ -1537,7 +1537,7 @@ void cChunk::RemoveEntity(cEntity * a_Entity) if (SizeBefore != SizeAfter) { // Mark as dirty if it was a server-generated entity: - if (a_Entity->GetEntityType() != cEntity::eEntityType_Player) + if (!a_Entity->IsPlayer()) { MarkDirty(); } -- cgit v1.2.3