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:
parent
a7c5de6ac3
commit
fff182b457
7 changed files with 27 additions and 34 deletions
11
gui.hpp
11
gui.hpp
|
@ -9,6 +9,8 @@
|
|||
|
||||
using std::string;
|
||||
|
||||
class Builder;
|
||||
|
||||
class SoundQuip {
|
||||
public:
|
||||
sf::Sound sound;
|
||||
|
@ -23,7 +25,7 @@ public:
|
|||
};
|
||||
|
||||
class GUI {
|
||||
std::vector<string> lines;
|
||||
std::vector<string> _lines;
|
||||
|
||||
SoundQuip you_died_sound;
|
||||
SoundQuip build_works_sound;
|
||||
|
@ -34,9 +36,12 @@ class GUI {
|
|||
|
||||
GUI();
|
||||
|
||||
void output(const string &msg);
|
||||
// FOUND BUG: adding this found that I was accidentally copying the gui, really it shouldn't be copyable
|
||||
GUI(GUI &g) = delete;
|
||||
|
||||
int main_loop(GameEngine &game, std::function<bool()> runner);
|
||||
void output(const string msg);
|
||||
|
||||
int main_loop(GameEngine &game, Builder &builder);
|
||||
|
||||
void build_works();
|
||||
void build_failed(bool play_sound, const string &command);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue