Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9869 in orxonox.OLD for trunk/src/world_entities/npcs/gate.cc


Ignore:
Timestamp:
Oct 3, 2006, 12:19:30 AM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: merged the new_class_id branche back to the trunk.
merged with command:
svn merge https://svn.orxonox.net/orxonox/branches/new_class_id trunk -r9683:HEAD
no conflicts… puh..

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/npcs/gate.cc

    r9406 r9869  
    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_DEPRECATED.h"
     34ObjectListDefinitionID(Gate, CL_GATE);
     35CREATE_FACTORY(Gate);
    3736
    3837
    3938#include "script_class.h"
    40 CREATE_SCRIPTABLE_CLASS(Gate, CL_GATE,
    41                             addMethod("hide", ExecutorLua0<WorldEntity>(&WorldEntity::hide))
    42                             ->addMethod("unhide", ExecutorLua0<WorldEntity>(&WorldEntity::unhide))
    43                             ->addMethod("destroy", ExecutorLua0<Gate>(&Gate::destroy))   
    44                             ->addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor))
    45                             ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX))
    46                             ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY))
    47                             ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ))
     39CREATE_SCRIPTABLE_CLASS(Gate,
     40                        addMethod("hide", Executor0<WorldEntity, lua_State*>(&WorldEntity::hide))
     41                            ->addMethod("unhide", Executor0<WorldEntity, lua_State*>(&WorldEntity::unhide))
     42                            ->addMethod("destroy", Executor0<Gate, lua_State*>(&Gate::destroy))
     43                            ->addMethod("setAbsCoor", Executor3<PNode, lua_State*,float,float,float>(&PNode::setAbsCoor))
     44                            ->addMethod("getAbsCoorX", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorX))
     45                            ->addMethod("getAbsCoorY", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorY))
     46                            ->addMethod("getAbsCoorZ", Executor0ret<PNode, lua_State*, float>(&PNode::getAbsCoorZ))
    4847                       );
     48
    4949
    5050
     
    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 (ObjectList<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 (ObjectList<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.