Changeset 4977 in orxonox.OLD for orxonox/trunk/src/story_entities
- Timestamp:
- Aug 10, 2005, 11:26:59 AM (19 years ago)
- Location:
- orxonox/trunk/src/story_entities
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/story_entities/world.cc
r4976 r4977 20 20 #include "world.h" 21 21 22 #include "orxonox.h"23 22 24 23 #include "state.h" … … 75 74 using namespace std; 76 75 77 WorldInterface* WorldInterface::singletonRef = 0;78 79 80 /**81 * private constructor because of singleton82 */83 WorldInterface::WorldInterface()84 {85 this->worldIsInitialized = false;86 this->worldReference = NULL;87 }88 89 /**90 * public deconstructor91 */92 WorldInterface::~WorldInterface()93 {94 this->singletonRef = NULL;95 this->worldIsInitialized = false;96 this->worldReference = NULL;97 }98 99 /**100 * gets the singleton instance101 * @returns singleton instance102 */103 WorldInterface* WorldInterface::getInstance()104 {105 if( singletonRef == NULL)106 singletonRef = new WorldInterface();107 return singletonRef;108 }109 110 111 /**112 * initializes the interface113 * @param reference to the world114 115 if the worldinterface is not initilizes, there wont be any116 useable interface117 */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 world131 * @return entity list132 */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 }140 76 141 77 CREATE_FACTORY(World); … … 183 119 ParticleEngine::getInstance()->debug(); 184 120 185 delete WorldInterface::getInstance();186 121 delete this->entities; 187 122 State::setWorldEntityList(NULL); … … 266 201 267 202 /* init the world interface */ 268 WorldInterface* wi = WorldInterface::getInstance();269 wi->init(this);270 203 271 204 LightManager::getInstance(); … … 677 610 EventHandler::getInstance()->subscribe(this->pilotNode, ES_GAME, EV_MOUSE_MOTION); 678 611 679 // bind input680 Orxonox *orx = Orxonox::getInstance ();681 //orx->getLocalInput()->bind (this->pilotNode);682 683 612 /* 684 613 PNode* tn = TrackManager::getInstance()->getTrackNode(); -
orxonox/trunk/src/story_entities/world.h
r4961 r4977 25 25 26 26 class OggPlayer; 27 //! The game world Interface28 /**29 this is a singleton interface, that enables world_entities to access the30 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 object44 bool worldIsInitialized; //!< true if the world has been initialized45 World* worldReference; //!< this is a reference to the running world46 47 };48 27 49 28 //! The game world … … 114 93 115 94 OggPlayer* music; 95 116 96 // IMPORTANT WORLD-ENTITIES 117 97 PNode* nullParent; //!< The zero-point, that everything has as its parent.
Note: See TracChangeset
for help on using the changeset viewer.