From e2be2878272501ef3f32ef1b26cb3fa757f4334a Mon Sep 17 00:00:00 2001 From: Jupeyy Date: Sun, 15 Nov 2020 07:38:49 +0100 Subject: [PATCH] numeric robustness --- src/game/client/components/menus.cpp | 4 ++-- src/game/editor/editor.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/game/client/components/menus.cpp b/src/game/client/components/menus.cpp index 1dfb8dd2c..28741ffd7 100644 --- a/src/game/client/components/menus.cpp +++ b/src/game/client/components/menus.cpp @@ -483,7 +483,7 @@ int CMenus::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned StrS do { *Offset += minimum(wt - *Offset - Textbox.w, Textbox.w / 3); - } while(w - *Offset > Textbox.w); + } while(w - *Offset > Textbox.w + 0.0001f); } else if(w - *Offset < 0.0f) { @@ -491,7 +491,7 @@ int CMenus::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned StrS do { *Offset = maximum(0.0f, *Offset - Textbox.w / 3); - } while(w - *Offset < 0.0f); + } while(w - *Offset < -0.0001f); } } UI()->ClipEnable(pRect); diff --git a/src/game/editor/editor.cpp b/src/game/editor/editor.cpp index 0377626ed..250a7d313 100644 --- a/src/game/editor/editor.cpp +++ b/src/game/editor/editor.cpp @@ -461,7 +461,7 @@ int CEditor::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned Str do { *Offset += minimum(wt - *Offset - Textbox.w, Textbox.w / 3); - } while(w - *Offset > Textbox.w); + } while(w - *Offset > Textbox.w + 0.0001f); } else if(w - *Offset < 0.0f) { @@ -469,7 +469,7 @@ int CEditor::DoEditBox(void *pID, const CUIRect *pRect, char *pStr, unsigned Str do { *Offset = maximum(0.0f, *Offset - Textbox.w / 3); - } while(w - *Offset < 0.0f); + } while(w - *Offset < -0.0001f); } } UI()->ClipEnable(pRect);