diff --git a/Source/UI/Buttons/UITextButton.cpp b/Source/UI/Buttons/UITextButton.cpp index dcbc916b..fbbbd901 100644 --- a/Source/UI/Buttons/UITextButton.cpp +++ b/Source/UI/Buttons/UITextButton.cpp @@ -2916,7 +2916,7 @@ void UIItemTagButton::Slot25(int x, int y) { return; } - if (x < 0 || this->geometry.width <= x || y < 0 || this->geometry.height <= y) { + if (x < 0 || x >= this->geometry.width || y < 0 || y >= this->geometry.height) { this->geometry.unknown_0030 = 0; } else { this->geometry.unknown_0030 = 1; diff --git a/Source/UI/Party/UIRegisterPartyWnd.cpp b/Source/UI/Party/UIRegisterPartyWnd.cpp index df349052..5d5fddd8 100644 --- a/Source/UI/Party/UIRegisterPartyWnd.cpp +++ b/Source/UI/Party/UIRegisterPartyWnd.cpp @@ -221,7 +221,7 @@ void UIRegisterPartyWnd::NormalizeLevels() { if (!Digits(text)) { char number[10] = {}; - StringFormat(number, sizeof(number), _TRUNCATE, "%d", std::max(level - 5, 1)); + StringFormat(number, sizeof(number), _TRUNCATE, "%d", level - 5 > 1 ? level - 5 : 1); this->minimum->SetText(number); } diff --git a/Source/UI/ProbabilityTable/UIProbabilityTable.cpp b/Source/UI/ProbabilityTable/UIProbabilityTable.cpp index 4c319b74..dc46daf5 100644 --- a/Source/UI/ProbabilityTable/UIProbabilityTable.cpp +++ b/Source/UI/ProbabilityTable/UIProbabilityTable.cpp @@ -109,11 +109,12 @@ void ProbabilityTableSelectCallback::operator()(CUIListItem* const& item) { if (selectedItem->index != static_cast(list->selected) || !list->unknown_00E0) { ProbabilityTable::CUIItem* probabilityItem = dynamic_cast(selectedItem); if (probabilityItem) { - list->selected = probabilityItem->index; - if (list->onSelect && probabilityItem->index >= 0 && - static_cast(probabilityItem->index) < list->data.size()) { + const int selectedIndex = probabilityItem->index; + list->selected = selectedIndex; + if (list->onSelect && selectedIndex >= 0 && + static_cast(selectedIndex) < list->data.size()) { auto node = list->data.begin(); - for (int index = probabilityItem->index; index > 0; --index) { + for (int index = selectedIndex; index > 0; --index) { ++node; } list->onSelect(probabilityItem, *node); diff --git a/Source/UI/RuneSystem/UIRuneSystemWnd.cpp b/Source/UI/RuneSystem/UIRuneSystemWnd.cpp index 31686ba9..819ba686 100644 --- a/Source/UI/RuneSystem/UIRuneSystemWnd.cpp +++ b/Source/UI/RuneSystem/UIRuneSystemWnd.cpp @@ -442,12 +442,12 @@ void UIRuneSet_Info::Slot28(int x, int y) { // OFFSET: 0x0081C960 // FUNCTION: fn_10210 void UIRuneSystem_tagListWnd::Slot28(int x, int) { - if (x < 20 || x > this->geometry.width - 23) { + if (x < 20 || this->geometry.width - 23 < x) { return; } const int index = (x - 20) / 27; - if (index > -1 && index < g_runeSystemMgr->GetTagCount()) { + if (index > -1 && g_runeSystemMgr->GetTagCount() > index) { std::string name = g_runeSystemMgr->GetTagByIndex(index)->m_name; if (!name.empty()) { int screenX = index * 24 + 19; diff --git a/Source/UI/SelectPackageItemBox/UISelectPackageItemBox.cpp b/Source/UI/SelectPackageItemBox/UISelectPackageItemBox.cpp index b61251c1..80dcd110 100644 --- a/Source/UI/SelectPackageItemBox/UISelectPackageItemBox.cpp +++ b/Source/UI/SelectPackageItemBox/UISelectPackageItemBox.cpp @@ -477,10 +477,11 @@ void ListSelectCallback::operator( return; } - list->selected = selectedItem->index; - if (list->onSelect && selectedItem->index >= 0 && static_cast(selectedItem->index) < list->data.size()) { + const int selectedIndex = selectedItem->index; + list->selected = selectedIndex; + if (list->onSelect && selectedIndex >= 0 && static_cast(selectedIndex) < list->data.size()) { auto node = list->data.begin(); - for (int index = selectedItem->index; index > 0; --index) { + for (int index = selectedIndex; index > 0; --index) { ++node; } list->onSelect(selectedItem, *node); @@ -513,10 +514,11 @@ void ListSelectCallbackselected = selectedTab->index; - if (list->onSelect && selectedTab->index >= 0 && static_cast(selectedTab->index) < list->data.size()) { + const int selectedIndex = selectedTab->index; + list->selected = selectedIndex; + if (list->onSelect && selectedIndex >= 0 && static_cast(selectedIndex) < list->data.size()) { auto node = list->data.begin(); - for (int index = selectedTab->index; index > 0; --index) { + for (int index = selectedIndex; index > 0; --index) { ++node; } list->onSelect(selectedTab, *node); diff --git a/Source/UI/SkillDelayInfo/UISkillDelayInfo.cpp b/Source/UI/SkillDelayInfo/UISkillDelayInfo.cpp index 3ee5dac3..d3b632e2 100644 --- a/Source/UI/SkillDelayInfo/UISkillDelayInfo.cpp +++ b/Source/UI/SkillDelayInfo/UISkillDelayInfo.cpp @@ -393,10 +393,11 @@ void SkillDelayInfoSelectCallback::operator()(CUIListItem* const& item) { if (!delayItem) { return; } - list->selected = delayItem->index; - if (list->onSelect && delayItem->index >= 0 && static_cast(delayItem->index) < list->data.size()) { + const int selectedIndex = delayItem->index; + list->selected = selectedIndex; + if (list->onSelect && selectedIndex >= 0 && static_cast(selectedIndex) < list->data.size()) { auto node = list->data.begin(); - for (int index = delayItem->index; index > 0; --index) { + for (int index = selectedIndex; index > 0; --index) { ++node; } list->onSelect(delayItem, *node); diff --git a/Source/UI/Window/UINavigationHelpWnd.cpp b/Source/UI/Window/UINavigationHelpWnd.cpp index d3729cef..a11a991d 100644 --- a/Source/UI/Window/UINavigationHelpWnd.cpp +++ b/Source/UI/Window/UINavigationHelpWnd.cpp @@ -11,39 +11,39 @@ void UINavigationHelpWnd::Slot15(int width, int height) { this->m_viewer = new UITextViewer(); this->m_viewer->Configure(5, 22, width - 10, height - 27, 0); - this->m_viewer->backgroundRed = 0xd2; - this->m_viewer->backgroundGreen = 0xd2; this->m_viewer->backgroundBlue = 0xd2; + this->m_viewer->backgroundGreen = 0xd2; + this->m_viewer->backgroundRed = 0xd2; this->AddChild(this->m_viewer); this->m_viewer->SendMsg(nullptr, 29, reinterpret_cast(LookupMessage(2241)), 0x30, 0, 0); - this->m_viewer->SendMsg(nullptr, 29, reinterpret_cast(""), 0x30, 0, 0); + this->m_viewer->SendMsg(nullptr, 29, reinterpret_cast(" "), 0x30, 0, 0); this->m_viewer->SendMsg(nullptr, 29, reinterpret_cast(LookupMessage(2242)), 0x30, 0, 0); this->m_viewer->SendMsg(nullptr, 29, reinterpret_cast(LookupMessage(2243)), 0x30, 0, 0); this->m_viewer->SendMsg(nullptr, 29, reinterpret_cast(LookupMessage(2244)), 0x30, 0, 0); - this->m_viewer->SendMsg(nullptr, 29, reinterpret_cast(""), 0x30, 0, 0); + this->m_viewer->SendMsg(nullptr, 29, reinterpret_cast(" "), 0x30, 0, 0); this->m_viewer->SendMsg(nullptr, 29, reinterpret_cast(LookupMessage(2245)), 0x30, 0, 0); this->m_viewer->SendMsg(nullptr, 29, reinterpret_cast(LookupMessage(2246)), 0x30, 0, 0); this->m_viewer->SendMsg(nullptr, 29, reinterpret_cast(LookupMessage(2247)), 0x30, 0, 0); - this->m_viewer->SendMsg(nullptr, 29, reinterpret_cast(""), 0x30, 0, 0); + this->m_viewer->SendMsg(nullptr, 29, reinterpret_cast(" "), 0x30, 0, 0); this->m_viewer->SendMsg(nullptr, 29, reinterpret_cast(LookupMessage(2248)), 0x30, 0, 0); - this->m_viewer->SendMsg(nullptr, 29, reinterpret_cast(""), 0x30, 0, 0); + this->m_viewer->SendMsg(nullptr, 29, reinterpret_cast(" "), 0x30, 0, 0); this->m_viewer->SendMsg(nullptr, 29, reinterpret_cast(LookupMessage(2249)), 0x30, 0, 0); - this->m_viewer->SendMsg(nullptr, 29, reinterpret_cast(""), 0x30, 0, 0); + this->m_viewer->SendMsg(nullptr, 29, reinterpret_cast(" "), 0x30, 0, 0); this->m_viewer->SendMsg(nullptr, 29, reinterpret_cast(LookupMessage(2250)), 0x30, 0, 0); - this->m_viewer->SendMsg(nullptr, 29, reinterpret_cast(""), 0x30, 0, 0); + this->m_viewer->SendMsg(nullptr, 29, reinterpret_cast(" "), 0x30, 0, 0); this->m_viewer->SendMsg(nullptr, 29, reinterpret_cast(LookupMessage(2251)), 0x30, 0, 0); - this->m_viewer->SendMsg(nullptr, 29, reinterpret_cast(""), 0x30, 0, 0); + this->m_viewer->SendMsg(nullptr, 29, reinterpret_cast(" "), 0x30, 0, 0); this->m_viewer->SendMsg(nullptr, 29, reinterpret_cast(LookupMessage(2252)), 0x30, 0, 0); - this->m_viewer->SendMsg(nullptr, 29, reinterpret_cast(""), 0x30, 0, 0); + this->m_viewer->SendMsg(nullptr, 29, reinterpret_cast(" "), 0x30, 0, 0); this->m_viewer->SendMsg(nullptr, 29, reinterpret_cast(LookupMessage(2253)), 0x30, 0, 0); this->m_viewer->SendMsg(nullptr, 29, reinterpret_cast(LookupMessage(2254)), 0x30, 0, 0); - this->m_viewer->SendMsg(nullptr, 29, reinterpret_cast(""), 0x30, 0, 0); + this->m_viewer->SendMsg(nullptr, 29, reinterpret_cast(" "), 0x30, 0, 0); this->m_viewer->SendMsg(nullptr, 29, reinterpret_cast(LookupMessage(2255)), 0x30, 0, 0); this->m_viewer->SendMsg(nullptr, 29, reinterpret_cast(LookupMessage(2256)), 0x30, 0, 0); - this->m_viewer->SendMsg(nullptr, 29, reinterpret_cast(""), 0x30, 0, 0); + this->m_viewer->SendMsg(nullptr, 29, reinterpret_cast(" "), 0x30, 0, 0); this->m_viewer->SendMsg(nullptr, 29, reinterpret_cast(LookupMessage(3216)), 0x30, 0, 0); - this->m_viewer->SendMsg(nullptr, 29, reinterpret_cast(""), 0x30, 0, 0); + this->m_viewer->SendMsg(nullptr, 29, reinterpret_cast(" "), 0x30, 0, 0); this->m_viewer->SendMsg(nullptr, 29, reinterpret_cast(LookupMessage(3217)), 0x30, 0, 0); this->m_viewer->SendMsg(nullptr, 29, reinterpret_cast(LookupMessage(3218)), 0x30, 0, 0); diff --git a/Source/UI/Window/UIWindow.cpp b/Source/UI/Window/UIWindow.cpp index 5325150f..da75b936 100644 --- a/Source/UI/Window/UIWindow.cpp +++ b/Source/UI/Window/UIWindow.cpp @@ -550,8 +550,7 @@ void UIWindow::Slot43() { // OFFSET: 0x005C4480 // FUNCTION: fn_03560 std::vector UIWindow::Slot44() { - std::vector result; - return result; + return std::vector(); } // OFFSET: 0x005C8F60 @@ -3448,8 +3447,9 @@ void UINavigationV4Wnd::SelectRouteNode(int node) { g_navigationManager.SelectNodeState(); } - this->unknown_00F0->selected = g_navigationManager.unknown_12C8; - this->unknown_00F0->Invalidate(); + UIListBox_NaviSearch* list = this->unknown_00F0; + list->selected = g_navigationManager.unknown_12C8; + list->Invalidate(); if (g_windowMgr.modal) { reinterpret_cast(g_windowMgr.modal)->RefreshWorldMapSelection(); }