MORTEVIELLE: Properly implement get_random_number method

This commit is contained in:
Paul Gilbert 2012-01-20 23:08:35 +11:00 committed by Strangerke
parent 962069f937
commit 37386cdf7c
3 changed files with 7 additions and 3 deletions

View File

@ -37,7 +37,7 @@ namespace Mortevielle {
MortevielleEngine *g_vm;
MortevielleEngine::MortevielleEngine(OSystem *system, const ADGameDescription *gameDesc):
Engine(system), _gameDescription(gameDesc) {
Engine(system), _gameDescription(gameDesc), _randomSource("mortevielle") {
g_vm = this;
_lastGameFrame = 0;
_mouseButtons = 0;

View File

@ -25,6 +25,7 @@
#include "common/events.h"
#include "common/file.h"
#include "common/random.h"
#include "common/rect.h"
#include "common/stack.h"
#include "engines/advancedDetector.h"
@ -65,6 +66,7 @@ public:
ScreenSurface _screenSurface;
PaletteManager _paletteManager;
GfxSurface _backgroundSurface;
Common::RandomSource _randomSource;
public:
MortevielleEngine(OSystem *system, const ADGameDescription *gameDesc);
~MortevielleEngine();

View File

@ -307,9 +307,11 @@ void graphbackground(int c) {
void intr(int intNum, registres &regs) {
}
/**
* Get a random number between two values
*/
int get_random_number(int minval, int maxval) {
// TODO: Replace with a proper random source in the engine
return minval;
return g_vm->_randomSource.getRandomNumber(maxval - minval) + minval;
}
bool keypressed() {