Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5779 in orxonox.OLD for trunk/src/lib/physics


Ignore:
Timestamp:
Nov 26, 2005, 2:20:58 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: ClassList is now in std::list style
ShellCommand is now in std::list style

Location:
trunk/src/lib/physics
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/physics/physics_engine.cc

    r5778 r5779  
    131131PhysicsInterface* PhysicsEngine::getPhysicsInterfaceByName(const char* physicsInterfaceName) const
    132132{
    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;
    146135}
    147136
     
    237226  if (this->interfaces != NULL || (this->interfaces = ClassList::getList(CL_PHYSICS_INTERFACE)) != NULL)
    238227  {
    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);
    248231  }
    249232}
     
    261244  PRINT(0)(" reference: %p\n", this);
    262245  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());
    264247  PRINT(0)(" number of Fields: %d\n", this->fields.size());
    265248  PRINT(0)(" number of Connections: %d\n", this->connections.size());
  • trunk/src/lib/physics/physics_engine.h

    r5777 r5779  
    5454  std::list<Field*>             fields;               //!< a list of physicsl fields.
    5555  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.
    5757};
    5858
Note: See TracChangeset for help on using the changeset viewer.