Check whether DoCommand test execution changes the random seed

This commit is contained in:
Jonathan G Rennison
2019-05-21 20:48:43 +01:00
parent 97baff6fd8
commit 6bfbd638ac
2 changed files with 25 additions and 1 deletions

View File

@@ -49,7 +49,7 @@ static inline void SaveRandomSeeds(SavedRandomSeeds *storage)
/**
* Restores previously saved seeds
* @param storage Storage where SaveRandomSeeds() stored th seeds
* @param storage Storage where SaveRandomSeeds() stored the seeds
*/
static inline void RestoreRandomSeeds(const SavedRandomSeeds &storage)
{
@@ -57,6 +57,22 @@ static inline void RestoreRandomSeeds(const SavedRandomSeeds &storage)
_interactive_random = storage.interactive_random;
}
struct GameRandomSeedChecker {
private:
Randomizer random;
public:
GameRandomSeedChecker()
{
this->random = _random;
}
bool Check() const
{
return (this->random.state[0] == _random.state[0] && this->random.state[1] == _random.state[1]);
}
};
void SetRandomSeed(uint32 seed);
#ifdef RANDOM_DEBUG
#ifdef __APPLE__