ALMaSS  1.2 (after EcoStack, March 2024)
The Animal, Landscape and Man Simulation System
Skylark_Base Class Reference

#include <skylarks_all.h>

Inheritance diagram for Skylark_Base:
TAnimal TALMaSSObject Skylark_Adult Skylark_Clutch Skylark_Nestling Skylark_Female Skylark_Male Skylark_PreFledgeling

Public Member Functions

 Skylark_Base (int x, int y, SkTerritories *Terrs, Landscape *L, Skylark_Population_Manager *SPM, int bx, int by, int mh)
 
virtual void ReInit (int x, int y, SkTerritories *Terrs, Landscape *L, Skylark_Population_Manager *SPM, int bx, int by, int mh)
 
virtual double On_FoodSupply (double)
 
void AddStriglingMort (const int lifestage) const
 
int WhatState () override
 Returns the objects current state number. More...
 
bool InSquare (rectangle R) const
 
- Public Member Functions inherited from TAnimal
 TAnimal (int x, int y, Landscape *L)
 The TAnimal constructor saving the x,y, location and the landscape pointer. More...
 
 TAnimal (int x, int y)
 The TAnimal constructor saving the x,y used if landscape is already set. More...
 
void SetGuardMapIndex (int a_index_x, int a_index_y)
 Set the guard map index, this is used to avoid two animals operating in the same location when using multithread. More...
 
unsigned SupplyFarmOwnerRef () const
 Get the current location farm ref if any. More...
 
AnimalPosition SupplyPosition () const
 Returns the objects location and habitat type and veg type. More...
 
APoint SupplyPoint () const
 Returns the objects location in ALMaSS coordinates. More...
 
int SupplyPolygonRef () const
 Returns the polygon reference where the object is located. More...
 
TTypesOfLandscapeElement SupplyPolygonType () const
 Returns the polygon type where the object is located. More...
 
int Supply_m_Location_x () const
 Returns the ALMaSS x-coordinate. More...
 
int Supply_m_Location_y () const
 Returns the ALMaSS y-coordinate. More...
 
int SupplyGuardCellX () const
 Returns the x-index to the guard cell. More...
 
int SupplyGuardCellY () const
 Returns the y-index to the guard cell. More...
 
int SupplyAge () const
 Returns the animals age in days. More...
 
void SetAge (int a_age)
 Sets the animals age in days. More...
 
virtual void KillThis ()
 Sets all parameters ready for object destruction. More...
 
virtual void CopyMyself ()
 Used to copy the object details to another in descendent classes. More...
 
void SetX (const int a_x)
 Sets the x-coordinate. More...
 
void SetY (const int a_y)
 Sets the y-coordinate. More...
 
virtual void ReinitialiseObject (int a_x, int a_y, Landscape *a_l_ptr)
 
virtual void ReinitialiseObject (int a_x, int a_y)
 Used to re-use an object - must be implemented in descendent classes. More...
 
virtual void Dying ()
 A wrapped for KillThis - ideally should not be used. More...
 
void CheckManagement ()
 Used to start a check for any management related effects at the objects current location. More...
 
void CheckManagementXY (int a_x, int a_y)
 Used to start a check for any management related effects at x,y. More...
 
virtual bool OnFarmEvent (FarmToDo)
 Must be reimplemented if used in descendent classes. Sets the action on a management event. More...
 
- Public Member Functions inherited from TALMaSSObject
int GetCurrentStateNo () const
 Returns the current state number. More...
 
void SetCurrentStateNo (int a_num)
 Sets the current state number. More...
 
bool GetStepDone () const
 Returns the step done indicator flag. More...
 
void SetStepDone (bool a_bool)
 Sets the step done indicator flag. More...
 
virtual void BeginStep ()
 BeingStep behaviour - must be implemented in descendent classes. More...
 
virtual void Step ()
 Step behaviour - must be implemented in descendent classes. More...
 
virtual void EndStep ()
 EndStep behaviour - must be implemented in descendent classes. More...
 
void ReinitialiseObjectBase ()
 Used to initialise an object. More...
 
 TALMaSSObject ()
 The constructor for TALMaSSObject. More...
 
