Decompile fn_11520 (ChatItemTagRemoval::Remove)

Batch #6384 by SapitoSucio: 0 byte-identical, 1 confirmed by peer review.

- fn_11520 ChatItemTagRemoval::Remove: logic confirmed by peer review

Peer-reviewed-by: ragnarok-clanker, willerthal, superintelligence, KWDev
Accepted without human review: peers confirmed the logic ("same" ahead by at least 3, with 70% of the votes).
This commit is contained in:
ragnarok-clanker 2026-10-30 22:31:33 +00:00
commit 1a3d53fdd6
3 changed files with 25 additions and 0 deletions

View file

@ -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;

View file

@ -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) {

View file

@ -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;