Added the return of the index position of the added UserObject

This commit is contained in:
Robert Osfield 2011-06-07 09:28:38 +00:00
parent 71a961ccc3
commit 848ec5e770

View File

@ -58,7 +58,7 @@ const Referenced* Object::getUserData() const
return _userDataContainer.valid() ? _userDataContainer->_userData.get() : 0; return _userDataContainer.valid() ? _userDataContainer->_userData.get() : 0;
} }
void Object::addUserObject(Object* obj) unsigned int Object::addUserObject(Object* obj)
{ {
// make sure the UserDataContainer exists // make sure the UserDataContainer exists
getOrCreateUserDataContainer(); getOrCreateUserDataContainer();
@ -68,11 +68,15 @@ void Object::addUserObject(Object* obj)
if (i<_userDataContainer->_objectList.size()) if (i<_userDataContainer->_objectList.size())
{ {
// object already in container so just return. // object already in container so just return.
return; return i;
} }
unsigned int pos = _userDataContainer->_objectList.size();
// object not already on user data container so add it in. // object not already on user data container so add it in.
_userDataContainer->_objectList.push_back(obj); _userDataContainer->_objectList.push_back(obj);
return pos;
} }
void Object::removeUserObject(unsigned int i) void Object::removeUserObject(unsigned int i)