ALMaSS Skylark ODDox  1.1
The skylark model description following ODdox protocol
Skylark_Male Class Reference

#include <skylarks_all.h>

Public Member Functions

 Skylark_Male (int x, int y, double size, int age, SkTerritories *Terrs, Landscape *L, Skylark_Population_Manager *SPM, int bx, int by, int mh)
 
virtual ~Skylark_Male ()
 
virtual void ReInit (int x, int y, double size, int age, SkTerritories *Terrs, Landscape *L, Skylark_Population_Manager *SPM, int bx, int by, int mh)
 
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...
 
bool OnEvicted ()
 
int SupplyNoHabitatRefs ()
 
int SupplyBroodSize ()
 
int SupplyBroodAge (int n)
 
double Supply_TerritoryQual ()
 
int SupplyBroodWeight (int n)
 
double OnFoodMessage (int n, double f)
 
void OnAddNestling (Skylark_Nestling *N)
 
void OnAddPreFledgeling (Skylark_PreFledgeling *P, Skylark_Nestling *N)
 
skTerritory_struct Supply_Territory ()
 
int DefendTerritory ()
 
void OnEggHatch ()
 
void OnMateDying ()
 
void OnMateLeaving ()
 
void OnPairing (Skylark_Female *female)
 
void OnBroodDeath ()
 
void OnNestLocation (int x, int y)
 
void OnNestlingDeath (Skylark_Nestling *N)
 
void OnPreFledgelingDeath (Skylark_PreFledgeling *P)
 
void OnPreFledgelingMature (Skylark_PreFledgeling *P)
 
void OnMateNeverComesBack (Skylark_Female *AFemale)
 
void OnNestPredatation ()
 
void OnBroodDesertion ()
 
void OnReHouse ()
 
void SensibleCopy ()
 
bool SupplyNestValid ()
 
APoint SupplyNestLoc ()
 
- Public Member Functions inherited from Skylark_Adult
 Skylark_Adult (int x, int y, double size, int age, SkTerritories *Terrs, Landscape *L, Skylark_Population_Manager *SPM, int bx, int by, int mh)
 
virtual ~Skylark_Adult ()
 
virtual void CopyMyself (int a_sktype)
 
- Public Member Functions inherited from Skylark_Base
 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 (int lifestage)
 
virtual int WhatState ()
 
bool InSquare (rectangle R)
 
- 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 void Dying ()
 
void CheckManagement (void)
 
void CheckManagementXY (int x, int y)
 
- 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...
 

Public Attributes

Skylark_FemaleMyMate
 
int BroodAge
 
vector< int > m_HabitatTable_PNum
 
vector< int > m_HabitatTable_Size
 
vector< double > m_InsectTable
 
bool HaveTerritory
 
- Public Attributes inherited from Skylark_Adult
bool Paired
 
- Public Attributes inherited from Skylark_Base
double m_pesticide_accumulation
 
double m_pcide_conc
 
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
 

Protected Member Functions

int st_Flocking ()
 
TTypesOfSkState st_Floating ()
 
bool st_Arriving ()
 
bool st_Immigrating ()
 
int st_Emigrating ()
 
int st_TempLeavingArea ()
 
int st_FindingTerritory ()
 
int st_AttractingAMate ()
 
int st_FollowingMate ()
 
void ConstructAHabitatTable ()
 
int EstablishingATerritory ()
 
int st_ScaringOffChicks ()
 
int st_CaringForYoung ()
 
void st_Dying ()
 
void ReEvaluateTerritory ()
 Daily re-evaluation of territory. More...
 
double GetFood (int time)
 
void OptimiseHabitatSearchingOrder ()
 
int GetMigrationMortality ()
 
virtual bool OnFarmEvent (FarmToDo event)
 
virtual void PesticideResponse ()
 
- Protected Member Functions inherited from Skylark_Adult
virtual double RemoveEM (double food)
 
double GetVegHindrance (int PolyRef)
 
double GetWeatherHindrance ()
 
bool GetBadWeather ()
 Extreme weather conditions check. More...
 
- Protected Member Functions inherited from Skylark_Base
bool DailyMortality (int mort)
 
- Protected Member Functions inherited from TAnimal
void CorrectWrapRound ()
 Corrects wrap around co-ordinate problems. More...
 

Protected Attributes

double m_XFNestAcceptScore
 
bool m_firstPF
 
int GoodWeather
 
int m_BroodSize
 
Skylark_Nestlingm_Brood [26]
 
int No_HabitatTable_Refs
 
int m_MyMinTerritoryQual
 
- Protected Attributes inherited from Skylark_Adult
int GoodWeather
 
bool BSuccess
 
double MyExtractEff
 
int m_pesticide_affected
 
skTerritory_struct MyTerritory
 
vector< APoint > * m_aTerrlist
 
- 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...
 

Constructor & Destructor Documentation

◆ Skylark_Male()

Skylark_Male::Skylark_Male ( int  x,
int  y,
double  size,
int  age,
SkTerritories Terrs,
Landscape L,
Skylark_Population_Manager SPM,
int  bx,
int  by,
int  mh 
)

The Male constructor. This initialises some important parameters.

There is some individual variation around the territory acceptance score, up to 10% max

3796  : Skylark_Adult(x, y, size, age, Terrs, L, SPM, bx, by, mh) {
3800  GoodWeather = 0;
3801  HaveTerritory = false;
3802  MyMate = NULL;
3803  m_BroodSize = 0; // don't start life with chicks!
3804  BSuccess = false;
3805  m_firstPF = false;
3807  m_MyMinTerritoryQual = (int)(cfg_FemaleMinTerritoryAcceptScore.value() * (g_rand_uni() / 10.0 + 1.0)); //= 1.0 to 1.1
3808  m_XFNestAcceptScore = m_MyMinTerritoryQual * (double)(g_rand_uni() + 2.1);
3809  for (int i = 0; i < 6; i++) m_Brood[i] = NULL;
3810 }

References Skylark_Adult::BSuccess, cfg_FemaleMinTerritoryAcceptScore, g_rand_uni, GoodWeather, HaveTerritory, m_Brood, m_BroodSize, m_firstPF, m_MyMinTerritoryQual, m_XFNestAcceptScore, and MyMate.

◆ ~Skylark_Male()

Skylark_Male::~Skylark_Male ( )
virtual
3831  {
3832 }

Member Function Documentation

◆ BeginStep()

void Skylark_Male::BeginStep ( void  )
virtual

BeingStep behaviour - must be implemented in descendent classes.

Reimplemented from TAnimal.

3963  {
3964 #ifdef __CJTDebug_5
3965  if ( IsAlive() != 0x0DEADC0DE ) DEADCODEError();
3966 #endif
3967 
3968  if ( m_CurrentSkState == toss_Destroy ) return;
3969  CheckManagement();
3970 
3971  switch ( m_CurrentSkState ) {
3972  case toss_MFloating: // Floating
3973  m_CurrentSkState=st_Floating(); // Legal returns are toss_MFlocking, toss_MFindingTerritory, toss_MTempLeavingArea
3974  m_StepDone = true;
3975  break;
3976  case toss_MCaringForYoung: // CaringForYoung
3977  if ( st_CaringForYoung() )
3978  m_CurrentSkState = toss_ScaringOffChicks; //ScareOffChicks
3979  m_StepDone = true;
3980  case toss_AttractingAMate:
3981  case toss_ScaringOffChicks:
3982  case toss_FollowingMate:
3984  break;
3985  default:
3986  /* char errornum[20]; sprintf(errornum, "%d", m_CurrentSkState );
3987  g_land->Warn("Skylark_Male::BeginStep(): Unknown state: ", errornum); exit(0); */
3988  break;
3989  }
3990 }

References TAnimal::CheckManagement(), Skylark_Base::m_CurrentSkState, TALMaSSObject::m_StepDone, ReEvaluateTerritory(), st_CaringForYoung(), st_Floating(), toss_AttractingAMate, toss_Destroy, toss_FollowingMate, toss_MCaringForYoung, toss_MFloating, and toss_ScaringOffChicks.

◆ ConstructAHabitatTable()

void Skylark_Male::ConstructAHabitatTable ( )
protected
4938  {
4939 #ifdef __CJTDebug_5
4940  if ( IsAlive() != 0xDEADC0DE )
4941  DEADCODEError();
4942 #endif
4943  // This function must be called when the female arrives and
4944  // again when the eggs first hatch
4945  // This function constructs a table listing
4946  // the reference of each habitat object
4947  // and the area of that object within the skylarks home range
4948  // First must find out which habitats are in HomeRange
4949  // this is done by searching the landscape raster and counting how many
4950  // 1 meter areas are present for each habitat object
4951 
4952  // These days this is easy, as the information is already
4953  // available in the territory as a pre-chewed list provided
4954  // for this very use by PreProcessLandscape2()! :-)
4956  int l_polys = (int)l_terr->m_hr_polys.size();
4957 #ifdef __PESTICIDE_RA
4958  m_PConcTable.resize(l_polys);
4959 #endif
4960  m_HabitatTable_PNum.resize(l_polys);
4961  m_HabitatTable_Size.resize(l_polys);
4962  m_InsectTable.resize(l_polys);
4963  for ( int i = 0; i < l_polys; i++ ) {
4964  m_HabitatTable_PNum[ i ] = l_terr->m_hr_polys[ i ];
4965  m_HabitatTable_Size[ i ] = l_terr->m_hr_sizes[ i ];
4966  }
4967  No_HabitatTable_Refs = l_polys;
4968 }

References m_HabitatTable_PNum, m_HabitatTable_Size, skTTerritory::m_hr_polys, skTTerritory::m_hr_sizes, m_InsectTable, Skylark_Base::m_OurTerritories, Skylark_Adult::MyTerritory, No_HabitatTable_Refs, skTerritory_struct::ref, and SkTerritories::Supply_terr().

Referenced by OnPairing().

◆ DefendTerritory()

int Skylark_Male::DefendTerritory ( )
4700  {
4701 #ifdef __CJTDebug_5
4702  if ( IsAlive() != 0xDEADC0DE )
4703  DEADCODEError();
4704 #endif
4705  if ( ( Paired == true ) || ( BSuccess == true ) ) return 999; // very old
4706  else
4707  return Age; //can't be ousted if paired or owned the territory before
4708 }

References Skylark_Base::Age, Skylark_Adult::BSuccess, and Skylark_Adult::Paired.

Referenced by st_FindingTerritory().

◆ EndStep()

void Skylark_Male::EndStep ( void  )
virtual

EndStep behaviour - must be implemented in descendent classes.

Reimplemented from TAnimal.

4090  {
4091 #ifdef __CJTDebug_5
4092  if ( IsAlive() != 0x0DEADC0DE ) DEADCODEError();
4093 #endif
4094  if ( m_CurrentSkState == toss_Destroy ) return;
4095 #ifdef __PESTICIDE_RA
4097 #endif
4098 }

References Skylark_Base::m_CurrentSkState, PesticideResponse(), and toss_Destroy.

◆ EstablishingATerritory()

int Skylark_Male::EstablishingATerritory ( )
protected
4678  {
4679 /*
4680 The male claims the territory, primarily a programming construct, but resulting in the male being registered as occupying the territory.<br>
4681 */
4682 
4683 #ifdef __CJTDebug_5
4684  if ( IsAlive() != 0x0DEADC0DE ) DEADCODEError();
4685 #endif
4686  m_aTerrlist->clear();
4687  // Stand in the centre.
4692  // claim occupation
4694  HaveTerritory = true;
4695  return 0; // TransferToState(AttractMate)
4696 }

References HaveTerritory, Skylark_Adult::m_aTerrlist, TAnimal::m_Location_x, TAnimal::m_Location_y, Skylark_Base::m_OurPopulationManager, Skylark_Base::m_OurTerritories, Skylark_Adult::MyTerritory, SkTerritories::Occupy(), skTerritory_struct::ref, Population_Manager::SimH, Population_Manager::SimW, skTerritory_struct::size, skTerritory_struct::x, and skTerritory_struct::y.

Referenced by OnReHouse(), and Step().

◆ GetFood()

double Skylark_Male::GetFood ( int  time)
protected
5083  {
5084 #ifdef __CJTDebug_5
5085  if ( IsAlive() != 0x0DEADC0DE ) DEADCODEError();
5086 #endif
5087 
5088 #ifdef __CJTDebug_4
5089  if ( No_HabitatTable_Refs > 250 )
5091 #endif
5092  // This must be called each day before the female's code is executed
5093  double food = 0;
5094  // First find out how much food is available from each habitat
5095  // Note that the pesticide risk assessment code is integrated here.
5096  // Stage 1 create the insect data
5097  for ( int i = 0; i < No_HabitatTable_Refs; i++ ) {
5098  // Insects = Insects * Hindrance
5099  // Insect table holds insects per squaremetre
5100 #ifdef __PESTICIDE_RA
5101  m_PConcTable[i] = m_OurLandscape->SupplyPesticide( m_HabitatTable_PNum[ i ], ppp_1 );
5102 #endif
5103  double WHindrance = GetWeatherHindrance();
5104  double hind = GetVegHindrance( m_HabitatTable_PNum[ i ] );
5105  double insects = m_OurLandscape->SupplyInsects( m_HabitatTable_PNum[ i ] );
5106  // Insects = Insects * Hindrance
5107  // Insect table holds insects per squaremetre
5108  m_InsectTable[ i ] = insects * hind * WHindrance;
5109  }
5110  // Now sort habitats into optimal searching order (i.e. most insect/m2)
5112  // Now extract insects available from each for as long as spends searching
5113  int index = 0;
5114  // Note at present this routine assumes that 1 min is spent per m2
5115  // if this assumption is changed then we must alter 'time' accordingly
5116 #ifdef __PESTICIDE_RA
5117  m_pcide = 0.0;
5118 #endif
5119  double fd;
5120  while ( time > 0 ) {
5121  int area = m_HabitatTable_Size[ index ];
5122  if ( time > area) {
5123  time -= area;
5124  // Food+= area*WeatherHindrance*ExtractionEfficiency*Insects per m2
5125  fd = area * MyExtractEff * m_InsectTable[ index ];
5126  food += fd;
5127 #ifdef __PESTICIDE_RA
5128  m_pcide += fd * m_PConcTable[ index ] * KcalPerGInsect_kg_inv; // Needs converting from kcal to mg;
5129 #endif
5130  index++;
5131 #ifdef __CJTDebug_4
5132  if ( index > 249 )
5134 #endif
5135  } else {
5136  // Food+=
5137  // minutes left*WeatherHindrance*ExtractionEfficiency*Insects per m2
5138  fd = time * MyExtractEff * m_InsectTable[ index ];
5139  food += fd;
5140 #ifdef __PESTICIDE_RA
5141  m_pcide += m_PConcTable[ index ] * time * KcalPerGInsect_kg_inv; // Needs converting from kcal to mg;
5142 #endif
5143  time = 0;
5144  }
5145  }
5146  return food;
5147 }

References Skylark_Adult::GetVegHindrance(), Skylark_Adult::GetWeatherHindrance(), KcalPerGInsect_kg_inv, m_HabitatTable_PNum, m_HabitatTable_Size, m_InsectTable, TAnimal::m_OurLandscape, Skylark_Adult::MyExtractEff, No_HabitatTable_Refs, TALMaSSObject::OnArrayBoundsError(), OptimiseHabitatSearchingOrder(), ppp_1, Landscape::SupplyInsects(), and Landscape::SupplyPesticide().

Referenced by st_CaringForYoung(), and st_FollowingMate().

◆ GetMigrationMortality()

int Skylark_Male::GetMigrationMortality ( )
protected
4713  {
4714 #ifdef __CJTDebug_5
4715  if ( IsAlive() != 0x0DEADC0DE ) DEADCODEError();
4716 #endif
4717  Age++;
4718  if ( Age == 1 ) return JuvenileReturnMort;
4720 }

References Skylark_Base::Age, JuvenileReturnMort, Skylark_Base::m_OurPopulationManager, and Skylark_Population_Manager::SupplyM_Mig_Mort().

Referenced by st_Immigrating().

◆ OnAddNestling()

void Skylark_Male::OnAddNestling ( Skylark_Nestling N)
4834  {
4835 #ifdef __CJTDebug_5
4836  if ( IsAlive() != 0xDEADC0DE )
4837  DEADCODEError();
4838 #endif
4839  // Add nestling and record the new brood member
4840  m_Brood[ m_BroodSize++ ] = N;
4841 #ifdef __CJTDebug_4
4842  if ( m_BroodSize > 25 ) {
4844  }
4845 #endif
4846 }

References m_Brood, m_BroodSize, and TALMaSSObject::OnArrayBoundsError().

Referenced by Skylark_Population_Manager::CreateObjects().

◆ OnAddPreFledgeling()

void Skylark_Male::OnAddPreFledgeling ( Skylark_PreFledgeling P,
Skylark_Nestling N 
)
4404  {
4405 #ifdef __CJTDebug_5
4406  if ( IsAlive() != 0xDEADC0DE )
4407  DEADCODEError();
4408 #endif
4409  // Must now replace nestling pointer with one to the new object
4410  int n = -1;
4411  for ( int i = 0; i < m_BroodSize; i++ ) {
4412  if ( N == m_Brood[ i ] ) n = i;
4413  }
4414  if ( n == -1 ) {
4415  // Very nasty problems
4416  g_land->Warn( "Skylark_Male::Step: Maturing PreFl. not in Male's list", NULL );
4417  exit( 1 );
4418  }
4419  m_Brood[ n ] = P;
4420  if ( !m_firstPF ) {
4422  }
4423  m_firstPF = true;
4424 }

References g_land, m_Brood, m_BroodSize, m_firstPF, MyMate, Skylark_Female::OnBreedSuccess(), and Landscape::Warn().

Referenced by Skylark_Population_Manager::CreateObjects().

◆ OnBroodDeath()

void Skylark_Male::OnBroodDeath ( )
4385  {
4386 #ifdef __CJTDebug_5
4387  if ( IsAlive() != 0xDEADC0DE )
4388  DEADCODEError();
4389 #endif
4390  for ( int i = 0; i < m_BroodSize; i++ ) m_Brood[ i ] = NULL;
4391  m_BroodSize = 0;
4392  if ( Paired ) {
4393  m_CurrentSkState = toss_FollowingMate; // Follow mate
4394  MyMate->OnBroodDeath();
4396  else {
4398  }
4399 }

References HaveTerritory, m_Brood, m_BroodSize, Skylark_Base::m_CurrentSkState, MyMate, Skylark_Female::OnBroodDeath(), Skylark_Adult::Paired, toss_AttractingAMate, toss_FollowingMate, and toss_MFlocking.

Referenced by OnBroodDesertion(), OnNestlingDeath(), OnNestPredatation(), and OnPreFledgelingDeath().

◆ OnBroodDesertion()

void Skylark_Male::OnBroodDesertion ( )
4896  {
4897  for ( int i = 0; i < m_BroodSize; i++ ) {
4898  m_Brood[ i ]->OnDeserted();
4899  }
4900  m_BroodSize = 0;
4901  OnBroodDeath();
4902 }

References m_Brood, m_BroodSize, OnBroodDeath(), and Skylark_Nestling::OnDeserted().

◆ OnEggHatch()

void Skylark_Male::OnEggHatch ( )
4817  {
4818 #ifdef __CJTDebug_5
4819  if ( IsAlive() != 0xDEADC0DE )
4820  DEADCODEError();
4821 #endif
4822  // NB this must not occur if there are still chicks to scare off -
4823  // if it does then they are left in limbo!
4824  // Brood information is already put here by CreatObjects
4825 #ifdef __CJTDebug_7
4826  if ( m_BroodSize < 1 ) {
4827  g_land->Warn( "Skylark_Male::OnEggHatch: DeBug7 ", NULL ); exit( 1 );
4828  }
4829 #endif
4830  m_CurrentSkState = toss_MCaringForYoung; // TransferToState(CareForYoung);
4831 }

References g_land, m_BroodSize, Skylark_Base::m_CurrentSkState, toss_MCaringForYoung, and Landscape::Warn().

Referenced by Skylark_Female::OnEggsHatch().

◆ OnEvicted()

bool Skylark_Male::OnEvicted ( )
4240  {
4241 #ifdef __CJTDebug_5
4242  if ( IsAlive() != 0xDEADC0DE )
4243  DEADCODEError();
4244 #endif
4245  // returns true if evicted or otherwise false
4246  if ( !Paired ) {
4247  m_aTerrlist->clear();
4250  MyTerritory.ref = -1;
4251  HaveTerritory = false;
4253  return true;
4254  } else return false; // can't evict I'm paired
4255 }

References SkTerritories::GetTerritoriesByDistance(), HaveTerritory, Skylark_Adult::m_aTerrlist, Skylark_Base::m_CurrentSkState, Skylark_Base::m_OurPopulationManager, Skylark_Base::m_OurTerritories, Skylark_Adult::MyTerritory, Skylark_Adult::Paired, skTerritory_struct::ref, SkTerritories::RemoveMale(), Skylark_Population_Manager::TheSkylarkTerrs, toss_MFindingTerritory, skTerritory_struct::x, and skTerritory_struct::y.

Referenced by st_FindingTerritory().

◆ OnFarmEvent()

bool Skylark_Male::OnFarmEvent ( FarmToDo  event)
protectedvirtual

Reimplemented from TAnimal.

3835  {
3836  switch ( event ) {
3837  case sleep_all_day:
3838  break;
3839  case autumn_plough:
3840  break;
3841  case autumn_harrow:
3842  break;
3843  case autumn_roll:
3844  break;
3845  case autumn_sow:
3846  break;
3847  case winter_plough:
3848  break;
3849  case deep_ploughing:
3850  break;
3851  case spring_plough:
3852  break;
3853  case spring_harrow:
3854  break;
3855  case spring_roll:
3856  break;
3857  case spring_sow:
3858  break;
3859  case fp_npks:
3860  break;
3861  case fp_npk:
3862  break;
3863  case fp_pk:
3864  break;
3865  case fp_liquidNH3:
3866  break;
3867  case fp_slurry:
3868  break;
3869  case fp_manganesesulphate:
3870  break;
3871  case fp_manure:
3872  break;
3873  case fp_greenmanure:
3874  break;
3875  case fp_sludge:
3876  break;
3877  case fa_npk:
3878  break;
3879  case fa_pk:
3880  break;
3881  case fa_slurry:
3882  break;
3883  case fa_ammoniumsulphate:
3884  break;
3885  case fa_manure:
3886  break;
3887  case fa_greenmanure:
3888  break;
3889  case fa_sludge:
3890  break;
3891  case herbicide_treat:
3892  break;
3893  case growth_regulator:
3894  break;
3895  case fungicide_treat:
3896  break;
3897  case insecticide_treat:
3899  break;
3900  case syninsecticide_treat:
3901  if ( random( 1000 ) < cfg_insecticide_direct_mortM.value() ) {
3902 #ifdef TEST_ISSUE_DEATH_WARRANT
3903  printf( "Skylark_Male::OnFarmEvent() : %d : %d\n", event, ( int )g_date->Date() );
3904 #endif
3906  }
3907  break;
3908  case molluscicide:
3909  break;
3910  case row_cultivation:
3911  break;
3912  case strigling:
3913  break;
3914  case hilling_up:
3915  break;
3916  case water:
3917  break;
3918  case swathing:
3919  break;
3920  case harvest:
3921  break;
3922  case cattle_out:
3923  case cattle_out_low:
3924  break;
3925  case cut_to_hay:
3926  break;
3927  case cut_to_silage:
3928  break;
3929  case straw_chopping:
3930  break;
3931  case hay_turning:
3932  break;
3933  case hay_bailing:
3934  break;
3935  case stubble_harrowing:
3936  break;
3938  break;
3939  case burn_straw_stubble:
3940  break;
3941  case mow:
3942  break;
3943  case cut_weeds:
3944  break;
3945  case pigs_out:
3946  break;
3947  case strigling_sow:
3948  break;
3949  case product_treat:
3950  break;
3951  case glyphosate:
3952  break;
3953  default:
3954  g_land->Warn( "Skylark_Male::OnFarmEvent(): ""Unknown event type:", m_OurLandscape->EventtypeToString( event ) );
3955  exit( 1 );
3956  }
3957  if ( m_CurrentSkState == toss_MDying ) return true; else
3958  return false;
3959 }

References autumn_harrow, autumn_or_spring_plough, autumn_plough, autumn_roll, autumn_sow, burn_straw_stubble, cattle_out, cattle_out_low, cfg_insecticide_direct_mortM, cut_to_hay, cut_to_silage, cut_weeds, deep_ploughing, Landscape::EventtypeToString(), fa_ammoniumsulphate, fa_greenmanure, fa_manure, fa_npk, fa_pk, fa_sludge, fa_slurry, fp_greenmanure, fp_liquidNH3, fp_manganesesulphate, fp_manure, fp_npk, fp_npks, fp_pk, fp_sludge, fp_slurry, fungicide_treat, g_land, glyphosate, growth_regulator, harvest, hay_bailing, hay_turning, herbicide_treat, hilling_up, insecticide_treat, Skylark_Base::m_CurrentSkState, TAnimal::m_OurLandscape, molluscicide, mow, pigs_out, product_treat, row_cultivation, sleep_all_day, spring_harrow, spring_plough, spring_roll, spring_sow, straw_chopping, strigling, strigling_sow, stubble_harrowing, swathing, syninsecticide_treat, toss_MDying, trial_insecticidetreat, Landscape::Warn(), water, and winter_plough.

◆ OnFoodMessage()

double Skylark_Male::OnFoodMessage ( int  n,
double  f 
)
inline
949  {
950  double extra = m_Brood[n]->On_FoodSupply( f );
951  return extra;
952  }

References Skylark_Nestling::On_FoodSupply().

Referenced by Skylark_Female::FeedYoung().

◆ OnMateDying()

void Skylark_Male::OnMateDying ( )
4311  {
4312 #ifdef __CJTDebug_5
4313  if ( IsAlive() != 0xDEADC0DE )
4314  DEADCODEError();
4315 #endif
4316  // Brood size is reduced to zero because he forgets about the young
4317  // So must also tell them to forget him
4318  for ( int i = 0; i < m_BroodSize; i++ ) {
4319  m_Brood[ i ]->OnDadDead();
4320  m_Brood[ i ] = NULL;
4321 
4322  }
4323  m_BroodSize = 0;
4324  MyMate = NULL;
4325  Paired = false;
4326  BSuccess = false;
4327  int today = m_OurLandscape->SupplyDayInYear();
4328  if ( today >= g_stopdate ) {
4330  }
4331  else m_CurrentSkState = toss_AttractingAMate; // TransferToState(AttractAMate);
4332 }

References Skylark_Adult::BSuccess, g_stopdate, m_Brood, m_BroodSize, Skylark_Base::m_CurrentSkState, TAnimal::m_OurLandscape, MyMate, Skylark_Nestling::OnDadDead(), Skylark_Adult::Paired, Landscape::SupplyDayInYear(), toss_AttractingAMate, and toss_MFlocking.

Referenced by Skylark_Population_Manager::Catastrophe(), and Skylark_Female::st_Dying().

◆ OnMateLeaving()

void Skylark_Male::OnMateLeaving ( )
4337  {
4338 #ifdef __CJTDebug_5
4339  if ( IsAlive() != 0xDEADC0DE )
4340  DEADCODEError();
4341 #endif
4342  // Brood size is reduced to zero because he forgets about the young
4343  // He must tell them to forget about him as well
4344  for ( int i = 0; i < m_BroodSize; i++ ) {
4345  m_Brood[ i ]->OnDadDead(); // OK he is lying
4346  m_Brood[ i ] = NULL;
4347  }
4348  m_BroodSize = 0;
4349  if ( !BSuccess ) {
4350  // She has left him, so in this case he gives up
4351  MyMate = NULL;
4352  double qual = m_OurTerritories->Supply_terr( MyTerritory.ref )->GetQuality();
4353  // Store the quality for today so the female can read it
4355  {
4356  MyTerritory.nqual = qual;
4357  m_CurrentSkState = toss_AttractingAMate; // TransferToState(AttractAMate);
4358  }
4359  else
4360  {
4361  // Too late to try again
4363  HaveTerritory = false;
4364  // Must de-register himself as territory owner
4366  // Just to be sure we can set the ref to -1 = no territory
4367  MyTerritory.ref = -1;
4368  }
4369  } else {
4370  // She has stopped breeding for the year
4371  m_CurrentSkState = toss_MFlocking; // TransferToState(Flocking);
4372  HaveTerritory = false;
4373  // Must de-register himself as territory owner
4375  // Just to be sure we can set the ref to -1 = no territory
4376  MyTerritory.ref = -1;
4377  }
4378  // In all cases
4379  Paired = false;
4380 }

References Skylark_Adult::BSuccess, g_stopdate, skTTerritory::GetQuality(), HaveTerritory, m_Brood, m_BroodSize, Skylark_Base::m_CurrentSkState, m_MyMinTerritoryQual, TAnimal::m_OurLandscape, Skylark_Base::m_OurTerritories, MyMate, Skylark_Adult::MyTerritory, skTerritory_struct::nqual, Skylark_Nestling::OnDadDead(), Skylark_Adult::Paired, skTerritory_struct::ref, SkTerritories::RemoveMale(), SkTerritories::Supply_terr(), Landscape::SupplyDayInYear(), toss_AttractingAMate, and toss_MFlocking.

Referenced by Skylark_Female::st_GivingUpTerritory(), and Skylark_Female::st_StoppingBreeding().

◆ OnMateNeverComesBack()

void Skylark_Male::OnMateNeverComesBack ( Skylark_Female AFemale)
4532  {
4533 #ifdef __CJTDebug_5
4534  if ( IsAlive() != 0xDEADC0DE )
4535  DEADCODEError();
4536 #endif
4537  // Just a safety check
4538  if ( MyMate == AFemale ) {
4539  MyMate = NULL;
4540  Paired = false;
4541  BSuccess = false;
4542  }
4543 }

References Skylark_Adult::BSuccess, MyMate, and Skylark_Adult::Paired.

Referenced by Skylark_Female::st_Finding_Territory(), and Skylark_Female::st_Immigrating().

◆ OnNestlingDeath()

void Skylark_Male::OnNestlingDeath ( Skylark_Nestling N)
4850  {
4851 #ifdef __CJTDebug_5
4852  if ( IsAlive() != 0xDEADC0DE )
4853  DEADCODEError();
4854  bool found = false;
4855 #endif
4856  // remove the dead one
4857  m_BroodSize--;
4858 #ifdef __CJTDebug_4
4859  if ( m_BroodSize < 0 ) {
4861  }
4862 #endif
4863  for ( int i = 0; i <= m_BroodSize; i++ ) {
4864  if ( m_Brood[ i ] == N ) {
4865  m_Brood[ i ] = m_Brood[ m_BroodSize ];
4866  m_Brood[ m_BroodSize ] = NULL;
4867 #ifdef __CJTDebug_5
4868  found = true;
4869 #endif
4870  }
4871  }
4872 #ifdef __CJTDebug_5
4873  if ( found == false ) {
4874  g_land->Warn( "Skylark_Male::OnNestlingDeath - Debug 5 ", NULL ); exit( 1 );
4875  }
4876 #endif
4877  // If all dead do on Brood death
4878  // remove the matured one
4879  if ( m_BroodSize == 0 ) {
4880  OnBroodDeath();
4881  }
4882 }

References g_land, m_Brood, m_BroodSize, TALMaSSObject::OnArrayBoundsError(), OnBroodDeath(), and Landscape::Warn().

Referenced by Skylark_Nestling::st_Dying().

◆ OnNestLocation()

void Skylark_Male::OnNestLocation ( int  x,
int  y 
)
4907  {
4908 #ifdef __CJTDebug_5
4909  if ( IsAlive() != 0xDEADC0DE )
4910  DEADCODEError();
4911 #endif
4912  if ( x == 0 ) x = 2;
4913  m_Location_x = x - 1;
4914  m_Location_y = y;
4915 }

References TAnimal::m_Location_x, and TAnimal::m_Location_y.

Referenced by Skylark_Female::st_MakingNest().

◆ OnNestPredatation()

void Skylark_Male::OnNestPredatation ( )
4886  {
4887  for ( int i = 0; i < m_BroodSize; i++ ) {
4888  m_Brood[ i ]->OnYouHaveBeenEaten();
4889  }
4890  m_BroodSize = 0;
4891  OnBroodDeath();
4892 }

References m_Brood, m_BroodSize, OnBroodDeath(), and Skylark_Nestling::OnYouHaveBeenEaten().

Referenced by Skylark_Nestling::EndStep().

◆ OnPairing()

void Skylark_Male::OnPairing ( Skylark_Female female)
4920  {
4921 #ifdef __CJTDebug_5
4922  if ( IsAlive() != 0xDEADC0DE )
4923  DEADCODEError();
4924 #endif
4925  Paired = true;
4926  if ( MyMate ) {
4927  if ( MyMate != female ) MyMate->OnMaleNeverComesBack( this );
4928  }
4929  MyMate = female;
4931  BSuccess = false;
4933 }

References Skylark_Adult::BSuccess, ConstructAHabitatTable(), Skylark_Base::m_CurrentSkState, MyMate, Skylark_Female::OnMaleNeverComesBack(), Skylark_Adult::Paired, and toss_FollowingMate.

Referenced by Skylark_Female::EstablishTerritory().

◆ OnPreFledgelingDeath()

void Skylark_Male::OnPreFledgelingDeath ( Skylark_PreFledgeling P)
4458  {
4459 #ifdef __CJTDebug_5
4460  if ( IsAlive() != 0xDEADC0DE )
4461  DEADCODEError();
4462  bool found = false;
4463 #endif
4464  // remove the dead one
4465  for ( int i = 0; i < m_BroodSize; i++ ) {
4466  if ( m_Brood[ i ] == P ) {
4467  m_Brood[ i ] = m_Brood[ --m_BroodSize ];
4468  m_Brood[ m_BroodSize ] = NULL;
4469 #ifdef __CJTDebug_5
4470  found = true;
4471 #endif
4472  }
4473  }
4474 
4475 #ifdef __CJTDebug_4
4476  if ( m_BroodSize < 0 ) {
4478  }
4479 #endif
4480 
4481 #ifdef __CJTDebug_5
4482  if ( found == false ) {
4483  g_land->Warn( "Skylark_Male::OnPreFledgelingDeath: DeBug5 ", NULL );
4484  exit( 1 );
4485  }
4486 #endif
4487  // If all dead do on Brood death
4488  // remove the matured one
4489  if ( m_BroodSize == 0 ) {
4490  OnBroodDeath();
4491  }
4492 }

References g_land, m_Brood, m_BroodSize, TALMaSSObject::OnArrayBoundsError(), OnBroodDeath(), and Landscape::Warn().

Referenced by Skylark_PreFledgeling::st_Dying().

◆ OnPreFledgelingMature()

void Skylark_Male::OnPreFledgelingMature ( Skylark_PreFledgeling P)
4497  {
4498 #ifdef __CJTDebug_5
4499  if ( IsAlive() != 0xDEADC0DE )
4500  DEADCODEError();
4501 #endif
4502  for ( int i = 0; i < m_BroodSize; i++ ) {
4503  if ( m_Brood[ i ] == P ) {
4504  m_Brood[ i ] = m_Brood[ --m_BroodSize ];
4505  m_Brood[ m_BroodSize ] = NULL;
4506  BSuccess = true;
4507  if ( MyMate ) MyMate->OnBreedingSuccess();
4508  }
4509  }
4510  // If all matured do on Brood death
4511  // remove the matured one
4512 #ifdef __CJTDebug_4
4513  if ( m_BroodSize < 0 ) {
4515  }
4516 #endif
4517  if ( m_BroodSize == 0 ) {
4518  if ( Paired ) {
4519  // it all depends what the female is doing
4520  // what he must do.
4521  // if she is also feeding he needs to tell here to stop
4525  else {
4527  }
4528  }
4529 }

References Skylark_Adult::BSuccess, HaveTerritory, m_Brood, m_BroodSize, Skylark_Base::m_CurrentSkState, MyMate, TALMaSSObject::OnArrayBoundsError(), Skylark_Female::OnBreedingSuccess(), Skylark_Female::OnStopFeedingChicks(), Skylark_Adult::Paired, toss_AttractingAMate, toss_FollowingMate, and toss_MFlocking.

Referenced by Skylark_PreFledgeling::st_Maturing().

◆ OnReHouse()

void Skylark_Male::OnReHouse ( )
4261  {
4262 #ifdef __CJTDebug_5
4263  if ( IsAlive() != 0xDEADC0DE )
4264  DEADCODEError();
4265 #endif
4266  int mindist=100000000;
4267  int index=-1;
4268  // Needs to sort through the new list of territories to find one closest to its m_Location_x, m_Location_y
4269  int Nterrs = m_OurTerritories->SupplyNoTerritories();
4270  int dist=0;
4271  for (int i=0; i<Nterrs; i++) {
4272  Skylark_Base* TheOwner = m_OurTerritories->Supply_Owner( i );
4273  if ( !TheOwner ) {
4274  int tx = m_OurTerritories->Supply_x(i);
4275  int ty = m_OurTerritories->Supply_y(i);
4276  dist = (int)sqrt((float)(tx*tx+ty*ty));
4277  if (dist< mindist) {
4278  mindist=dist;
4279  index=i;
4280  }
4281  }
4282  }
4283  if (index!=-1) {
4284  MyTerritory.ref = index;
4285  // store territory data
4286  MyTerritory.x = m_OurTerritories->Supply_x( index );
4287  MyTerritory.y = m_OurTerritories->Supply_y( index );
4291  if (Paired) {
4294  }
4295  }
4296  else {
4297  if (Paired) {
4299  MyMate = NULL;
4300  Paired=false;
4301  }
4302  MyTerritory.ref = -1;
4303  HaveTerritory = false;
4305  }
4306 }

References EstablishingATerritory(), Skylark_Female::EstablishTerritory(), SkTerritories::FemaleOccupy(), HaveTerritory, Skylark_Base::m_CurrentSkState, Skylark_Base::m_OurTerritories, MyMate, Skylark_Adult::MyTerritory, Skylark_Female::OnMateHomeless(), Skylark_Adult::Paired, skTerritory_struct::ref, skTerritory_struct::size, SkTerritories::Supply_Owner(), SkTerritories::Supply_size(), SkTerritories::Supply_x(), SkTerritories::Supply_y(), SkTerritories::SupplyIsNestValid(), SkTerritories::SupplyNoTerritories(), toss_MFindingTerritory, skTerritory_struct::validnest, skTerritory_struct::x, and skTerritory_struct::y.

Referenced by Skylark_Population_Manager::ReHouse().

◆ OptimiseHabitatSearchingOrder()

void Skylark_Male::OptimiseHabitatSearchingOrder ( )
protected
5152  {
5153 #ifdef __CJTDebug_5
5154  if ( IsAlive() != 0xDEADC0DE )
5155  DEADCODEError();
5156 #endif
5157  // This method sorts the HabitatTable on the basis of the highest
5158  // available insects per square metre basis
5159  // It also puts the available insects into the table
5160 
5161  // Sort the entries on the basis of InsectTable
5162  int hold1;
5163  double hold2;
5164  int interChange = 1;
5165  int pass = 0;
5166  while ( ( pass++ <= No_HabitatTable_Refs - 1 ) && interChange ) {
5167  interChange = 0;
5168  for ( int j = 0; j < No_HabitatTable_Refs - pass; j++ )
5169  if ( m_InsectTable[ j ] < m_InsectTable[ j + 1 ] ) {
5170  // set the flag
5171  interChange = 1;
5172  // The poly ref
5173  hold1 = m_HabitatTable_PNum[ j ];
5174  m_HabitatTable_PNum[ j ] = m_HabitatTable_PNum[ j + 1 ];
5175  m_HabitatTable_PNum[ j + 1 ] = hold1;
5176  // the size
5177  hold1 = m_HabitatTable_Size[ j ];
5178  m_HabitatTable_Size[ j ] = m_HabitatTable_Size[ j + 1 ];
5179  m_HabitatTable_Size[ j + 1 ] = hold1;
5180  // The insects
5181  hold2 = m_InsectTable[ j ];
5182  m_InsectTable[ j ] = m_InsectTable[ j + 1 ];
5183  m_InsectTable[ j + 1 ] = ( int )hold2;
5184  // The Pesticide
5185 #ifdef __PESTICIDE_RA
5186  hold2 = m_PConcTable[ j ];
5187  m_PConcTable[ j ] = m_PConcTable[ j + 1 ];
5188  m_PConcTable[ j + 1 ] = ( int )hold2;
5189 #endif
5190  }
5191  }
5192 }

References m_HabitatTable_PNum, m_HabitatTable_Size, m_InsectTable, and No_HabitatTable_Refs.

Referenced by GetFood().

◆ PesticideResponse()

void Skylark_Male::PesticideResponse ( void  )
protectedvirtual

Reimplemented from Skylark_Base.

6843  {
6845  ;
6846  }
6848 }

References cfg_Skylark_male_Biodegredation, cfg_Skylark_male_NOEL, and Skylark_Base::m_pesticide_accumulation.

Referenced by EndStep().

◆ ReEvaluateTerritory()

void Skylark_Male::ReEvaluateTerritory ( )
protected

Daily re-evaluation of territory.

The method is designed to keep the measure of territory quality up to date and avoids the need for the female to do this unless finding a nest position. The second usage is to provide the potential to reduce territory size should conditions improve. The reverse situation results in desertion by the female so is not handled here.

4792  {
4799  double qual = 0;
4800  if (MyTerritory.validnest) {
4802 
4803  }
4804  else qual=0;
4805  if (qual>m_XFNestAcceptScore) {
4807  // He really has too much, so split it down into 2
4810 
4811  }
4812  // Store the quality for today so the female can read it
4813  MyTerritory.nqual = qual;
4814 }

References skTTerritory::GetQuality(), skTTerritory::GetVirtualDiameter(), Skylark_Base::m_OurTerritories, m_XFNestAcceptScore, Skylark_Adult::MyTerritory, skTerritory_struct::nqual, skTerritory_struct::ref, SkTerritories::Split(), SkTerritories::Supply_terr(), and skTerritory_struct::validnest.

Referenced by BeginStep().

◆ ReInit()

void Skylark_Male::ReInit ( int  x,
int  y,
double  size,
int  age,
SkTerritories Terrs,
Landscape L,
Skylark_Population_Manager SPM,
int  bx,
int  by,
int  mh 
)
virtual

The Male constructor. This initialises some important parameters.

There is some individual variation around the territory acceptance score, up to 10% max

Reimplemented from Skylark_Adult.

3813  {
3814  Skylark_Adult::ReInit(x, y, size, age, Terrs, L, SPM, bx, by, mh);
3818  GoodWeather = 0;
3819  HaveTerritory = false;
3820  MyMate = NULL;
3821  m_BroodSize = 0; // don't start life with chicks!
3822  BSuccess = false;
3823  m_firstPF = false;
3825  m_MyMinTerritoryQual = (int)(cfg_FemaleMinTerritoryAcceptScore.value() * (g_rand_uni() / 10.0 + 1.0)); //= 1.0 to 1.1
3826  m_XFNestAcceptScore = m_MyMinTerritoryQual * (double)(g_rand_uni() + 2.1);
3827  for (int i = 0; i < 6; i++) m_Brood[i] = NULL;
3828 }

References Skylark_Adult::BSuccess, cfg_FemaleMinTerritoryAcceptScore, g_rand_uni, GoodWeather, HaveTerritory, m_Brood, m_BroodSize, m_firstPF, m_MyMinTerritoryQual, m_XFNestAcceptScore, MyMate, and Skylark_Adult::ReInit().

◆ SensibleCopy()

void Skylark_Male::SensibleCopy ( )
6820  {
6821  // This is called if a new bird is made as a copy of another and needs to have some sensible information added
6823 }

References Skylark_Base::m_CurrentSkState, and toss_MEmigrating.

Referenced by Skylark_Population_Manager::CreateObjects().

◆ st_Arriving()

bool Skylark_Male::st_Arriving ( )
protected
4157  {
4158 #ifdef __CJTDebug_5
4159  if ( IsAlive() != 0x0DEADC0DE ) DEADCODEError();
4160 #endif
4161  if ( GetBadWeather() )
4162  return false; // TransferToState(Flocking)
4163  else {
4164  m_aTerrlist->clear();
4165  int x = m_Born_x;
4166  int y = m_Born_y;
4167  if (MyTerritory.x>0) {
4168  x = MyTerritory.x;
4169  y = MyTerritory.y;
4170  }
4172  return true; // TransferToState(FindTerritory)
4173  }
4174 }

References Skylark_Adult::GetBadWeather(), SkTerritories::GetTerritoriesByDistance(), Skylark_Adult::m_aTerrlist, Skylark_Base::m_Born_x, Skylark_Base::m_Born_y, Skylark_Base::m_OurPopulationManager, Skylark_Adult::MyTerritory, Skylark_Population_Manager::TheSkylarkTerrs, skTerritory_struct::x, and skTerritory_struct::y.

Referenced by Step().

◆ st_AttractingAMate()

int Skylark_Male::st_AttractingAMate ( )
protected

Is called once each day. If a female comes along and pairs then she will trigger a move to FollowMate via Skylark_Male::OnPairing

4725  {
4726 #ifdef __CJTDebug_5
4727  if ( IsAlive() != 0x0DEADC0DE ) DEADCODEError();
4728 #endif
4729 
4733  MyTerritory.ref = -1; // No territory
4734  HaveTerritory = false;
4735  return 1; // TransferToState(Flocking)
4736  }
4737  else {
4738  return 0; // Do nothing
4739  }
4740 }

