Guest User

Untitled

a guest
Feb 22nd, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. // Make the soldiers who aren't patrolling attack the enemy
  2. for (int i = NUM_SOLDIERS / 2; i < NUM_SOLDIERS; ++i) {
  3. auto &soldier = state.soldiers[i];
  4. if (soldier.hp == 0) // If this soldier is dead, skip it
  5. continue;
  6.  
  7. for (auto enemy_soldier : state.enemy_soldiers) {
  8. if (enemy_soldier.hp != 0) { // Ensure your prospective target has
  9. // not already been slain
  10. soldier.soldier_target = enemy_soldier.id;
  11. break;
  12. }
  13. }
  14. }
Add Comment
Please, Sign In to add comment