Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Make the soldiers who aren't patrolling attack the enemy
- for (int i = NUM_SOLDIERS / 2; i < NUM_SOLDIERS; ++i) {
- auto &soldier = state.soldiers[i];
- if (soldier.hp == 0) // If this soldier is dead, skip it
- continue;
- for (auto enemy_soldier : state.enemy_soldiers) {
- if (enemy_soldier.hp != 0) { // Ensure your prospective target has
- // not already been slain
- soldier.soldier_target = enemy_soldier.id;
- break;
- }
- }
- }
Add Comment
Please, Sign In to add comment