Skip to content

Commit f6edc16

Browse files
committed
Fix inventory/paperdoll panels switching during stealing
Closes #65
1 parent 848371b commit f6edc16

File tree

1 file changed

+26
-18
lines changed

1 file changed

+26
-18
lines changed

src/ui/inven_ui.c

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2129,25 +2129,33 @@ bool inven_ui_message_filter(TigMessage* msg)
21292129

21302130
switch (msg->type) {
21312131
case TIG_MESSAGE_BUTTON:
2132-
switch (msg->data.button.state) {
2133-
case TIG_BUTTON_STATE_PRESSED:
2134-
// 0x573897
2135-
if (inven_ui_message_filter_handle_button_pressed(msg)) {
2136-
return true;
2137-
}
2138-
break;
2139-
case TIG_BUTTON_STATE_RELEASED:
2140-
// 0x573A95
2141-
if (inven_ui_message_filter_handle_button_released(msg)) {
2142-
return true;
2143-
}
2144-
break;
2145-
case TIG_BUTTON_STATE_MOUSE_INSIDE:
2146-
// 0x573BAF
2147-
if (inven_ui_mssage_filter_handle_button_hovered(msg)) {
2148-
return true;
2132+
// CE: Ignore button events while dragging an item to steal it. This
2133+
// prevents handling press events that would switch between the
2134+
// inventory and paperdoll panels (these buttons form a radio group and
2135+
// use the "pressed" event as their main handler, not "released" as with
2136+
// usual buttons).
2137+
if (!(inven_ui_mode == INVEN_UI_MODE_STEAL
2138+
&& inven_ui_drag_item_obj != OBJ_HANDLE_NULL)) {
2139+
switch (msg->data.button.state) {
2140+
case TIG_BUTTON_STATE_PRESSED:
2141+
// 0x573897
2142+
if (inven_ui_message_filter_handle_button_pressed(msg)) {
2143+
return true;
2144+
}
2145+
break;
2146+
case TIG_BUTTON_STATE_RELEASED:
2147+
// 0x573A95
2148+
if (inven_ui_message_filter_handle_button_released(msg)) {
2149+
return true;
2150+
}
2151+
break;
2152+
case TIG_BUTTON_STATE_MOUSE_INSIDE:
2153+
// 0x573BAF
2154+
if (inven_ui_mssage_filter_handle_button_hovered(msg)) {
2155+
return true;
2156+
}
2157+
break;
21492158
}
2150-
break;
21512159
}
21522160
break;
21532161
case TIG_MESSAGE_MOUSE:

0 commit comments

Comments
 (0)