Advertisement
BiceMaster

nukeSim collisionHandling

Feb 9th, 2012
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.00 KB | None | 0 0
  1. void Simulation::collisionHandling()
  2. {
  3.     for(int type=0; type<NUM_BIO_TYPES; type++)
  4.     {
  5.         for(int x=0; x<MAP_SIZE; x++)
  6.         {
  7.             for(int y=0; y<MAP_SIZE; y++)
  8.             {
  9.                 if(bios[type][x][y].alive == true)
  10.                 {
  11.                     // if not in the bottom of the food chain
  12.                     if(type > 0)
  13.                     {
  14.                         int foodIndex = type - 1; // Who's below me in the food chain?
  15.                         // If there's food
  16.                         if(bios[foodIndex][x][y].alive == true)
  17.                         {
  18.                             bios[type][x][y].hunger = 0;
  19.                             killBio(foodIndex, x, y);
  20.                             // Update contamination levels
  21.                         }
  22.                     }
  23.                 }
  24.             }
  25.         }
  26.     }
  27.  
  28.     // DEBUG
  29.     for(int x=0; x<MAP_SIZE; x++)
  30.     {
  31.         for(int y=0; y<MAP_SIZE; y++)
  32.         {
  33.             bool found = false;
  34.             for(int type=0; type<NUM_BIO_TYPES; type++)
  35.             {
  36.                 if(bios[type][x][y].type != -1)
  37.                 {
  38.                     if(found == true)
  39.                     {
  40.                         Bio berry = bios[BERRIES][x][y];
  41.                         Bio elk   = bios[ELK][x][y];
  42.                         Bio wolf  = bios[WOLF][x][y];
  43.                         int breakHere = 0;
  44.                     }
  45.                     found = true;
  46.                 }
  47.             }
  48.         }
  49.     }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement