ALMaSS Vole ODDox  1.1
The vole model description following ODdox protocol
Weasel Class Reference

The Weasel class is one of two current implementations of TPredator. More...

#include <Predators.h>

Public Member Functions

virtual void BeginStep (void)
 BeingStep behaviour - must be implemented in descendent classes. More...
 
virtual void Step (void)
 Step behaviour - must be implemented in descendent classes. More...
 
virtual void EndStep (void)
 EndStep behaviour - must be implemented in descendent classes. More...
 
 Weasel (Vole_Population_Manager *ThePrey, int p_x, int p_y, Landscape *p_L, TPredator_Population_Manager *p_PPM)
 
virtual ~Weasel ()
 
- Public Member Functions inherited from TPredator
 TPredator (Vole_Population_Manager *ThePrey, int p_x, int p_y, Landscape *p_L, TPredator_Population_Manager *p_PPM)
 
 ~TPredator ()
 
bool OverlapMyTerritory (unsigned x, unsigned y)
 
virtual void st_Dispersal ()
 
virtual void st_Movement ()
 
virtual int st_Hunting ()
 
unsigned SupplySpeciesID ()
 
int SupplyKill ()
 
bool SupplyTerr ()
 
int SupplyKillEff ()
 
int SupplyHomeRange ()
 
- Public Member Functions inherited from TAnimal
unsigned SupplyFarmOwnerRef ()
 
AnimalPosition SupplyPosition ()
 
APoint SupplyPoint ()
 
int SupplyPolygonRef ()
 
int Supply_m_Location_x ()
 
int Supply_m_Location_y ()
 
virtual void KillThis ()
 
virtual void CopyMyself ()
 
void SetX (int a_x)
 
void SetY (int a_y)
 
 TAnimal (int x, int y, Landscape *L)
 
virtual void ReinitialiseObject (int x, int y, Landscape *L)
 Used to re-use an object - must be implemented in descendent classes. More...
 
virtual int WhatState ()
 
virtual void Dying ()
 
void CheckManagement (void)
 
void CheckManagementXY (int x, int y)
 
virtual bool OnFarmEvent (FarmToDo)
 
- Public Member Functions inherited from TALMaSSObject
int GetCurrentStateNo ()
 Returns the current state number. More...
 
void SetCurrentStateNo (int a_num)
 Sets the current state number. More...
 
bool GetStepDone ()
 Returns the step done indicator flag. More...
 
void SetStepDone (bool a_bool)
 Sets the step done indicator flag. More...
 
virtual void ReinitialiseObject ()
 Used to re-use an object - must be implemented in descendent classes. More...
 
 TALMaSSObject ()
 The constructor for TALMaSSObject. More...
 
virtual ~TALMaSSObject ()
 The destructor for TALMaSSObject. More...
 
void OnArrayBoundsError ()
 Used for debugging only, tests basic object properties. More...
 

Additional Inherited Members

- Protected Member Functions inherited from TAnimal
void CorrectWrapRound ()
 Corrects wrap around co-ordinate problems. More...
 
- Protected Attributes inherited from TPredator
TTypeOfPredatorState CurrentPState
 
unsigned SpeciesID
 
unsigned m_DispersalMax
 
unsigned m_SearchArea
 
int m_kills_this_season
 
int PreyResponse1
 
int PreyResponse2
 
int m_Search_x
 
int m_Search_y
 
int SimW
 
int SimH
 
unsigned m_FailureCount
 
unsigned m_NoFailuresBeforeDispersal
 
unsigned m_HomeRange
 
bool m_HaveTerritory
 
int m_KillEfficiency
 
Vole_Population_Managerm_Prey
 
TPredator_Population_Managerm_OurPopulationManager
 
vector< Vole_Base * > * CurrentPrey
 
- Protected Attributes inherited from TAnimal
int m_Location_x
 
int m_Location_y
 
Landscapem_OurLandscape
 
- Protected Attributes inherited from TALMaSSObject
int m_CurrentStateNo
 The basic state number for all objects - '-1' indicates death. More...
 
bool m_StepDone
 Indicates whether the iterative step code is done for this timestep. More...
 

Detailed Description

The Weasel class is one of two current implementations of TPredator.

It is configurable via config parameters and in other than name and default configuration it is identical to the Owl class

Definition at line 187 of file Predators.h.

Constructor & Destructor Documentation

◆ Weasel()

◆ ~Weasel()

Weasel::~Weasel ( )
virtual

Definition at line 833 of file Predators.cpp.

834 {
835  //Nothing to do
836 }

Member Function Documentation

◆ BeginStep()

void Weasel::BeginStep ( void  )
virtual

BeingStep behaviour - must be implemented in descendent classes.

Reimplemented from TPredator.

Definition at line 839 of file Predators.cpp.

840 {
841  int day= m_OurLandscape->SupplyDayInYear();
842  if (day==weasel_breed_day)
843  {
845  for (int k=0; k<noToMake; k++)
846  {
847  // make a new weasel
848  struct_Predator* sp;
849  sp = new struct_Predator;
851  sp->L = m_OurLandscape;
852  sp->x = m_Location_x;
853  sp->y = m_Location_y;
854  m_OurPopulationManager->CreateObjects(0,NULL,sp,1); // 0 = weasel
855  delete sp;
856  }
857  }
858  else if (day==364)
859  {
861  {
863  {
865  KillThis();
866  }
867  }
868  m_kills_this_season=0; // reset the count
869  }
870 }

References TPredator_Population_Manager::CreateObjects(), TPredator_Population_Manager::dec_inds(), TAnimal::KillThis(), struct_Predator::L, TPredator::m_kills_this_season, TAnimal::m_Location_x, TAnimal::m_Location_y, TAnimal::m_OurLandscape, TPredator::m_OurPopulationManager, struct_Predator::PM, TPredator_Population_Manager::supply_no_inds(), Landscape::SupplyDayInYear(), WEASEL, weasel_breed_day, weasel_breed_threshold, weasel_death_threshold, struct_Predator::x, and struct_Predator::y.

◆ EndStep()

virtual void Weasel::EndStep ( void  )
inlinevirtual

EndStep behaviour - must be implemented in descendent classes.

Reimplemented from TPredator.

Definition at line 195 of file Predators.h.

195 {}

◆ Step()

void Weasel::Step ( void  )
virtual

Step behaviour - must be implemented in descendent classes.

Reimplemented from TPredator.

Definition at line 873 of file Predators.cpp.

874 {
875  if (m_StepDone || m_CurrentStateNo == -1) return;
876  switch (CurrentPState)
877  {
878  case tops_InitialState: // Initial state
880  m_HaveTerritory=false;
881  break;
882  case tops_Hunting:
884  m_StepDone=true;
885  break;
886  case tops_Dispersal:
887  st_Dispersal();
889  m_StepDone=true;
890  break;
891  case tops_Movement:
892  st_Movement();
893  if (st_Hunting()<PreyResponse2) // alter this figure to increase functional response
894  m_FailureCount++;
895  else m_FailureCount=0;
897  {
898  m_HaveTerritory=false;
900  }
902  m_StepDone=true;
903  break;
904  default:
905  m_OurLandscape->Warn("Weasel::Step()","unknown state - default");
906  exit(1);
907  }
908 }

References TPredator::CurrentPState, TALMaSSObject::m_CurrentStateNo, TPredator::m_FailureCount, TPredator::m_HaveTerritory, TPredator::m_NoFailuresBeforeDispersal, TAnimal::m_OurLandscape, TALMaSSObject::m_StepDone, TPredator::PreyResponse1, TPredator::PreyResponse2, TPredator::st_Dispersal(), TPredator::st_Hunting(), TPredator::st_Movement(), tops_Dispersal, tops_Hunting, tops_InitialState, tops_Movement, and Landscape::Warn().


