From 82868d5dfbb473909a2f5132bd8699b0defbeb3f Mon Sep 17 00:00:00 2001 From: staphen Date: Thu, 26 Jun 2025 17:09:49 -0400 Subject: [PATCH] Fix crashes at startup in Win9x builds --- Source/control.cpp | 4 ++-- Source/engine/random.hpp | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/control.cpp b/Source/control.cpp index ce8711c17..5db62b582 100644 --- a/Source/control.cpp +++ b/Source/control.cpp @@ -145,8 +145,8 @@ Rectangle MainPanelButtonRect[8] = { Rectangle LevelButtonRect = { { 40, -39 }, { 41, 22 } }; -int BeltItems = 8; -Size BeltSize { (INV_SLOT_SIZE_PX + 1) * BeltItems, INV_SLOT_SIZE_PX }; +constexpr int BeltItems = 8; +constexpr Size BeltSize { (INV_SLOT_SIZE_PX + 1) * BeltItems, INV_SLOT_SIZE_PX }; Rectangle BeltRect { { 205, 5 }, BeltSize }; Rectangle SpellButtonRect { { 565, 64 }, { 56, 56 } }; diff --git a/Source/engine/random.hpp b/Source/engine/random.hpp index 670b9a7c6..17718cec7 100644 --- a/Source/engine/random.hpp +++ b/Source/engine/random.hpp @@ -272,10 +272,12 @@ private: { seed(timeSeed()); +#if !(defined(WINVER) && WINVER <= 0x0500 && (!defined(_WIN32_WINNT) || _WIN32_WINNT == 0)) static std::random_device rd; std::uniform_int_distribution dist; for (uint32_t &cell : s) cell ^= dist(rd); +#endif } static uint64_t timeSeed();