Added Mersenne Twister pseudo-random number generator ( really usefull and fast for some type of games if you want a deterministic random number generator ).

Reimplemented the tResourceManager, now uses std::list instead of std::map, and added some new methods.
cShapeGroupManager and cShapeGroup now inherits from tResourceManager.
Rolled back eeUint and eeInt, now are fine again ( it was changed for testing ).
This commit is contained in:
spartanj
2010-08-01 18:16:27 -03:00
parent 0a3d6e0728
commit 74e6eacd15
16 changed files with 463 additions and 271 deletions

View File

@@ -3,56 +3,13 @@
namespace EE { namespace Graphics {
cShapeGroupManager::cShapeGroupManager() {
cShapeGroupManager::cShapeGroupManager() :
tResourceManager<cShapeGroup>( false )
{
Add( cGlobalShapeGroup::instance() );
}
cShapeGroupManager::~cShapeGroupManager() {
Destroy();
}
void cShapeGroupManager::Destroy() {
std::list<cShapeGroup*>::iterator it;
for ( it = mGroups.begin(); it != mGroups.end(); it++ )
eeSAFE_DELETE( (*it) );
}
void cShapeGroupManager::Add( cShapeGroup * Group ) {
if ( NULL != Group )
mGroups.push_back( Group );
}
void cShapeGroupManager::Remove( cShapeGroup * Group, bool Delete ) {
if ( NULL != Group ) {
mGroups.remove( Group );
if ( Delete )
eeSAFE_DELETE( Group );
}
}
Uint32 cShapeGroupManager::Count() {
return mGroups.size();
}
cShapeGroup * cShapeGroupManager::GetByName( const std::string& Name ) {
return GetById( MakeHash( Name ) );
}
cShapeGroup * cShapeGroupManager::GetById( const Uint32& Id ) {
std::list<cShapeGroup*>::iterator it;
cShapeGroup * tGroup = NULL;
for ( it = mGroups.begin(); it != mGroups.end(); it++ ) {
tGroup = (*it);
if ( tGroup->Id() == Id )
return tGroup;
}
return NULL;
}
cShape * cShapeGroupManager::GetShapeByName( const std::string& Name ) {
@@ -62,12 +19,10 @@ cShape * cShapeGroupManager::GetShapeByName( const std::string& Name ) {
cShape * cShapeGroupManager::GetShapeById( const Uint32& Id ) {
std::list<cShapeGroup*>::iterator it;
cShapeGroup * tGroup = NULL;
cShape * tShape = NULL;
for ( it = mGroups.begin(); it != mGroups.end(); it++ ) {
tGroup = (*it);
tShape = tGroup->GetById( Id );
for ( it = mResources.begin(); it != mResources.end(); it++ ) {
tShape = (*it)->GetById( Id );
if ( NULL != tShape )
return tShape;