diff --git a/Source/UI/Chat/ChatSuggestions.h b/Source/UI/Chat/ChatSuggestions.h index 296c7f65..be3dd0bd 100644 --- a/Source/UI/Chat/ChatSuggestions.h +++ b/Source/UI/Chat/ChatSuggestions.h @@ -15,6 +15,8 @@ struct ChatSuggestions { UIWindow& chat; UIWindow* const& window; UIEditCtrl* const& input; + /* 000C */ unsigned char unknown_000C[0xB0]; + /* 00BC */ UIWindow* unknown_00BC; bool Visible() const; @@ -22,6 +24,7 @@ struct ChatSuggestions { }; extern ChatSuggestions* g_chatSuggestions; +extern bool g_inputSuggestionsEnabled; struct ChatInputLayout { UIWindow& chat; diff --git a/Source/UI/Edit/ItemTagRetirement.cpp b/Source/UI/Edit/ItemTagRetirement.cpp index 7c3510a5..4d1ef6cb 100644 --- a/Source/UI/Edit/ItemTagRetirement.cpp +++ b/Source/UI/Edit/ItemTagRetirement.cpp @@ -1,3 +1,4 @@ +#include "UI/Chat/ChatSuggestions.h" #include "UI/Window/InputFocus.h" #include "UI/Edit/ItemTagRetirement.h" #include "UI/Edit/UIItemTagCtrl.h" @@ -10,6 +11,9 @@ FocusedItemTagRemoval::FocusedItemTagRemoval(InputFocus& focus) : m_focus(focus) { } +// GLOBAL: gl_24635 +bool g_inputSuggestionsEnabled; + // OFFSET: 0x00896EB0 // FUNCTION: fn_11519 void FocusedItemTagRemoval::Remove(UIWindow* child) { @@ -18,6 +22,20 @@ void FocusedItemTagRemoval::Remove(UIWindow* child) { } } +// OFFSET: 0x00896EE0 +// FUNCTION: fn_11520 +void ChatItemTagRemoval::Remove(UIWindow* child) { + if (g_inputSuggestionsEnabled == 1 && g_chatSuggestions->unknown_00BC != nullptr && g_chatSuggestions->unknown_00BC->Contains(child)) { + g_chatSuggestions->unknown_00BC->RemoveChild(child, 1); + return; + } + + UIWindow* hoverWindow = g_windowMgr.GetHoverWindow(); + if (hoverWindow != nullptr && hoverWindow->Contains(child)) { + hoverWindow->RemoveChild(child, 1); + } +} + // OFFSET: 0x00879830 // FUNCTION: fn_11218 bool UIItemTagOnChat::CanInsertTag(const std::string& name, int width) { diff --git a/Source/UI/Edit/ItemTagRetirement.h b/Source/UI/Edit/ItemTagRetirement.h index 4bb5f239..444a8640 100644 --- a/Source/UI/Edit/ItemTagRetirement.h +++ b/Source/UI/Edit/ItemTagRetirement.h @@ -31,6 +31,10 @@ private: InputFocus& m_focus; }; +struct ChatItemTagRemoval final : ItemTagRemoval { + void Remove(UIWindow* child) override; +}; + struct MailItemTagRemoval final : ItemTagRemoval { explicit MailItemTagRemoval(UIWindow* const& owner); void Remove(UIWindow* child) override;