Logging for the FSM works better now.
This commit is contained in:
parent
0aeb5b4ceb
commit
40ba7f0b66
3 changed files with 3 additions and 4 deletions
3
fsm.hpp
3
fsm.hpp
|
@ -5,7 +5,7 @@
|
||||||
#ifndef FSM_DEBUG
|
#ifndef FSM_DEBUG
|
||||||
#define FSM_STATE(C, S, F, E) case C::S: F(E); break
|
#define FSM_STATE(C, S, F, E) case C::S: F(E); break
|
||||||
#else
|
#else
|
||||||
#define FSM_STATE_LOG(C, S, F, E) case C::S: fmt::println(">> " #C " " #S ":" #F " event={}, state={}", int(E), int(_state)); F(E); fmt::println("<< " #C " state={}", int(_state)); break
|
#define FSM_STATE(C, S, F, E) case C::S: fmt::println(">> " #C " " #S ":" #F " event={}, state={}", int(E), int(_state)); F(E); fmt::println("<< " #C " state={}", int(_state)); break
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
template<typename S, typename E>
|
template<typename S, typename E>
|
||||||
|
@ -18,7 +18,6 @@ public:
|
||||||
virtual void event(E event) = 0;
|
virtual void event(E event) = 0;
|
||||||
|
|
||||||
void state(S next_state) {
|
void state(S next_state) {
|
||||||
// fmt::println("STATE {}->{}", int(_state), int(next_state));
|
|
||||||
_state = next_state;
|
_state = next_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,6 @@
|
||||||
#include "game_engine.hpp"
|
#include "game_engine.hpp"
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
#define FSM_DEBUG 1
|
|
||||||
|
|
||||||
const auto ERROR = fmt::emphasis::bold | fg(fmt::color::red);
|
const auto ERROR = fmt::emphasis::bold | fg(fmt::color::red);
|
||||||
|
|
||||||
using namespace fmt;
|
using namespace fmt;
|
||||||
|
|
|
@ -3,10 +3,12 @@
|
||||||
BUGS:
|
BUGS:
|
||||||
* BUG: Log doesn't scroll.
|
* BUG: Log doesn't scroll.
|
||||||
* BUG: lots of errors crash it
|
* BUG: lots of errors crash it
|
||||||
|
* BUG: doesn't play you_died sound.
|
||||||
|
|
||||||
TODO:
|
TODO:
|
||||||
* Rewrite dbc.hpp to actually work.
|
* Rewrite dbc.hpp to actually work.
|
||||||
* Use parameter pack in FSM template
|
* Use parameter pack in FSM template
|
||||||
* Add a timer to the game engine so you can set a kind of pomodoro timer and if you don't meet the goal it costs you.
|
* Add a timer to the game engine so you can set a kind of pomodoro timer and if you don't meet the goal it costs you.
|
||||||
|
* Track the deaths.
|
||||||
|
|
||||||
https://en.cppreference.com/w/cpp/language/parameter_pack
|
https://en.cppreference.com/w/cpp/language/parameter_pack
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue