Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Feb 12, 2011, 7:24:16 PM (14 years ago)
Author:
landauf
Message:

added feature: ogre config dialog keeps showing up on startup until the user loads a level the first time.

the reason is: if the user closes the game (or it crashes) before loading a level, there was maybe a problem with the ogre config, so we show the menu again to modify it.
if the user manages to start a level, at least the menu shows correctly, hence he can change the config in the orxonox settings from now on if needed.

Location:
code/trunk/src/libraries/core
Files:
3 edited

Legend:

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

    r7868 r7870  
    9494        , bGraphicsLoaded_(false)
    9595        , bStartIOConsole_(true)
     96        , lastLevelTimestamp_(0)
     97        , ogreConfigTimestamp_(0)
    9698    {
    9799        // Set the hard coded fixed paths
     
    221223        SetConfigValue(bStartIOConsole_, true)
    222224            .description("Set to false if you don't want to use the IOConsole (for Lua debugging for instance)");
     225        SetConfigValue(lastLevelTimestamp_, 0)
     226            .description("Timestamp when the last level was started.");
     227        SetConfigValue(ogreConfigTimestamp_, 0)
     228            .description("Timestamp when the ogre config file was changed.");
    223229    }
    224230
     
    395401        }
    396402    }
     403
     404    void Core::updateLastLevelTimestamp()
     405    {
     406        ModifyConfigValue(lastLevelTimestamp_, set, static_cast<long long>(time(NULL)));
     407    }
     408
     409    void Core::updateOgreConfigTimestamp()
     410    {
     411        ModifyConfigValue(ogreConfigTimestamp_, set, static_cast<long long>(time(NULL)));
     412    }
    397413}
  • code/trunk/src/libraries/core/Core.h

    r7401 r7870  
    8383            void resetLanguage();
    8484
     85            void updateLastLevelTimestamp();
     86            inline long long getLastLevelTimestamp() const
     87                { return this->lastLevelTimestamp_; }
     88
     89            void updateOgreConfigTimestamp();
     90            inline long long getOgreConfigTimestamp() const
     91                { return this->ogreConfigTimestamp_; }
     92
    8593        private:
    8694            Core(const Core&); //!< Don't use (undefined symbol)
     
    120128            bool                          bInitRandomNumberGenerator_; //!< If true, srand(time(0)) is called
    121129            bool                          bStartIOConsole_;            //!< Set to false if you don't want to use the IOConsole
     130            long long                     lastLevelTimestamp_;         ///< Timestamp when the last level was started
     131            long long                     ogreConfigTimestamp_;        ///< Timestamp wehen the ogre config level was modified
    122132
    123133            static Core*                  singletonPtr_s;
  • code/trunk/src/libraries/core/GraphicsManager.cc

    r7868 r7870  
    5454#include "ConfigValueIncludes.h"
    5555#include "CoreIncludes.h"
     56#include "Core.h"
    5657#include "Game.h"
    5758#include "GameMode.h"
     
    303304        CCOUT(4) << "Configuring Renderer" << std::endl;
    304305
    305         if (!ogreRoot_->restoreConfig())
     306        if (!ogreRoot_->restoreConfig() || Core::getInstance().getOgreConfigTimestamp() > Core::getInstance().getLastLevelTimestamp())
     307        {
    306308            if (!ogreRoot_->showConfigDialog())
    307309                ThrowException(InitialisationFailed, "OGRE graphics configuration dialogue canceled.");
     310            else
     311                Core::getInstance().updateOgreConfigTimestamp();
     312        }
    308313
    309314        CCOUT(4) << "Creating render window" << std::endl;
Note: See TracChangeset for help on using the changeset viewer.