diff --git a/src/openrct2/core/Random.hpp b/src/openrct2/core/Random.hpp index 70c34afe40..91254c577d 100644 --- a/src/openrct2/core/Random.hpp +++ b/src/openrct2/core/Random.hpp @@ -11,6 +11,7 @@ #include "Numerics.hpp" +#include #include #include #include diff --git a/src/openrct2/scenario/Scenario.cpp b/src/openrct2/scenario/Scenario.cpp index 5ef2424669..b806b3ddb0 100644 --- a/src/openrct2/scenario/Scenario.cpp +++ b/src/openrct2/scenario/Scenario.cpp @@ -68,7 +68,7 @@ uint16_t gSavedAge; uint32_t gLastAutoSaveUpdate = 0; uint32_t gScenarioTicks; -static Random::Rct2Engine rnd; +Random::Rct2Engine gScenarioRand; uint8_t gScenarioObjectiveType; uint8_t gScenarioObjectiveYear; @@ -92,7 +92,7 @@ void scenario_begin() // Set the scenario pseudo-random seeds Random::Rct2Seed s{ 0x1234567F ^ platform_get_ticks(), 0x789FABCD ^ platform_get_ticks() }; - rnd.seed(s); + gScenarioRand.seed(s); gParkFlags &= ~PARK_FLAGS_NO_MONEY; if (gParkFlags & PARK_FLAGS_NO_MONEY_SCENARIO) @@ -480,7 +480,7 @@ static int32_t scenario_create_ducks() std::pair scenario_rand_seed() { std::stringstream ss; - ss << rnd; + ss << gScenarioRand; uint32_t s0, s1; ss >> s0; ss >> s1; @@ -490,7 +490,7 @@ std::pair scenario_rand_seed() void scenario_rand_seed(uint32_t s0, uint32_t s1) { Random::Rct2Seed s{ s0, s1 }; - rnd.seed(s); + gScenarioRand.seed(s); } /** @@ -540,7 +540,7 @@ uint32_t dbg_scenario_rand(const char* file, const char* function, const uint32_ } #endif - return rnd(); + return gScenarioRand(); } #ifdef DEBUG_DESYNC diff --git a/src/openrct2/scenario/Scenario.h b/src/openrct2/scenario/Scenario.h index 186e9f8c10..94936e64d6 100644 --- a/src/openrct2/scenario/Scenario.h +++ b/src/openrct2/scenario/Scenario.h @@ -11,6 +11,7 @@ #define _SCENARIO_H_ #include "../common.h" +#include "../core/Random.hpp" #include "../management/Finance.h" #include "../management/Research.h" #include "../object/Object.h" @@ -366,6 +367,7 @@ enum extern const rct_string_id ScenarioCategoryStringIds[SCENARIO_CATEGORY_COUNT]; extern uint32_t gScenarioTicks; +extern Random::Rct2Engine gScenarioRand; extern uint8_t gScenarioObjectiveType; extern uint8_t gScenarioObjectiveYear;