Changeset 5779 in orxonox.OLD for trunk/src/lib/physics
- Timestamp:
- Nov 26, 2005, 2:20:58 PM (19 years ago)
- Location:
- trunk/src/lib/physics
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/physics/physics_engine.cc
r5778 r5779 131 131 PhysicsInterface* PhysicsEngine::getPhysicsInterfaceByName(const char* physicsInterfaceName) const 132 132 { 133 tIterator<BaseObject>* tmpIt = ClassList::getList(CL_PHYSICS_INTERFACE)->getIterator(); 134 BaseObject* tmpInt = tmpIt->firstElement(); 135 while(tmpInt) 136 { 137 if (!strcmp(physicsInterfaceName, tmpInt->getName())) 138 { 139 delete tmpIt; 140 return dynamic_cast<PhysicsInterface*>(tmpInt); 141 } 142 tmpInt = tmpIt->nextElement(); 143 } 144 delete tmpIt; 145 return NULL; 133 BaseObject* interface = ClassList::getObject(physicsInterfaceName, CL_PHYSICS_INTERFACE); 134 return (interface != NULL)? dynamic_cast<PhysicsInterface*>(interface) : NULL; 146 135 } 147 136 … … 237 226 if (this->interfaces != NULL || (this->interfaces = ClassList::getList(CL_PHYSICS_INTERFACE)) != NULL) 238 227 { 239 tIterator<BaseObject>* itPI = this->interfaces->getIterator(); 240 PhysicsInterface* enumPI = dynamic_cast<PhysicsInterface*>(itPI->firstElement()); 241 while (enumPI) 242 { 243 enumPI->tickPhys(dt); 244 245 enumPI = dynamic_cast<PhysicsInterface*>(itPI->nextElement()); 246 } 247 delete itPI; 228 list<BaseObject*>::const_iterator tickPhys; 229 for (tickPhys = this->interfaces->begin(); tickPhys != this->interfaces->end(); tickPhys++) 230 dynamic_cast<PhysicsInterface*>(*tickPhys)->tickPhys(dt); 248 231 } 249 232 } … … 261 244 PRINT(0)(" reference: %p\n", this); 262 245 if (this->interfaces != NULL) 263 PRINT(0)(" number of Interfaces: %d\n", this->interfaces-> getSize());246 PRINT(0)(" number of Interfaces: %d\n", this->interfaces->size()); 264 247 PRINT(0)(" number of Fields: %d\n", this->fields.size()); 265 248 PRINT(0)(" number of Connections: %d\n", this->connections.size()); -
trunk/src/lib/physics/physics_engine.h
r5777 r5779 54 54 std::list<Field*> fields; //!< a list of physicsl fields. 55 55 std::list<PhysicsConnection*> connections; //!< a list of physical connections. 56 const tList<BaseObject>*interfaces; //!< The list of physical interfaces.56 const std::list<BaseObject*>* interfaces; //!< The list of physical interfaces. 57 57 }; 58 58
Note: See TracChangeset
for help on using the changeset viewer.