Hi guys,

I am doing a project for my mid term and I am held up with this doubt. I might have misunderstood something all together or it might be a small mistake. Please point it out:

I have a baseentity class defining the features of a character.
I have three entities TEnt, Male and Female which inherits from the base entity.
Now what I wanted was to have a Entitymanager Class which manages all the entities.

This is a code I wrote for my entity manager:
namespace Sims{
/*! Forward declaration of the class*/
class TEnt;


/*! class Entity manager inherits from the singleton_client class */
class EntityManagerrivate Singleton_client{
/*! \class Sims::EntityManager "include/EntityManager.h" <BR>
\brief A Singleton manager entity that basically manages all the entities in the scene
Inherited from the SEntityEyeDefs
*/
public:
/*! A class that registers the entity to the base vector*/
/*! FIXME: This function needs to be defined for every class of entity*/
void REGISTER_ENTITY_INSTANCE(TEnt& instance);




/*! Prints out a test message //TODO: needs to be removed after testing */
void print();

private:
/*! A vector of Each of the classes */
//FIXME: This piece of code is rubbish.. i need to have a access to all the entities rather than a vector of every set of entity
/*! A vector of TEnts*/
std::vector < TEnt* > m_ppTEntList;

};
}

As you can see here there needs to be a private member variable for every class that inherits from the base entity . Also Every function like the REGISTER which has a input or output of the class needs to be called for each and every class. I can understand that this is bad coding. Is there a better way to do this at all?
|