From 1cf6164358bd1c29d0dc6b6dc2d6ccfa5f9bdd90 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Thu, 9 Nov 2017 20:14:25 -0600 Subject: [PATCH] Remove array globals from OxStd, as they were causing section overlaps on GBA --- src/ox/std/random.cpp | 11 ++++------- src/ox/std/random.hpp | 5 +++-- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/ox/std/random.cpp b/src/ox/std/random.cpp index 247cab5aa..70ca85c34 100644 --- a/src/ox/std/random.cpp +++ b/src/ox/std/random.cpp @@ -11,7 +11,10 @@ namespace ox { -RandomSeed Random::DEFAULT_SEED = {540932923848, 540932540932}; +Random::Random() { + m_seed[0] = 540932923848; + m_seed[1] = 540932540932; +} Random::Random(RandomSeed seed) { m_seed[0] = seed[0]; @@ -32,9 +35,3 @@ uint64_t Random::gen() { } } - - -uint64_t ox_rand() { - static ox::Random rand; - return rand.gen(); -} diff --git a/src/ox/std/random.hpp b/src/ox/std/random.hpp index 43d4daaf7..77ce64add 100644 --- a/src/ox/std/random.hpp +++ b/src/ox/std/random.hpp @@ -16,13 +16,14 @@ typedef uint64_t RandomSeed[2]; class Random { public: - static RandomSeed DEFAULT_SEED; private: RandomSeed m_seed; public: - Random(RandomSeed seed = DEFAULT_SEED); + Random(); + + Random(RandomSeed seed); uint64_t gen(); };