Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9706 in orxonox.OLD


Ignore:
Timestamp:
Aug 25, 2006, 9:50:23 PM (18 years ago)
Author:
bensch
Message:

adapted spawning point

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/new_class_id/src/world_entities/spawning_point.cc

    r9705 r9706  
    3333#include "converter.h"
    3434
     35#include "class_id.h"
    3536CREATE_FACTORY( SpawningPoint, CL_SPAWNING_POINT );
    36 
     37NewObjectListDefinitionID(SpawningPoint, CL_SPAWNING_POINT);
    3738/**
    3839 *  constructor
     
    5051void SpawningPoint::init()
    5152{
    52   this->setClassID(CL_SPAWNING_POINT, "SpawningPoint");
     53  this->registerObject(this, SpawningPoint::_objectList);
    5354  PRINTF(0)("Created SpawningPoint\n");
    5455
     
    8283  /* load teamId */
    8384  LoadParam(root, "teamId", this, SpawningPoint, setTeamId)
    84       .describe("sets teamId");
     85  .describe("sets teamId");
    8586}
    8687
     
    106107void SpawningPoint::spawn(Playable* entity)
    107108{
    108   const std::list<BaseObject*> * list = ClassList::getList( CL_PLAYABLE );
    109 
    110109  bool found = false;
    111110
    112   if ( !list )
    113     return;
    114 
    115   for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ )
     111  for (NewObjectList<Playable>::const_iterator it = Playable::objectList().begin();
     112       it != Playable::objectList().end();
     113       ++it)
    116114  {
    117115    if ( *it == entity )
     
    160158      this->spawn(it->entity);
    161159
    162       const std::list<BaseObject*> * list = ClassList::getList( CL_PLAYABLE );
    163 
    164160      bool found = false;
    165161
    166       if ( !list )
    167         return;
    168 
    169       for ( std::list<BaseObject*>::const_iterator it2 = list->begin(); it2 != list->end(); it2++ )
     162      for (NewObjectList<Playable>::const_iterator it2 = Playable::objectList().begin();
     163           it2 != Playable::objectList().end();
     164           ++it2)
    170165      {
    171166        if ( *it2 == it->entity )
     
    200195 */
    201196void SpawningPoint::draw() const
    202 {
    203 }
     197{}
    204198
    205199void SpawningPoint::sendRespawnMessage( int uniqueId )
     
    241235  Playable      * playable = NULL;
    242236
    243   const std::list<BaseObject*> * list = ClassList::getList( CL_SPAWNING_POINT );
    244 
    245   if ( list )
    246   {
    247     for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ )
    248     {
    249       PRINTF(0)("%d:%d\n", dynamic_cast<SpawningPoint*>(*it)->getUniqueID(), spUniqueId);
    250       if ( dynamic_cast<SpawningPoint*>(*it)->getUniqueID() == spUniqueId )
    251       {
    252         sp = dynamic_cast<SpawningPoint*>(*it);
    253         break;
    254       }
     237  for (NewObjectList<SpawningPoint>::const_iterator it = SpawningPoint::objectList().begin();
     238       it != SpawningPoint::objectList().end();
     239       ++it)
     240  {
     241    PRINTF(0)("%d:%d\n", (*it)->getUniqueID(), spUniqueId);
     242    if ( (*it)->getUniqueID() == spUniqueId )
     243    {
     244      sp = (*it);
     245      break;
    255246    }
    256247  }
     
    262253  }
    263254
    264   list = ClassList::getList( CL_PLAYABLE );
    265 
    266   if ( list )
    267   {
    268     for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ )
    269     {
    270       if ( dynamic_cast<Playable*>(*it)->getUniqueID() == uniqueId )
    271       {
    272         playable = dynamic_cast<Playable*>(*it);
    273         break;
    274       }
     255  for (NewObjectList<Playable>::const_iterator it = Playable::objectList().begin();
     256       it != Playable::objectList().end();
     257       ++it)
     258  {
     259    if ( (*it)->getUniqueID() == uniqueId )
     260    {
     261      playable = (*it);
     262      break;
    275263    }
    276264  }
Note: See TracChangeset for help on using the changeset viewer.