Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 23, 2009, 11:31:02 PM (15 years ago)
Author:
rgrieder
Message:

Removed almost everything. Should be working already, but not yet tested on Unix.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/libraries/core/Core.cc

    r5759 r5774  
    6363#include "util/SignalHandler.h"
    6464#include "Clock.h"
    65 #include "CommandExecutor.h"
    6665#include "CommandLine.h"
    6766#include "ConfigFileManager.h"
     
    7069#include "DynLibManager.h"
    7170#include "Factory.h"
    72 #include "GameMode.h"
    73 #include "GraphicsManager.h"
    74 #include "GUIManager.h"
    7571#include "Identifier.h"
    7672#include "Language.h"
    7773#include "LuaState.h"
    78 #include "Shell.h"
    79 #include "TclBind.h"
    80 #include "TclThreadManager.h"
    81 #include "input/InputManager.h"
    8274
    8375// Boost 1.36 has some issues with deprecated functions that have been omitted
     
    117109            RegisterRootObject(CoreConfiguration);
    118110            this->setConfigValues();
    119 
    120             // External data directory only exists for dev runs
    121             if (Core::isDevelopmentRun())
    122             {
    123                 // Possible data path override by the command line
    124                 if (!CommandLine::getArgument("externalDataPath")->hasDefaultValue())
    125                     tsetExternalDataPath(CommandLine::getValue("externalDataPath"));
    126             }
    127111        }
    128112
     
    194178        }
    195179
    196         /**
    197         @brief
    198             Temporary sets the external data path
    199         @param path
    200             The new data path
    201         */
    202         void tsetExternalDataPath(const std::string& path)
    203         {
    204             externalDataPath_ = boost::filesystem::path(path);
    205         }
    206 
    207180        void initializeRandomNumberGenerator()
    208181        {
     
    228201        boost::filesystem::path modulePath_;            //!< Path to the modules
    229202        boost::filesystem::path dataPath_;              //!< Path to the data file folder
    230         boost::filesystem::path externalDataPath_;      //!< Path to the external data file folder
    231203        boost::filesystem::path configPath_;            //!< Path to the config file folder
    232204        boost::filesystem::path logPath_;               //!< Path to the log file folder
     
    237209        // Cleanup guard for identifier destruction (incl. XMLPort, configValues, consoleCommands)
    238210        : identifierDestroyer_(Identifier::destroyAllIdentifiers)
    239         // Cleanup guard for external console commands that don't belong to an Identifier
    240         , consoleCommandDestroyer_(CommandExecutor::destroyExternalCommands)
    241211        , configuration_(new CoreConfiguration()) // Don't yet create config values!
    242212        , bDevRun_(false)
    243         , bGraphicsLoaded_(false)
    244213    {
    245214        // Set the hard coded fixed paths
     
    339308        // possibility to configure everything below here
    340309        this->configuration_->initialise();
    341 
    342         // Load OGRE excluding the renderer and the render window
    343         this->graphicsManager_.reset(new GraphicsManager(false));
    344 
    345         // initialise Tcl
    346         this->tclBind_.reset(new TclBind(Core::getDataPathString()));
    347         this->tclThreadManager_.reset(new TclThreadManager(tclBind_->getTclInterpreter()));
    348 
    349         // create a shell
    350         this->shell_.reset(new Shell());
    351310    }
    352311
     
    357316    Core::~Core()
    358317    {
    359     }
    360 
    361     void Core::loadGraphics()
    362     {
    363         // Any exception should trigger this, even in upgradeToGraphics (see its remarks)
    364         Loki::ScopeGuard unloader = Loki::MakeObjGuard(*this, &Core::unloadGraphics);
    365 
    366         // Upgrade OGRE to receive a render window
    367         graphicsManager_->upgradeToGraphics();
    368 
    369         // Calls the InputManager which sets up the input devices.
    370         inputManager_.reset(new InputManager());
    371 
    372         // load the CEGUI interface
    373         guiManager_.reset(new GUIManager(graphicsManager_->getRenderWindow(),
    374             inputManager_->getMousePosition(), graphicsManager_->isFullScreen()));
    375 
    376         unloader.Dismiss();
    377 
    378         bGraphicsLoaded_ = true;
    379     }
    380 
    381     void Core::unloadGraphics()
    382     {
    383         this->guiManager_.reset();;
    384         this->inputManager_.reset();;
    385         this->graphicsManager_.reset();
    386 
    387         // Load Ogre::Root again, but without the render system
    388         try
    389             { this->graphicsManager_.reset(new GraphicsManager(false)); }
    390         catch (...)
    391         {
    392             COUT(0) << "An exception occurred during 'unloadGraphics':" << Exception::handleMessage() << std::endl
    393                     << "Another exception might be being handled which may lead to undefined behaviour!" << std::endl
    394                     << "Terminating the program." << std::endl;
    395             abort();
    396         }
    397 
    398         bGraphicsLoaded_ = false;
    399318    }
    400319
     
    457376    }
    458377
    459     /*static*/ void Core::tsetExternalDataPath(const std::string& path)
    460     {
    461         getInstance().configuration_->tsetExternalDataPath(path);
    462     }
    463 
    464378    /*static*/ const boost::filesystem::path& Core::getDataPath()
    465379    {
     
    469383    {
    470384        return getInstance().configuration_->dataPath_.string() + '/';
    471     }
    472 
    473     /*static*/ const boost::filesystem::path& Core::getExternalDataPath()
    474     {
    475         return getInstance().configuration_->externalDataPath_;
    476     }
    477     /*static*/ std::string Core::getExternalDataPathString()
    478     {
    479         return getInstance().configuration_->externalDataPath_.string() + '/';
    480385    }
    481386
     
    659564        {
    660565            configuration_->dataPath_  = specialConfig::dataDevDirectory;
    661             configuration_->externalDataPath_ = specialConfig::externalDataDevDirectory;
    662566            configuration_->configPath_ = specialConfig::configDevDirectory;
    663567            configuration_->logPath_    = specialConfig::logDevDirectory;
     
    725629    void Core::preUpdate(const Clock& time)
    726630    {
    727         if (this->bGraphicsLoaded_)
    728         {
    729             // process input events
    730             this->inputManager_->update(time);
    731             // process gui events
    732             this->guiManager_->update(time);
    733         }
    734         // process thread commands
    735         this->tclThreadManager_->update(time);
    736631    }
    737632
    738633    void Core::postUpdate(const Clock& time)
    739634    {
    740         if (this->bGraphicsLoaded_)
    741         {
    742             // Render (doesn't throw)
    743             this->graphicsManager_->update(time);
    744         }
    745635    }
    746636}
Note: See TracChangeset for help on using the changeset viewer.