virtual ~TALMaSSObject ()=default
 The destructor for TALMaSSObject. More...
 

Public Attributes

TTypesOfSkState m_CurrentSkState
 
int Age
 
double m_Size
 
int m_Born_x
 
int m_Born_y
 
int m_MyHome
 The vegetation type where the skylark was born. More...
 
SkTerritoriesm_OurTerritories
 
Skylark_Population_Managerm_OurPopulationManager
 

Static Protected Member Functions

static bool DailyMortality (int mort)
 

Additional Inherited Members

- Static Public Member Functions inherited from TAnimal
static void SetSimulationWidth (int a_value)
 Sets the simulation width. More...
 
static void SetSimulationHeight (int a_value)
 Sets the simulation height. More...
 
static void SetDayInYear (int a_value)
 Sets the day in year attribute. More...
 
static void SetOurLandscape (Landscape *a_value)
 Sets the landscape pointer. More...
 
static void SetTempToday (double a_value)
 Sets the temperature today attribute. More...
 
- Static Public Member Functions inherited from TALMaSSObject
static void OnArrayBoundsError ()
 Used for debugging only, tests basic object properties. More...
 
- Protected Member Functions inherited from TAnimal
void CorrectWrapRound ()
 Corrects wrap around co-ordinate problems. More...
 
- Protected Attributes inherited from TAnimal
int m_Location_x
 The objects ALMaSS x coordinate. More...
 
int m_Location_y
 The objects ALMaSS y coordinate. More...
 
int m_guard_cell_x
 The index x to the guard cell. More...
 
int m_guard_cell_y
 The index y to the guard cell. More...
 
int m_AgeDays {0}
 To hold the age in days. More...
 
PesticideToxicity m_my_pesticide
 
- 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...
 
- Static Protected Attributes inherited from TAnimal
static Landscapem_OurLandscape = nullptr
 A pointer to the landscape object shared with all TAnimal objects. More...
 
static int m_SimulationWidth = 0
 A static member for the simulation width because it is often used by descendent classes. More...
 
static int m_SimulationHeight = 0
 A static member for the simulation height because it is often used by descendent classes. More...
 
static double m_TemperatureToday = 0.0
 A holder for the temperature today shared with all TAnimal objects. More...
 
static int m_DayInYear = 0
 A holder for the day in year shared with all TAnimal objects. More...
 

Constructor & Destructor Documentation

◆ Skylark_Base()

Skylark_Base::Skylark_Base ( int  x,
int  y,
SkTerritories Terrs,
Landscape L,
Skylark_Population_Manager SPM,
int  bx,
int  by,
int  mh 
)
2059  : TAnimal(x, y) {
2060  m_OurTerritories = Terrs;
2061  m_OurPopulationManager = SPM;
2062  // Make sure that the skylark starts in the correct state
2063  m_CurrentSkState = toss_Initiation;
2064  m_CurrentStateNo = 0;
2065  m_Born_x = bx;
2066  m_Born_y = by;
2067  m_MyHome = mh;
2068 #ifdef __PESTICIDE_RA
2069  m_pesticide_accumulation = 0;
2070 #endif
2071 }

References m_Born_x, m_Born_y, m_CurrentSkState, TALMaSSObject::m_CurrentStateNo, m_MyHome, m_OurPopulationManager, and m_OurTerritories.

Member Function Documentation

◆ AddStriglingMort()

◆ DailyMortality()

bool Skylark_Base::DailyMortality ( int  mort)
staticprotected
2092  {
2093 #ifdef __CJTDebug_5
2094  if ( IsAlive() != 0x0DEADC0DE ) DEADCODEError();
2095 #endif
2096  // Timing: Must be called once each day and if true then death
2097  //returns true if the object must die
2098  const int ch = g_random_fnc(10000);
2099  if (ch < mort) return true;
2100  return false;
2101 }

References g_random_fnc().

Referenced by Skylark_Clutch::st_Developing(), Skylark_Nestling::st_Developing(), and Skylark_PreFledgeling::st_Developing().

◆ InSquare()

