Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Simulation::collisionHandling()
- {
- for(int type=0; type<NUM_BIO_TYPES; type++)
- {
- for(int x=0; x<MAP_SIZE; x++)
- {
- for(int y=0; y<MAP_SIZE; y++)
- {
- if(bios[type][x][y].alive == true)
- {
- // if not in the bottom of the food chain
- if(type > 0)
- {
- int foodIndex = type - 1; // Who's below me in the food chain?
- // If there's food
- if(bios[foodIndex][x][y].alive == true)
- {
- bios[type][x][y].hunger = 0;
- killBio(foodIndex, x, y);
- // Update contamination levels
- }
- }
- }
- }
- }
- }
- // DEBUG
- for(int x=0; x<MAP_SIZE; x++)
- {
- for(int y=0; y<MAP_SIZE; y++)
- {
- bool found = false;
- for(int type=0; type<NUM_BIO_TYPES; type++)
- {
- if(bios[type][x][y].type != -1)
- {
- if(found == true)
- {
- Bio berry = bios[BERRIES][x][y];
- Bio elk = bios[ELK][x][y];
- Bio wolf = bios[WOLF][x][y];
- int breakHere = 0;
- }
- found = true;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement