|
|
@ -111,8 +111,8 @@ namespace gui { |
|
|
|
switch(ev) { |
|
|
|
switch(ev) { |
|
|
|
case AIM_CLICK: { |
|
|
|
case AIM_CLICK: { |
|
|
|
// take from inventory, drop on floor
|
|
|
|
// take from inventory, drop on floor
|
|
|
|
bool worked = throw_on_floor($status_ui.$gui, true); |
|
|
|
throw_on_floor($status_ui.$gui, true); |
|
|
|
if(worked) END(CLOSE); |
|
|
|
END(CLOSE); |
|
|
|
} break; |
|
|
|
} break; |
|
|
|
case INV_SELECT: { |
|
|
|
case INV_SELECT: { |
|
|
|
auto drop_id = std::any_cast<guecs::Entity>(data); |
|
|
|
auto drop_id = std::any_cast<guecs::Entity>(data); |
|
|
@ -137,8 +137,8 @@ namespace gui { |
|
|
|
break; |
|
|
|
break; |
|
|
|
case AIM_CLICK: { |
|
|
|
case AIM_CLICK: { |
|
|
|
// THIS IS PUT IT BACK ON THE FLOOR
|
|
|
|
// THIS IS PUT IT BACK ON THE FLOOR
|
|
|
|
bool worked = throw_on_floor($loot_ui.$gui, false); |
|
|
|
throw_on_floor($loot_ui.$gui, false); |
|
|
|
if(worked) END(CLOSE); |
|
|
|
END(CLOSE); |
|
|
|
} break; |
|
|
|
} break; |
|
|
|
default: |
|
|
|
default: |
|
|
|
handle_mouse(ev, $loot_ui.$gui); |
|
|
|
handle_mouse(ev, $loot_ui.$gui); |
|
|
@ -282,27 +282,21 @@ namespace gui { |
|
|
|
* Dropping on the ground is only possible from the |
|
|
|
* Dropping on the ground is only possible from the |
|
|
|
* status_ui for now. |
|
|
|
* status_ui for now. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
bool DNDLoot::throw_on_floor(guecs::UI& gui, bool from_status) { |
|
|
|
void DNDLoot::throw_on_floor(guecs::UI& gui, bool from_status) { |
|
|
|
dbc::check($grab_source != std::nullopt, "attempt to commit_drop but no grab_source set"); |
|
|
|
dbc::check($grab_source != std::nullopt, "attempt to commit_drop but no grab_source set"); |
|
|
|
dbc::check(gui.has<guecs::GrabSource>(*$grab_source), |
|
|
|
dbc::check(gui.has<guecs::GrabSource>(*$grab_source), |
|
|
|
"StatusUI doesn't actually have that GrabSource in the gui."); |
|
|
|
"StatusUI doesn't actually have that GrabSource in the gui."); |
|
|
|
|
|
|
|
|
|
|
|
auto& grab = gui.get<guecs::GrabSource>(*$grab_source); |
|
|
|
auto& grab = gui.get<guecs::GrabSource>(*$grab_source); |
|
|
|
|
|
|
|
|
|
|
|
bool result = false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(from_status) { |
|
|
|
if(from_status) { |
|
|
|
result = $status_ui.drop_item(grab.world_entity); |
|
|
|
$status_ui.drop_item(grab.world_entity); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
result = $loot_ui.drop_item(grab.world_entity); |
|
|
|
$loot_ui.drop_item(grab.world_entity); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(result) { |
|
|
|
|
|
|
|
grab.commit(); |
|
|
|
|
|
|
|
clear_grab(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return result; |
|
|
|
grab.commit(); |
|
|
|
|
|
|
|
clear_grab(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|