mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-29 16:25:42 +00:00
simset::objectList to simset::mObjectList
This commit is contained in:
parent
2e7d406860
commit
2369645a5a
5 changed files with 47 additions and 47 deletions
|
|
@ -612,6 +612,6 @@ void SimDataBlockGroup::sort()
|
||||||
if(mLastModifiedKey != SimDataBlock::getNextModifiedKey())
|
if(mLastModifiedKey != SimDataBlock::getNextModifiedKey())
|
||||||
{
|
{
|
||||||
mLastModifiedKey = SimDataBlock::getNextModifiedKey();
|
mLastModifiedKey = SimDataBlock::getNextModifiedKey();
|
||||||
dQsort(objectList.address(),objectList.size(),sizeof(SimObject *),compareModifiedKey);
|
dQsort(mObjectList.address(), mObjectList.size(),sizeof(SimObject *),compareModifiedKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,7 @@ IMPLEMENT_CALLBACK( SimSet, onObjectRemoved, void, ( SimObject* object ), ( obje
|
||||||
|
|
||||||
SimSet::SimSet()
|
SimSet::SimSet()
|
||||||
{
|
{
|
||||||
VECTOR_SET_ASSOCIATION( objectList );
|
VECTOR_SET_ASSOCIATION(mObjectList);
|
||||||
mMutex = Mutex::createMutex();
|
mMutex = Mutex::createMutex();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -139,7 +139,7 @@ void SimSet::addObject( SimObject* obj )
|
||||||
|
|
||||||
lock();
|
lock();
|
||||||
|
|
||||||
const bool added = objectList.pushBack( obj );
|
const bool added = mObjectList.pushBack( obj );
|
||||||
if( added )
|
if( added )
|
||||||
deleteNotify( obj );
|
deleteNotify( obj );
|
||||||
|
|
||||||
|
|
@ -159,7 +159,7 @@ void SimSet::removeObject( SimObject* obj )
|
||||||
{
|
{
|
||||||
lock();
|
lock();
|
||||||
|
|
||||||
const bool removed = objectList.remove( obj );
|
const bool removed = mObjectList.remove( obj );
|
||||||
if( removed )
|
if( removed )
|
||||||
clearNotify( obj );
|
clearNotify( obj );
|
||||||
|
|
||||||
|
|
@ -182,7 +182,7 @@ void SimSet::pushObject( SimObject* obj )
|
||||||
|
|
||||||
lock();
|
lock();
|
||||||
|
|
||||||
bool added = objectList.pushBackForce( obj );
|
bool added = mObjectList.pushBackForce( obj );
|
||||||
if( added )
|
if( added )
|
||||||
deleteNotify( obj );
|
deleteNotify( obj );
|
||||||
|
|
||||||
|
|
@ -200,15 +200,15 @@ void SimSet::pushObject( SimObject* obj )
|
||||||
|
|
||||||
void SimSet::popObject()
|
void SimSet::popObject()
|
||||||
{
|
{
|
||||||
if( objectList.empty() )
|
if(mObjectList.empty() )
|
||||||
{
|
{
|
||||||
AssertWarn(false, "Stack underflow in SimSet::popObject");
|
AssertWarn(false, "Stack underflow in SimSet::popObject");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
lock();
|
lock();
|
||||||
SimObject* object = objectList.last();
|
SimObject* object = mObjectList.last();
|
||||||
objectList.pop_back();
|
mObjectList.pop_back();
|
||||||
|
|
||||||
clearNotify( object );
|
clearNotify( object );
|
||||||
unlock();
|
unlock();
|
||||||
|
|
@ -223,7 +223,7 @@ void SimSet::popObject()
|
||||||
void SimSet::scriptSort( const String &scriptCallbackFn )
|
void SimSet::scriptSort( const String &scriptCallbackFn )
|
||||||
{
|
{
|
||||||
lock();
|
lock();
|
||||||
objectList.scriptSort( scriptCallbackFn );
|
mObjectList.scriptSort( scriptCallbackFn );
|
||||||
unlock();
|
unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -303,8 +303,8 @@ bool SimSet::reOrder( SimObject *obj, SimObject *target )
|
||||||
if ( itrS != (end()-1) )
|
if ( itrS != (end()-1) )
|
||||||
{
|
{
|
||||||
// remove object from its current location and push to back of list
|
// remove object from its current location and push to back of list
|
||||||
objectList.erase(itrS);
|
mObjectList.erase(itrS);
|
||||||
objectList.push_back(obj);
|
mObjectList.push_back(obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -314,12 +314,12 @@ bool SimSet::reOrder( SimObject *obj, SimObject *target )
|
||||||
// target must be in list
|
// target must be in list
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
objectList.erase(itrS);
|
mObjectList.erase(itrS);
|
||||||
|
|
||||||
// once itrS has been erased, itrD won't be pointing at the
|
// once itrS has been erased, itrD won't be pointing at the
|
||||||
// same place anymore - re-find...
|
// same place anymore - re-find...
|
||||||
itrD = find(begin(),end(),target);
|
itrD = find(begin(),end(),target);
|
||||||
objectList.insert(itrD, obj);
|
mObjectList.insert(itrD, obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -340,15 +340,15 @@ void SimSet::onRemove()
|
||||||
MutexHandle handle;
|
MutexHandle handle;
|
||||||
handle.lock( mMutex );
|
handle.lock( mMutex );
|
||||||
|
|
||||||
if( !objectList.empty() )
|
if( !mObjectList.empty() )
|
||||||
{
|
{
|
||||||
objectList.sortId();
|
mObjectList.sortId();
|
||||||
|
|
||||||
// This backwards iterator loop doesn't work if the
|
// This backwards iterator loop doesn't work if the
|
||||||
// list is empty, check the size first.
|
// list is empty, check the size first.
|
||||||
|
|
||||||
for( SimObjectList::iterator ptr = objectList.end() - 1;
|
for( SimObjectList::iterator ptr = mObjectList.end() - 1;
|
||||||
ptr >= objectList.begin(); ptr -- )
|
ptr >= mObjectList.begin(); ptr -- )
|
||||||
clearNotify( *ptr );
|
clearNotify( *ptr );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -417,8 +417,8 @@ void SimSet::deleteAllObjects()
|
||||||
lock();
|
lock();
|
||||||
while( !empty() )
|
while( !empty() )
|
||||||
{
|
{
|
||||||
SimObject* object = objectList.last();
|
SimObject* object = mObjectList.last();
|
||||||
objectList.pop_back();
|
mObjectList.pop_back();
|
||||||
|
|
||||||
object->deleteObject();
|
object->deleteObject();
|
||||||
}
|
}
|
||||||
|
|
@ -536,7 +536,7 @@ SimObject* SimSet::findObjectByLineNumber(const char* fileName, S32 declarationL
|
||||||
SimObject* SimSet::getRandom()
|
SimObject* SimSet::getRandom()
|
||||||
{
|
{
|
||||||
if (size() > 0)
|
if (size() > 0)
|
||||||
return objectList[mRandI(0, size() - 1)];
|
return mObjectList[mRandI(0, size() - 1)];
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -640,7 +640,7 @@ void SimGroup::_addObject( SimObject* obj, bool forcePushBack )
|
||||||
if( obj->getGroup() )
|
if( obj->getGroup() )
|
||||||
obj->getGroup()->removeObject( obj );
|
obj->getGroup()->removeObject( obj );
|
||||||
|
|
||||||
if( forcePushBack ? objectList.pushBack( obj ) : objectList.pushBackForce( obj ) )
|
if( forcePushBack ? mObjectList.pushBack( obj ) : mObjectList.pushBackForce( obj ) )
|
||||||
{
|
{
|
||||||
mNameDictionary.insert( obj );
|
mNameDictionary.insert( obj );
|
||||||
obj->mGroup = this;
|
obj->mGroup = this;
|
||||||
|
|
@ -685,7 +685,7 @@ void SimGroup::_removeObjectNoLock( SimObject* obj )
|
||||||
obj->onGroupRemove();
|
obj->onGroupRemove();
|
||||||
|
|
||||||
mNameDictionary.remove( obj );
|
mNameDictionary.remove( obj );
|
||||||
objectList.remove( obj );
|
mObjectList.remove( obj );
|
||||||
obj->mGroup = 0;
|
obj->mGroup = 0;
|
||||||
|
|
||||||
getSetModificationSignal().trigger( SetObjectRemoved, this, obj );
|
getSetModificationSignal().trigger( SetObjectRemoved, this, obj );
|
||||||
|
|
@ -709,14 +709,14 @@ void SimGroup::popObject()
|
||||||
MutexHandle handle;
|
MutexHandle handle;
|
||||||
handle.lock( mMutex );
|
handle.lock( mMutex );
|
||||||
|
|
||||||
if( objectList.empty() )
|
if(mObjectList.empty() )
|
||||||
{
|
{
|
||||||
AssertWarn( false, "SimGroup::popObject - Stack underflow" );
|
AssertWarn( false, "SimGroup::popObject - Stack underflow" );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
SimObject* object = objectList.last();
|
SimObject* object = mObjectList.last();
|
||||||
objectList.pop_back();
|
mObjectList.pop_back();
|
||||||
|
|
||||||
object->onGroupRemove();
|
object->onGroupRemove();
|
||||||
object->mGroup = NULL;
|
object->mGroup = NULL;
|
||||||
|
|
@ -736,9 +736,9 @@ void SimGroup::popObject()
|
||||||
void SimGroup::onRemove()
|
void SimGroup::onRemove()
|
||||||
{
|
{
|
||||||
lock();
|
lock();
|
||||||
if( !objectList.empty() )
|
if( !mObjectList.empty() )
|
||||||
{
|
{
|
||||||
objectList.sortId();
|
mObjectList.sortId();
|
||||||
clear();
|
clear();
|
||||||
}
|
}
|
||||||
SimObject::onRemove();
|
SimObject::onRemove();
|
||||||
|
|
@ -752,10 +752,10 @@ void SimGroup::clear()
|
||||||
lock();
|
lock();
|
||||||
while( size() > 0 )
|
while( size() > 0 )
|
||||||
{
|
{
|
||||||
SimObject* object = objectList.last();
|
SimObject* object = mObjectList.last();
|
||||||
object->onGroupRemove();
|
object->onGroupRemove();
|
||||||
|
|
||||||
objectList.pop_back();
|
mObjectList.pop_back();
|
||||||
mNameDictionary.remove( object );
|
mNameDictionary.remove( object );
|
||||||
object->mGroup = 0;
|
object->mGroup = 0;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,7 @@ class SimSet : public SimObject, public TamlChildren
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
SimObjectList objectList;
|
SimObjectList mObjectList;
|
||||||
void *mMutex;
|
void *mMutex;
|
||||||
|
|
||||||
/// Signal that is triggered when objects are added or removed from the set.
|
/// Signal that is triggered when objects are added or removed from the set.
|
||||||
|
|
@ -144,14 +144,14 @@ class SimSet : public SimObject, public TamlChildren
|
||||||
///
|
///
|
||||||
typedef SimObjectList::iterator iterator;
|
typedef SimObjectList::iterator iterator;
|
||||||
typedef SimObjectList::value_type value;
|
typedef SimObjectList::value_type value;
|
||||||
SimObject* front() { return objectList.front(); }
|
SimObject* front() { return mObjectList.front(); }
|
||||||
SimObject* first() { return objectList.first(); }
|
SimObject* first() { return mObjectList.first(); }
|
||||||
SimObject* last() { return objectList.last(); }
|
SimObject* last() { return mObjectList.last(); }
|
||||||
bool empty() const { return objectList.empty(); }
|
bool empty() const { return mObjectList.empty(); }
|
||||||
S32 size() const { return objectList.size(); }
|
S32 size() const { return mObjectList.size(); }
|
||||||
iterator begin() { return objectList.begin(); }
|
iterator begin() { return mObjectList.begin(); }
|
||||||
iterator end() { return objectList.end(); }
|
iterator end() { return mObjectList.end(); }
|
||||||
value operator[] (S32 index) { return objectList[U32(index)]; }
|
value operator[] (S32 index) { return mObjectList[U32(index)]; }
|
||||||
|
|
||||||
inline iterator find( iterator first, iterator last, SimObject *obj)
|
inline iterator find( iterator first, iterator last, SimObject *obj)
|
||||||
{ return ::find(first, last, obj); }
|
{ return ::find(first, last, obj); }
|
||||||
|
|
@ -163,7 +163,7 @@ class SimSet : public SimObject, public TamlChildren
|
||||||
virtual bool reOrder( SimObject *obj, SimObject *target=0 );
|
virtual bool reOrder( SimObject *obj, SimObject *target=0 );
|
||||||
|
|
||||||
/// Return the object at the given index.
|
/// Return the object at the given index.
|
||||||
SimObject* at(S32 index) const { return objectList.at(index); }
|
SimObject* at(S32 index) const { return mObjectList.at(index); }
|
||||||
|
|
||||||
/// Remove all objects from this set.
|
/// Remove all objects from this set.
|
||||||
virtual void clear();
|
virtual void clear();
|
||||||
|
|
@ -263,7 +263,7 @@ class SimSet : public SimObject, public TamlChildren
|
||||||
#ifdef TORQUE_DEBUG_GUARD
|
#ifdef TORQUE_DEBUG_GUARD
|
||||||
inline void _setVectorAssoc( const char *file, const U32 line )
|
inline void _setVectorAssoc( const char *file, const U32 line )
|
||||||
{
|
{
|
||||||
objectList.setFileAssociation( file, line );
|
mObjectList.setFileAssociation( file, line );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -324,9 +324,9 @@ void SimSet::findObjectByType( Vector<T*> &foundObjects )
|
||||||
|
|
||||||
// Loop through our child objects.
|
// Loop through our child objects.
|
||||||
|
|
||||||
SimObjectList::iterator itr = objectList.begin();
|
SimObjectList::iterator itr = mObjectList.begin();
|
||||||
|
|
||||||
for ( ; itr != objectList.end(); itr++ )
|
for ( ; itr != mObjectList.end(); itr++ )
|
||||||
{
|
{
|
||||||
curObj = dynamic_cast<T*>( *itr );
|
curObj = dynamic_cast<T*>( *itr );
|
||||||
curSet = dynamic_cast<SimSet*>( *itr );
|
curSet = dynamic_cast<SimSet*>( *itr );
|
||||||
|
|
@ -358,9 +358,9 @@ void SimSet::findObjectByCallback( bool ( *fn )( T* ), Vector<T*> &foundObjects
|
||||||
|
|
||||||
// Loop through our child objects.
|
// Loop through our child objects.
|
||||||
|
|
||||||
SimObjectList::iterator itr = objectList.begin();
|
SimObjectList::iterator itr = mObjectList.begin();
|
||||||
|
|
||||||
for ( ; itr != objectList.end(); itr++ )
|
for ( ; itr != mObjectList.end(); itr++ )
|
||||||
{
|
{
|
||||||
curObj = dynamic_cast<T*>( *itr );
|
curObj = dynamic_cast<T*>( *itr );
|
||||||
curSet = dynamic_cast<SimSet*>( *itr );
|
curSet = dynamic_cast<SimSet*>( *itr );
|
||||||
|
|
|
||||||
|
|
@ -172,8 +172,8 @@ SimGroup* ForestBrush::getGroup()
|
||||||
|
|
||||||
bool ForestBrush::containsItemData( const ForestItemData *inData )
|
bool ForestBrush::containsItemData( const ForestItemData *inData )
|
||||||
{
|
{
|
||||||
SimObjectList::iterator iter = objectList.begin();
|
SimObjectList::iterator iter = mObjectList.begin();
|
||||||
for ( ; iter != objectList.end(); iter++ )
|
for ( ; iter != mObjectList.end(); iter++ )
|
||||||
{
|
{
|
||||||
ForestBrushElement *pElement = dynamic_cast<ForestBrushElement*>(*iter);
|
ForestBrushElement *pElement = dynamic_cast<ForestBrushElement*>(*iter);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -194,7 +194,7 @@ void Path::onRemove()
|
||||||
/// Sort the markers objects into sequence order
|
/// Sort the markers objects into sequence order
|
||||||
void Path::sortMarkers()
|
void Path::sortMarkers()
|
||||||
{
|
{
|
||||||
dQsort(objectList.address(), objectList.size(), sizeof(SimObject*), cmpPathObject);
|
dQsort(mObjectList.address(), mObjectList.size(), sizeof(SimObject*), cmpPathObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Path::updatePath()
|
void Path::updatePath()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue