Advertisement
Guest User

Untitled

a guest
Dec 9th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. void command_and_not_die(const vector<int>& W , Pos p, int id, const Dir& dir)
  2. {
  3. if (S[id].empty()) return;
  4.  
  5. int ai, aj;
  6. calculate(S[id].top(), ai, aj);
  7. Pos newmov = {ai, aj};
  8. newmov += dir;
  9. if (not pos_ok(newmov)) command_and_not_die(W, p, id, progress(dir));
  10. else if (check_others(W, id))
  11. {
  12. if (unit(id).type == Car and cell(newmov).type == City) command_and_not_die(W, p, id, progress(dir));
  13. else if ((cell(newmov).id != -1 and unit(cell(ai, aj).id).player != me()) or (cell(newmov).type != Desert
  14. or cell(newmov).type != Road or cell(newmov).type != City)) command_and_not_die(W, p, id, progress(dir));
  15. else
  16. {
  17. //Because I have'd to modify the route
  18. Priority[id] = false;
  19. InRoute[id] = false;
  20. Attack[id] = false;
  21. command(id, dir);
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement