diff options
author | Johannes Schickel | 2010-07-30 22:47:01 +0000 |
---|---|---|
committer | Johannes Schickel | 2010-07-30 22:47:01 +0000 |
commit | e29d6e681a2eccbfbedaf584f4cc530311ce1eb0 (patch) | |
tree | 62874911622559f9d63c0c082a8ec47ea3d4c0b9 /engines/sci/sci.cpp | |
parent | 062d9eedce06e79526b478441d2eefe85cf41113 (diff) | |
download | scummvm-rg350-e29d6e681a2eccbfbedaf584f4cc530311ce1eb0.tar.gz scummvm-rg350-e29d6e681a2eccbfbedaf584f4cc530311ce1eb0.tar.bz2 scummvm-rg350-e29d6e681a2eccbfbedaf584f4cc530311ce1eb0.zip |
SCI: Switch to Common::RandomSource.
Since I got no response to my mail to -devel, I just assume that there is
no specific reason for using rand() in SCI.
As explained in my mail to -devel about why SCI uses rand, this might allow
SCI to work with our event recording, when that ever gets finished.
I adapted kRandom so that it also supports negative random numbers. And
furthermore that the toNumber argument is smaller than the fromNumber
argument. I am not sure whether that really happens though, but it should
be safer to have this. I marked that place with an TODO/CHECKME.
svn-id: r51521
Diffstat (limited to 'engines/sci/sci.cpp')
-rw-r--r-- | engines/sci/sci.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/engines/sci/sci.cpp b/engines/sci/sci.cpp index f07cc257bd..080c045e27 100644 --- a/engines/sci/sci.cpp +++ b/engines/sci/sci.cpp @@ -26,6 +26,7 @@ #include "common/system.h" #include "common/config-manager.h" #include "common/debug-channels.h" +#include "common/EventRecorder.h" #include "engines/advancedDetector.h" #include "engines/util.h" @@ -169,6 +170,8 @@ SciEngine::~SciEngine() { } Common::Error SciEngine::run() { + g_eventRec.registerRandomSource(_rng, "sci"); + // Assign default values to the config manager, in case settings are missing ConfMan.registerDefault("undither", "true"); ConfMan.registerDefault("enable_fb01", "false"); @@ -304,8 +307,6 @@ bool SciEngine::initGame() { _gamestate->gameStartTime = _gamestate->lastWaitTime = _gamestate->_screenUpdateTime = g_system->getMillis(); - srand(g_system->getMillis()); // Initialize random number generator - // Load game language into printLang property of game object setSciLanguage(); |