References g_stopdate, HaveTerritory, TAnimal::m_OurLandscape, Skylark_Base::m_OurTerritories, Skylark_Adult::MyTerritory, skTerritory_struct::ref, SkTerritories::RemoveMale(), and Landscape::SupplyDayInYear().

Referenced by Step().

◆ st_CaringForYoung()

int Skylark_Male::st_CaringForYoung ( )
protected
4994  {
4995 #ifdef __CJTDebug_5
4996  if ( IsAlive() != 0x0DEADC0DE ) DEADCODEError();
4997  if ( m_BroodSize < 1 )
4998  DEADCODEError();
4999 #endif
5000  double spare; // spare food
5001  int HungryChicks = m_BroodSize;
5002  int FeedingProbs[ 26 ];
5003  double ChickFood[ 26 ];
5004 #ifdef __PESTICIDE_RA_CHICK
5005  double ChickPoison[ 26 ];
5006 #endif
5007  if ( m_Brood[ 0 ]->Age == 31 ) {
5008  return 1; // Scare off chicks
5009  }
5010  // Check for bad weather
5011  double RainToday = m_OurLandscape->SupplyRain();
5012  if (RainToday>MaxFeedRain) return 0; // No feeding today
5013 
5014  // can only get food in daylight - dawn & dusk
5015  int food_time = ( int )( ( double )( m_OurLandscape->SupplyDaylength() - 120 ));
5016  double resources_all = GetFood( food_time ); // dw g insects
5017  // remove metabolic requirements
5018  double resources = RemoveEM( resources_all );
5019  if ( resources > 0 )
5020  // Now give the food to the chicks
5021  // The chance that a chick get a portion is proportional to their size
5022  {
5023  // Zero the feeding probabilities
5024  for ( int i = 0; i < m_BroodSize; i++ ) {
5025  FeedingProbs[ i ] = 0;
5026  ChickFood[ i ] = 0;
5027 #ifdef __PESTICIDE_RA_CHICK
5028  ChickPoison[ i ] = 0;
5029 #endif
5030  }
5031  resources /= FoodTripsPerDay; // Split into portions (food trips per day)
5032 #ifdef __PESTICIDE_RA_CHICK
5033  double pcide_remain = resources * m_pcide_conc;
5034 #endif
5035  int BroodWeight = 0;
5036  for ( int i = 0; i < m_BroodSize; i++ ) {
5037  // Add up brood weight
5038  int weight = ( int )floor( m_Brood[ i ]->m_Size + 0.5 );
5039  BroodWeight += weight;
5040  for ( int j = i; j < m_BroodSize; j++ ) FeedingProbs[ j ] += weight;
5041  }
5042 
5043  while ( ( resources > 0.01 ) && ( HungryChicks > 0 ) ) {
5044  for ( int portion = 0; portion < FoodTripsPerDay; portion++ ) { // For each portion
5045  int choose = random( BroodWeight );
5046  for ( int i = 0; i < m_BroodSize; i++ ) {
5047  if ( choose < FeedingProbs[ i ] ) {
5048  ChickFood[ i ] += resources; // store the food for that chick
5049 #ifdef __PESTICIDE_RA_CHICK
5050  ChickPoison[ i ] += pcide_remain;
5051 #endif
5052  break;
5053  }
5054  }
5055  }
5056  // Now give the food to the chicks
5057  // Better do this than feed each a portion at a time, it is more efficient
5058  // and stops problems with growth between portions
5059  spare = 0;
5060  for ( int i = 0; i < m_BroodSize; i++ ) {
5061  double extra = m_Brood[ i ]->On_FoodSupply( ChickFood[ i ] );
5062 #ifdef __PESTICIDE_RA_CHICK
5063  // If we want a chick response to pesticide then the line below should be lit up, and the response
5064  // specified in the PesticideResponse method
5065  m_Brood[ i ]->m_pesticide_accumulation += ChickPoison[i]* ((ChickFood[ i ]-extra)/ChickFood[ i ]);
5066 #endif
5067  if ( extra > 0 ) // chick must be full
5068  {
5069  FeedingProbs[ i ] = -1; // no chance of food
5070  HungryChicks--;
5071  spare += extra;
5072  }
5073  }
5074  resources = spare / FoodTripsPerDay;
5075  }
5076  }
5077  return 0; // no change
5078 }

References Skylark_Base::Age, FoodTripsPerDay, GetFood(), m_Brood, m_BroodSize, TAnimal::m_OurLandscape, Skylark_Base::m_pcide_conc, Skylark_Base::m_pesticide_accumulation, Skylark_Base::m_Size, MaxFeedRain, Skylark_Nestling::On_FoodSupply(), Skylark_Adult::RemoveEM(), Landscape::SupplyDaylength(), and Landscape::SupplyRain().

Referenced by BeginStep().

◆ st_Dying()

void Skylark_Male::st_Dying ( )
protected
4102  {
4103 #ifdef __CJTDebug_5
4104  if ( IsAlive() != 0x0DEADC0DE ) DEADCODEError();
4105 #endif
4106  if ( MyMate ) {
4107  if ( MyMate->MyMate != this ) {
4108  g_land->Warn( "Skylark_Male::st_Dying: DeBug1 ", NULL ); exit( 1 );
4109  }
4110  MyMate->OnMateDying();
4111  }
4113  MyTerritory.ref = -1; // No territory
4114  HaveTerritory = false;
4115  MyMate = NULL;
4116  Paired = false;
4117  if ( m_BroodSize > 0 ) {
4118  for ( int i = 0; i < m_BroodSize; i++ ) {
4119  m_Brood[ i ]->OnDadDead();
4120  }
4121  }
4122  m_CurrentStateNo = -1;
4124 }

References g_land, HaveTerritory, m_Brood, m_BroodSize, Skylark_Base::m_CurrentSkState, TALMaSSObject::m_CurrentStateNo, Skylark_Base::m_OurTerritories, Skylark_Female::MyMate, MyMate, Skylark_Adult::MyTerritory, Skylark_Nestling::OnDadDead(), Skylark_Female::OnMateDying(), Skylark_Adult::Paired, skTerritory_struct::ref, SkTerritories::RemoveMale(), toss_Destroy, and Landscape::Warn().

Referenced by Step().

◆ st_Emigrating()

int Skylark_Male::st_Emigrating ( )
protected
4211  {
4212 #ifdef __CJTDebug_5
4213  if ( IsAlive() != 0x0DEADC0DE ) DEADCODEError();
4214 #endif
4215  // Timing: Called once per day in the middle of a day
4216  // In the emigration state GoodWeather must be 0 on first entry
4217  int today = m_OurLandscape->SupplyDayInYear();
4218  if ( today >= g_stopdate ) return 0; //don't come back this year
4219  if ( m_OurLandscape->SupplyTemp() > 0.0 ) GoodWeather++; else
4220  GoodWeather = 0;
4221  if ( GoodWeather >= 3 ) // Third day of good weather
4222  {
4223  int chance = random( 10000 ); // number between 0-99
4224  if ( Age < 1 ) {
4225  // below returning probability is divided by 30 as the number of days
4226  if ( ( chance < 300 ) && ( today >= March ) ) return 1; else if ( today >= April ) return 1;
4227  } else {
4228  if ( ( chance < 7 ) && ( today >= January ) ) return 1;
4229  else if ( ( chance < 33 ) && ( today >= February ) ) return 1;
4230  else if ( ( chance < 300 ) & ( today >= March ) ) return 1;
4231  else if ( today >= April ) return 1;
4232  }
4233  }
4234  return 0; // return value of 0 do nothing, 1 go to immigration
4235 }

References Skylark_Base::Age, April, February, g_stopdate, GoodWeather, January, TAnimal::m_OurLandscape, March, Landscape::SupplyDayInYear(), and Landscape::SupplyTemp().

Referenced by Step().

◆ st_FindingTerritory()

int Skylark_Male::st_FindingTerritory ( )
protected

This option picks 10 territories at random and tests them. This will happen if the bird arrives here without an m_aTerrlist, or because it has exhausted its list of possible territories.

This option is for birds with a valid m_aTerrlist to search. It takes the 10 nearest territories one at a time and tests to see if they are OK If so establish in one of them, otherwise wait until another day to test the next 10

4577  {
4578  Skylark_Male * TheOwner;
4579  if (m_aTerrlist->size()==0) {
4583  #ifdef __CJTDebug_5
4584  if ( IsAlive() != 0x0DEADC0DE ) DEADCODEError();
4585  #endif
4586  int Nterrs = m_OurTerritories->SupplyNoTerritories();
4587  int territories[ 10 ] [ 2 ];
4588  // Select 10 territories
4589  for ( int i = 0; i < 10; i++ ) {
4590  territories[ i ] [ 0 ] = random( Nterrs );
4591  TheOwner = m_OurTerritories->Supply_Owner( territories[ i ] [ 0 ] );
4592  // If there is an owner
4593  if ( TheOwner != NULL ) {
4594  if ( TheOwner->DefendTerritory() >= Age ) {
4595  territories[ i ] [ 1 ] = -1;
4596  }
4597  } else {
4598  territories[ i ] [ 1 ] = m_OurTerritories->Supply_quality( territories[ i ] [ 0 ] );
4599  }
4600  }
4601  int best_qual = 0; // much too low
4602  int best = -1;
4603  for ( int i = 0; i < 10; i++ ) {
4604  if ( territories[ i ] [ 1 ] > best_qual ) {
4605  best_qual = territories[ i ] [ 1 ];
4606  best = i;
4607  }
4608  }
4609  if ( best_qual > m_MyMinTerritoryQual ) // Territory acceptable
4610  {
4611  // save ref number
4612  TheOwner = m_OurTerritories->Supply_Owner( territories[ best ] [ 0 ] );
4613  if ( TheOwner ) {
4614  // Must send a get out message to the other bird
4615  // if he is already breeding then fail
4616  if ( TheOwner->OnEvicted() ) return 2; // fail
4617  }
4618  MyTerritory.ref = territories[ best ] [ 0 ];
4619  // store territory data
4624  return 1; //TransferToState(EstablishTerritory);
4625  }
4626  }
4627  else {
4633  for (int i=0; i<10 ; i++) {
4634  int sz = int (m_aTerrlist->size()-1);
4635  int qual= 0 ;
4636  if (sz >= 0) {
4637  APoint p = (*m_aTerrlist)[sz--];
4638  m_aTerrlist->pop_back();
4639  TheOwner = m_OurTerritories->Supply_Owner( p.m_x );
4640  // If there is an owner
4641  if ( TheOwner != NULL ) {
4642  if ( TheOwner->DefendTerritory() < Age ) {
4643  qual = m_OurTerritories->Supply_quality( p.m_x );
4644  }
4645  }
4646  else {
4647  qual = m_OurTerritories->Supply_quality( p.m_x );
4648  }
4649  if ( qual > m_MyMinTerritoryQual ) // Territory acceptable
4650  {
4651  if ( TheOwner ) {
4652  // Must send a get out message to the other bird
4653  // if he is already breeding then fail
4654  if ( TheOwner->OnEvicted() ) return 2; // fail
4655  }
4656  MyTerritory.ref = p.m_x;
4657  // store territory data
4662  return 1; //TransferToState(EstablishTerritory);
4663  }
4664  }
4665  }
4666  }
4667 
4668 
4669 #ifdef FOR_DEMONSTRATION
4670  m_Location_x = 0;
4671  m_Location_y = 0;
4672 #endif
4673  return 2; //TransferToState(Floating);
4674 }

