diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp index 8d8d4062286..6be12558529 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp @@ -394,13 +394,14 @@ WindowMsgHandledType GadgetHorizontalSliderSystem( GameWindow *window, UnsignedI Int newPos = (Int)mData1; GameWindow *child = window->winGetChild(); - if( newPos < s->minVal || newPos > s->maxVal ) - break; + // TheSuperHackers @fix No longer reject out of bounds positions to prevent + // reset of custom option.ini settings to 0. s->position = newPos; // Translate to window coords newPos = (Int)((newPos - s->minVal) * s->numTicks); + newPos = clamp(0, newPos, (Int)((s->maxVal - s->minVal) * s->numTicks)); child->winSetPosition( newPos , HORIZONTAL_SLIDER_THUMB_POSITION ); break; diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp index f60c27e6cfd..0d622ad8900 100644 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp +++ b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp @@ -378,13 +378,14 @@ WindowMsgHandledType GadgetVerticalSliderSystem( GameWindow *window, UnsignedInt Int newPos = (Int)mData1; GameWindow *child = window->winGetChild(); - if (newPos < s->minVal || newPos > s->maxVal) - break; + // TheSuperHackers @fix No longer reject out of bounds positions to prevent + // reset of custom option.ini settings to 0. s->position = newPos; // Translate to window coords newPos = (Int)((s->maxVal - newPos) * s->numTicks); + newPos = clamp(0, newPos, (Int)((s->maxVal - s->minVal) * s->numTicks)); child->winSetPosition( 0, newPos ); diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp index f5abf8391eb..2e37f5a17d4 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp @@ -394,13 +394,14 @@ WindowMsgHandledType GadgetHorizontalSliderSystem( GameWindow *window, UnsignedI Int newPos = (Int)mData1; GameWindow *child = window->winGetChild(); - if( newPos < s->minVal || newPos > s->maxVal ) - break; + // TheSuperHackers @fix No longer reject out of bounds positions to prevent + // reset of custom option.ini settings to 0. s->position = newPos; // Translate to window coords newPos = (Int)((newPos - s->minVal) * s->numTicks); + newPos = clamp(0, newPos, (Int)((s->maxVal - s->minVal) * s->numTicks)); child->winSetPosition( newPos , HORIZONTAL_SLIDER_THUMB_POSITION ); break; diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp index bef33d32710..4f16471ff5e 100644 --- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp +++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp @@ -378,13 +378,14 @@ WindowMsgHandledType GadgetVerticalSliderSystem( GameWindow *window, UnsignedInt Int newPos = (Int)mData1; GameWindow *child = window->winGetChild(); - if (newPos < s->minVal || newPos > s->maxVal) - break; + // TheSuperHackers @fix No longer reject out of bounds positions to prevent + // reset of custom option.ini settings to 0. s->position = newPos; // Translate to window coords newPos = (Int)((s->maxVal - newPos) * s->numTicks); + newPos = clamp(0, newPos, (Int)((s->maxVal - s->minVal) * s->numTicks)); child->winSetPosition( 0, newPos );