| 34 | using namespace Cm; |
| 35 | |
| 36 | void Collection::add(PxBase& object, PxSerialObjectId id) |
| 37 | { |
| 38 | PxSerialObjectId originId = getId(object); |
| 39 | if( originId != PX_SERIAL_OBJECT_ID_INVALID) |
| 40 | { |
| 41 | if( originId != id) |
| 42 | { |
| 43 | physx::shdfnd::getFoundation().error(physx::PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, |
| 44 | "PxCollection::add called for an object that has an associated id already present in the collection!"); |
| 45 | } |
| 46 | return; |
| 47 | } |
| 48 | |
| 49 | if(id != PX_SERIAL_OBJECT_ID_INVALID) |
| 50 | { |
| 51 | if(!mIds.insert(id, &object)) |
| 52 | { |
| 53 | physx::shdfnd::getFoundation().error(physx::PxErrorCode::eINVALID_PARAMETER, __FILE__, __LINE__, |
| 54 | "PxCollection::add called with an id which is already used in the collection"); |
| 55 | return; |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | mObjects[&object] = id; |
| 60 | } |
| 61 | |
| 62 | void Collection::remove(PxBase& object) |
| 63 | { |