Make the game engine use a start/end round and do healing if you don't make any mistakes.
This commit is contained in:
parent
e35536c7e3
commit
c52bc8fafd
4 changed files with 25 additions and 8 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue