Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1243


Ignore:
Timestamp:
May 7, 2008, 12:11:25 AM (17 years ago)
Author:
rgrieder
Message:
  • rearranged function calls in Orxonox.cc has yet to be looked at clearly, commented and COUTed
  • works so far, but using 3 little hacks… in hacky classes
Location:
code/branches/ogre/src
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • code/branches/ogre/src/core/CoreIncludes.h

    r1062 r1243  
    5959    if (orxonox::Identifier::isCreatingHierarchy() && this->getParents()) \
    6060        this->getParents()->insert(this->getParents()->end(), this->getIdentifier()); \
    61     orxonox::ClassManager<ClassName>::getIdentifier()->addObject(this)
     61    orxonox::ClassManager<ClassName>::getIdentifier()->addObject(this); \
     62    if (orxonox::Identifier::isCreatingHierarchy()) \
     63      return
    6264
    6365/**
  • code/branches/ogre/src/orxonox/GraphicsEngine.cc

    r1220 r1243  
    4444#include "core/ConfigValueIncludes.h"
    4545#include "core/Debug.h"
    46 #include "core/TclBind.h"
    4746
    4847
     
    6564  {
    6665    RegisterObject(GraphicsEngine);
    67     //this->bOverwritePath_ = false;
    68     this->setConfigValues();
    6966    // set to standard values
    7067    this->configPath_ = "";
     
    7269    this->scene_ = 0;
    7370    this->renderWindow_ = 0;
     71    this->setConfigValues();
    7472    COUT(4) << "*** GraphicsEngine: Constructed" << std::endl;
    7573  }
     
    113111    SetConfigValue(ogreLogLevelNormal_  , 4).description("Corresponding orxonox debug level for ogre Normal");
    114112    SetConfigValue(ogreLogLevelCritical_, 2).description("Corresponding orxonox debug level for ogre Critical");
    115 
    116     TclBind::getInstance().setDataPath(this->dataPath_);
    117113  }
    118114
     
    120116    @brief Creates the Ogre Root object and sets up the ogre log.
    121117  */
    122   void GraphicsEngine::setup()
    123   {
     118  bool GraphicsEngine::setup(std::string& dataPath)
     119  {
     120    // temporary overwrite of dataPath, change ini file for permanent change
     121    if (dataPath != "")
     122      dataPath_ = dataPath;
     123    if (dataPath_ == "")
     124      return false;
     125    if (dataPath_[dataPath_.size() - 1] != '/')
     126      dataPath_ += "/";
     127
    124128    //TODO: Check if file exists (maybe not here)
    125 /*#ifndef OGRE_STATIC_LIB
    126     root_ = new Ogre::Root(configPath_ + "plugins.cfg", configPath_ + "ogre.cfg",
    127                      configPath_ + "Ogre.log");
    128 #else
    129     root_ = new Ogre::Root(NULL, configPath_ + "ogre.cfg", configPath_ + "Ogre.log");
    130 #endif*/
    131129#if ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC && defined(_DEBUG)
    132130    std::string plugin_filename = "plugins_d.cfg";
     
    158156    root_ = new Ogre::Root(plugin_filename);
    159157    COUT(4) << "*** GraphicsEngine: Creating Ogre Root done" << std::endl;
    160   }
    161 
    162   /**
    163    * @return scene manager
    164    */
    165   Ogre::SceneManager* GraphicsEngine::getSceneManager()
    166   {
    167     if(!scene_)
    168     {
    169       scene_ = root_->createSceneManager(Ogre::ST_GENERIC, "Default SceneManager");
    170       COUT(3) << "Info: Created SceneMan: " << scene_ << std::endl;
    171     }
    172     return scene_;
    173   }
    174 
    175   bool GraphicsEngine::load(std::string dataPath)
    176   {
    177     // temporary overwrite of dataPath, change ini file for permanent change
    178     if( dataPath != "" )
    179       dataPath_ = dataPath + "/";
    180     loadRessourceLocations(this->dataPath_);
    181     if (!root_->restoreConfig() && !root_->showConfigDialog())
    182       return false;
     158
     159    // specify where Ogre has to look for resources. This call doesn't parse anything yet!
     160    declareRessourceLocations();
     161
    183162    return true;
    184163  }
    185164
    186   void GraphicsEngine::initialise()
    187   {
    188     this->renderWindow_ = root_->initialise(true, "OrxonoxV2");
    189     Ogre::WindowEventUtilities::addWindowEventListener(this->renderWindow_, this);
    190     Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5);
    191     //TODO: Do NOT load all the groups, why are we doing that? And do we really do that? initialise != load...
    192     Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
    193   }
    194 
    195   void GraphicsEngine::loadRessourceLocations(std::string dataPath)
     165  void GraphicsEngine::declareRessourceLocations()
    196166  {
    197167    //TODO: Specify layout of data file and maybe use xml-loader
     
    199169    // Load resource paths from data file using configfile ressource type
    200170    Ogre::ConfigFile cf;
    201     cf.load(dataPath + "resources.cfg");
     171    cf.load(dataPath_ + "resources.cfg");
    202172
    203173    // Go through all sections & settings in the file
     
    216186
    217187        Ogre::ResourceGroupManager::getSingleton().addResourceLocation(
    218                                            std::string(dataPath + archName),
     188                                           std::string(dataPath_ + archName),
    219189                                           typeName, secName);
    220190      }
    221191    }
     192  }
     193
     194  bool GraphicsEngine::loadRenderer()
     195  {
     196    if (!root_->restoreConfig() && !root_->showConfigDialog())
     197      return false;
     198
     199    this->renderWindow_ = root_->initialise(true, "OrxonoxV2");
     200    if (!root_->isInitialised())
     201      return false;
     202    Ogre::WindowEventUtilities::addWindowEventListener(this->renderWindow_, this);
     203    Ogre::TextureManager::getSingleton().setDefaultNumMipmaps(5);
     204    return true;
     205  }
     206
     207  void GraphicsEngine::initialiseResources()
     208  {
     209    //TODO: Do NOT load all the groups, why are we doing that? And do we really do that? initialise != load...
     210    Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
     211  }
     212
     213  /**
     214   * @brief Creates the SceneManager
     215   */
     216  bool GraphicsEngine::createNewScene()
     217  {
     218    if (scene_)
     219      return false;
     220    scene_ = root_->createSceneManager(Ogre::ST_GENERIC, "Default SceneManager");
     221    COUT(3) << "Info: Created SceneManager: " << scene_ << std::endl;
     222    return true;
    222223  }
    223224
     
    291292    }
    292293    OutputHandler::getOutStream().setOutputLevel(orxonoxLevel)
    293         << "*** Ogre: " << message << std::endl;
     294        << "Ogre: " << message << std::endl;
    294295  }
    295296
  • code/branches/ogre/src/orxonox/GraphicsEngine.h

    r1214 r1243  
    5252    @brief Graphics engine manager class
    5353    */
    54     class _OrxonoxExport GraphicsEngine : public Ogre::WindowEventListener, public OrxonoxClass, public Ogre::LogListener
     54    class _OrxonoxExport GraphicsEngine : public Ogre::WindowEventListener, public Ogre::LogListener, public OrxonoxClass
    5555    {
    56         friend class ClassIdentifier<GraphicsEngine>;
    5756        public:
    58             void setConfigPath(std::string path) { this->configPath_ = path; };
    5957            void setConfigValues();
    60             void setup();
    61             bool load(std::string path);
    62             void loadRessourceLocations(std::string path);
    63             Ogre::SceneManager* getSceneManager();
    64             void initialise();
     58            bool setup(std::string& dataPath);
     59            void declareRessourceLocations();
     60            bool loadRenderer();
     61            void initialiseResources();
     62            bool createNewScene();
     63
    6564            void destroy();
     65
     66            Ogre::SceneManager* getSceneManager() { return scene_; }
     67            std::string& getDataPath() { return dataPath_; }
    6668
    6769            // several window properties
     
    7173            int getWindowHeight() const;
    7274
    73             static GraphicsEngine& getSingleton();
    74             static GraphicsEngine* getSingletonPtr() { return &getSingleton(); }
    75 
    7675            void windowMoved(Ogre::RenderWindow* rw);
    7776            void windowResized(Ogre::RenderWindow* rw);
    7877            void windowFocusChanged(Ogre::RenderWindow* rw);
     78
     79            static GraphicsEngine& getSingleton();
     80            static GraphicsEngine* getSingletonPtr() { return &getSingleton(); }
    7981
    8082        private:
  • code/branches/ogre/src/orxonox/Orxonox.cc

    r1219 r1243  
    6565#include "core/InputBuffer.h"
    6666#include "core/InputManager.h"
     67#include "core/TclBind.h"
    6768
    6869// audio
     
    166167    this->ogre_ = &GraphicsEngine::getSingleton();
    167168    this->timer_ = 0;
    168     this->dataPath_ = "";
    169     this->auMan_ = 0;
     169    //this->auMan_ = 0;
    170170    this->orxonoxHUD_ = 0;
    171171    this->inputHandler_ = 0;
     
    186186    Loader::close();
    187187    InputManager::destroy();
    188     if (this->auMan_)
    189       delete this->auMan_;
     188    //if (this->auMan_)
     189    //  delete this->auMan_;
    190190    if (this->timer_)
    191191      delete this->timer_;
     
    196196    if (server_g)
    197197      delete server_g;
    198   }
    199 
    200   /**
    201     @brief Immediately deletes the orxonox object.
    202     Never use if you can help it while rendering!
    203   */
    204   void Orxonox::abortImmediateForce()
    205   {
    206     COUT(1) << "*** Orxonox Error: Orxonox object was unexpectedly destroyed." << std::endl;
    207     delete this;
    208198  }
    209199
     
    243233   * @param path path to config (in home dir or something)
    244234   */
    245   void Orxonox::init(int argc, char **argv, std::string path)
     235  bool Orxonox::init(int argc, char **argv, std::string path)
    246236  {
    247237    //TODO: find config file (assuming executable directory)
     
    249239    //TODO: give config file to Ogre
    250240    std::string mode;
     241    std::string dataPath;
    251242
    252243    ArgReader ar(argc, argv);
    253244    ar.checkArgument("mode", mode, false);
    254     ar.checkArgument("data", this->dataPath_, false);
     245    ar.checkArgument("data", dataPath, false);
    255246    ar.checkArgument("ip", serverIp_, false);
    256     if(ar.errorHandling()) abortImmediateForce();
    257     if(mode == std::string("client"))
    258     {
     247    if(ar.errorHandling())
     248      return false;
     249
     250    if (mode == "client")
    259251      mode_ = CLIENT;
    260       clientInit(path);
    261     }
    262     else if(mode== std::string("server")){
     252    else if (mode == "server")
    263253      mode_ = SERVER;
    264       serverInit(path);
    265     }
    266     else{
     254    else
    267255      mode_ = STANDALONE;
    268       standaloneInit(path);
    269     }
    270   }
    271 
    272   void Orxonox::serverInit(std::string path)
    273   {
    274     COUT(2) << "initialising server" << std::endl;
    275 
    276     ogre_->setConfigPath(path);
    277     ogre_->setup();
    278     //root_ = ogre_->getRoot();
    279     if(!ogre_->load(this->dataPath_)) abortImmediateForce(/* unable to load */);
    280 
    281     server_g = new network::Server();
    282   }
    283 
    284   void Orxonox::clientInit(std::string path)
    285   {
    286     COUT(2) << "initialising client" << std::endl;\
    287 
    288     ogre_->setConfigPath(path);
    289     ogre_->setup();
    290     if(serverIp_.compare("")==0)
    291       client_g = new network::Client();
    292     else
    293       client_g = new network::Client(serverIp_, NETWORK_PORT);
    294     if(!ogre_->load(this->dataPath_)) abortImmediateForce(/* unable to load */);
    295   }
    296 
    297   void Orxonox::standaloneInit(std::string path)
    298   {
    299     COUT(2) << "initialising standalone mode" << std::endl;
    300 
    301     ogre_->setConfigPath(path);
    302     ogre_->setup();
    303     if(!ogre_->load(this->dataPath_)) abortImmediateForce(/* unable to load */);
     256
     257    //if (mode_ == DEDICATED)
     258      // TODO: decide what to do here
     259    //else
     260
     261    // for playable server, client and standalone, the startup
     262    // procedure until the GUI is the identical
     263
     264    TclBind::getInstance().setDataPath(dataPath);
     265    ConfigFileManager::getSingleton()->setFile(CFT_Settings, "orxonox.ini");
     266    Factory::createClassHierarchy();
     267
     268    if (!ogre_->setup(path))       // creates ogre root and other essentials
     269      return false;
     270
     271    return true;
    304272  }
    305273
     
    307275   * start modules
    308276   */
    309   void Orxonox::start()
    310   {
    311     switch(mode_){
     277  bool Orxonox::start()
     278  {
     279    //if (mode == DEDICATED)
     280    // do something else
     281    //else
     282
     283    if (!ogre_->loadRenderer())    // creates the render window
     284      return false;
     285
     286    // Calls the InputHandler which sets up the input devices.
     287    // The render window width and height are used to set up the mouse movement.
     288    if (!InputManager::initialise(ogre_->getWindowHandle(),
     289          ogre_->getWindowWidth(), ogre_->getWindowHeight()))
     290      return false;
     291
     292    // TODO: Spread this so that this call onyl initialises things needed for the GUI
     293    ogre_->initialiseResources();
     294
     295    // TOOD: load the GUI here
     296    // set InputManager to GUI mode
     297    InputManager::setInputState(InputManager::IS_GUI);
     298    // TODO: run GUI here
     299
     300    // The following lines depend very much on the GUI, so they're probably misplaced here..
     301
     302    InputManager::setInputState(InputManager::IS_NONE);
     303
     304    if (!loadPlayground())
     305      return false;
     306
     307    switch (mode_)
     308    {
     309    case SERVER:
     310      if (!serverLoad())
     311        return false;
     312      break;
    312313    case CLIENT:
    313       clientStart();
    314       break;
    315     case SERVER:
    316       serverStart();
     314      if (!clientLoad())
     315        return false;
    317316      break;
    318317    default:
    319       standaloneStart();
     318      if (!standaloneLoad())
     319        return false;
    320320    }
    321   }
    322 
    323   void Orxonox::clientStart(){
    324     ogre_->initialise();
    325     ConfigFileManager::getSingleton()->setFile(CFT_Settings, "orxonox.ini");
    326     Factory::createClassHierarchy();
    327 
    328 
    329     auMan_ = new audio::AudioManager();
    330 
     321
     322    InputManager::setInputState(InputManager::IS_NORMAL);
     323
     324    return startRenderLoop();
     325  }
     326
     327  bool Orxonox::loadPlayground()
     328  {
     329    ogre_->createNewScene();
     330
     331          // Init audio
     332    //auMan_ = new audio::AudioManager();
     333    //auMan_->ambientAdd("a1");
     334    //auMan_->ambientAdd("a2");
     335    //auMan_->ambientAdd("a3");
     336    //auMan->ambientAdd("ambient1");
     337    //auMan_->ambientStart();
     338
     339    // Load the HUD
    331340    Ogre::Overlay* hudOverlay = Ogre::OverlayManager::getSingleton().getByName("Orxonox/HUD1.2");
    332341    orxonoxHUD_ = new HUD();
     
    335344    hudOverlay->show();
    336345
    337     client_g->establishConnection();
    338     client_g->tick(0);
    339 
    340 
    341     //setupInputSystem();
    342 
    343     startRenderLoop();
    344   }
    345 
    346   void Orxonox::serverStart(){
    347     //TODO: start modules
    348     ogre_->initialise();
    349     //TODO: run engine
    350     ConfigFileManager::getSingleton()->setFile(CFT_Settings, "orxonox.ini");
    351     Factory::createClassHierarchy();
    352     createScene();
    353     setupInputSystem();
    354 
    355     server_g->open();
    356 
    357     startRenderLoop();
    358   }
    359 
    360   void Orxonox::standaloneStart(){
    361     //TODO: start modules
    362     ogre_->initialise();
    363     //TODO: run engine
    364     ConfigFileManager::getSingleton()->setFile(CFT_Settings, "orxonox.ini");
    365     Factory::createClassHierarchy();
    366     createScene();
    367     setupInputSystem();
    368 
    369     startRenderLoop();
    370   }
    371 
    372   void Orxonox::createScene(void)
    373   {
    374           // Init audio
    375     auMan_ = new audio::AudioManager();
    376 
    377     // load this file from config
    378     Level* startlevel = new Level("levels/sample.oxw");
    379     Loader::open(startlevel);
    380 
    381     Ogre::Overlay* hudOverlay = Ogre::OverlayManager::getSingleton().getByName("Orxonox/HUD1.2");
    382     orxonoxHUD_ = new HUD();
    383     orxonoxHUD_->setEnergyValue(20);
    384     orxonoxHUD_->setEnergyDistr(20,20,60);
    385     hudOverlay->show();
    386 
    387         /*
    388     auMan_->ambientAdd("a1");
    389     auMan_->ambientAdd("a2");
    390     auMan_->ambientAdd("a3");
    391     //auMan->ambientAdd("ambient1");
    392     auMan_->ambientStart();
    393   */
    394   }
    395 
    396   /**
    397     @brief Calls the InputHandler which sets up the input devices.
    398     The render window width and height are used to set up the mouse movement.
    399   */
    400   void Orxonox::setupInputSystem()
    401   {
    402     if (!InputManager::initialise(ogre_->getWindowHandle(),
    403           ogre_->getWindowWidth(), ogre_->getWindowHeight()))
    404       abortImmediateForce();
    405     InputManager::setInputState(InputManager::IS_NORMAL);
    406   }
    407 
    408   /**
    409     Main loop of the orxonox game.
    410     This is a new solution, using the ogre engine instead of being used by it.
    411     An alternative solution would be to simply use the timer of the Root object,
    412     but that implies using Ogre in any case. There would be no way to test
    413     our code without the help of the root object.
    414     There's even a chance that we can dispose of the root object entirely
    415     in server mode.
    416     About the loop: The design is almost exactly like the one in ogre, so that
    417     if any part of ogre registers a framelisteners, it will still behave
    418     correctly. Furthermore the time smoothing feature from ogre has been
    419     implemented too. If turned on (see orxonox constructor), it will calculate
    420     the dt_n by means of the recent most dt_n-1, dt_n-2, etc.
    421   */
    422   void Orxonox::startRenderLoop()
    423   {
    424346    InputBuffer* ib = dynamic_cast<InputBuffer*>(InputManager::getKeyHandler("buffer"));
    425347    /*
     
    432354    ib->registerListener(console, &Testconsole::exit, (char)0x1B, true);
    433355    */
    434 
    435356    orxonoxConsole_ = new InGameConsole(ib);
    436357    ib->registerListener(orxonoxConsole_, &InGameConsole::listen, true);
     
    441362    ib->registerListener(orxonoxConsole_, &InGameConsole::exit, (char)0x1B, true);
    442363
     364    return true;
     365  }
     366
     367  bool Orxonox::serverLoad()
     368  {
     369    COUT(2) << "initialising server" << std::endl;
     370
     371    server_g = new network::Server();
     372
     373    if (!loadScene())
     374      return false;
     375
     376    server_g->open();
     377
     378    return true;
     379  }
     380
     381  bool Orxonox::clientLoad()
     382  {
     383    COUT(2) << "initialising client" << std::endl;\
     384
     385    if (serverIp_.compare("") == 0)
     386      client_g = new network::Client();
     387    else
     388      client_g = new network::Client(serverIp_, NETWORK_PORT);
     389
     390    client_g->establishConnection();
     391    client_g->tick(0);
     392
     393    return true;
     394  }
     395
     396  bool Orxonox::standaloneLoad()
     397  {
     398    COUT(2) << "initialising standalone mode" << std::endl;
     399
     400    if (!loadScene())
     401      return false;
     402
     403    return true;
     404  }
     405
     406  bool Orxonox::loadScene()
     407  {
     408    Level* startlevel = new Level("levels/sample.oxw");
     409    Loader::open(startlevel);
     410
     411    return true;
     412  }
     413
     414
     415  /**
     416    Main loop of the orxonox game.
     417    About the loop: The design is almost exactly like the one in ogre, so that
     418    if any part of ogre registers a framelisteners, it will still behave
     419    correctly. Furthermore the time smoothing feature from ogre has been
     420    implemented too. If turned on (see orxonox constructor), it will calculate
     421    the dt_n by means of the recent most dt_n-1, dt_n-2, etc.
     422  */
     423  bool Orxonox::startRenderLoop()
     424  {
    443425    // first check whether ogre root object has been created
    444426    if (Ogre::Root::getSingletonPtr() == 0)
    445427    {
    446428      COUT(2) << "*** Orxonox Error: Could not start rendering. No Ogre root object found" << std::endl;
    447       return;
     429      return false;
    448430    }
    449431    Ogre::Root& ogreRoot = Ogre::Root::getSingleton();
     
    510492      ogreRoot._fireFrameEnded(evt);
    511493          }
     494
     495    return true;
    512496  }
    513497
  • code/branches/ogre/src/orxonox/Orxonox.h

    r1219 r1243  
    5757  {
    5858    public:
    59       void init(int argc, char **argv, std::string path);
    60       void start();
    61       void abortImmediateForce();
     59      bool init(int argc, char **argv, std::string path);
     60      bool start();
     61
    6262      void abortRequest();
    63       inline audio::AudioManager* getAudioManagerPointer() { return auMan_; };
     63      //inline audio::AudioManager* getAudioManagerPointer() { return auMan_; };
    6464
    6565      static Orxonox* getSingleton();
     
    7979      ~Orxonox();
    8080
    81       // init functions
    82       void serverInit(std::string path);
    83       void clientInit(std::string path);
    84       void standaloneInit(std::string path);
     81      bool loadPlayground();
    8582
    86       // run functions
    87       void serverStart();
    88       void clientStart();
    89       void standaloneStart();
     83      bool serverLoad();
     84      bool clientLoad();
     85      bool standaloneLoad();
    9086
    91       void createScene();
    92       void setupInputSystem();
    93       void startRenderLoop();
     87      bool loadScene();
     88
     89      bool startRenderLoop();
     90
    9491      float calculateEventTime(unsigned long, std::deque<unsigned long>&);
    9592
    9693    private:
    9794      GraphicsEngine*       ogre_;          //!< our dearest graphics engine <3
    98       std::string           dataPath_;      //!< path to data
    99       audio::AudioManager*  auMan_;         //!< audio manager
     95      //audio::AudioManager*  auMan_;         //!< audio manager
    10096      InputManager*         inputHandler_;  //!< Handles input with key bindings
    10197      Ogre::Timer*          timer_;         //!< Main loop timer
  • code/branches/ogre/src/orxonox/objects/Explosion.cc

    r1056 r1243  
    4747    Explosion::Explosion(WorldEntity* owner)
    4848    {
    49         RegisterObject(Explosion);
    50 
    5149        this->particle_ = 0;
    5250        this->lifetime_ = 0.4;
     51
     52        RegisterObject(Explosion);
    5353
    5454        if (owner)
  • code/branches/ogre/src/orxonox/objects/SpaceShip.cc

    r1219 r1243  
    6464    SpaceShip::SpaceShip()
    6565    {
    66         RegisterObject(SpaceShip);
    67         this->registerAllVariables();
    68 
    6966        SpaceShip::instance_s = this;
    70 
    71         this->setConfigValues();
    7267
    7368        this->setMouseEventCallback_ = false;
     
    139134//         this->create();
    140135
     136        RegisterObject(SpaceShip);
     137        this->registerAllVariables();
     138        this->setConfigValues();
    141139
    142140        COUT(3) << "Info: SpaceShip was loaded" << std::endl;
     
    166164    void SpaceShip::init()
    167165    {
     166        if (!setMouseEventCallback_)
     167        {
     168          InputManager::addMouseHandler(this, "SpaceShip");
     169          setMouseEventCallback_ = true;
     170        }
     171
    168172        // START CREATING THRUSTER
    169173        this->tt_ = new ParticleInterface(GraphicsEngine::getSingleton().getSceneManager(),"twinthruster" + this->getName(),"Orxonox/engineglow");
     
    428432    void SpaceShip::tick(float dt)
    429433    {
    430         if (!setMouseEventCallback_)
    431         {
    432           InputManager::addMouseHandler(this, "SpaceShip");
    433           setMouseEventCallback_ = true;
    434         }
    435 
    436434        if (this->redNode_ && this->greenNode_)
    437435        {
  • code/branches/ogre/src/orxonox/objects/WorldEntity.cc

    r1209 r1243  
    4747    WorldEntity::WorldEntity()
    4848    {
    49         RegisterObject(WorldEntity);
    50 
    51         //create();
    52 
    5349        this->bStatic_ = true;
    5450        this->velocity_ = Vector3(0, 0, 0);
     
    5753        this->rotationRate_ = 0;
    5854        this->momentum_ = 0;
     55
     56        RegisterObject(WorldEntity);
    5957
    6058        if (GraphicsEngine::getSingleton().getSceneManager())
  • code/branches/ogre/src/orxonox/tools/Timer.cc

    r1063 r1243  
    6868    TimerBase::TimerBase()
    6969    {
    70         RegisterRootObject(TimerBase);
    71 
    7270        this->executor_ = 0;
    7371        this->interval_ = 0;
     
    7674
    7775        this->time_ = 0;
     76
     77        RegisterRootObject(TimerBase);
    7878    }
    7979
     
    8383    TimerBase::~TimerBase()
    8484    {
    85         delete this->executor_;
     85      if (this->executor_)
     86          delete this->executor_;
    8687    }
    8788
Note: See TracChangeset for help on using the changeset viewer.