Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 28, 2005, 11:56:46 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: more loading (especially for physics)

File:
1 edited

Legend:

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

    r4597 r4728  
    2121
    2222#include "list.h"
     23#include "game_loader.h"
     24#include "tinyxml.h"
    2325
    2426using namespace std;
     
    5153}
    5254
     55/**
     56  \param root the XML-element to load settings from
     57 */
     58void loadParams(const TiXmlElement* root)
     59{
     60  const TiXmlElement* element;
     61
     62  PRINTF(4)("Loading Physical Fields\n");
     63  element = root->FirstChildElement("Fields");
     64  {
     65    element = element->FirstChildElement();
     66    GameLoader::getInstance()->fabricate(element);
     67
     68    element = element->NextSiblingElement();
     69  }
     70
     71  PRINTF(4)("Loading Physical Connections\n");
     72  element = root->FirstChildElement("PhysicsConnections");
     73  {
     74    element = element->FirstChildElement();
     75    GameLoader::getInstance()->fabricate(element);
     76
     77    element = element->NextSiblingElement();
     78  }
     79
     80}
     81
     82
     83
    5384
    5485/**
     
    75106
    76107/**
     108  \param physicsInterfaceName the Name of the PhysicsInterface to search for
     109  \returns the PhysicsInterface if found, or NULL if not
     110 */
     111PhysicsInterface* PhysicsEngine::getPhysicsInterfaceByName(const char* physicsInterfaceName) const
     112{
     113  tIterator<PhysicsInterface>* tmpIt = interfaces->getIterator();
     114  PhysicsInterface* tmpInt = tmpIt->nextElement();
     115  while(tmpInt)
     116  {
     117    if (!strcmp(physicsInterfaceName, tmpInt->getName()))
     118    {
     119      delete tmpIt;
     120      return tmpInt;
     121    }
     122    tmpInt = tmpIt->nextElement();
     123  }
     124  delete tmpIt;
     125  return NULL;
     126}
     127
     128/**
    77129   \brief adds a Field to the list of handeled fields
    78130   \param field the field to add
     
    97149
    98150/**
     151  \param FieldName the Name of the PhysicsInterface to search for
     152  \returns the Field if found, or NULL if not
     153 */
     154Field* PhysicsEngine::getFieldByName(const char* FieldName) const
     155{
     156  tIterator<Field>* tmpIt = fields->getIterator();
     157  Field* tmpField = tmpIt->nextElement();
     158  while(tmpField)
     159  {
     160    if (!strcmp(FieldName, tmpField->getName()))
     161    {
     162      delete tmpIt;
     163      return tmpField;
     164    }
     165    tmpField = tmpIt->nextElement();
     166  }
     167  delete tmpIt;
     168  return NULL;
     169}
     170
     171
     172
     173/**
    99174   \brief adds A Physical Connection to the List of Connections
    100175   \param connection the Connection to add
     
    118193}
    119194
    120 
     195/**
     196  \param physicsConnectionName the Name of the PhysicsInterface to search for
     197  \returns the PhysicsConnection if found, or NULL if not
     198 */
     199PhysicsConnection* PhysicsEngine::getPhysicsConnectionByName(const char* physicsConnectionName) const
     200{
     201  tIterator<PhysicsConnection>* tmpIt = connections->getIterator();
     202  PhysicsConnection* tmpConn = tmpIt->nextElement();
     203  while(tmpConn)
     204  {
     205    if (!strcmp(physicsConnectionName, tmpConn->getName()))
     206    {
     207      delete tmpIt;
     208      return tmpConn;
     209    }
     210    tmpConn = tmpIt->nextElement();
     211  }
     212  delete tmpIt;
     213  return NULL;
     214}
    121215
    122216
Note: See TracChangeset for help on using the changeset viewer.