Guest User

Untitled

a guest
Nov 23rd, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. void forest::setOnFire(vector<vector<int>> &vec)
  2. {
  3. for (int y = 0, n = 12; y < n; y++){
  4. for (int x = 0, p = 16; x < p; x++){
  5. if (vec[y+1][x] == 1)
  6. {
  7. vec[y][x] = 1;
  8. }
  9. if (vec[y-1][x] == 1)
  10. {
  11. vec[y][x] = 1;
  12. }
  13. if (vec[y][x+1] == 1)
  14. {
  15. vec[y][x] = 1;
  16. }
  17. if (vec[y][x-1] == 1)
  18. {
  19. vec[y][x] = 1;
  20. }
  21. else{
  22. return;
  23. }
  24. }
  25. }
  26. }
  27.  
  28. QTimer* fireTimer = new QTimer(this);
  29. connect(fireTimer, SIGNAL(timeout()),this,SLOT(setOnFire()));
  30. fireTimer->start(1000);
Add Comment
Please, Sign In to add comment