References Skylark_Base::Age, DefendTerritory(), Skylark_Adult::m_aTerrlist, TAnimal::m_Location_x, TAnimal::m_Location_y, m_MyMinTerritoryQual, Skylark_Base::m_OurTerritories, Skylark_Adult::MyTerritory, OnEvicted(), skTerritory_struct::ref, skTerritory_struct::size, SkTerritories::Supply_Owner(), SkTerritories::Supply_quality(), SkTerritories::Supply_size(), SkTerritories::Supply_x(), SkTerritories::Supply_y(), SkTerritories::SupplyIsNestValid(), SkTerritories::SupplyNoTerritories(), skTerritory_struct::validnest, skTerritory_struct::x, and skTerritory_struct::y.

Referenced by Step().

◆ st_Floating()

TTypesOfSkState Skylark_Male::st_Floating ( )
protected
4744  {
4745 #ifdef __CJTDebug_5
4746  if ( IsAlive() != 0x0DEADC0DE ) DEADCODEError();
4747 #endif
4748  if ( GetBadWeather() ) return toss_MTempLeavingArea;
4752  return toss_MFlocking;
4753  } else {
4754 #ifdef FOR_DEMONSTRATION
4755  m_Location_x = 0;
4756  m_Location_y = 0;
4757 #endif
4758  return toss_MFindingTerritory; //TransferToState(FindTerritory);
4759  }
4760 }

References g_stopdate, Skylark_Adult::GetBadWeather(), TAnimal::m_Location_x, TAnimal::m_Location_y, TAnimal::m_OurLandscape, Skylark_Base::m_OurPopulationManager, Landscape::SupplyDayInYear(), Population_Manager::SupplySimH(), Population_Manager::SupplySimW(), toss_MFindingTerritory, toss_MFlocking, and toss_MTempLeavingArea.

Referenced by BeginStep().

◆ st_Flocking()

int Skylark_Male::st_Flocking ( )
protected

The bird is assumed to move around the area waiting until weather conditions are suitable to begin Emigration, depending upon the time of year. Only arrives here after breeding, so poor conditions will trigger a transition to Emigration. A transition to Emigration will also occur if the bird has not emigrated before October.

4129  {
4130 #ifdef __CJTDebug_5
4131  if ( IsAlive() != 0x0DEADC0DE ) DEADCODEError();
4132 #endif
4133 
4138 #ifdef FOR_DEMONSTRATION
4139  // TODO if we want it to look nice on the screen then the birds must flock
4140  // this will not affect the rest of the simulation - just look better
4141  // Can we be bothered????
4142  // Just for now set the location to 0,0
4143  m_Location_x = 0;
4144  m_Location_y = 0;
4145 #endif
4146 
4147  if ( m_OurLandscape->SupplyDayInYear() > October ) {
4148  GoodWeather = 0;
4149  return 1; //TransferToState(Emigration);
4150  }
4151  bool bad=GetBadWeather();
4152  if ( (bad) && ( m_OurLandscape->SupplyDayInYear() >= September )) return 1; //TransferToState(Emigration);
4153  return 0; // Carry on
4154 }

References Skylark_Adult::GetBadWeather(), GoodWeather, TAnimal::m_Location_x, TAnimal::m_Location_y, TAnimal::m_OurLandscape, October, September, and Landscape::SupplyDayInYear().

Referenced by Step().

◆ st_FollowingMate()

int Skylark_Male::st_FollowingMate ( )
protected

This is simply waiting for a message to say that either female is dead, female leaves or the eggs hatch. The male occupies the same location as the female. When the female's eggs hatch there is a transition to st_CaringForYoung. If the female dies or abandons the territory, there is a transition to AttractingAMate. This method also has another function in that it sets up the food tables for the female, hence must be called before female activity starts.

4764  {
4765 #ifdef __CJTDebug_5
4766  if ( IsAlive() != 0x0DEADC0DE ) DEADCODEError();
4767 #endif
4768 
4774  if ( Paired ) {
4775  GetFood( 0 ); //needs to set up the food tables for the female
4776  }
4777  else {
4779  if ( HaveTerritory ) {
4780  HaveTerritory = false;
4781  // Must de-register himself as territory owner
4783  // Just to be sure we can set the ref to -1 = no territory
4784  MyTerritory.ref = -1;
4785  }
4786  }
4787  return 0;
4788 }

References GetFood(), HaveTerritory, Skylark_Base::m_CurrentSkState, Skylark_Base::m_OurTerritories, Skylark_Adult::MyTerritory, Skylark_Adult::Paired, skTerritory_struct::ref, SkTerritories::RemoveMale(), and toss_MFloating.

Referenced by Step().

◆ st_Immigrating()

bool Skylark_Male::st_Immigrating ( )
protected

An instantaneous state which determines the chance of migration mortality. If he does die then he has to inform any old mate that he has gone. If she is already paired with another bird then can just forget her. If not dying then the bird transitions to st_Arrival.

4178  {
4183 #ifdef __CJTDebug_5
4184  if ( IsAlive() != 0x0DEADC0DE ) DEADCODEError();
4185 #endif
4186  if ( ( random( 100 ) < GetMigrationMortality() ) || Age > 5 ) {
4187  if ( MyMate != NULL ) {
4188  // Needs to be sure that she is not mated to someone else
4189  if ( !MyMate->Paired ) {
4190  MyMate->OnMaleNeverComesBack( this ); //stop a bogus on matedeath message
4191  }
4192  // In either case forget about mate - he no longer cares about this female
4193  MyMate = NULL;
4194  BSuccess = false;
4195 #ifdef __CJTDebug_8
4196  if ( m_BroodSize != 0 )
4197  int rubbish = 0;
4198  for ( int i = 0; i < 6; i++ ) {
4199  if ( m_Brood[ i ] != NULL )
4200  int rubbish = 0;
4201  }
4202 #endif
4203  }
4204  return false; // TransfertoState(Die)
4205  } else
4206  return true; // TransferToState(Arrival)
4207 }

References Skylark_Base::Age, Skylark_Adult::BSuccess, GetMigrationMortality(), m_Brood, m_BroodSize, MyMate, Skylark_Female::OnMaleNeverComesBack(), and Skylark_Adult::Paired.

Referenced by Step().

◆ st_ScaringOffChicks()

int Skylark_Male::st_ScaringOffChicks ( )
protected
4973  {
4974 #ifdef __CJTDebug_5
4975  if ( IsAlive() != 0x0DEADC0DE ) DEADCODEError();
4976 #endif
4977  if ( m_BroodSize > 0 ) {
4978  for ( int i = 0; i < m_BroodSize; i++ ) {
4979  m_Brood[ i ]->OnDadDead();
4980  m_Brood[ i ] = NULL;
4981  }
4982  m_BroodSize = 0; // all chicks gone
4985  BSuccess = true;
4986  }
4987  m_firstPF = false;
4988  return 1; // TransferToState(FollowMate)
4989 }

References Skylark_Adult::BSuccess, m_Brood, m_BroodSize, m_firstPF, MyMate, Skylark_Female::OnBreedingSuccess(), Skylark_Nestling::OnDadDead(), and Skylark_Female::OnStopFeedingChicks().

Referenced by Step().

◆ st_TempLeavingArea()

int Skylark_Male::st_TempLeavingArea ( )
protected
4559  {
4560 #ifdef __CJTDebug_5
4561  if ( IsAlive() != 0x0DEADC0DE ) DEADCODEError();
4562 #endif
4563  // Timing - called once per day
4564  // In the emigration state GoodWeather must be 0 on first entry
4565  if ( !GetBadWeather() ) GoodWeather++;
4566  else
4567  GoodWeather = 0;
4568  if ( GoodWeather >= 7 ) // 7 days of good weather
4569  {
4570  return 1; // comeback to the area
4571  }
4572  return 0; // return value of 0 do nothing, 1 go to Arrival
4573 }

References Skylark_Adult::GetBadWeather(), and GoodWeather.

Referenced by Step().

◆ Step()

void Skylark_Male::Step ( void  )
virtual

Step behaviour - must be implemented in descendent classes.

Reimplemented from TAnimal.

3995  {
3996 #ifdef __CJTDebug_5
3997  if ( IsAlive() != 0x0DEADC0DE ) DEADCODEError();
3998 #endif
3999  if ( m_StepDone || m_CurrentSkState == toss_Destroy ) return;
4000  switch ( m_CurrentSkState ) {
4001  case toss_Initiation: // Initial
4003  break;
4004  case toss_MFlocking: // Flocking
4005  switch ( st_Flocking() ) {
4006  case 3:
4007  m_CurrentSkState = toss_MFindingTerritory; // -> find terr.
4008  break;
4009  case 2:
4010  m_CurrentSkState = toss_MTempLeavingArea; // -> temp.leave
4011  break;
4012  case 1:
4013  // use 0,0 as a default location
4014  m_Location_x = 0;
4015  m_Location_y = 0;
4016  m_CurrentSkState = toss_MEmigrating; // -> Emigration
4017  break;
4018  case 0:
4019  m_StepDone = true;
4020  }
4021  break;
4022  case toss_MArriving: // Arriving
4023  if ( st_Arriving() ) m_CurrentSkState = toss_MFindingTerritory; // -> find terr.
4024  else {
4026  }
4027  m_StepDone = true;
4028  break;
4029  case toss_MImmigrating: // Immigration - is instant
4030  if ( st_Immigrating() )
4031  m_CurrentSkState = toss_MArriving; // -> arrival
4032  else {
4033 #ifdef TEST_ISSUE_DEATH_WARRANT
4034  printf( "Skylark_Male::Step() : st_Immigrating() : %d\n", ( int )g_date->Date() );
4035 #endif
4036  m_CurrentSkState = toss_MDying; // -> die
4037  }
4038  break;
4039  case toss_MEmigrating: // Emigration
4040  if ( st_Emigrating() == 1 ) m_CurrentSkState = toss_MImmigrating; // -> immigr.
4041  m_StepDone = true;
4042  break;
4043  case toss_MTempLeavingArea: // Temp.leave.area
4044  if ( st_TempLeavingArea() ) m_CurrentSkState = toss_MArriving; // -> arrival
4045  m_StepDone = true;
4046  break;
4047  case toss_MFindingTerritory: // FindingTerritory
4048  switch ( st_FindingTerritory() ) {
4049  case 1:
4050  // Must do this now in case someone else gets this territory
4052  m_CurrentSkState = toss_AttractingAMate; // -> attract mate
4053  break;
4054  case 2:
4055  HaveTerritory = false;
4056  m_CurrentSkState = toss_MFloating; // -> floating
4057  //m_CurrentSkState = toss_MTempLeavingArea;
4058  m_StepDone = true;
4059  break;
4060  }
4061  break;
4062  case toss_AttractingAMate: // Attract mate
4063  if ( st_AttractingAMate() ) {
4064  m_CurrentSkState = toss_MFlocking; // -> flocking
4065  }
4066  m_StepDone = true;
4067  break;
4068  case toss_FollowingMate: // FollowingMate
4069  st_FollowingMate();
4070  m_StepDone = true;
4071  break;
4072  case toss_ScaringOffChicks: // ScaringOffChicks - instant
4073  if ( st_ScaringOffChicks() ) m_CurrentSkState = toss_FollowingMate; // -> follow mate
4074  break;
4075  case toss_MDying: // Dying
4076  st_Dying();
4077  m_StepDone = true;
4078  break;
4079  default:
4081  g_land->Warn( "Skylark_Male::Step: Unknown State", st.c_str() );
4082  exit( 0 );
4083  break;
4084  }
4085  if ( m_BroodSize ) BroodAge = m_Brood[ 0 ]->Age; else
4086  BroodAge = -1;
4087 }

