|
|
@ -107,7 +107,8 @@ namespace gui { |
|
|
|
|
|
|
|
|
|
|
|
switch(ev) { |
|
|
|
switch(ev) { |
|
|
|
case AIM_CLICK: { |
|
|
|
case AIM_CLICK: { |
|
|
|
bool worked = throw_on_floor(); |
|
|
|
// take from inventory, drop on floor
|
|
|
|
|
|
|
|
bool worked = throw_on_floor($status_ui.$gui, true); |
|
|
|
dbc::check(worked, "Need to fix this, should be able to abort."); |
|
|
|
dbc::check(worked, "Need to fix this, should be able to abort."); |
|
|
|
END(CLOSE); |
|
|
|
END(CLOSE); |
|
|
|
} break; |
|
|
|
} break; |
|
|
@ -137,12 +138,12 @@ namespace gui { |
|
|
|
END(CLOSE); |
|
|
|
END(CLOSE); |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
case AIM_CLICK: |
|
|
|
case AIM_CLICK: { |
|
|
|
// BUG: because I put things into fake loot containers it's actually
|
|
|
|
// THIS IS PUT IT BACK ON THE FLOOR
|
|
|
|
// hard to put things back. It's probably a System::remove from the
|
|
|
|
bool worked = throw_on_floor($loot_ui.$gui, false); |
|
|
|
// loot container combined with a System::drop_item
|
|
|
|
dbc::check(worked, "Failed to drop it back on the floor."); |
|
|
|
dbc::log("Put it back?"); |
|
|
|
END(CLOSE); |
|
|
|
break; |
|
|
|
} break; |
|
|
|
default: |
|
|
|
default: |
|
|
|
handle_mouse(ev, $loot_ui.$gui); |
|
|
|
handle_mouse(ev, $loot_ui.$gui); |
|
|
|
} |
|
|
|
} |
|
|
@ -174,7 +175,7 @@ namespace gui { |
|
|
|
case TICK: // ignored
|
|
|
|
case TICK: // ignored
|
|
|
|
break; |
|
|
|
break; |
|
|
|
default: |
|
|
|
default: |
|
|
|
dbc::sentinel(fmt::format("invalid event: {}", int(ev))); |
|
|
|
dbc::log(fmt::format("invalid event: {}", int(ev))); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -296,15 +297,22 @@ 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() { |
|
|
|
bool 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($status_ui.$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 = $status_ui.$gui.get<guecs::GrabSource>(*$grab_source); |
|
|
|
auto& grab = gui.get<guecs::GrabSource>(*$grab_source); |
|
|
|
grab.commit(); |
|
|
|
grab.commit(); |
|
|
|
|
|
|
|
|
|
|
|
bool result = $status_ui.drop_item(grab.world_entity); |
|
|
|
bool result = false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(from_status) { |
|
|
|
|
|
|
|
result = $status_ui.drop_item(grab.world_entity); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
result = $loot_ui.drop_item(grab.world_entity); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
clear_grab(); |
|
|
|
clear_grab(); |
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|