Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


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

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

File:
1 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());
Note: See TracChangeset for help on using the changeset viewer.