Trying out Ragel's state machine generation as an alternative to the DinkyFSM style.
This commit is contained in:
parent
9468990f76
commit
7fc32b0248
10 changed files with 428 additions and 19 deletions
16
gui/fsm.cpp
16
gui/fsm.cpp
|
@ -116,8 +116,6 @@ namespace gui {
|
|||
void FSM::LOOTING(Event ev, std::any data) {
|
||||
if(!$dnd_loot.event(ev, data)) {
|
||||
state(State::IDLE);
|
||||
} else {
|
||||
dbc::log("!!!!!!!!! LOOTING ENDED!");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -168,9 +166,12 @@ namespace gui {
|
|||
sound::stop("ambient");
|
||||
state(State::NEXT_LEVEL);
|
||||
break;
|
||||
case LOOT_ITEM:
|
||||
$dnd_loot.event(Event::LOOT_ITEM);
|
||||
state(State::LOOTING);
|
||||
break;
|
||||
case LOOT_OPEN:
|
||||
$dnd_loot.event(Event::STARTED);
|
||||
$loot_ui.active = true;
|
||||
$dnd_loot.event(Event::LOOT_OPEN);
|
||||
state(State::LOOTING);
|
||||
break;
|
||||
case INV_SELECT:
|
||||
|
@ -457,13 +458,10 @@ namespace gui {
|
|||
auto gui_id = $loot_ui.$gui.entity("item_0");
|
||||
$loot_ui.contents.insert_or_assign(gui_id, entity);
|
||||
$loot_ui.update();
|
||||
event(Event::LOOT_OPEN);
|
||||
event(Event::LOOT_ITEM);
|
||||
} break;
|
||||
case eGUI::LOOT_CONTAINER: {
|
||||
dbc::check(world.has<components::InventoryItem>(entity),
|
||||
"INVALID LOOT_ITEM, that entity has no InventoryItem");
|
||||
|
||||
dbc::log("everything is empty for now");
|
||||
dbc::log("YEP container works.");
|
||||
event(Event::LOOT_OPEN);
|
||||
} break;
|
||||
case eGUI::HP_STATUS:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue