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/gate.cc

    r9406 r9709  
    2525
    2626#include "gate.h"
    27 #include "class_list.h"
    28 
    2927#include "effects/explosion.h"
    3028
     
    3331
    3432
    35 
    36 CREATE_FACTORY(Gate, CL_GATE);
     33#include "class_id.h"
     34NewObjectListDefinitionID(Gate, CL_GATE);
     35CREATE_FACTORY(Gate);
    3736
    3837
    3938#include "script_class.h"
    40 CREATE_SCRIPTABLE_CLASS(Gate, CL_GATE,
     39CREATE_SCRIPTABLE_CLASS(Gate, Gate::classID(),
    4140                            addMethod("hide", ExecutorLua0<WorldEntity>(&WorldEntity::hide))
    4241                            ->addMethod("unhide", ExecutorLua0<WorldEntity>(&WorldEntity::unhide))
    43                             ->addMethod("destroy", ExecutorLua0<Gate>(&Gate::destroy))   
     42                            ->addMethod("destroy", ExecutorLua0<Gate>(&Gate::destroy))
    4443                            ->addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor))
    4544                            ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX))
     
    4948
    5049
     50
    5151//! list of all different animations a std md2model supports
    5252sAnim Gate::animationList[3] =
     
    6262Gate::Gate(const TiXmlElement* root)
    6363{
    64 
    65   this->setClassID(CL_GATE, "Gate");
     64  this->registerObject(this, Gate::_objectList);
    6665  this->scale = 1.0f;
    6766  this->actionRadius = 1.0;
     
    165164void Gate::close()
    166165{
    167  
     166
    168167  if( this->destroyed)
    169168    return;
    170  
     169
    171170  this->setAnimation(GATE_CLOSE, MD2_ANIM_ONCE);
    172171  this->bOpen = false;
     
    178177  if( this->destroyed)
    179178    return;
    180  
     179
    181180  this->setAnimation(GATE_DIE, MD2_ANIM_ONCE);
    182181
    183182  Explosion::explode(this, Vector(this->getScaling()/160,this->getScaling()/160,this->getScaling()/160));
    184  
    185  
     183
     184
    186185  this->destroyed = true;
    187186}
    188187
     188#include "playable.h"
     189#include "generic_npc.h"
    189190
    190191/**
     
    195196
    196197  std::list<BaseObject*>::const_iterator it;
    197   const std::list<BaseObject*>* list = ClassList::getList(CL_PLAYABLE);
    198198  WorldEntity* entity;
    199199  float distance;
    200200
    201   if( list == NULL)
    202     return false;
    203 
    204201  // for all players
    205   for( it = list->begin(); it != list->end(); it++)
    206   {
    207     entity = dynamic_cast<WorldEntity*>(*it);
     202  for (NewObjectList<Playable>::const_iterator it = Playable::objectList().begin();
     203       it != Playable::objectList().end();
     204       ++it)
     205  {
     206    entity = (*it);
    208207
    209208    distance = fabs((this->getAbsCoor() - entity->getAbsCoor()).len());
     
    213212
    214213
    215   list = ClassList::getList(CL_GENERIC_NPC);
    216   if( list == NULL)
    217     return false;
    218   for( it = list->begin(); it != list->end(); it++)
    219   {
    220     entity = dynamic_cast<WorldEntity*>(*it);
     214  for (NewObjectList<GenericNPC>::const_iterator it = GenericNPC::objectList().begin();
     215       it != GenericNPC::objectList().end();
     216       ++it)
     217  {
     218    entity = (*it);
    221219
    222220    distance = fabs((this->getAbsCoor() - entity->getAbsCoor()).len());
Note: See TracChangeset for help on using the changeset viewer.