From 3557f0ba80942397a9d963208695b4fa80290cb0 Mon Sep 17 00:00:00 2001 From: jbzdarkid Date: Tue, 30 Oct 2018 21:58:46 -0700 Subject: Infinite amounts of cleanup --- Source/Main.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'Source/Main.cpp') diff --git a/Source/Main.cpp b/Source/Main.cpp index 28bc472..8336c77 100644 --- a/Source/Main.cpp +++ b/Source/Main.cpp @@ -1,8 +1,6 @@ #include "windows.h" -#include "resource.h" #include -#include #include #include "Randomizer.h" @@ -40,18 +38,19 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) GetWindowText(hwndSeed, &text[0], 100); int seed = 0; if (wasSeedRandomlyGenerated || wcslen(text.c_str()) == 0) { - Random::SetSeed(time(nullptr)); // Seed from the time in milliseconds seed = Random::RandInt(0, 100000); - std::wstring seedString = std::to_wstring(seed); - SetWindowText(hwndSeed, seedString.c_str()); wasSeedRandomlyGenerated = true; } else { seed = _wtoi(text.c_str()); wasSeedRandomlyGenerated = false; } - Random::SetSeed(seed); + Randomizer randomizer; - randomizer.Randomize(); + short metadata = randomizer.Randomize(seed); + if (metadata & 0x1) break; // Was already randomized + + std::wstring seedString = std::to_wstring(seed); + SetWindowText(hwndSeed, seedString.c_str()); if (IsDlgButtonChecked(hwnd, IDC_TOGGLESPEED)) { randomizer.AdjustSpeed(); } -- cgit 1.4.1