References Skylark_Base::Age, BroodAge, EstablishingATerritory(), g_land, HaveTerritory, m_Brood, m_BroodSize, Skylark_Base::m_CurrentSkState, TAnimal::m_Location_x, TAnimal::m_Location_y, Skylark_Base::m_OurPopulationManager, TALMaSSObject::m_StepDone, st_Arriving(), st_AttractingAMate(), st_Dying(), st_Emigrating(), st_FindingTerritory(), st_Flocking(), st_FollowingMate(), st_Immigrating(), st_ScaringOffChicks(), st_TempLeavingArea(), Population_Manager::SupplyStateNames(), toss_AttractingAMate, toss_Destroy, toss_FollowingMate, toss_Initiation, toss_MArriving, toss_MDying, toss_MEmigrating, toss_MFindingTerritory, toss_MFloating, toss_MFlocking, toss_MImmigrating, toss_MTempLeavingArea, toss_ScaringOffChicks, and Landscape::Warn().

◆ Supply_Territory()

skTerritory_struct Skylark_Male::Supply_Territory ( )
4548  {
4549 #ifdef __CJTDebug_5
4550  if ( IsAlive() != 0xDEADC0DE )
4551  DEADCODEError();
4552 #endif
4553  return MyTerritory;
4554 }

References Skylark_Adult::MyTerritory.

Referenced by Skylark_Female::EstablishTerritory(), and Skylark_Female::st_Finding_Territory().

◆ Supply_TerritoryQual()

double Skylark_Male::Supply_TerritoryQual ( )
inline

brief Provide todays territory quality

938  {
939  return MyTerritory.nqual;
940  }

Referenced by Skylark_Female::st_BuildingUpResources(), Skylark_Female::st_MakingNest(), and Skylark_Female::st_StartingNewBrood().

◆ SupplyBroodAge()

int Skylark_Male::SupplyBroodAge ( int  n)
inline
933  {
934  return m_Brood[n]->Age;
935  }

References Skylark_Base::Age.

Referenced by Skylark_Female::FeedYoung(), and Skylark_Female::st_CaringForYoung().

◆ SupplyBroodSize()

int Skylark_Male::SupplyBroodSize ( )
inline
928  {
929  return m_BroodSize;
930  }

Referenced by Skylark_Female::FeedYoung(), and Skylark_Female::st_GivingUpTerritory().

◆ SupplyBroodWeight()

int Skylark_Male::SupplyBroodWeight ( int  n)
inline
943  {
944  return ( int )m_Brood[n]->m_Size;
945  }

References Skylark_Base::m_Size.

Referenced by Skylark_Female::FeedYoung().

◆ SupplyNestLoc()

APoint Skylark_Male::SupplyNestLoc ( )
inline

◆ SupplyNestValid()

bool Skylark_Male::SupplyNestValid ( )
inline

◆ SupplyNoHabitatRefs()

int Skylark_Male::SupplyNoHabitatRefs ( )
inline
923  {
924  return No_HabitatTable_Refs;
925  }

Referenced by Skylark_Female::GetFood().

Member Data Documentation

◆ BroodAge

int Skylark_Male::BroodAge

Referenced by Step().

◆ GoodWeather

int Skylark_Male::GoodWeather
protected

◆ HaveTerritory

◆ m_Brood

◆ m_BroodSize

◆ m_firstPF

bool Skylark_Male::m_firstPF
protected

◆ m_HabitatTable_PNum

vector<int> Skylark_Male::m_HabitatTable_PNum

◆ m_HabitatTable_Size

◆ m_InsectTable

◆ m_MyMinTerritoryQual

int Skylark_Male::m_MyMinTerritoryQual
protected

◆ m_XFNestAcceptScore

double Skylark_Male::m_XFNestAcceptScore
protected

◆ MyMate

◆ No_HabitatTable_Refs

int Skylark_Male::No_HabitatTable_Refs
protected

