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