Creates a new avatar based on the organism's forage target as a predator or prey, and adds it to the cell
| 1750 | |
| 1751 | // Creates a new avatar based on the organism's forage target as a predator or prey, and adds it to the cell |
| 1752 | void cPopulationInterface::AddPredPreyAV(cAvidaContext& ctx, int av_cell_id) |
| 1753 | { |
| 1754 | // Add predator (saved as input avatar) |
| 1755 | if (!GetOrganism()->IsPreyFT()) { |
| 1756 | sIO_avatar predAV(av_cell_id, 0, -1, true, false); |
| 1757 | m_avatars.Push(predAV); |
| 1758 | m_world->GetPopulation().GetCell(av_cell_id).AddPredAV(ctx, GetOrganism()); |
| 1759 | // Add prey (saved as output avatar) |
| 1760 | } else { |
| 1761 | sIO_avatar preyAV(av_cell_id, 0, -1, false, true); |
| 1762 | m_avatars.Push(preyAV); |
| 1763 | m_world->GetPopulation().GetCell(av_cell_id).AddPreyAV(ctx, GetOrganism()); |
| 1764 | } |
| 1765 | // Find the created avatar's faced cell |
| 1766 | SetAVFacedCellID(ctx, GetNumAV() - 1); |
| 1767 | } |
| 1768 | |
| 1769 | // Switches the avatar from being a predator to a prey avatar or vice-versa |
| 1770 | void cPopulationInterface::SwitchPredPrey(cAvidaContext& ctx, int av_num) |
no test coverage detected