bool Skylark_Base::InSquare ( rectangle  R) const
2107  {
2108 #ifdef __CJTDebug_5
2109  if ( IsAlive() != 0x0DEADC0DE ) DEADCODEError();
2110 #endif
2111  if (m_Location_x >= static_cast<int>(p_R.m_x1) && m_Location_x < static_cast<int>(p_R.m_x2) && m_Location_y >= static_cast<int>(p_R.m_y1) &&
2112  m_Location_y < static_cast<int>(p_R.m_y2)) return true;
2113  return false;
2114 }

References TAnimal::m_Location_x, TAnimal::m_Location_y, rectangle::m_x1, rectangle::m_x2, rectangle::m_y1, and rectangle::m_y2.

◆ On_FoodSupply()

virtual double Skylark_Base::On_FoodSupply ( double  )
inlinevirtual

Reimplemented in Skylark_Nestling.

529 { return 0.0; }

◆ ReInit()

void Skylark_Base::ReInit ( int  x,
int  y,
SkTerritories Terrs,
Landscape L,
Skylark_Population_Manager SPM,
int  bx,
int  by,
int  mh 
)
virtual
2075  {
2077  // Assign the pointer to the population manager
2078  m_OurTerritories = Terrs;
2079  m_OurPopulationManager = SPM;
2080  // Make sure that the skylark starts in the correct state
2081  m_CurrentSkState = toss_Initiation;
2082  m_CurrentStateNo = 0;
2083  m_Born_x = bx;
2084  m_Born_y = by;
2085  m_MyHome = mh;
2086 #ifdef __PESTICIDE_RA
2087  m_pesticide_accumulation = 0;
2088 #endif
2089  }

References m_Born_x, m_Born_y, m_CurrentSkState, TALMaSSObject::m_CurrentStateNo, m_MyHome, m_OurPopulationManager, m_OurTerritories, and TAnimal::ReinitialiseObject().

Referenced by Skylark_Clutch::ReInit(), Skylark_Nestling::ReInit(), and Skylark_Adult::ReInit().

◆ WhatState()

int Skylark_Base::WhatState ( )
inlineoverridevirtual

Returns the objects current state number.

Reimplemented from TAnimal.

534 { return m_CurrentSkState; }

Member Data Documentation

◆ Age

◆ m_Born_x

◆ m_Born_y

◆ m_CurrentSkState

◆ m_MyHome

int Skylark_Base::m_MyHome

◆ m_OurPopulationManager

◆ m_OurTerritories

◆ m_Size


The documentation for this class was generated from the following files:
Skylark_Population_Manager::AddStriglingMort
void AddStriglingMort(const int lifestage)
Definition: skylarks_all.h:490
Skylark_Base::m_CurrentSkState
TTypesOfSkState m_CurrentSkState
Definition: skylarks_all.h:517
Skylark_Base::m_Born_y
int m_Born_y
Definition: skylarks_all.h:521
Skylark_Base::m_OurTerritories
SkTerritories * m_OurTerritories
Definition: skylarks_all.h:525
TAnimal::TAnimal
TAnimal(int x, int y, Landscape *L)
The TAnimal constructor saving the x,y, location and the landscape pointer.
Definition: PopulationManager.cpp:1553
Skylark_Base::m_MyHome
int m_MyHome
The vegetation type where the skylark was born.
Definition: skylarks_all.h:523
TAnimal::m_Location_y
int m_Location_y
The objects ALMaSS y coordinate.
Definition: PopulationManager.h:366
Skylark_Base::m_Born_x
int m_Born_x
Definition: skylarks_all.h:520
TAnimal::ReinitialiseObject
virtual void ReinitialiseObject(int a_x, int a_y, Landscape *a_l_ptr)
Definition: PopulationManager.h:282
Skylark_Base::m_OurPopulationManager
Skylark_Population_Manager * m_OurPopulationManager
Definition: skylarks_all.h:526
g_random_fnc
int g_random_fnc(const int a_range)
Definition: ALMaSS_Random.cpp:74
TALMaSSObject::m_CurrentStateNo
int m_CurrentStateNo
The basic state number for all objects - '-1' indicates death.
Definition: PopulationManager.h:131
TAnimal::m_Location_x
int m_Location_x
The objects ALMaSS x coordinate.
Definition: PopulationManager.h:362