Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 31, 2006, 10:51:08 PM (18 years ago)
Author:
bensch
Message:

orxonox/branches/new_class_id: new_class ID working, adapdet many classes, and reinvented some of the ClassID stuff

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/new_class_id/src/world_entities/npcs/door.cc

    r9406 r9709  
    2525
    2626#include "door.h"
    27 #include "class_list.h"
    2827
    29 
    30 
    31 
    32 
    33 CREATE_FACTORY(Door, CL_DOOR);
     28#include "class_id.h"
     29NewObjectListDefinitionID(Door, CL_DOOR);
     30CREATE_FACTORY(Door);
    3431
    3532
     
    4744Door::Door(const TiXmlElement* root)
    4845{
    49 
    50   this->setClassID(CL_DOOR, "Door");
     46  this->registerObject(this, Door::_objectList);
    5147  this->scale = 1.0f;
    5248  this->actionRadius = 1.0;
     
    152148
    153149
    154 
     150#include "playable.h"
     151#include "generic_npc.h"
    155152/**
    156153 * checks if the door is open
     
    159156{
    160157
    161   std::list<BaseObject*>::const_iterator it;
    162   const std::list<BaseObject*>* list = ClassList::getList(CL_PLAYABLE);
    163158  WorldEntity* entity;
    164159  float distance;
    165160
    166   if( list == NULL)
    167     return false;
    168 
     161  for (NewObjectList<Playable>::const_iterator it = Playable::objectList().begin();
     162       it != Playable::objectList().end();
     163       ++it)
    169164  // for all players
    170   for( it = list->begin(); it != list->end(); it++)
    171165  {
    172     entity = dynamic_cast<WorldEntity*>(*it);
     166    entity = (*it);
    173167
    174168    distance = fabs((this->getAbsCoor() - entity->getAbsCoor()).len());
     
    178172
    179173
    180   list = ClassList::getList(CL_GENERIC_NPC);
    181   if( list == NULL)
    182     return false;
    183   for( it = list->begin(); it != list->end(); it++)
     174
     175  for (NewObjectList<GenericNPC>::const_iterator it = GenericNPC::objectList().begin();
     176       it != GenericNPC::objectList().end();
     177       ++it)
    184178  {
    185     entity = dynamic_cast<WorldEntity*>(*it);
     179    entity = (*it);
    186180
    187181    distance = fabs((this->getAbsCoor() - entity->getAbsCoor()).len());
Note: See TracChangeset for help on using the changeset viewer.