Remove commit_drop from status and loot UI since DropTarget already does that.
This commit is contained in:
parent
343f3a246f
commit
7a551cf83a
5 changed files with 6 additions and 20 deletions
|
@ -147,7 +147,9 @@ namespace gui {
|
||||||
auto gui_id = std::any_cast<DinkyECS::Entity>(data);
|
auto gui_id = std::any_cast<DinkyECS::Entity>(data);
|
||||||
|
|
||||||
if($grab_source) {
|
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);
|
$loot_ui.commit_grab(*$grab_source);
|
||||||
$grab_source = std::nullopt;
|
$grab_source = std::nullopt;
|
||||||
}
|
}
|
||||||
|
@ -192,7 +194,9 @@ namespace gui {
|
||||||
auto gui_id = std::any_cast<DinkyECS::Entity>(data);
|
auto gui_id = std::any_cast<DinkyECS::Entity>(data);
|
||||||
|
|
||||||
if($grab_source) {
|
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);
|
$status_ui.commit_grab(*$grab_source);
|
||||||
$grab_source = std::nullopt;
|
$grab_source = std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,14 +125,4 @@ namespace gui {
|
||||||
dbc::log("begin the loot drop");
|
dbc::log("begin the loot drop");
|
||||||
$selected_entity = world_entity;
|
$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);
|
guecs::DropTarget& get_drop_target(DinkyECS::Entity gui_id);
|
||||||
void begin_drop(DinkyECS::Entity world_entity);
|
void begin_drop(DinkyECS::Entity world_entity);
|
||||||
bool commit_drop(DinkyECS::Entity gui_id);
|
|
||||||
bool place_slot(DinkyECS::Entity id);
|
bool place_slot(DinkyECS::Entity id);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,12 +104,6 @@ namespace gui {
|
||||||
$selected_entity = world_entity;
|
$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) {
|
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.");
|
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);
|
guecs::DropTarget& get_drop_target(DinkyECS::Entity gui_id);
|
||||||
void begin_drop(DinkyECS::Entity world_entity);
|
void begin_drop(DinkyECS::Entity world_entity);
|
||||||
bool commit_drop(DinkyECS::Entity gui_id);
|
|
||||||
bool place_slot(DinkyECS::Entity gui_id);
|
bool place_slot(DinkyECS::Entity gui_id);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue