| 4866 | } |
| 4867 | |
| 4868 | void cHardwareCPU::DoDonate(cAvidaContext& ctx, cOrganism* to_org) |
| 4869 | { |
| 4870 | assert(to_org != NULL); |
| 4871 | |
| 4872 | const double merit_given = m_world->GetConfig().MERIT_GIVEN.Get(); |
| 4873 | const double merit_received = m_world->GetConfig().MERIT_RECEIVED.Get(); |
| 4874 | |
| 4875 | double cur_merit = m_organism->GetPhenotype().GetMerit().GetDouble(); |
| 4876 | cur_merit -= merit_given; |
| 4877 | if (cur_merit < 0) cur_merit=0; |
| 4878 | |
| 4879 | // Plug the current merit back into this organism and notify the scheduler. |
| 4880 | m_organism->UpdateMerit(ctx, cur_merit); |
| 4881 | m_organism->GetPhenotype().SetIsEnergyDonor(); |
| 4882 | |
| 4883 | // Update the merit of the organism being donated to... |
| 4884 | double other_merit = to_org->GetPhenotype().GetMerit().GetDouble(); |
| 4885 | other_merit += merit_received; |
| 4886 | to_org->UpdateMerit(ctx, other_merit); |
| 4887 | to_org->GetPhenotype().SetIsEnergyReceiver(); |
| 4888 | |
| 4889 | } |
| 4890 | |
| 4891 | void cHardwareCPU::DoEnergyDonate(cAvidaContext& ctx, cOrganism* to_org) |
| 4892 | { |
nothing calls this directly
no test coverage detected