diff options
Diffstat (limited to 'Source/Main.cpp')
-rw-r--r-- | Source/Main.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
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 @@ | |||
1 | #include "windows.h" | 1 | #include "windows.h" |
2 | #include "resource.h" | ||
3 | #include <Richedit.h> | 2 | #include <Richedit.h> |
4 | 3 | ||
5 | #include <ctime> | ||
6 | #include <string> | 4 | #include <string> |
7 | 5 | ||
8 | #include "Randomizer.h" | 6 | #include "Randomizer.h" |
@@ -40,18 +38,19 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) | |||
40 | GetWindowText(hwndSeed, &text[0], 100); | 38 | GetWindowText(hwndSeed, &text[0], 100); |
41 | int seed = 0; | 39 | int seed = 0; |
42 | if (wasSeedRandomlyGenerated || wcslen(text.c_str()) == 0) { | 40 | if (wasSeedRandomlyGenerated || wcslen(text.c_str()) == 0) { |
43 | Random::SetSeed(time(nullptr)); // Seed from the time in milliseconds | ||
44 | seed = Random::RandInt(0, 100000); | 41 | seed = Random::RandInt(0, 100000); |
45 | std::wstring seedString = std::to_wstring(seed); | ||
46 | SetWindowText(hwndSeed, seedString.c_str()); | ||
47 | wasSeedRandomlyGenerated = true; | 42 | wasSeedRandomlyGenerated = true; |
48 | } else { | 43 | } else { |
49 | seed = _wtoi(text.c_str()); | 44 | seed = _wtoi(text.c_str()); |
50 | wasSeedRandomlyGenerated = false; | 45 | wasSeedRandomlyGenerated = false; |
51 | } | 46 | } |
52 | Random::SetSeed(seed); | 47 | |
53 | Randomizer randomizer; | 48 | Randomizer randomizer; |
54 | randomizer.Randomize(); | 49 | short metadata = randomizer.Randomize(seed); |
50 | if (metadata & 0x1) break; // Was already randomized | ||
51 | |||
52 | std::wstring seedString = std::to_wstring(seed); | ||
53 | SetWindowText(hwndSeed, seedString.c_str()); | ||
55 | if (IsDlgButtonChecked(hwnd, IDC_TOGGLESPEED)) { | 54 | if (IsDlgButtonChecked(hwnd, IDC_TOGGLESPEED)) { |
56 | randomizer.AdjustSpeed(); | 55 | randomizer.AdjustSpeed(); |
57 | } | 56 | } |