The documentation for this class was generated from the following files:
TAnimal::KillThis
virtual void KillThis()
Definition: PopulationManager.h:219
tops_Dispersal
Definition: Predators.h:57
cfg_weasel_kill_efficiency
static CfgInt cfg_weasel_kill_efficiency("WEASEL_KILL_EFF", CFG_CUSTOM, 250)
struct_Predator::y
int y
Definition: Predators.h:69
TAnimal::m_OurLandscape
Landscape * m_OurLandscape
Definition: PopulationManager.h:229
TPredator_Population_Manager::supply_no_inds
unsigned supply_no_inds(unsigned list)
Definition: Predators.h:157
TPredator::st_Movement
virtual void st_Movement()
Definition: Predators.cpp:753
struct_Predator::PM
TPredator_Population_Manager * PM
Definition: Predators.h:72
TPredator::PreyResponse2
int PreyResponse2
Definition: Predators.h:109
struct_Predator::L
Landscape * L
Definition: Predators.h:71
struct_Predator
Used for creation of a new predator object.
Definition: Predators.h:65
weasel_breed_day
int weasel_breed_day
Definition: Predators.cpp:76
TPredator_Population_Manager::dec_inds
void dec_inds(unsigned list)
Definition: Predators.h:156
tops_Movement
Definition: Predators.h:58
TPredator::m_SearchArea
unsigned m_SearchArea
Definition: Predators.h:106
TPredator::st_Hunting
virtual int st_Hunting()
Definition: Predators.cpp:726
cfg_weasel_NoFailuresBeforeDispersal
static CfgInt cfg_weasel_NoFailuresBeforeDispersal("WEASEL_FAILURES", CFG_CUSTOM, 10)
TAnimal::m_Location_y
int m_Location_y
Definition: PopulationManager.h:228
TPredator::m_KillEfficiency
int m_KillEfficiency
Definition: Predators.h:118
cfg_weasel_DispersalMax
static CfgInt cfg_weasel_DispersalMax("WEASEL_DISPERSAL_MAX", CFG_CUSTOM, 200)
cfg_weasel_search_area
static CfgInt cfg_weasel_search_area("WEASEL_SEARCH_AREA", CFG_CUSTOM, 100)
TPredator::st_Dispersal
virtual void st_Dispersal()
Definition: Predators.cpp:787
TPredator::PreyResponse1
int PreyResponse1
Definition: Predators.h:108
Landscape::SupplyDayInYear
int SupplyDayInYear(void)
Definition: Landscape.h:1596
weasel_death_threshold
int weasel_death_threshold
Definition: Predators.cpp:74
TALMaSSObject::m_StepDone
bool m_StepDone
Indicates whether the iterative step code is done for this timestep.
Definition: PopulationManager.h:118
TPredator::m_FailureCount
unsigned m_FailureCount
Definition: Predators.h:114
TPredator_Population_Manager::CreateObjects
void CreateObjects(int ob_type, TAnimal *pvo, struct_Predator *data, int number)
Definition: Predators.cpp:137
TPredator::CurrentPState
TTypeOfPredatorState CurrentPState
Definition: Predators.h:103
TPredator::m_HaveTerritory
bool m_HaveTerritory
Definition: Predators.h:117
TPredator::m_OurPopulationManager
TPredator_Population_Manager * m_OurPopulationManager
Definition: Predators.h:120
TPredator::SpeciesID
unsigned SpeciesID
Definition: Predators.h:104
TPredator::m_DispersalMax
unsigned m_DispersalMax
Definition: Predators.h:105
cfg_weasel_home_range
static CfgInt cfg_weasel_home_range("WEASEL_HOME_RANGE", CFG_CUSTOM, 250)
tops_InitialState
Definition: Predators.h:55
TPredator::TPredator
TPredator(Vole_Population_Manager *ThePrey, int p_x, int p_y, Landscape *p_L, TPredator_Population_Manager *p_PPM)
Definition: Predators.cpp:696
tops_Hunting
Definition: Predators.h:56
TPredator::m_HomeRange
unsigned m_HomeRange
Definition: Predators.h:116
TALMaSSObject::m_CurrentStateNo
int m_CurrentStateNo
The basic state number for all objects - '-1' indicates death.
Definition: PopulationManager.h:116
weasel_breed_threshold
int weasel_breed_threshold
Definition: Predators.cpp:72
WEASEL
#define WEASEL
Definition: Predators.cpp:48
TPredator::m_NoFailuresBeforeDispersal
unsigned m_NoFailuresBeforeDispersal
Definition: Predators.h:115
struct_Predator::x
int x
Definition: Predators.h:68
Landscape::Warn
void Warn(std::string a_msg1, std::string a_msg2)
Definition: Landscape.h:1579
TAnimal::m_Location_x
int m_Location_x
Definition: PopulationManager.h:225
TPredator::m_kills_this_season
int m_kills_this_season
Definition: Predators.h:107