From 3827e427954e2ec95b6b08df9dee1b192b0206ac Mon Sep 17 00:00:00 2001 From: fallenoak Date: Sun, 4 Jan 2026 19:44:33 -0600 Subject: [PATCH] feat(client): initialize g_rndSeed in InitializeGlobal --- src/client/Client.cpp | 6 ++++-- src/util/Random.cpp | 3 +++ src/util/Random.hpp | 8 ++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 src/util/Random.cpp create mode 100644 src/util/Random.hpp diff --git a/src/client/Client.cpp b/src/client/Client.cpp index 1ba7de9..b2c50be 100644 --- a/src/client/Client.cpp +++ b/src/client/Client.cpp @@ -17,9 +17,11 @@ #include "sound/Interface.hpp" #include "ui/FrameScript.hpp" #include "ui/FrameXML.hpp" +#include "util/Random.hpp" #include "world/World.hpp" #include #include +#include #include CVar* Client::g_accountNameVar; @@ -449,8 +451,8 @@ int32_t InitializeGlobal() { // OsIMEInitialize(); - // uint32_t v13 = OsGetAsyncTimeMs(); - // g_rndSeed.SetSeed(v13); + uint32_t seed = OsGetAsyncTimeMs(); + g_rndSeed.SetSeed(seed); Client::g_clientEventContext = EventCreateContextEx( 1, diff --git a/src/util/Random.cpp b/src/util/Random.cpp new file mode 100644 index 0000000..6cdc1bc --- /dev/null +++ b/src/util/Random.cpp @@ -0,0 +1,3 @@ +#include "util/Random.hpp" + +CRndSeed g_rndSeed(0); diff --git a/src/util/Random.hpp b/src/util/Random.hpp new file mode 100644 index 0000000..7204971 --- /dev/null +++ b/src/util/Random.hpp @@ -0,0 +1,8 @@ +#ifndef UTIL_RANDOM_HPP +#define UTIL_RANDOM_HPP + +#include + +extern CRndSeed g_rndSeed; + +#endif