Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4977 in orxonox.OLD for orxonox


Ignore:
Timestamp:
Aug 10, 2005, 11:26:59 AM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: removed the WorldInterface, as its job is already been taken by state.h
also removed some totally obsolete but very cool functions of NPC

Location:
orxonox/trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/story_entities/world.cc

    r4976 r4977  
    2020#include "world.h"
    2121
    22 #include "orxonox.h"
    2322
    2423#include "state.h"
     
    7574using namespace std;
    7675
    77 WorldInterface* WorldInterface::singletonRef = 0;
    78 
    79 
    80 /**
    81  *  private constructor because of singleton
    82 */
    83 WorldInterface::WorldInterface()
    84 {
    85   this->worldIsInitialized = false;
    86   this->worldReference = NULL;
    87 }
    88 
    89 /**
    90  *  public deconstructor
    91 */
    92 WorldInterface::~WorldInterface()
    93 {
    94   this->singletonRef = NULL;
    95   this->worldIsInitialized = false;
    96   this->worldReference = NULL;
    97 }
    98 
    99 /**
    100  *  gets the singleton instance
    101  * @returns singleton instance
    102 */
    103 WorldInterface* WorldInterface::getInstance()
    104 {
    105   if( singletonRef == NULL)
    106     singletonRef = new WorldInterface();
    107   return singletonRef;
    108 }
    109 
    110 
    111 /**
    112  *  initializes the interface
    113  * @param reference to the world
    114 
    115    if the worldinterface is not initilizes, there wont be any
    116    useable interface
    117 */
    118 void WorldInterface::init(World* world)
    119 {
    120   this->worldReference = world;
    121   if( world != NULL)
    122     {
    123       this->worldIsInitialized = true;
    124       PRINTF(3)("WorldInterface up and running\n");
    125     }
    126 }
    127 
    128 
    129 /**
    130  *  gets the entity list from the world
    131  * @return entity list
    132 */
    133 tList<WorldEntity>* WorldInterface::getEntityList()
    134 {
    135   if( this->worldIsInitialized)
    136     return this->worldReference->getEntities();
    137   PRINT(1)("tried to use the WorldInterface before it has been initizlized! this can result in SEGFAULTs!\n");
    138   return NULL;
    139 }
    14076
    14177CREATE_FACTORY(World);
     
    183119  ParticleEngine::getInstance()->debug();
    184120
    185   delete WorldInterface::getInstance();
    186121  delete this->entities;
    187122  State::setWorldEntityList(NULL);
     
    266201
    267202  /* init the world interface */
    268   WorldInterface* wi = WorldInterface::getInstance();
    269   wi->init(this);
    270203
    271204  LightManager::getInstance();
     
    677610        EventHandler::getInstance()->subscribe(this->pilotNode, ES_GAME, EV_MOUSE_MOTION);
    678611
    679         // bind input
    680         Orxonox *orx = Orxonox::getInstance ();
    681         //orx->getLocalInput()->bind (this->pilotNode);
    682 
    683612        /*
    684613        PNode* tn = TrackManager::getInstance()->getTrackNode();
  • orxonox/trunk/src/story_entities/world.h

    r4961 r4977  
    2525
    2626class OggPlayer;
    27 //! The game world Interface
    28 /**
    29    this is a singleton interface, that enables world_entities to access the
    30    world. for those objects, there is no easier way than over this interface!
    31 */
    32 class WorldInterface : BaseObject {
    33 
    34  public:
    35   ~WorldInterface();
    36   static WorldInterface* getInstance();
    37   void init(World* world);
    38   inline World* getCurrentWorld() {return this->worldReference;}
    39   tList<WorldEntity>* getEntityList();
    40 
    41  private:
    42   WorldInterface();
    43   static WorldInterface* singletonRef;    //!< singleton reference to this object
    44   bool worldIsInitialized;                //!< true if the world has been initialized
    45   World* worldReference;                  //!< this is a reference to the running world
    46 
    47 };
    4827
    4928//! The game world
     
    11493
    11594  OggPlayer* music;
     95
    11696  // IMPORTANT WORLD-ENTITIES
    11797  PNode* nullParent;                  //!< The zero-point, that everything has as its parent.
  • orxonox/trunk/src/world_entities/npc.cc

    r4976 r4977  
    1616*/
    1717
    18 #include <iostream>
    19 #include <GL/glut.h>
    2018
    21 #include "ai.h"
     19//#include "ai.h"
    2220
    2321#include "npc.h"
     
    2927{
    3028  this->setClassID(CL_NPC, "NPC");
    31   hasDied = 0;
    3229
    3330  this->loadModel("models/bolido.obj");
     
    3532
    3633NPC::~NPC () {}
    37 
    38 
    39 void NPC::setPosition(float x, float y, float z)
    40 {
    41   xCor = x; yCor = y; zCor = z;
    42 }
    43 
    44 void NPC::getPosition(float* x, float* y, float* z)
    45 {
    46   *x = xCor;
    47   *y = yCor;
    48   *z = zCor;
    49 }
    50 
    51 void NPC::setCollisionRadius(float r)
    52 {
    53   collisionRadius = r;
    54 }
    55 
    56 float NPC::getCollisionRadius()
    57 {
    58   return collisionRadius;
    59 }
    6034
    6135
     
    7145void NPC::die()
    7246{
    73   hasDied = 1;
    7447}
  • orxonox/trunk/src/world_entities/npc.h

    r4746 r4977  
    1313  ~NPC ();
    1414
    15   /* collision control */
    16   float collisionRadius;
    1715
    18   float xCor;
    19   float yCor;
    20   float zCor;
     16  void addAI(AI* ai);
    2117
    22   void drawNPC();
    23   void paint();
    24   void setPosition(float x, float y, float z);
    25   void getPosition(float* x, float* y, float* z);
    26   void addAI(AI* ai);
    27   void setCollisionRadius(float r);
    28   float getCollisionRadius();
    2918  int hit();
    3019  void die();
     
    3221 private:
    3322  /* position of the non player space craft */
    34 
    35   int npcType;
    36   int hasDied;
    37 
    38 
    3923;
    4024
Note: See TracChangeset for help on using the changeset viewer.