From 37ebf780e740d121dc68855019539aab85c35704 Mon Sep 17 00:00:00 2001 From: num0005 Date: Sun, 15 Jul 2018 16:15:41 +0100 Subject: [PATCH] Limit director speed and disallow negative speed. Speed is now limited to 5000 and setting negative speed should no longer be possible. --- H2Codez/H2Codez.vcxproj | 4 ++-- H2Codez/H2Sapien/H2Sapien.cpp | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/H2Codez/H2Codez.vcxproj b/H2Codez/H2Codez.vcxproj index 75decdc..3ac1796 100644 --- a/H2Codez/H2Codez.vcxproj +++ b/H2Codez/H2Codez.vcxproj @@ -63,7 +63,7 @@ NotUsing Level3 Disabled - WIN32;_DEBUG;_WINDOWS;_USRDLL;H2CODEZ_EXPORTS;%(PreprocessorDefinitions) + WIN32;NOMINMAX;_DEBUG;_WINDOWS;_USRDLL;H2CODEZ_EXPORTS;%(PreprocessorDefinitions) 4005;4800;4996;4200 /std:c++14 %(AdditionalOptions) Async @@ -82,7 +82,7 @@ MaxSpeed false true - WIN32;_WINDOWS;_USRDLL;H2CODEZ_EXPORTS;%(PreprocessorDefinitions) + WIN32;NOMINMAX;_WINDOWS;_USRDLL;H2CODEZ_EXPORTS;%(PreprocessorDefinitions) MultiThreaded 4005;4800;4996;4200 /std:c++14 %(AdditionalOptions) diff --git a/H2Codez/H2Sapien/H2Sapien.cpp b/H2Codez/H2Sapien/H2Sapien.cpp index 55658bf..7ce5e6e 100644 --- a/H2Codez/H2Sapien/H2Sapien.cpp +++ b/H2Codez/H2Sapien/H2Sapien.cpp @@ -89,6 +89,7 @@ INT_PTR CALLBACK CustomDirectorSpeed(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPA { try { float new_speed = std::stof(speed_text); + new_speed = std::fmin(std::fabs(new_speed), 5000.0f); WriteValue(0x009AAC60, new_speed); print_to_console("speed is now " + std::to_string(new_speed)); }