|
|
|
@ -40,7 +40,7 @@ void Builder::run_build(GameEngine &game, const char* command) { |
|
|
|
|
FILE *build_out = popen(command, "r"); |
|
|
|
|
dbc::check(build_out != nullptr, "Failed to run command."); |
|
|
|
|
|
|
|
|
|
int hit_count = 0; |
|
|
|
|
game.start_round(); |
|
|
|
|
|
|
|
|
|
while(fgets(buffer, BUF_MAX, build_out) != nullptr) { |
|
|
|
|
string line(buffer); // yeah, that's probably a problem
|
|
|
|
@ -63,7 +63,6 @@ void Builder::run_build(GameEngine &game, const char* command) { |
|
|
|
|
gui.output(format("\nHIT WITH {} @ {}:{}:{} {}", type, file_name, lnumber, col, message)); |
|
|
|
|
|
|
|
|
|
game.hit(type); |
|
|
|
|
++hit_count; |
|
|
|
|
|
|
|
|
|
// refactor this
|
|
|
|
|
if(game.is_dead()) { |
|
|
|
@ -72,9 +71,7 @@ void Builder::run_build(GameEngine &game, const char* command) { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if(hit_count == 0) { |
|
|
|
|
game.heal(10); |
|
|
|
|
} |
|
|
|
|
game.end_round(); |
|
|
|
|
|
|
|
|
|
int rc = pclose(build_out); |
|
|
|
|
if(rc == 0) { |
|
|
|
|