From fc93ba053982e67e3061541067ec1874c0d6072d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Sat, 14 May 2022 00:26:15 +0200 Subject: [PATCH] Remove unused DoButtonLogic pText argument --- src/game/client/components/menus.cpp | 10 +++++----- src/game/client/components/menus_browser.cpp | 8 ++++---- src/game/client/components/menus_demo.cpp | 8 ++++---- src/game/client/components/menus_ingame.cpp | 2 +- src/game/client/ui.cpp | 5 ----- src/game/client/ui.h | 1 - src/game/client/ui_ex.cpp | 2 +- src/game/editor/editor.cpp | 4 ++-- 8 files changed, 17 insertions(+), 23 deletions(-) diff --git a/src/game/client/components/menus.cpp b/src/game/client/components/menus.cpp index 22298e878..3132445cb 100644 --- a/src/game/client/components/menus.cpp +++ b/src/game/client/components/menus.cpp @@ -165,7 +165,7 @@ int CMenus::DoButton_Toggle(const void *pID, int Checked, const CUIRect *pRect, } Graphics()->QuadsEnd(); - return Active ? UI()->DoButtonLogic(pID, "", Checked, pRect) : 0; + return Active ? UI()->DoButtonLogic(pID, Checked, pRect) : 0; } int CMenus::DoButton_Menu(const void *pID, const char *pText, int Checked, const CUIRect *pRect, const char *pImageName, int Corners, float r, float FontFactor, vec4 ColorHot, vec4 Color, int AlignVertically, bool CheckForActiveColorPicker) @@ -221,7 +221,7 @@ int CMenus::DoButton_Menu(const void *pID, const char *pText, int Checked, const if(MouseInsideColorPicker) return 0; - return UI()->DoButtonLogic(pID, pText, Checked, pRect); + return UI()->DoButtonLogic(pID, Checked, pRect); } void CMenus::DoButton_KeySelect(const void *pID, const char *pText, int Checked, const CUIRect *pRect) @@ -311,7 +311,7 @@ int CMenus::DoButton_MenuTab(const void *pID, const char *pText, int Checked, co Props.m_AlignVertically = AlignVertically; UI()->DoLabel(&Temp, pText, Temp.h * CUI::ms_FontmodHeight, TEXTALIGN_CENTER, Props); - return UI()->DoButtonLogic(pID, pText, Checked, pRect); + return UI()->DoButtonLogic(pID, Checked, pRect); } int CMenus::DoButton_GridHeader(const void *pID, const char *pText, int Checked, const CUIRect *pRect) @@ -323,7 +323,7 @@ int CMenus::DoButton_GridHeader(const void *pID, const char *pText, int Checked, CUIRect t; pRect->VSplitLeft(5.0f, 0, &t); UI()->DoLabel(&t, pText, pRect->h * CUI::ms_FontmodHeight, TEXTALIGN_LEFT); - return UI()->DoButtonLogic(pID, pText, Checked, pRect); + return UI()->DoButtonLogic(pID, Checked, pRect); } int CMenus::DoButton_CheckBox_Common(const void *pID, const char *pText, const char *pBoxText, const CUIRect *pRect) @@ -353,7 +353,7 @@ int CMenus::DoButton_CheckBox_Common(const void *pID, const char *pText, const c TextRender()->SetRenderFlags(0); UI()->DoLabel(&t, pText, c.h * CUI::ms_FontmodHeight, TEXTALIGN_LEFT); - return UI()->DoButtonLogic(pID, pText, 0, pRect); + return UI()->DoButtonLogic(pID, 0, pRect); } void CMenus::DoLaserPreview(const CUIRect *pRect, const ColorHSLA LaserOutlineColor, const ColorHSLA LaserInnerColor) diff --git a/src/game/client/components/menus_browser.cpp b/src/game/client/components/menus_browser.cpp index 848914eed..85cef8271 100644 --- a/src/game/client/components/menus_browser.cpp +++ b/src/game/client/components/menus_browser.cpp @@ -300,7 +300,7 @@ void CMenus::RenderServerbrowserServerList(CUIRect View) RenderTools()->DrawUIElRect(*pItem->m_pUIElement->Get(1), &r, ColorRGBA(1, 1, 1, 0.25f), CUI::CORNER_ALL, 4.0f); } - if(UI()->DoButtonLogic(pItem, "", Selected, &Row)) + if(UI()->DoButtonLogic(pItem, Selected, &Row)) { NewSelected = ItemIndex; if(NewSelected == m_DoubleClickIndex) @@ -754,7 +754,7 @@ void CMenus::RenderServerbrowserFilters(CUIRect View) ColorRGBA Color(1.0f, 1.0f, 1.0f, g_Config.m_BrFilterCountry ? 1.0f : 0.5f); m_pClient->m_CountryFlags.Render(g_Config.m_BrFilterCountryIndex, &Color, Rect.x, Rect.y, Rect.w, Rect.h); - if(g_Config.m_BrFilterCountry && UI()->DoButtonLogic(&g_Config.m_BrFilterCountryIndex, "", 0, &Rect)) + if(g_Config.m_BrFilterCountry && UI()->DoButtonLogic(&g_Config.m_BrFilterCountryIndex, 0, &Rect)) m_Popup = POPUP_COUNTRY; } @@ -861,7 +861,7 @@ void CMenus::RenderServerbrowserFilters(CUIRect View) Rect.w = TypesWidth; Rect.h = TypesHeight; - int Click = UI()->DoButtonLogic(&s_aTypeButtons[TypeIndex], "", 0, &Rect); + int Click = UI()->DoButtonLogic(&s_aTypeButtons[TypeIndex], 0, &Rect); if(Click == 1 || Click == 2) { // left/right click to toggle filter @@ -956,7 +956,7 @@ void CMenus::RenderServerbrowserFilters(CUIRect View) Rect.w = FlagWidth; Rect.h = FlagHeight; - int Click = UI()->DoButtonLogic(&s_aFlagButtons[CountryIndex], "", 0, &Rect); + int Click = UI()->DoButtonLogic(&s_aFlagButtons[CountryIndex], 0, &Rect); if(Click == 1 || Click == 2) { // left/right click to toggle filter diff --git a/src/game/client/components/menus_demo.cpp b/src/game/client/components/menus_demo.cpp index a0ae069e1..ac12f6503 100644 --- a/src/game/client/components/menus_demo.cpp +++ b/src/game/client/components/menus_demo.cpp @@ -26,7 +26,7 @@ int CMenus::DoButton_DemoPlayer(const void *pID, const char *pText, int Checked, { RenderTools()->DrawUIRect(pRect, ColorRGBA(1, 1, 1, (Checked ? 0.10f : 0.5f) * UI()->ButtonColorMul(pID)), CUI::CORNER_ALL, 5.0f); UI()->DoLabel(pRect, pText, 14.0f, TEXTALIGN_CENTER); - return UI()->DoButtonLogic(pID, pText, Checked, pRect); + return UI()->DoButtonLogic(pID, Checked, pRect); } int CMenus::DoButton_Sprite(const void *pID, int ImageID, int SpriteID, int Checked, const CUIRect *pRect, int Corners) @@ -41,7 +41,7 @@ int CMenus::DoButton_Sprite(const void *pID, int ImageID, int SpriteID, int Chec Graphics()->QuadsDrawTL(&QuadItem, 1); Graphics()->QuadsEnd(); - return UI()->DoButtonLogic(pID, "", Checked, pRect); + return UI()->DoButtonLogic(pID, Checked, pRect); } bool CMenus::DemoFilterChat(const void *pData, int Size, void *pUser) @@ -630,7 +630,7 @@ CMenus::CListboxItem CMenus::UiDoListboxNextItem(const void *pId, bool Selected, HitRect.h = minimum(HitRect.h, (gs_ListBoxOriginalView.y + gs_ListBoxOriginalView.h) - HitRect.y); bool DoubleClickable = false; - if(Item.m_Visible && UI()->DoButtonLogic(pId, "", gs_ListBoxSelectedIndex == gs_ListBoxItemIndex, &HitRect)) + if(Item.m_Visible && UI()->DoButtonLogic(pId, gs_ListBoxSelectedIndex == gs_ListBoxItemIndex, &HitRect)) { DoubleClickable |= gs_ListBoxNewSelected == ThisItemIndex; gs_ListBoxClicked = true; @@ -1121,7 +1121,7 @@ void CMenus::RenderDemoList(CUIRect MainView) RenderTools()->DrawUIRect(&Rect, ColorRGBA(1, 1, 1, 0.25f), CUI::CORNER_ALL, 4.0f); } - if(UI()->DoButtonLogic(r.front().m_aName /* TODO: */, "", Selected, &Row)) + if(UI()->DoButtonLogic(r.front().m_aName, Selected, &Row)) { DoubleClicked |= ItemIndex == m_DoubleClickIndex; str_copy(g_Config.m_UiDemoSelected, r.front().m_aName, sizeof(g_Config.m_UiDemoSelected)); diff --git a/src/game/client/components/menus_ingame.cpp b/src/game/client/components/menus_ingame.cpp index 87c6c1984..307b76e5c 100644 --- a/src/game/client/components/menus_ingame.cpp +++ b/src/game/client/components/menus_ingame.cpp @@ -1074,7 +1074,7 @@ void CMenus::RenderGhost(CUIRect MainView) RenderTools()->DrawUIRect(&r, ColorRGBA(1, 1, 1, 0.5f), CUI::CORNER_ALL, 4.0f); } - if(UI()->DoButtonLogic(pItem, "", 0, &Row)) + if(UI()->DoButtonLogic(pItem, 0, &Row)) { NewSelected = i; DoubleClicked |= NewSelected == m_DoubleClickIndex; diff --git a/src/game/client/ui.cpp b/src/game/client/ui.cpp index da31972b7..2dacc95ae 100644 --- a/src/game/client/ui.cpp +++ b/src/game/client/ui.cpp @@ -425,11 +425,6 @@ bool CUIRect::Inside(float x_, float y_) const return x_ >= this->x && x_ < this->x + this->w && y_ >= this->y && y_ < this->y + this->h; } -int CUI::DoButtonLogic(const void *pID, const char *pText, int Checked, const CUIRect *pRect) -{ - return DoButtonLogic(pID, Checked, pRect); -} - int CUI::DoButtonLogic(const void *pID, int Checked, const CUIRect *pRect) { // logic diff --git a/src/game/client/ui.h b/src/game/client/ui.h index 465ad4a83..21e0cb307 100644 --- a/src/game/client/ui.h +++ b/src/game/client/ui.h @@ -298,7 +298,6 @@ public: float Scale() const; int DoButtonLogic(const void *pID, int Checked, const CUIRect *pRect); - int DoButtonLogic(const void *pID, const char *pText /* TODO: Refactor: Remove */, int Checked, const CUIRect *pRect); int DoPickerLogic(const void *pID, const CUIRect *pRect, float *pX, float *pY); float DoTextLabel(float x, float y, float w, float h, const char *pText, float Size, int Align, const SLabelProperties &LabelProps = {}); diff --git a/src/game/client/ui_ex.cpp b/src/game/client/ui_ex.cpp index 347b77ff5..5083f624a 100644 --- a/src/game/client/ui_ex.cpp +++ b/src/game/client/ui_ex.cpp @@ -639,7 +639,7 @@ bool CUIEx::DoClearableEditBox(const void *pID, const void *pClearID, const CUIR Props.m_AlignVertically = 0; UI()->DoLabel(&ClearButton, "×", ClearButton.h * CUI::ms_FontmodHeight, TEXTALIGN_CENTER, Props); TextRender()->SetRenderFlags(0); - if(UI()->DoButtonLogic(pClearID, "×", 0, &ClearButton)) + if(UI()->DoButtonLogic(pClearID, 0, &ClearButton)) { pStr[0] = 0; UI()->SetActiveItem(pID); diff --git a/src/game/editor/editor.cpp b/src/game/editor/editor.cpp index e7fd592a2..e31b320c4 100644 --- a/src/game/editor/editor.cpp +++ b/src/game/editor/editor.cpp @@ -366,7 +366,7 @@ int CEditor::DoButton_Editor_Common(const void *pID, const char *pText, int Chec if(UI()->HotItem() == pID && pToolTip) m_pTooltip = pToolTip; - return UI()->DoButtonLogic(pID, pText, Checked, pRect); + return UI()->DoButtonLogic(pID, Checked, pRect); // Draw here //return UI()->DoButton(id, text, checked, r, draw_func, 0); @@ -4445,7 +4445,7 @@ void CEditor::RenderFileDialog() static int s_ClearButton = 0; RenderTools()->DrawUIRect(&ClearBox, ColorRGBA(1, 1, 1, 0.33f * UI()->ButtonColorMul(&s_ClearButton)), CUI::CORNER_R, 3.0f); UI()->DoLabel(&ClearBox, "×", 10.0f, TEXTALIGN_CENTER); - if(UI()->DoButtonLogic(&s_ClearButton, "×", 0, &ClearBox)) + if(UI()->DoButtonLogic(&s_ClearButton, 0, &ClearBox)) { m_aFileDialogSearchText[0] = 0; UI()->SetActiveItem(&s_SearchBoxID);