MCPcopy Create free account
hub / github.com/devosoft/avida / FindResCenter

Method FindResCenter

avida-core/source/main/cOrgSensor.cc:220–239  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

218}
219
220cOrgSensor::sLookOut cOrgSensor::FindResCenter(cAvidaContext& ctx, const int res_id, const int distance_sought, const int facing)
221{
222 sLookOut res_search;
223 res_search.report_type = 1;
224 res_search.habitat = -2;
225 res_search.id_sought = res_id;
226 res_search.search_type = -9;
227
228 int target_cell = m_organism->GetOrgInterface().GetCellID();
229 if (m_use_avatar) target_cell = m_organism->GetOrgInterface().GetAVCellID();
230
231 cResourceCount* res_count = m_organism->GetOrgInterface().GetResourceCount();
232 if (res_search.distance != -1) {
233 if (m_world->GetEnvironment().GetResourceLib().GetResource(res_id)->GetGradient()) {
234 target_cell = res_count->GetCurrPeakX(ctx, res_id) + (res_count->GetCurrPeakY(ctx, res_id) * m_world->GetConfig().WORLD_X.Get());
235 }
236 }
237 FindThing(target_cell, distance_sought, facing, res_search);
238 return res_search;
239}
240
241void cOrgSensor::FindThing(int target_cell, const int distance_sought, const int facing, sLookOut& thing_search, cOrganism* target_org)
242{

Callers

nothing calls this directly

Calls 9

GetGradientMethod · 0.80
GetConfigMethod · 0.80
GetCellIDMethod · 0.45
GetAVCellIDMethod · 0.45
GetResourceCountMethod · 0.45
GetResourceMethod · 0.45
GetCurrPeakXMethod · 0.45
GetCurrPeakYMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected