Fix a bug where a failinb build that causes death would play both the death sound and build failed sound.

master
Zed A. Shaw 3 months ago
parent e8163bbeaf
commit fee724e637
  1. 3
      builder.cpp
  2. 8
      gui.cpp
  3. 2
      gui.hpp

@ -88,7 +88,8 @@ void Builder::run_build() {
if(rc == 0) { if(rc == 0) {
gui.build_works(); gui.build_works();
} else { } else {
gui.build_failed(build_cmd); gui.output(format(">>>>>>>> DIED? {}", game.is_dead()));
gui.build_failed(!game.is_dead(), build_cmd);
} }
stats_out.close(); stats_out.close();

@ -139,9 +139,13 @@ void GUI::build_works() {
output("BUILD FINISHED!"); output("BUILD FINISHED!");
} }
void GUI::build_failed(const string &command) { void GUI::build_failed(bool play_sound, const string &command) {
building_sound.stop(); building_sound.stop();
build_failed_sound.play();
if(play_sound) {
build_failed_sound.play();
}
output(format("!!! BUILD FAILED. Your command correct? '{}'", command)); output(format("!!! BUILD FAILED. Your command correct? '{}'", command));
} }

@ -37,7 +37,7 @@ class GUI {
int main_loop(GameEngine &game, std::function<bool()> runner); int main_loop(GameEngine &game, std::function<bool()> runner);
void build_works(); void build_works();
void build_failed(const string &command); void build_failed(bool play_sound, const string &command);
void you_died(); void you_died();
void building(); void building();
}; };

Loading…
Cancel
Save