Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4382 in orxonox.OLD


Ignore:
Timestamp:
May 29, 2005, 9:04:17 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: BaseObject virtual public in PNode and Player(for test).
This is, so only one Object of type BaseObject is being created when deriving with multiple inheritance

@patrick: read it in a book at the lake today :)

Location:
orxonox/trunk/src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/coord/p_node.h

    r4372 r4382  
    4545
    4646//! Patent Node is a Engine to calculate the position of an Object in respect to the position of its parent.
    47 class PNode : public BaseObject {
     47class PNode : virtual public BaseObject {
    4848
    4949 public:
  • orxonox/trunk/src/lib/lang/base_object.h

    r4381 r4382  
    11/*!
    2     \file proto_class.h
    3     \brief Definition of the proto class template, used quickly start work
     2    \file base_object.h
     3    \brief Definition of the base object class. that is a global handler for all classes.
    44*/
    55
     
    1010#include "class_list.h"
    1111
     12//! A class all other classes are derived from
    1213class BaseObject {
    1314
     
    2021  void setClassID(int id, const char* className);
    2122
     23  /** \returns the className of the corresponding Object */
    2224  inline const char* getClassName(void) const { return this->className;};
     25  /** \returns the classID of the corresponding Object */
    2326  inline int getClassID(void) const { return this->id; }
    2427  bool isA (char* className);
    2528
     29  /** \returns if the object is finalized */
    2630  inline bool isFinalized() { return this->finalized; }
    2731  void finalize();
  • orxonox/trunk/src/lib/physics/physics_interface.h

    r4377 r4382  
    1717   here can be some longer description of this class
    1818*/
    19 class PhysicsInterface : public BaseObject
     19class PhysicsInterface : virtual public BaseObject
    2020{
    2121
  • orxonox/trunk/src/story_entities/world.cc

    r4349 r4382  
    381381      while( element != NULL)
    382382        {
    383           WorldEntity* created = (WorldEntity*) loader->fabricate( element);
     383          WorldEntity* created = dynamic_cast<WorldEntity*>( loader->fabricate( element));
    384384          if( created != NULL) this->spawn( created);
    385385          // if we load a 'Player' we use it as localPlayer
  • orxonox/trunk/src/world_entities/player.h

    r4261 r4382  
    88
    99#include "world_entity.h"
     10#include "physics_interface.h"
    1011
    1112template<class T> class tList;
     
    1617
    1718//! Basic controllable WorldEntity
    18 class Player : public WorldEntity 
     19class Player : public WorldEntity, public PhysicsInterface
    1920{
    2021  friend class World;
  • orxonox/trunk/src/world_entities/test_gun.cc

    r4320 r4382  
    144144    }
    145145
    146   Projectile* pj = (TestBullet*)ObjectManager::getInstance()->getFromDeadList(CL_TEST_BULLET);
     146  Projectile* pj = dynamic_cast<TestBullet*>(ObjectManager::getInstance()->getFromDeadList(CL_TEST_BULLET));
    147147
    148148  //printf( "object ref %p\n", ObjectManager::getInstance()->getFromDeadList(CL_TEST_BULLET));
Note: See TracChangeset for help on using the changeset viewer.