Remove commit_drop from status and loot UI since DropTarget already does that.

master
Zed A. Shaw 1 week ago
parent 343f3a246f
commit 7a551cf83a
  1. 8
      gui/fsm.cpp
  2. 10
      gui/loot_ui.cpp
  3. 1
      gui/loot_ui.hpp
  4. 6
      gui/status_ui.cpp
  5. 1
      gui/status_ui.hpp

@ -147,7 +147,9 @@ namespace gui {
auto gui_id = std::any_cast<DinkyECS::Entity>(data);
if($grab_source) {
if($status_ui.commit_drop(gui_id)) {
auto& drop = $status_ui.get_drop_target(gui_id);
if(drop.commit()) {
$loot_ui.commit_grab(*$grab_source);
$grab_source = std::nullopt;
}
@ -192,7 +194,9 @@ namespace gui {
auto gui_id = std::any_cast<DinkyECS::Entity>(data);
if($grab_source) {
if($loot_ui.commit_drop(gui_id)) {
auto& drop = $loot_ui.get_drop_target(gui_id);
if(drop.commit()) {
$status_ui.commit_grab(*$grab_source);
$grab_source = std::nullopt;
}

@ -125,14 +125,4 @@ namespace gui {
dbc::log("begin the loot drop");
$selected_entity = world_entity;
}
bool LootUI::commit_drop(DinkyECS::Entity gui_id) {
if($gui.has<guecs::DropTarget>(gui_id)) {
auto& drop = get_drop_target(gui_id);
return drop.commit();
} else {
// NOTE: I think I need to cancel the drop or something?
return false;
}
}
}

@ -30,7 +30,6 @@ namespace gui {
guecs::DropTarget& get_drop_target(DinkyECS::Entity gui_id);
void begin_drop(DinkyECS::Entity world_entity);
bool commit_drop(DinkyECS::Entity gui_id);
bool place_slot(DinkyECS::Entity id);
};
}

@ -104,12 +104,6 @@ namespace gui {
$selected_entity = world_entity;
}
bool StatusUI::commit_drop(DinkyECS::Entity gui_id) {
// BUG: just roll this into DropTarget
auto& drop = get_drop_target(gui_id);
return drop.commit();
}
guecs::GrabSource& StatusUI::get_grab_source(DinkyECS::Entity gui_id) {
dbc::check($gui.has<guecs::Sprite>(gui_id), "invalid GrabSource requested, entity isn't in the GUI.");

@ -32,7 +32,6 @@ namespace gui {
guecs::DropTarget& get_drop_target(DinkyECS::Entity gui_id);
void begin_drop(DinkyECS::Entity world_entity);
bool commit_drop(DinkyECS::Entity gui_id);
bool place_slot(DinkyECS::Entity gui_id);
};
}

Loading…
Cancel
Save