From 9468990f76d3de92844f22ab500ac425c5379314 Mon Sep 17 00:00:00 2001 From: "Zed A. Shaw" Date: Fri, 13 Jun 2025 10:46:05 -0400 Subject: [PATCH] DNDLoot works now, just had to fix a problem with the constructor. --- gui/dnd_loot.cpp | 5 ++--- gui/dnd_loot.hpp | 14 +++++++------- gui/fsm.cpp | 1 - main.cpp | 1 - 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/gui/dnd_loot.cpp b/gui/dnd_loot.cpp index 3a22963..bb8c0dc 100644 --- a/gui/dnd_loot.cpp +++ b/gui/dnd_loot.cpp @@ -1,11 +1,10 @@ -#define FSM_DEBUG 1 #include "gui/guecstra.hpp" #include "gui/dnd_loot.hpp" #include "gui/uisystems.hpp" namespace gui { - DNDLoot::DNDLoot(StatusUI status_ui, LootUI loot_ui, sf::RenderWindow &window, routing::Router& router) : + DNDLoot::DNDLoot(StatusUI& status_ui, LootUI& loot_ui, sf::RenderWindow &window, routing::Router& router) : $status_ui(status_ui), $loot_ui(loot_ui), $window(window), @@ -24,7 +23,7 @@ namespace gui { dbc::log(fmt::format("event received with data but state={} is not handled", int($state))); } - return in_state(DNDState::END); + return !in_state(DNDState::END); } void DNDLoot::START(Event ev) { diff --git a/gui/dnd_loot.hpp b/gui/dnd_loot.hpp index 11ab269..9eeb450 100644 --- a/gui/dnd_loot.hpp +++ b/gui/dnd_loot.hpp @@ -7,11 +7,11 @@ namespace gui { enum class DNDState { - START=0, - LOOTING=1, - LOOT_GRAB=2, - INV_GRAB=3, - END=4 + START=100, + LOOTING=101, + LOOT_GRAB=102, + INV_GRAB=103, + END=104 }; class DNDLoot : public DeadSimpleFSM { @@ -22,8 +22,8 @@ namespace gui { sf::RenderWindow& $window; routing::Router& $router; - DNDLoot(StatusUI status_ui, - LootUI loot_ui, sf::RenderWindow& window, + DNDLoot(StatusUI& status_ui, + LootUI& loot_ui, sf::RenderWindow& window, routing::Router& router); bool event(Event ev, std::any data={}); diff --git a/gui/fsm.cpp b/gui/fsm.cpp index 34b6962..a964ecd 100644 --- a/gui/fsm.cpp +++ b/gui/fsm.cpp @@ -1,4 +1,3 @@ -#define FSM_DEBUG 1 #include "gui/fsm.hpp" #include #include diff --git a/main.cpp b/main.cpp index 9ba9bfc..559a8e1 100644 --- a/main.cpp +++ b/main.cpp @@ -43,7 +43,6 @@ int main(int argc, char* argv[]) { main.handle_keyboard_mouse(); } } else{ - dbc::log("NOT IN STATE"); main.event(gui::Event::TICK); }