Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 28, 2005, 10:33:14 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: more loading procedures, fixed small bugs in loadparam

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/particles/particle_engine.cc

    r4639 r4726  
    2424#include "debug.h"
    2525#include "stdlibincl.h"
     26#include "load_param.h"
    2627
    2728using namespace std;
     
    8283
    8384/**
     85  \brief loads the ParticleEngines settings and connections between particles and emitters
     86  \param root the XML-element to load this from.
     87 */
     88void ParticleEngine::loadParams(const TiXmlElement* root)
     89{
     90  const TiXmlElement* element = root->FirstChildElement();
     91  while( element != NULL)
     92  {
     93    LoadParam<ParticleEngine>(element, "connect", this, &ParticleEngine::addConnection, true)
     94        .describe("connects an Emitter to a System (emitterName, systemName)");
     95    element = element->NextSiblingElement();
     96  }
     97}
     98
     99
     100
     101/**
    84102   \brief Adds a System to the System list.
    85103
     
    99117{
    100118  this->emitterList->add(emitter);
     119}
     120
     121/**
     122  \brief Connects a ParticleSystem to a ParticleSystem thus emitting Particles.
     123  \param emitter the Emitter to connect to the System
     124  \param system the System to connect to the Emitter
     125*/
     126void ParticleEngine::addConnection(const char* emitter, const char* system)
     127{
     128  ParticleEmitter* tmpEmit = this->getEmitterByName(emitter);
     129  ParticleSystem* tmpSys = this->getSystemByName(system);
     130
     131  if (tmpEmit != NULL && tmpSys != NULL)
     132    this->addConnection(tmpEmit, tmpSys);
     133  else
     134  {
     135    if (tmpEmit == NULL)
     136      PRINTF(2)("Emitter %s not found in the List of emitters, not connecting to %s\n", emitter, system);
     137    if (tmpEmit == NULL)
     138      PRINTF(2)("System %s not found in the List of emitters, not connecting to %s\n", system, emitter);
     139  }
    101140}
    102141
Note: See TracChangeset for help on using the changeset viewer.