Fixed the problem where the only way to complete a grab/drop operation was to capture the MOUSE_CLICK directly. Solution was to move the mouse processing out of DNDLoot and only handle the MOUSE_MOVE/DRAG.

This commit is contained in:
Zed A. Shaw 2025-06-24 11:33:37 -04:00
parent 6a72d1160f
commit f559b5a39d
6 changed files with 32 additions and 43 deletions

View file

@ -93,7 +93,6 @@ namespace gui {
state(State::IN_COMBAT);
} break;
case STOP_COMBAT:
dbc::log("Exiting ATTACKING STATE");
state(State::IDLE);
break;
case ATTACK:
@ -118,8 +117,18 @@ namespace gui {
}
void FSM::LOOTING(Event ev, std::any data) {
if(!$dnd_loot.event(ev, data)) {
state(State::IDLE);
using enum Event;
switch(ev) {
case MOUSE_DRAG_START:
case MOUSE_CLICK:
case MOUSE_DROP:
mouse_action(false);
break;
default:
if(!$dnd_loot.event(ev, data)) {
state(State::IDLE);
}
}
}
@ -278,6 +287,7 @@ namespace gui {
if($debug_ui.active) $debug_ui.mouse(pos.x, pos.y, hover);
$combat_ui.mouse(pos.x, pos.y, hover);
$status_ui.mouse(pos.x, pos.y, hover);
if($loot_ui.active) {
$loot_ui.mouse(pos.x, pos.y, hover);
} else {
@ -459,7 +469,8 @@ namespace gui {
fmt::println("clicked on a thing: {}", aimed_at);
System::pickup($level, aimed_at);
} else {
dbc::log("there's no thing there!");
fmt::println("SENDING AIM_CLICK");
event(Event::AIM_CLICK);
}
break;
case eGUI::LOOT_ITEM: {