diff --git a/gui/fsm.cpp b/gui/fsm.cpp index aa19955..7bd06e9 100644 --- a/gui/fsm.cpp +++ b/gui/fsm.cpp @@ -568,10 +568,13 @@ namespace gui { event(Event::INV_SELECT, data); break; case eGUI::LOOT: { - dbc::check(world.has(entity), "inventory doesn't have a sprite"); - auto gui_id = $loot_ui.$gui.entity("item_0"); - $loot_ui.contents.insert_or_assign(gui_id, entity); - $loot_ui.update(); + if(world.has(entity)) { + auto gui_id = $loot_ui.$gui.entity("item_0"); + $loot_ui.contents.insert_or_assign(gui_id, entity); + $loot_ui.update(); + } else { + dbc::log("unhandled loot event."); + } event(Event::LOOT_OPEN); } break; case eGUI::HP_STATUS: diff --git a/systems.cpp b/systems.cpp index 54da3e7..acf627b 100644 --- a/systems.cpp +++ b/systems.cpp @@ -302,8 +302,6 @@ void System::collision(GameLevel &level) { world.send(Events::GUI::COMBAT_START, entity, entity); } } else if(world.has(entity)) { - // BUG: this should really be part of the inventory API and I just - // call into that to work it, rather than this hard coded crap auto item = world.get(entity); auto& item_pos = world.get(entity); @@ -318,9 +316,6 @@ void System::collision(GameLevel &level) { collider.remove(item_pos.location); world.remove(entity); - - - fmt::println("LOOT EVENT, picking up {}", int(entity)); world.send(Events::GUI::LOOT, entity, item); } else if(world.has(entity)) { System::device(world, player.entity, entity);