Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 9, 2008, 2:07:24 AM (16 years ago)
Author:
landauf
Message:
  • Fixed a problem with SUPER in combination with a pure-virtual base-function when called from a direct child of the base-class.
  • Added random number generator initialization to Core (configurable)
  • Fixed a bug in Convert.h
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/objecthierarchy2/src/core/Core.cc

    r2344 r2361  
    5656        RegisterRootObject(Core);
    5757
    58         assert(singletonRef_s == 0);
    59         singletonRef_s = this;
     58        assert(this->singletonRef_s == 0);
     59        this->singletonRef_s = this;
     60        this->bInitializeRandomNumberGenerator_ = false;
    6061
    6162        this->setConfigValues();
     
    8081        SetConfigValue(softDebugLevelShell_, 1).description("The maximal level of debug output shown in the ingame shell").callback(this, &Core::debugLevelChanged);
    8182        SetConfigValue(language_, Language::getLanguage().defaultLanguage_).description("The language of the ingame text").callback(this, &Core::languageChanged);
     83        SetConfigValue(bInitializeRandomNumberGenerator_, true).description("If true, all random actions are different each time you start the game").callback(this, &Core::initializeRandomNumberGenerator);
    8284    }
    8385
     
    174176        ResetConfigValue(language_);
    175177    }
     178
     179    void Core::initializeRandomNumberGenerator()
     180    {
     181        static bool bInitialized = false;
     182        if (!bInitialized && this->bInitializeRandomNumberGenerator_)
     183        {
     184            srand(time(0));
     185            rand();
     186            bInitialized = true;
     187        }
     188    }
    176189}
Note: See TracChangeset for help on using the changeset viewer.