The documentation for this class was generated from the following files:
insecticide_treat
Definition: treatment.h:74
JuvenileReturnMort
int JuvenileReturnMort
Definition: skylarks_all.cpp:225
Population_Manager::SupplyStateNames
const char * SupplyStateNames(int i)
Definition: PopulationManager.h:497
Skylark_Male::st_Floating
TTypesOfSkState st_Floating()
Definition: skylarks_all.cpp:4744
strigling
Definition: treatment.h:77
SkTerritories::SupplyIsNestValid
bool SupplyIsNestValid(int ref)
Definition: skylarks_all.h:426
Skylark_Male::st_FollowingMate
int st_FollowingMate()
Definition: skylarks_all.cpp:4764
hay_bailing
Definition: treatment.h:89
cfg_insecticide_direct_mortM
CfgInt cfg_insecticide_direct_mortM
Skylark_Adult::RemoveEM
virtual double RemoveEM(double food)
Definition: skylarks_all.cpp:3717
skTTerritory::GetQuality
int GetQuality(void)
Definition: skylarks_all.h:284
Skylark_Male::m_HabitatTable_Size
vector< int > m_HabitatTable_Size
Definition: skylarks_all.h:900
autumn_roll
Definition: treatment.h:38
Landscape::SupplyTemp
double SupplyTemp(void)
Definition: Landscape.h:1386
Skylark_Male::OptimiseHabitatSearchingOrder
void OptimiseHabitatSearchingOrder()
Definition: skylarks_all.cpp:5152
toss_MTempLeavingArea
Definition: skylarks_all.h:53
SkTerritories::SupplyNestPosition
APoint SupplyNestPosition(int ref)
Definition: skylarks_all.h:429
Skylark_Male::st_AttractingAMate
int st_AttractingAMate()
Definition: skylarks_all.cpp:4725
skTerritory_struct::validnest
bool validnest
Definition: skylarks_all.h:313
Skylark_Male::OnEvicted
bool OnEvicted()
Definition: skylarks_all.cpp:4240
fa_ammoniumsulphate
Definition: treatment.h:65
autumn_harrow
Definition: treatment.h:37
Skylark_Male::GoodWeather
int GoodWeather
Definition: skylarks_all.h:884
Skylark_Male::st_ScaringOffChicks
int st_ScaringOffChicks()
Definition: skylarks_all.cpp:4973
toss_MFlocking
Definition: skylarks_all.h:53
Skylark_Male::GetMigrationMortality
int GetMigrationMortality()
Definition: skylarks_all.cpp:4713
autumn_sow
Definition: treatment.h:41
Skylark_Female::OnStopFeedingChicks
void OnStopFeedingChicks()
Definition: skylarks_all.cpp:5665
Skylark_Base::m_CurrentSkState
TTypesOfSkState m_CurrentSkState
Definition: skylarks_all.h:594
SkTerritories::Split
void Split(int ref)
Definition: skylarks_all.cpp:2413
glyphosate
Definition: treatment.h:102
Skylark_Nestling::OnYouHaveBeenEaten
void OnYouHaveBeenEaten()
Definition: skylarks_all.cpp:3290
Skylark_Male::PesticideResponse
virtual void PesticideResponse()
Definition: skylarks_all.cpp:6843
harvest
Definition: treatment.h:82
Skylark_Adult::GetBadWeather
bool GetBadWeather()
Extreme weather conditions check.
Definition: skylarks_all.cpp:3710
TAnimal::m_OurLandscape
Landscape * m_OurLandscape
Definition: PopulationManager.h:229
SkTerritories::Supply_x
int Supply_x(int ref)
Definition: skylarks_all.cpp:1415
fp_slurry
Definition: treatment.h:52
Skylark_Male::ReEvaluateTerritory
void ReEvaluateTerritory()
Daily re-evaluation of territory.
Definition: skylarks_all.cpp:4792
fa_sludge
Definition: treatment.h:68
Skylark_Base::m_Born_y
int m_Born_y
Definition: skylarks_all.h:598
Skylark_Male::OnBroodDeath
void OnBroodDeath()
Definition: skylarks_all.cpp:4385
fp_greenmanure
Definition: treatment.h:56
February
const int February
Definition: Landscape.h:37
cfg_FemaleMinTerritoryAcceptScore
CfgFloat cfg_FemaleMinTerritoryAcceptScore
skTerritory_struct::ref
int ref
Definition: skylarks_all.h:311
SkTerritories::FemaleOccupy
void FemaleOccupy(int ref, Skylark_Female *Female)
Definition: skylarks_all.cpp:2392
toss_MFloating
Definition: skylarks_all.h:53
hay_turning
Definition: treatment.h:88
Skylark_Population_Manager::TheSkylarkTerrs
SkTerritories * TheSkylarkTerrs
Definition: skylarks_all.h:567
Skylark_Base::m_OurTerritories
SkTerritories * m_OurTerritories
Definition: skylarks_all.h:602
SkTerritories::RemoveMale
void RemoveMale(int ref)
Definition: skylarks_all.cpp:2406
MaxFeedRain
double MaxFeedRain
Definition: skylarks_all.cpp:222
Skylark_Male::m_XFNestAcceptScore
double m_XFNestAcceptScore
Definition: skylarks_all.h:882
water
Definition: treatment.h:80
Skylark_Male::st_FindingTerritory
int st_FindingTerritory()
Definition: skylarks_all.cpp:4577
fp_liquidNH3
Definition: treatment.h:51
molluscicide
Definition: treatment.h:75
burn_straw_stubble
Definition: treatment.h:92
Population_Manager::SimW
int SimW
Definition: PopulationManager.h:511
skTerritory_struct::size
int size
Definition: skylarks_all.h:310
SkTerritories::GetTerritoriesByDistance
void GetTerritoriesByDistance(int nx, int ny, vector< APoint > *alist)
Definition: skylarks_all.cpp:2364
cattle_out_low
Definition: treatment.h:100
Skylark_Male::m_firstPF
bool m_firstPF
Definition: skylarks_all.h:883
Skylark_Male::GetFood
double GetFood(int time)
Definition: skylarks_all.cpp:5083
fp_pk
Definition: treatment.h:50
fa_npk
Definition: treatment.h:61
cattle_out
Definition: treatment.h:83
toss_MDying
Definition: skylarks_all.h:55
fp_npk
Definition: treatment.h:49
SkTerritories::Supply_quality
int Supply_quality(int ref)
Definition: skylarks_all.cpp:2379
Skylark_Adult::GetVegHindrance
double GetVegHindrance(int PolyRef)
Definition: skylarks_all.cpp:3760
g_rand_uni
boost::variate_generator< base_generator_type &, boost::uniform_real<> > g_rand_uni
stubble_harrowing
Definition: treatment.h:90
Skylark_Population_Manager::SupplyM_Mig_Mort
int SupplyM_Mig_Mort()
Definition: skylarks_all.h:486
Landscape::SupplyPesticide
double SupplyPesticide(int a_x, int a_y, PlantProtectionProducts a_ppp)
Gets total pesticide for a location.
Definition: Landscape.cpp:586
Skylark_Nestling::On_FoodSupply
virtual double On_FoodSupply(double food)
Definition: skylarks_all.cpp:3312
autumn_plough
Definition: treatment.h:34
Skylark_Male::DefendTerritory
int DefendTerritory()
Definition: skylarks_all.cpp:4700
fp_manure
Definition: treatment.h:55
TAnimal::m_Location_y
int m_Location_y
Definition: PopulationManager.h:228
strigling_sow
Definition: treatment.h:95
Skylark_Male::st_Immigrating
bool st_Immigrating()
Definition: skylarks_all.cpp:4178
toss_MFindingTerritory
Definition: skylarks_all.h:54
toss_Initiation
Definition: skylarks_all.h:45
Skylark_Adult::Skylark_Adult
Skylark_Adult(int x, int y, double size, int age, SkTerritories *Terrs, Landscape *L, Skylark_Population_Manager *SPM, int bx, int by, int mh)
Definition: skylarks_all.cpp:3677
Skylark_Base
Definition: skylarks_all.h:586
Skylark_Base::Age
int Age
Definition: skylarks_all.h:595
Skylark_Male::st_Emigrating
int st_Emigrating()
Definition: skylarks_all.cpp:4211
Skylark_Nestling::OnDadDead
void OnDadDead()
Definition: skylarks_all.cpp:3278
winter_plough
Definition: treatment.h:42
toss_ScaringOffChicks
Definition: skylarks_all.h:54
Population_Manager::SupplySimW
int SupplySimW()
Definition: PopulationManager.h:452
Skylark_Female::EstablishTerritory
void EstablishTerritory()
Definition: skylarks_all.cpp:5925
fp_sludge
Definition: treatment.h:57
straw_chopping
Definition: treatment.h:87
fungicide_treat
Definition: treatment.h:73
deep_ploughing
Definition: treatment.h:43
Skylark_Male::m_InsectTable
vector< double > m_InsectTable
Definition: skylarks_all.h:901
Landscape::SupplyDayInYear
int SupplyDayInYear(void)
Definition: Landscape.h:1596
April
const int April
Definition: Landscape.h:39
mow
Definition: treatment.h:93
fa_pk
Definition: treatment.h:62
Skylark_Male::BroodAge
int BroodAge
Definition: skylarks_all.h:893
SkTerritories::Occupy
void Occupy(int ref, Skylark_Male *Male)
Definition: skylarks_all.cpp:2385
skTerritory_struct::y
int y
Definition: skylarks_all.h:309
TALMaSSObject::m_StepDone
bool m_StepDone
Indicates whether the iterative step code is done for this timestep.
Definition: PopulationManager.h:118
Skylark_Male
Definition: skylarks_all.h:854
Skylark_Adult::Paired
bool Paired
Definition: skylarks_all.h:752
spring_harrow
Definition: treatment.h:45
FoodTripsPerDay
static int FoodTripsPerDay
Definition: skylarks_all.cpp:184
Skylark_Male::st_Flocking
int st_Flocking()
Definition: skylarks_all.cpp:4129
toss_FollowingMate
Definition: skylarks_all.h:54
skTTerritory::m_hr_polys
vector< int > m_hr_polys
Definition: skylarks_all.h:267
KcalPerGInsect_kg_inv
const double KcalPerGInsect_kg_inv
Definition: skylarks_all.cpp:202
SkTerritories::Supply_y
int Supply_y(int ref)
Definition: skylarks_all.cpp:1465
hilling_up
Definition: treatment.h:79
Population_Manager::SupplySimH
int SupplySimH()
Definition: PopulationManager.h:455
Skylark_Base::m_Born_x
int m_Born_x
Definition: skylarks_all.h:597
Landscape::EventtypeToString
std::string EventtypeToString(int a_event)
Definition: Landscape.cpp:3918
toss_MArriving
Definition: skylarks_all.h:53
Skylark_Adult::m_aTerrlist
vector< APoint > * m_aTerrlist
Definition: skylarks_all.h:744
ppp_1
Definition: farm.h:422
Skylark_Male::m_Brood
Skylark_Nestling * m_Brood[26]
Definition: skylarks_all.h:886
syninsecticide_treat
Definition: treatment.h:99
fa_manure
Definition: treatment.h:66
Skylark_Male::st_Dying
void st_Dying()
Definition: skylarks_all.cpp:4102
fp_npks
Definition: treatment.h:48
row_cultivation
Definition: treatment.h:76
Landscape::SupplyInsects
double SupplyInsects(int a_polyref)
Definition: Landscape.h:1088
Landscape::SupplyRain
double SupplyRain(void)
Definition: Landscape.h:1365
Skylark_Male::st_TempLeavingArea
int st_TempLeavingArea()
Definition: skylarks_all.cpp:4559
Skylark_Base::m_pesticide_accumulation
double m_pesticide_accumulation
Definition: skylarks_all.h:592
Skylark_Female::OnBroodDeath
void OnBroodDeath()
Definition: skylarks_all.cpp:5972
trial_insecticidetreat
Definition: treatment.h:96
cfg_Skylark_male_NOEL
CfgFloat cfg_Skylark_male_NOEL
Skylark_Male::m_HabitatTable_PNum
vector< int > m_HabitatTable_PNum
Definition: skylarks_all.h:899
SkTerritories::Supply_Owner
Skylark_Male * Supply_Owner(int ref)
Definition: skylarks_all.cpp:1452
January
const int January
Definition: Landscape.h:36
toss_AttractingAMate
Definition: skylarks_all.h:54
Skylark_Female::OnBreedSuccess
void OnBreedSuccess()
Definition: skylarks_all.h:845
Skylark_Base::m_Size
double m_Size
Definition: skylarks_all.h:596
Skylark_Adult::MyExtractEff
double MyExtractEff
Definition: skylarks_all.h:741
TALMaSSObject::OnArrayBoundsError
void OnArrayBoundsError()
Used for debugging only, tests basic object properties.
g_stopdate
int g_stopdate
Definition: skylarks_all.cpp:43
Population_Manager::SimH
int SimH
Definition: PopulationManager.h:511
skTTerritory::GetVirtualDiameter
double GetVirtualDiameter()
Definition: skylarks_all.h:277
skTTerritory
Definition: skylarks_all.h:262
Skylark_Male::st_Arriving
bool st_Arriving()
Definition: skylarks_all.cpp:4157
Skylark_Base::m_OurPopulationManager
Skylark_Population_Manager * m_OurPopulationManager
Definition: skylarks_all.h:603
Skylark_Male::st_CaringForYoung
int st_CaringForYoung()
Definition: skylarks_all.cpp:4994
spring_plough
Definition: treatment.h:44
fa_greenmanure
Definition: treatment.h:67
September
const int September
Definition: Landscape.h:44
TAnimal::CheckManagement
void CheckManagement(void)
Skylark_Male::m_MyMinTerritoryQual
int m_MyMinTerritoryQual
Definition: skylarks_all.h:888
g_land
Landscape * g_land
Definition: skylarks_all.cpp:49
Skylark_Female::OnBreedingSuccess
void OnBreedingSuccess()
Definition: skylarks_all.cpp:5674
March
const int March
Definition: Landscape.h:38
spring_roll
Definition: treatment.h:46
Skylark_Male::HaveTerritory
bool HaveTerritory
Definition: skylarks_all.h:906
Skylark_Adult::GetWeatherHindrance
double GetWeatherHindrance()
Definition: skylarks_all.cpp:3740
Skylark_Male::m_BroodSize
int m_BroodSize
Definition: skylarks_all.h:885
cut_weeds
Definition: treatment.h:94
SkTerritories::Supply_terr
skTTerritory * Supply_terr(int ref)
Definition: skylarks_all.cpp:1448
fp_manganesesulphate
Definition: treatment.h:53
herbicide_treat
Definition: treatment.h:71
Skylark_Nestling::OnDeserted
void OnDeserted()
Definition: skylarks_all.cpp:3301
Skylark_Base::m_pcide_conc
double m_pcide_conc
Definition: skylarks_all.h:593
skTTerritory::m_hr_sizes
vector< int > m_hr_sizes
Definition: skylarks_all.h:268
growth_regulator
Definition: treatment.h:72
cut_to_silage
Definition: treatment.h:86
SkTerritories::Supply_size
int Supply_size(int ref)
Definition: skylarks_all.cpp:1471
product_treat
Definition: treatment.h:101
Skylark_Female::MyMate
Skylark_Male * MyMate
Definition: skylarks_all.h:806
TALMaSSObject::m_CurrentStateNo
int m_CurrentStateNo
The basic state number for all objects - '-1' indicates death.
Definition: PopulationManager.h:116
toss_Destroy
Definition: skylarks_all.h:62
Skylark_Female::OnMateDying
void OnMateDying()
Definition: skylarks_all.cpp:6034
pigs_out
Definition: treatment.h:84
toss_MImmigrating
Definition: skylarks_all.h:53
skTerritory_struct::nqual
double nqual
Definition: skylarks_all.h:312
toss_MCaringForYoung
Definition: skylarks_all.h:55
Skylark_Adult::ReInit
virtual void ReInit(int x, int y, double size, int age, SkTerritories *Terrs, Landscape *L, Skylark_Population_Manager *SPM, int bx, int by, int mh)
Definition: skylarks_all.cpp:3690
cut_to_hay
Definition: treatment.h:85
Skylark_Adult::MyTerritory
skTerritory_struct MyTerritory
Definition: skylarks_all.h:743
spring_sow
Definition: treatment.h:47
cfg_Skylark_male_Biodegredation
CfgFloat cfg_Skylark_male_Biodegredation
Landscape::Warn
void Warn(std::string a_msg1, std::string a_msg2)
Definition: Landscape.h:1579
sleep_all_day
Definition: treatment.h:33
Skylark_Male::No_HabitatTable_Refs
int No_HabitatTable_Refs
Definition: skylarks_all.h:887
Skylark_Male::MyMate
Skylark_Female * MyMate
Definition: skylarks_all.h:891
TAnimal::m_Location_x
int m_Location_x
Definition: PopulationManager.h:225
skTerritory_struct::x
int x
Definition: skylarks_all.h:308
toss_MEmigrating
Definition: skylarks_all.h:53
autumn_or_spring_plough
Definition: treatment.h:91
Skylark_Male::ConstructAHabitatTable
void ConstructAHabitatTable()
Definition: skylarks_all.cpp:4938
Skylark_Male::EstablishingATerritory
int EstablishingATerritory()
Definition: skylarks_all.cpp:4678
Landscape::SupplyDaylength
int SupplyDaylength(void)
Definition: Landscape.h:1530
fa_slurry
Definition: treatment.h:63
swathing
Definition: treatment.h:81
SkTerritories::SupplyNoTerritories
int SupplyNoTerritories()
Definition: skylarks_all.cpp:1422
October
const int October
Definition: Landscape.h:45
Skylark_Female::OnMaleNeverComesBack
void OnMaleNeverComesBack(Skylark_Male *AMale)
Definition: skylarks_all.cpp:6080
Skylark_Female::OnMateHomeless
void OnMateHomeless()
Definition: skylarks_all.cpp:6058
Skylark_Adult::BSuccess
bool BSuccess
Definition: skylarks_all.h:740