Refactored out the main_loop so that it's not tightly coupled inside builder, and in the process found I was accidentally copying GUI and GameEngine because Builder wasn't using a &ref for them. Now they don't have a copy constructor to catch that.

This commit is contained in:
Zed A. Shaw 2024-09-10 04:38:21 -04:00
parent a7c5de6ac3
commit fff182b457
7 changed files with 27 additions and 34 deletions

View file

@ -29,8 +29,9 @@ enum BuildEvent {
};
class Builder : DeadSimpleFSM<BuildState, BuildEvent> {
GUI gui;
GameEngine game;
// FOUND BUG: this was interesting, it got copied but the gui kept working until the refactor
GUI &gui;
GameEngine &game;
string git_path = "NOT SET";
string build_cmd = "NOT SET";
efsw::FileWatcher* fileWatcher = NULL;
@ -48,8 +49,6 @@ class Builder : DeadSimpleFSM<BuildState, BuildEvent> {
MatchResult parse_line(const string &line);
void run();
void event(BuildEvent ev) override {
try {
if(ev == QUIT) {