Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10058 in orxonox.OLD


Ignore:
Timestamp:
Dec 13, 2006, 10:44:37 AM (17 years ago)
Author:
patrick
Message:

mount point interaction

Location:
branches/mount_points/src/world_entities
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/mount_points/src/world_entities/mount_point.cc

    r10057 r10058  
    7676  this->toList(OM_GROUP_00);
    7777
    78   this->mount = NULL;
     78  this->_mount = NULL;
    7979}
    8080
     
    126126 */
    127127void MountPoint::mount(WorldEntity* entity)
    128 {}
     128{
     129  this->_mount = entity;
     130}
    129131
    130132
     
    133135 */
    134136void MountPoint::unmount()
    135 {}
     137{
     138  this->_mount = NULL;
     139}
     140
  • branches/mount_points/src/world_entities/mount_point.h

    r10057 r10058  
    3131
    3232  private:
    33     WorldEntity*         mount;       //!< the entity mounted at this mount point
     33    WorldEntity*         _mount;       //!< the entity mounted at this mount point
    3434
    3535};
  • branches/mount_points/src/world_entities/world_entity.cc

    r10057 r10058  
    2424#include "md2/md2Model.h"
    2525#include "md3/md3_model.h"
     26
    2627#include "oif/object_information_file.h"
     28#include "mount_point.h"
    2729
    2830#include "aabb_tree_node.h"
     
    334336  if( this->mountPoints[slot] != NULL)
    335337  {
    336     PRINTF(0)("adding a mount point to a slot, that already exists! ignoring - maybe some object do not get connected well (object: %s)", this->getClassCName());
     338    PRINTF(0)("adding a mount point to a slot, that already exists! ignoring - maybe some object do not get connected well (object: %s)\n", this->getClassCName());
    337339  }
    338340
     
    348350void WorldEntity::mount(int slot, WorldEntity* entity)
    349351{
    350 
     352  if( this->mountPoints[slot] == NULL)
     353  {
     354    PRINTF(0)("you tried to add an entity to a mount point that doesn't exist (slot %i)\n", slot);
     355    return;
     356  }
     357
     358  // mount the entity
     359  this->mountPoints[slot]->mount(entity);
    351360}
    352361
     
    358367void WorldEntity::unmount(int slot)
    359368{
     369    if( this->mountPoints[slot] == NULL)
     370  {
     371    PRINTF(0)("you tried to remove an entity from a mount point that doesn't exist (slot %i)\n", slot);
     372    return;
     373  }
     374
     375  // unmount the entity
     376  this->mountPoints[slot]->unmount();
    360377}
    361378
Note: See TracChangeset for help on using the changeset viewer.