Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3213 in orxonox.OLD for orxonox/trunk


Ignore:
Timestamp:
Dec 18, 2004, 2:54:59 AM (20 years ago)
Author:
patrick
Message:

orxonox/trunk: enhanced the CommandNode - cleaning up garbage doing the wash etc

Location:
orxonox/trunk/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/camera.cc

    r3175 r3213  
    279279  \param entity: The enitity to bind the camera to
    280280       
    281         This sets the focus of the camera to the given entity. This means that it will use the given WorldEntity's
    282         Location and get_lookat() to determine the viewpoint the camera will render from.
    283         Note that you cannot bind a camera to a free entity.
     281  This sets the focus of the camera to the given entity. This means that it will use the given WorldEntity's
     282  Location and get_lookat() to determine the viewpoint the camera will render from.
     283  Note that you cannot bind a camera to a free entity.
    284284*/
    285285void Camera::bind (WorldEntity* entity)
     
    287287  if( entity != NULL)
    288288    {
    289       if( entity->isFree ()) printf("Cannot bind camera to free entity");
     289      if( entity->isFree()) printf("Cannot bind camera to free entity");
    290290      else
    291291        {
    292           bound = entity;
     292          this->bound = entity;
    293293        }
    294294    }
     
    300300  this->world = world;
    301301}
     302
     303
     304/**
     305   \brief destroy, reset the camera so that it doesn't perform anything anymore
     306
     307*/
     308void Camera::destroy()
     309{
     310  this->bound = NULL;
     311  this->world = NULL;
     312}
  • orxonox/trunk/src/camera.h

    r2636 r3213  
    6464  void bind (WorldEntity* entity);
    6565  void jump (Placement* plc);
     66  void destroy();
    6667
    6768  void setWorld(World* world); 
  • orxonox/trunk/src/command_node.cc

    r3194 r3213  
    3333CommandNode::CommandNode (int ID)
    3434{
    35   bound = new List();
    36   aliases = NULL;
    37   netID = ID;
    38   bLocalInput = false;
     35  this->bound = new List();
     36  this->aliases = NULL;
     37  this->netID = ID;
     38  this->bLocalInput = false;
     39  this->bEnabled = true;
    3940}
    4041
     
    4546CommandNode::CommandNode (char* filename = DEFAULT_KEYBIND_FILE)
    4647{
    47   aliases = NULL;
    48   bLocalInput = true;
    49   netID = 0;
    50   bound = new List();
    51   load_bindings (filename);
     48  this->aliases = NULL;
     49  this->bLocalInput = true;
     50  this->netID = 0;
     51  this->bound = new List();
     52  this->bEnabled = true;
     53  this->load_bindings (filename);
    5254}
    5355
     
    5860{
    5961  if( aliases != NULL) free (aliases);
    60   if( bound != NULL) delete bound;
     62  if( bound != NULL) delete bound; /* \todo should this delete bound? dangerous FIX */
    6163}
    6264
     
    7476{
    7577  this->bound->destroy();
     78  //this->bound = NULL; /* \todo this produces a NULLpointer error.. FIX */
     79  this->bEnabled = false;
     80}
     81
     82void CommandNode::enable(bool bEnabled)
     83{
     84  this->bEnabled = bEnabled;
    7685}
    7786
     
    173182void CommandNode::process ()
    174183{
    175   if( bLocalInput) process_local ();
    176   else process_network ();
     184  if( this->bEnabled)
     185    {
     186      if( bLocalInput) process_local ();
     187      else process_network ();
     188    }
    177189}
    178190
     
    181193  SDL_Event event;
    182194  Command cmd;
    183  
    184195  while( SDL_PollEvent (&event))
    185196    {
     
    223234          Orxonox *orx = Orxonox::getInstance();
    224235          orx->event_handler (&event);
    225          
    226236          break;
    227237        }
  • orxonox/trunk/src/command_node.h

    r2816 r3213  
    3939 private:
    4040  bool bLocalInput;     //!< Identifies the CommandNode that processes local input
     41  bool bEnabled;
    4142  int netID;    //!< Unique identifier that is used to determine between remote CommandNodes
    4243  KeyBindings* aliases;
     
    5657  ~CommandNode ();
    5758
    58   void reset(); 
     59  void reset();
     60  void enable(bool bEnabled);
    5961  void load_bindings (char* filename);
    6062  void bind (WorldEntity* entity);
  • orxonox/trunk/src/list.cc

    r3194 r3213  
    8181  printf("List::clear() - clearing all world objects, releasing mem\n");
    8282  this->currentEl = this->first;
     83  listElement* le = NULL;
    8384  while(this->currentEl != NULL)
    8485    {
    85       listElement* le = this->currentEl->next;
     86      le = this->currentEl->next;
    8687      delete this->currentEl->curr;
    8788      delete this->currentEl;
  • orxonox/trunk/src/orxonox.cc

    r3174 r3213  
    171171 
    172172  // create camera
    173   localcamera = new Camera(world);
     173  //localcamera = new Camera(world); /* \todo camera/input node not used anymore*/
    174174 
    175175  return 0;
     
    304304{
    305305  // localinput
    306   localinput->process();
     306  //localinput->process();
    307307  // remoteinput
    308308}
  • orxonox/trunk/src/world.cc

    r3210 r3213  
    6464{
    6565  this->bPause = false;
     66  Orxonox::getInstance()->get_localinput()->enable(true);
    6667}
    6768
     
    7576  this->bQuitCurrentGame = true;
    7677  this->localCamera->setWorld(NULL);
     78  this->localCamera->destroy();
     79
     80
    7781  WorldEntity* entity = entities->enumerate(); 
    7882  while( entity != NULL )
     
    581585 
    582586      for(int i = 0; i < 10000000; i++) {}
    583 
    584587    }
    585588  printf("World|Exiting the main loop\n");
Note: See TracChangeset for help on using the changeset viewer.