| 8396 | } |
| 8397 | |
| 8398 | void cPopulation::UpdateInflow(const cString& res_name, const double change) |
| 8399 | { |
| 8400 | const cResourceLib & resource_lib = environment.GetResourceLib(); |
| 8401 | for (int i = 0; i < resource_lib.GetSize(); i++) { |
| 8402 | cResource* res = resource_lib.GetResource(i); |
| 8403 | if (res->GetName() == res_name) { |
| 8404 | resource_count.SetInflow(res_name, resource_count.GetInflow(res_name) + change); |
| 8405 | } |
| 8406 | } |
| 8407 | assert(resource_count.GetInflow(res_name) >= 0); |
| 8408 | if (resource_count.GetInflow(res_name) < 0) cout << "WARNING: update to inflow rate results in negative resource inflow!" << endl; |
| 8409 | } |
| 8410 | |
| 8411 | void cPopulation::ExecutePredatoryResource(cAvidaContext& ctx, const int cell_id, const double pred_odds, const int juvs_per, const bool hammer) |
| 8412 | { |