Loading [MathJax]/extensions/ams.js
ALMaSS  1.2 (after EcoStack, March 2024)
The Animal, Landscape and Man Simulation System
All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Skylark_Nestling Class Reference

#include <skylarks_all.h>

Inheritance diagram for Skylark_Nestling:
Skylark_Base TAnimal TALMaSSObject Skylark_PreFledgeling

Public Member Functions

 Skylark_Nestling (int x, int y, Skylark_Male *Daddy, Landscape *L, SkTerritories *Terrs, Skylark_Population_Manager *SPM, int bx, int by, int mh)
 
virtual void ReInit (int x, int y, Skylark_Male *Daddy, Landscape *L, SkTerritories *Terrs, Skylark_Population_Manager *SPM, int bx, int by, int mh)
 
void BeginStep (void) override
 BeingStep behaviour - must be implemented in descendent classes. More...
 
void Step (void) override
 Step behaviour - must be implemented in descendent classes. More...
 
void EndStep (void) override
 EndStep behaviour - must be implemented in descendent classes. More...
 
double On_FoodSupply (double food) override
 
void OnDadDead ()
 
void OnYouHaveBeenEaten ()
 
void OnDeserted ()
 
- 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)
 
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...
 
- 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...
 
void ReinitialiseObjectBase ()
 Used to initialise an object. More...
 
 TALMaSSObject ()
 The constructor for TALMaSSObject. More...
 
virtual ~TALMaSSObject ()=default
 The destructor for TALMaSSObject. More...
 

Protected Member Functions

virtual int st_Developing ()
 
virtual void st_Maturing ()
 
virtual void st_Dying ()
 
bool OnFarmEvent (FarmToDo event) override
 Must be reimplemented if used in descendent classes. Sets the action on a management event. More...
 
- Protected Member Functions inherited from TAnimal
void CorrectWrapRound ()
 Corrects wrap around co-ordinate problems. More...
 

Protected Attributes

bool Sex
 
int m_EM_fail
 
int m_NestLeavingChance
 
Skylark_Malem_Dad
 
double m_EM
 
double m_GrNeed
 
- 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...
 

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...
 
- Public Attributes inherited from Skylark_Base
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 inherited from Skylark_Base
static bool DailyMortality (int mort)
 
- 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_Nestling()

Skylark_Nestling::Skylark_Nestling ( int  x,
int  y,
Skylark_Male Daddy,
Landscape L,
SkTerritories Terrs,
Skylark_Population_Manager SPM,
int  bx,
int  by,
int  mh 
)
2618  : Skylark_Base(
2619  x, y, Terrs, L, SPM, bx, by, mh) {
2620  m_Dad = Daddy;
2621  //Growth = 0;
2622  // Must choose sex
2623  if (g_random_fnc(2) == 1) Sex = true;
2624  else Sex = false; // M or F
2625  m_Size = MeanHatchingWeight + (g_random_fnc(25) - 11) * MeanHatchingWeight / 1000.0;
2626  Age = 1;
2627  m_EM_fail = 0;
2628  // From Skylarks Energy Calcs Mar05.xls
2629  m_EM = 0.3058 * m_Size + 0.5221;
2630  m_GrNeed = cfg_PEmax.value(); // No of Kcals possible to use for growth on day 1
2632 }

References Skylark_Base::Age, cfg_NestLeavingChance, cfg_PEmax, g_random_fnc(), m_Dad, m_EM, m_EM_fail, m_GrNeed, m_NestLeavingChance, Skylark_Base::m_Size, MeanHatchingWeight, Sex, CfgInt::value(), and CfgFloat::value().

Member Function Documentation

◆ BeginStep()

void Skylark_Nestling::BeginStep ( void  )
overridevirtual

BeingStep behaviour - must be implemented in descendent classes.

Reimplemented from TALMaSSObject.

Reimplemented in Skylark_PreFledgeling.

2852  {
2853  // If you are not dead already find out if you are killed today by agriculture
2854  if (m_CurrentStateNo != -1) CheckManagement();
2855 }

References TAnimal::CheckManagement(), and TALMaSSObject::m_CurrentStateNo.

◆ EndStep()

void Skylark_Nestling::EndStep ( void  )
overridevirtual

EndStep behaviour - must be implemented in descendent classes.

Reimplemented from TALMaSSObject.

Reimplemented in Skylark_PreFledgeling.

2887  {
2888 #ifdef __CJTDebug_5
2889  if ( IsAlive() != 0x0DEADC0DE ) DEADCODEError();
2890 #endif
2891  if (m_CurrentSkState == toss_Destroy) return;
2892 #ifdef __CJTDebug_5
2893  if ( Dad )
2894  if ( !Dad->DoIExistN( this ) ) {
2895  g_land->Warn( "Skylark_Nestling::EndStep - Do I ExistN ", NULL ); exit( 1 );
2896  }
2897 #endif
2898  switch (m_CurrentSkState)
2899  {
2900  case toss_NDeveloping: // Develop
2901  switch (st_Developing())
2902  {
2903  case 3:
2904  if (m_Dad != nullptr) m_Dad->OnNestPredatation(); // Kill the whole brood
2905  break;
2906  case 2:
2907 #ifdef TEST_ISSUE_DEATH_WARRANT
2908  printf( "Skylark_Nestling::EndStep() : st_Developing() %d\n", ( int )g_date->Date() );
2909 #endif
2910  m_CurrentSkState = toss_NDying; // die
2911  break;
2912  case 1:
2913  // Maturing must be called here because it happens the same day as develop
2914  st_Maturing(); // Do Maturing
2915  m_CurrentSkState = toss_Destroy;
2916  m_CurrentStateNo = -1;
2917  m_StepDone = true;
2918  break;
2919  }
2920  break;
2921  case toss_NDying: // Dying
2922  st_Dying();
2923  m_StepDone = true;
2924  break;
2925  default:
2926  /* char errornum[20]; sprintf(errornum, "%d", m_CurrentSkState );
2927  g_land->Warn("Skylark_Nestling::EndStep(): Unknown state: ", errornum); exit(0); */
2928  break;
2929  }
2930 #ifdef __PESTICIDE_RA
2931  PesticideResponse();
2932 #endif
2933 }

References Calendar::Date(), g_date, g_land, Skylark_Base::m_CurrentSkState, TALMaSSObject::m_CurrentStateNo, m_Dad, TALMaSSObject::m_StepDone, Skylark_Male::OnNestPredatation(), st_Developing(), st_Dying(), st_Maturing(), and Landscape::Warn().

◆ On_FoodSupply()

double Skylark_Nestling::On_FoodSupply ( double  food)
overridevirtual

Reimplemented from Skylark_Base.

3059  {
3060 #ifdef __CJTDebug_5
3061  if ( IsAlive() != 0xDEADC0DE )
3062  DEADCODEError();
3063 #endif
3064 
3065  if (m_EM > 0) // Must maintain this
3066  {
3067  if (a_food > m_EM)
3068  {
3069  a_food -= m_EM;
3070  m_EM = 0;
3071  }
3072  else
3073  {
3074  m_EM -= a_food;
3075  a_food = 0;
3076  }
3077  }
3078  if (m_GrNeed > a_food)
3079  {
3080  m_GrNeed -= a_food;
3081  // Does the growing here
3082  m_Size += a_food * CE_nest[Age]; // Conv Eff is g dw insect to g ww bird
3083  a_food = 0;
3084  }
3085  else
3086  {
3087  // Does the growing here at the maximum allowed rate
3088  m_Size += m_GrNeed * CE_nest[Age]; // Conv Eff is g dw insect to g ww bird
3089  a_food -= m_GrNeed;
3090  m_GrNeed = 0;
3091  }
3092  return a_food;
3093 }

References Skylark_Base::Age, CE_nest, m_EM, m_GrNeed, and Skylark_Base::m_Size.

Referenced by Skylark_Male::OnFoodMessage(), and Skylark_Male::st_CaringForYoung().

◆ OnDadDead()

void Skylark_Nestling::OnDadDead ( )
3025  {
3026 #ifdef __CJTDebug_5
3027  if ( IsAlive() != 0xDEADC0DE )
3028  DEADCODEError();
3029 #endif
3030  // Dad is dead - so must not send him a message
3031  // So forget who he is (messaging to Dad must be checked for NULL on sending)
3032  m_Dad = nullptr;
3033 }

References m_Dad.

Referenced by Skylark_Male::OnMateDying(), Skylark_Male::OnMateLeaving(), Skylark_Male::st_Dying(), and Skylark_Male::st_ScaringOffChicks().

◆ OnDeserted()

void Skylark_Nestling::OnDeserted ( )
3048  {
3049  // Nobody to tell, nothing to do but vanish as soon as possible
3050  m_CurrentSkState = toss_Destroy;
3051  m_CurrentStateNo = -1;
3052 #ifdef __SKPOM
3054 #endif
3055 }

References Skylark_Base::m_CurrentSkState, TALMaSSObject::m_CurrentStateNo, TAnimal::m_OurLandscape, Skylark_Base::m_OurPopulationManager, Landscape::SupplyDayInYear(), and Skylark_Population_Manager::WriteSKPOM2().

Referenced by Skylark_Male::OnBroodDesertion().

◆ OnFarmEvent()

bool Skylark_Nestling::OnFarmEvent ( FarmToDo  )
overrideprotectedvirtual

Must be reimplemented if used in descendent classes. Sets the action on a management event.

Reimplemented from TAnimal.

Reimplemented in Skylark_PreFledgeling.

2653  {
2654  switch (event)
2655  {
2656  case sleep_all_day:
2657  break;
2658 // Here begins non-mortality events
2659  case fp_npks:
2660  case fp_npk:
2661  case fp_pk:
2662  case fp_k:
2663  case fp_p:
2664  case fp_ammoniumsulphate:
2665  case fp_manganesesulphate:
2666  case fp_manure:
2667  case fp_greenmanure:
2668  case fp_sludge:
2669  case fp_rsm:
2670  case fp_calcium:
2671  case fp_boron:
2672  case fp_cu:
2673  case fp_n:
2674  case fp_nc:
2675  case fp_nk:
2676  case fp_ns:
2677  case fp_pks:
2678  case fp_sk:
2679  case fa_npk:
2680  case fa_npks:
2681  case fa_n:
2682  case fa_pk:
2683  case fa_k:
2684  case fa_p:
2685  case fa_ammoniumsulphate:
2686  case fa_manganesesulphate:
2687  case fa_manure:
2688  case fa_sludge:
2689  case fa_rsm:
2690  case fa_calcium:
2691  case fa_boron:
2692  case fa_cu:
2693  case fa_nk:
2694  case fa_pks:
2695  case fa_sk:
2696  case herbicide_treat:
2697  case growth_regulator:
2698  case fungicide_treat:
2699  case insecticide_treat:
2701  case trial_control:
2702  case trial_toxiccontrol:
2703  case molluscicide:
2704  case water:
2705  case hay_bailing:
2706  case cut_weeds:
2707  case manual_weeding:
2708  case straw_covering:
2709  case fiber_covering:
2710  case fiber_removal:
2711  case straw_removal:
2712  case product_treat:
2713  case glyphosate:
2714  case biocide:
2715  case org_insecticide:
2716  case last_treatment:
2717  case org_fungicide:
2718  case org_herbicide:
2719  case pheromone:
2720  case suckering:
2721  break;
2722 // Here begins soil cultivation and cutting mortality
2723  case stubble_plough:
2726  case autumn_harrow:
2727  case preseeding_cultivator:
2729  case autumn_roll:
2730  case autumn_sow:
2731  case autumn_sow_with_ferti:
2732  case burn_top:
2733  case flammebehandling:
2734  case winter_plough:
2735  case deep_ploughing:
2736  case spring_plough:
2737  case spring_harrow:
2738  case green_harvest:
2739  case harvestshoots:
2740  case shallow_harrow:
2741  case pruning:
2742  case shredding:
2743  case summer_harrow:
2744  case summer_plough:
2745  case summer_sow:
2746  case winter_harrow:
2747  case spring_roll:
2748  case spring_sow:
2749  case spring_sow_with_ferti:
2750  case autumn_plough:
2751  case fp_liquidNH3:
2752  case fa_greenmanure:
2753  case row_cultivation:
2754  case hilling_up:
2755  case harvest:
2756  case harvest_bushfruit:
2757  case cut_to_hay:
2758  case cut_to_silage:
2759  case straw_chopping:
2760  case hay_turning:
2761  case stubble_harrowing:
2763  case burn_straw_stubble:
2764  case mow:
2765  case bed_forming:
2766  case flower_cutting:
2767  case bulb_harvest:
2768 #ifdef TEST_ISSUE_DEATH_WARRANT
2769  printf( "Skylark_Nestling::OnFarmEvent() : %d : %d\n", event, ( int )g_date->Date() );
2770 #endif
2771  m_CurrentSkState = toss_NDying;
2772  break;
2773 /*\todo what is the special case with the below three? */
2774  case fp_slurry:
2775  case fa_slurry:
2776  case swathing:
2777  if (g_random_fnc(100) < 2)
2778  {
2779 #ifdef TEST_ISSUE_DEATH_WARRANT
2780  printf( "Skylark_Nestling::OnFarmEvent() : %d : %d\n", event, ( int )g_date->Date() );
2781 #endif
2782  m_CurrentSkState = toss_NDying;
2783  }
2784  break;
2785 // Here begins spray mortality
2786  case syninsecticide_treat:
2788  {
2789 #ifdef TEST_ISSUE_DEATH_WARRANT
2790  printf( "Skylark_Nestling::OnFarmEvent() : %d : %d\n", event, ( int )g_date->Date() );
2791 #endif
2792  m_CurrentSkState = toss_NDying;
2793  }
2794  break;
2795 // Here begins strigling mortality
2796  case strigling:
2797  case strigling_sow:
2798  case strigling_hill:
2799 #ifndef __NoStriglingEffect
2801  {
2802 #ifdef TEST_ISSUE_DEATH_WARRANT
2803  printf( "Skylark_Nestling::OnFarmEvent() : %d : %d\n", event, ( int )g_date->Date() );
2804 #endif
2805  m_CurrentSkState = toss_NDying;
2806  AddStriglingMort(2);
2807  }
2808 #endif
2809  break;
2810 // Here begins grazing mortality
2811  case cattle_out:
2813  if (g_random_fnc(1000) < 20)
2814  {
2815 #ifdef TEST_ISSUE_DEATH_WARRANT
2816  printf( "Skylark_Nestling::OnFarmEvent() : %d : %d\n", event, ( int )g_date->Date() );
2817 #endif
2818  m_CurrentSkState = toss_NDying;
2819  }
2820  break;
2821  case cattle_out_low:
2823  if (g_random_fnc(1000) < 5)
2824  {
2825 #ifdef TEST_ISSUE_DEATH_WARRANT
2826  printf( "Skylark_Nestling::OnFarmEvent() : %d : %d\n", event, ( int )g_date->Date() );
2827 #endif
2828  m_CurrentSkState = toss_NDying;
2829  }
2830  break;
2831  case pigs_out:
2832 #ifndef __NoPigsOutEffect
2833  if (g_random_fnc(100) < 20)
2834  {
2835 #ifdef TEST_ISSUE_DEATH_WARRANT
2836  printf( "Skylark_Nestling::OnFarmEvent() : %d : %d\n", event, ( int )g_date->Date() );
2837 #endif
2838  m_CurrentSkState = toss_NDying;
2839  }
2840 #endif
2841  break;
2842  default:
2843  g_land->Warn("Skylark_Nestling::OnFarmEvent(): ""Unknown event type:", m_OurLandscape->EventtypeToString(event));
2844  exit(1);
2845  }
2846  if (m_CurrentSkState == toss_NDying) return true;
2847  return false;
2848 }

References Skylark_Base::AddStriglingMort(), autumn_harrow, autumn_or_spring_plough, autumn_plough, autumn_roll, autumn_sow, autumn_sow_with_ferti, bed_forming, biocide, bulb_harvest, burn_straw_stubble, burn_top, cattle_out, cattle_out_low, cfg_insecticide_direct_mortN, cfg_strigling_nestling, cut_to_hay, cut_to_silage, cut_weeds, Calendar::Date(), deep_ploughing, Landscape::EventtypeToString(), fa_ammoniumsulphate, fa_boron, fa_calcium, fa_cu, fa_greenmanure, fa_k, fa_manganesesulphate, fa_manure, fa_n, fa_nk, fa_npk, fa_npks, fa_p, fa_pk, fa_pks, fa_rsm, fa_sk, fa_sludge, fa_slurry, fiber_covering, fiber_removal, flammebehandling, flower_cutting, fp_ammoniumsulphate, fp_boron, fp_calcium, fp_cu, fp_greenmanure, fp_k, fp_liquidNH3, fp_manganesesulphate, fp_manure, fp_n, fp_nc, fp_nk, fp_npk, fp_npks, fp_ns, fp_p, fp_pk, fp_pks, fp_rsm, fp_sk, fp_sludge, fp_slurry, fungicide_treat, g_date, g_land, g_random_fnc(), glyphosate, green_harvest, growth_regulator, harvest, harvest_bushfruit, harvestshoots, hay_bailing, hay_turning, heavy_cultivator_aggregate, herbicide_treat, hilling_up, insecticide_treat, last_treatment, Skylark_Base::m_CurrentSkState, TAnimal::m_Location_x, TAnimal::m_Location_y, TAnimal::m_OurLandscape, manual_weeding, molluscicide, mow, org_fungicide, org_herbicide, org_insecticide, pheromone, pigs_out, preseeding_cultivator, preseeding_cultivator_sow, product_treat, pruning, row_cultivation, shallow_harrow, shredding, sleep_all_day, spring_harrow, spring_plough, spring_roll, spring_sow, spring_sow_with_ferti, straw_chopping, straw_covering, straw_removal, strigling, strigling_hill, strigling_sow, stubble_cultivator_heavy, stubble_harrowing, stubble_plough, suckering, summer_harrow, summer_plough, summer_sow, Landscape::SupplyGrazingPressure(), swathing, syninsecticide_treat, trial_control, trial_insecticidetreat, trial_toxiccontrol, CfgInt::value(), Landscape::Warn(), water, winter_harrow, and winter_plough.

◆ OnYouHaveBeenEaten()

void Skylark_Nestling::OnYouHaveBeenEaten ( )
3037  {
3038  // Nobody to tell, nothing to do but vanish as soon as possible
3039  m_CurrentSkState = toss_Destroy;
3040  m_CurrentStateNo = -1;
3041 #ifdef __SKPOM
3043 #endif
3044 }

References Skylark_Base::m_CurrentSkState, TALMaSSObject::m_CurrentStateNo, TAnimal::m_OurLandscape, Skylark_Base::m_OurPopulationManager, Landscape::SupplyDayInYear(), and Skylark_Population_Manager::WriteSKPOM2().

Referenced by Skylark_Male::OnNestPredatation().

◆ ReInit()

void Skylark_Nestling::ReInit ( int  x,
int  y,
Skylark_Male Daddy,
Landscape L,
SkTerritories Terrs,
Skylark_Population_Manager SPM,
int  bx,
int  by,
int  mh 
)
virtual
2636  {
2637  Skylark_Base::ReInit(x, y, Terrs, L, SPM, bx, by, mh);
2638  m_Dad = Daddy;
2639  //Growth = 0;
2640  // Must choose sex
2641  if (g_random_fnc(2) == 1) Sex = true;
2642  else Sex = false; // M or F
2643  m_Size = MeanHatchingWeight + (g_random_fnc(25) - 11) * MeanHatchingWeight / 1000.0;
2644  Age = 1;
2645  m_EM_fail = 0;
2646  // From Skylarks Energy Calcs Mar05.xls
2647  m_EM = 0.3058 * m_Size + 0.5221;
2648  m_GrNeed = cfg_PEmax.value(); // No of Kcals possible to use for growth on day 1
2650 }

References Skylark_Base::Age, cfg_NestLeavingChance, cfg_PEmax, g_random_fnc(), m_Dad, m_EM, m_EM_fail, m_GrNeed, m_NestLeavingChance, Skylark_Base::m_Size, MeanHatchingWeight, Skylark_Base::ReInit(), Sex, CfgInt::value(), and CfgFloat::value().

Referenced by Skylark_PreFledgeling::ReInit().

◆ st_Developing()

int Skylark_Nestling::st_Developing ( )
protectedvirtual

Reimplemented in Skylark_PreFledgeling.

2937  {
2938  // On entry GrNeed is set to the remaining food that could have been eaten
2939  // today
2940 #ifdef __CJTDebug_5
2941  if ( IsAlive() != 0x0DEADC0DE ) DEADCODEError();
2942 #endif
2943  // Timing of this function call is at the last moment of each day
2945  {
2946  return 3; //send brood eaten to Dad, will call OnYouHaveBeenEaten for all nestlings
2947  }
2948  // EM will be 0 if enough food has been given
2949  /*
2950  if ( m_EM > 0 )
2951  {
2952  if ( m_EM_fail > 2 )
2953  {
2954  #ifdef __SKPOM
2955  m_OurPopulationManager->WriteSKPOM2( m_OurLandscape->SupplyDayInYear(), 2002 );
2956  #endif
2957  return 2; //TransferToState(Die) Did not get EM for 2 days
2958  }
2959  } else
2960  {
2961  m_EM_fail = 0; // got EM so unset flag
2962  }
2963  */
2964  if (Age >= 6)
2965  {
2966  if (m_Size >= NestLeavingWeight)
2967  {
2968  if (g_random_fnc(100) < m_NestLeavingChance)
2969  {
2970 #ifdef __SKPOM
2972 #endif
2973  return 1;
2974  }
2975  m_NestLeavingChance *= 4;
2976  }
2977  }
2978  if (Age == 11)
2979  {
2980 #ifdef __SKPOM
2982 #endif
2983  return 2; // Taken too long so die
2984  }
2985  Age++; // age
2986  // From Skylarks Energy Calcs Mar05.xls
2987  if (Age < 6) m_EM = 0.31 * m_Size + 0.52;
2988  else m_EM = 0.24 * m_Size + 6.83;
2989  // Below is the correction for thermoregulation (Below 4days this is really a
2990  // female cost - but it is subtracted here instead).
2991  // Assumes that 50% of the time (night) that the chicks are covered and at 36)
2992  // EM += EM_nest_T[ Age ] * ( 36 - ( ( 0.5 * m_OurLandscape->SupplyTemp() ) + 18 ) );
2993  m_EM += EM_nest_T[Age] * (36 - m_OurLandscape->SupplyTemp());
2994  m_GrNeed = cfg_PEmax.value();
2995  return 0; // still growing and not dead
2996 }

References Skylark_Base::Age, cfg_PEmax, Skylark_Base::DailyMortality(), EM_nest_T, g_random_fnc(), m_EM, m_GrNeed, m_NestLeavingChance, TAnimal::m_OurLandscape, Skylark_Base::m_OurPopulationManager, Skylark_Base::m_Size, NestLeavingWeight, NestlingMortProb, Landscape::SupplyDayInYear(), Landscape::SupplyTemp(), CfgFloat::value(), and Skylark_Population_Manager::WriteSKPOM2().

Referenced by EndStep().

◆ st_Dying()

void Skylark_Nestling::st_Dying ( void  )
protectedvirtual

Reimplemented in Skylark_PreFledgeling.

3097  {
3098 #ifdef __CJTDebug_5
3099  if ( IsAlive() != 0x0DEADC0DE ) DEADCODEError();
3100 #endif
3101  // Timing: Zero time
3102  // Only called before object is destroyed
3103  // Checks that Dad exists
3104  if (m_Dad != nullptr) m_Dad->OnNestlingDeath(this);
3105  m_CurrentSkState = toss_Destroy; // will kill it at end of step!
3106  m_CurrentStateNo = -1;
3107 }

References Skylark_Base::m_CurrentSkState, TALMaSSObject::m_CurrentStateNo, m_Dad, and Skylark_Male::OnNestlingDeath().

Referenced by EndStep().

◆ st_Maturing()

void Skylark_Nestling::st_Maturing ( )
protectedvirtual

Reimplemented in Skylark_PreFledgeling.

2999  {
3000 #ifdef __CJTDebug_5
3001  if ( IsAlive() != 0x0DEADC0DE ) DEADCODEError();
3002 #endif
3003  if (!m_Dad) return; // If Dad is gone then something went wrong and we died
3004  // Timing: Occurs at 1 minute to midnight
3005  // When created they must update dads pointer
3006  const auto fps = new PreFledgeling_struct;
3007  fps->x = m_Location_x;
3008  fps->y = m_Location_y;
3009  fps->size = m_Size;
3010  fps->Dad = m_Dad;
3011  fps->age = Age;
3012  fps->L = m_OurLandscape;
3013  fps->Terrs = m_OurTerritories;
3014  fps->sex = Sex;
3015  fps->bx = m_Born_x;
3016  fps->by = m_Born_y;
3017  fps->mh = m_MyHome;
3018  m_OurPopulationManager->CreateObjects(2, this, nullptr, fps, 1);
3019  delete fps;
3020  // m_OurPopulationManager will destroy object
3021 }

References Skylark_Base::Age, Skylark_Population_Manager::CreateObjects(), Skylark_Base::m_Born_x, Skylark_Base::m_Born_y, m_Dad, TAnimal::m_Location_x, TAnimal::m_Location_y, Skylark_Base::m_MyHome, TAnimal::m_OurLandscape, Skylark_Base::m_OurPopulationManager, Skylark_Base::m_OurTerritories, Skylark_Base::m_Size, Sex, and Skylark_struct::x.

Referenced by EndStep().

◆ Step()

void Skylark_Nestling::Step ( void  )
overridevirtual

Step behaviour - must be implemented in descendent classes.

Reimplemented from TALMaSSObject.

Reimplemented in Skylark_PreFledgeling.

2859  {
2860 #ifdef __CJTDebug_5
2861  if ( IsAlive() != 0x0DEADC0DE ) DEADCODEError();
2862 #endif
2863  if (m_StepDone) return;
2864  switch (m_CurrentSkState)
2865  {
2866  case toss_Initiation: // Initial
2867  m_CurrentSkState = toss_NDeveloping;
2868  m_StepDone = true;
2869  break;
2870  case toss_Destroy:
2871  m_StepDone = true;
2872  break;
2873  case toss_NDeveloping: // Develop
2874  m_StepDone = true;
2875  break;
2876  case toss_NDying: // Dying
2877  m_StepDone = true;
2878  break;
2879  default:
2880  g_land->Warn("Skylark_Nestling::Step(): Unknown State ", nullptr);
2881  exit(1);
2882  }
2883 }

References g_land, Skylark_Base::m_CurrentSkState, TALMaSSObject::m_StepDone, and Landscape::Warn().

Member Data Documentation

◆ m_Dad

◆ m_EM

◆ m_EM_fail

int Skylark_Nestling::m_EM_fail
protected

Referenced by ReInit(), and Skylark_Nestling().

◆ m_GrNeed

◆ m_NestLeavingChance

int Skylark_Nestling::m_NestLeavingChance
protected

◆ Sex


The documentation for this class was generated from the following files:
fiber_removal
Definition: Treatment.h:129
fp_rsm
Definition: Treatment.h:64
org_insecticide
Definition: Treatment.h:84
fa_sk
Definition: Treatment.h:71
NestlingMortProb
static int NestlingMortProb
Definition: skylarks_all.cpp:159
Skylark_Nestling::m_EM
double m_EM
Definition: skylarks_all.h:596
row_cultivation
Definition: Treatment.h:88
fa_pk
Definition: Treatment.h:68
winter_harrow
Definition: Treatment.h:144
cfg_PEmax
CfgFloat cfg_PEmax
fp_npk
Definition: Treatment.h:52
strigling
Definition: Treatment.h:89
harvest
Definition: Treatment.h:94
fa_nk
Definition: Treatment.h:142
Skylark_Base::AddStriglingMort
void AddStriglingMort(const int lifestage) const
Definition: skylarks_all.h:531
Landscape::SupplyTemp
double SupplyTemp(void)
Passes a request on to the associated Weather class function, the temperature for the current day.
Definition: Landscape.h:1993
insecticide_treat
Definition: Treatment.h:83
straw_chopping
Definition: Treatment.h:99
fa_greenmanure
Definition: Treatment.h:76
stubble_plough
Definition: Treatment.h:35
growth_regulator
Definition: Treatment.h:81
deep_ploughing
Definition: Treatment.h:43
hilling_up
Definition: Treatment.h:91
green_harvest
Definition: Treatment.h:127
autumn_or_spring_plough
Definition: Treatment.h:103
flower_cutting
Definition: Treatment.h:121
Skylark_Nestling::st_Maturing
virtual void st_Maturing()
Definition: skylarks_all.cpp:2999
g_land
Landscape * g_land
Definition: skylarks_all.cpp:44
spring_plough
Definition: Treatment.h:44
fp_sk
Definition: Treatment.h:56
pruning
Definition: Treatment.h:125
Skylark_Base::m_CurrentSkState
TTypesOfSkState m_CurrentSkState
Definition: skylarks_all.h:517
Landscape::SupplyGrazingPressure
int SupplyGrazingPressure(int a_polyref)
Returns the grazing pressure of the polygon using the polygon reference number a_polyref or coordinat...
Definition: Landscape.h:1848
fp_manure
Definition: Treatment.h:61
herbicide_treat
Definition: Treatment.h:80
fp_ammoniumsulphate
Definition: Treatment.h:60
g_date
class Calendar * g_date
Definition: Calendar.cpp:37
flammebehandling
Definition: Treatment.h:90
straw_covering
Definition: Treatment.h:123
fp_boron
Definition: Treatment.h:131
fp_cu
Definition: Treatment.h:138
bulb_harvest
Definition: Treatment.h:122
preseeding_cultivator
Definition: Treatment.h:39
trial_control
Definition: Treatment.h:110
fp_npks
Definition: Treatment.h:51
CfgFloat::value
double value() const
Definition: Configurator.h:142
burn_top
Definition: Treatment.h:143
EM_nest_T
const double EM_nest_T[14]
Definition: skylarks_all.cpp:144
fp_nk
Definition: Treatment.h:133
Skylark_Base::m_Born_y
int m_Born_y
Definition: skylarks_all.h:521
burn_straw_stubble
Definition: Treatment.h:104
org_herbicide
Definition: Treatment.h:85
Skylark_struct::x
int x
Definition: skylarks_all.h:209
MeanHatchingWeight
static double MeanHatchingWeight
Definition: skylarks_all.cpp:161
Skylark_Base::m_OurTerritories
SkTerritories * m_OurTerritories
Definition: skylarks_all.h:525
fa_cu
Definition: Treatment.h:140
autumn_roll
Definition: Treatment.h:38
strigling_hill
Definition: Treatment.h:117
Skylark_Nestling::st_Developing
virtual int st_Developing()
Definition: skylarks_all.cpp:2937
heavy_cultivator_aggregate
Definition: Treatment.h:120
fp_manganesesulphate
Definition: Treatment.h:59
hay_turning
Definition: Treatment.h:100
Skylark_Nestling::m_NestLeavingChance
int m_NestLeavingChance
Definition: skylarks_all.h:593
last_treatment
Definition: Treatment.h:150
straw_removal
Definition: Treatment.h:124
fa_n
Definition: Treatment.h:139
shredding
Definition: Treatment.h:126
pheromone
Definition: Treatment.h:149
fp_n
Definition: Treatment.h:132
manual_weeding
Definition: Treatment.h:148
fa_npk
Definition: Treatment.h:67
winter_plough
Definition: Treatment.h:42
fp_calcium
Definition: Treatment.h:65
Skylark_Nestling::m_Dad
Skylark_Male * m_Dad
Definition: skylarks_all.h:595
spring_harrow
Definition: Treatment.h:45
cut_to_silage
Definition: Treatment.h:98
Skylark_Nestling::Sex
bool Sex
Definition: skylarks_all.h:591
Skylark_Base::m_MyHome
int m_MyHome
The vegetation type where the skylark was born.
Definition: skylarks_all.h:523
fa_sludge
Definition: Treatment.h:77
pigs_out
Definition: Treatment.h:96
fp_p
Definition: Treatment.h:54
suckering
Definition: Treatment.h:130
cut_to_hay
Definition: Treatment.h:97
fa_boron
Definition: Treatment.h:141
Skylark_Nestling::m_GrNeed
double m_GrNeed
Definition: skylarks_all.h:597
Calendar::Date
long Date(void)
Definition: Calendar.h:57
TAnimal::m_Location_y
int m_Location_y
The objects ALMaSS y coordinate.
Definition: PopulationManager.h:366
fa_k
Definition: Treatment.h:70
spring_roll
Definition: Treatment.h:46
TAnimal::m_OurLandscape
static Landscape * m_OurLandscape
A pointer to the landscape object shared with all TAnimal objects.
Definition: PopulationManager.h:342
TAnimal::CheckManagement
void CheckManagement()
Used to start a check for any management related effects at the objects current location.
Definition: PopulationManager.cpp:1591
Skylark_Base::DailyMortality
static bool DailyMortality(int mort)
Definition: skylarks_all.cpp:2092
Skylark_Base::Age
int Age
Definition: skylarks_all.h:518
syninsecticide_treat
Definition: Treatment.h:111
cfg_strigling_nestling
CfgInt cfg_strigling_nestling
fp_nc
Definition: Treatment.h:135
fungicide_treat
Definition: Treatment.h:82
fp_sludge
Definition: Treatment.h:63
fp_greenmanure
Definition: Treatment.h:62
Skylark_Base::Skylark_Base
Skylark_Base(int x, int y, SkTerritories *Terrs, Landscape *L, Skylark_Population_Manager *SPM, int bx, int by, int mh)
Definition: skylarks_all.cpp:2058
shallow_harrow
Definition: Treatment.h:119
fa_slurry
Definition: Treatment.h:72
cattle_out_low
Definition: Treatment.h:112
harvest_bushfruit
Definition: Treatment.h:137
preseeding_cultivator_sow
Definition: Treatment.h:40
fp_pk
Definition: Treatment.h:53
Skylark_Nestling::m_EM_fail
int m_EM_fail
Definition: skylarks_all.h:592
cfg_insecticide_direct_mortN
CfgInt cfg_insecticide_direct_mortN
fa_pks
Definition: Treatment.h:145
org_fungicide
Definition: Treatment.h:86
summer_harrow
Definition: Treatment.h:49
Landscape::SupplyDayInYear
int SupplyDayInYear(void)
Passes a request on to the associated Calendar class function, the day in the year.
Definition: Landscape.h:2267
cattle_out
Definition: Treatment.h:95
harvestshoots
Definition: Treatment.h:147
stubble_cultivator_heavy
Definition: Treatment.h:36
TALMaSSObject::m_StepDone
bool m_StepDone
Indicates whether the iterative step code is done for this timestep.
Definition: PopulationManager.h:133
biocide
Definition: Treatment.h:116
swathing
Definition: Treatment.h:93
glyphosate
Definition: Treatment.h:114
CfgInt::value
int value() const
Definition: Configurator.h:116
fa_manure
Definition: Treatment.h:75
spring_sow
Definition: Treatment.h:47
cut_weeds
Definition: Treatment.h:106
trial_toxiccontrol
Definition: Treatment.h:109
summer_plough
Definition: Treatment.h:48
Skylark_Base::m_Born_x
int m_Born_x
Definition: skylarks_all.h:520
Landscape::EventtypeToString
std::string EventtypeToString(int a_event)
Returns the text representation of a treatment type.
Definition: Landscape.cpp:6024
CE_nest
const double CE_nest[15]
Definition: skylarks_all.cpp:149
fp_pks
Definition: Treatment.h:146
fp_ns
Definition: Treatment.h:134
bed_forming
Definition: Treatment.h:118
Skylark_Base::ReInit
virtual void ReInit(int x, int y, SkTerritories *Terrs, Landscape *L, Skylark_Population_Manager *SPM, int bx, int by, int mh)
Definition: skylarks_all.cpp:2074
product_treat
Definition: Treatment.h:113
Skylark_Base::m_Size
double m_Size
Definition: skylarks_all.h:519
cfg_NestLeavingChance
CfgInt cfg_NestLeavingChance
autumn_sow
Definition: Treatment.h:41
Skylark_Base::m_OurPopulationManager
Skylark_Population_Manager * m_OurPopulationManager
Definition: skylarks_all.h:526
autumn_harrow
Definition: Treatment.h:37
Skylark_Population_Manager::WriteSKPOM2
void WriteSKPOM2(const int n, const int n2) const
Definition: skylarks_all.h:452
fa_calcium
Definition: Treatment.h:79
fa_ammoniumsulphate
Definition: Treatment.h:74
Skylark_Population_Manager::CreateObjects
void CreateObjects(int ob_type, TAnimal *pTAo, void *null, Skylark_struct *data, int number)
Definition: skylarks_all.cpp:539
autumn_sow_with_ferti
Definition: Treatment.h:136
trial_insecticidetreat
Definition: Treatment.h:108
fa_p
Definition: Treatment.h:69
mow
Definition: Treatment.h:105
Skylark_Male::OnNestlingDeath
void OnNestlingDeath(const Skylark_Nestling *N)
Definition: skylarks_all.cpp:4665
fa_rsm
Definition: Treatment.h:78
g_random_fnc
int g_random_fnc(const int a_range)
Definition: ALMaSS_Random.cpp:74
NestLeavingWeight
static double NestLeavingWeight
Definition: skylarks_all.cpp:155
fa_npks
Definition: Treatment.h:66
water
Definition: Treatment.h:92
stubble_harrowing
Definition: Treatment.h:102
PreFledgeling_struct
Definition: skylarks_all.h:238
fp_liquidNH3
Definition: Treatment.h:57
molluscicide
Definition: Treatment.h:87
TALMaSSObject::m_CurrentStateNo
int m_CurrentStateNo
The basic state number for all objects - '-1' indicates death.
Definition: PopulationManager.h:131
hay_bailing
Definition: Treatment.h:101
fa_manganesesulphate
Definition: Treatment.h:73
fp_k
Definition: Treatment.h:55
Landscape::Warn
void Warn(std::string a_msg1, std::string a_msg2)
Wrapper for the g_msg Warn function.
Definition: Landscape.h:2250
autumn_plough
Definition: Treatment.h:34
TAnimal::m_Location_x
int m_Location_x
The objects ALMaSS x coordinate.
Definition: PopulationManager.h:362
fp_slurry
Definition: Treatment.h:58
fiber_covering
Definition: Treatment.h:128
Skylark_Nestling::st_Dying
virtual void st_Dying()
Definition: skylarks_all.cpp:3097
summer_sow
Definition: Treatment.h:50
spring_sow_with_ferti
Definition: Treatment.h:115
Skylark_Male::OnNestPredatation
void OnNestPredatation()
Definition: skylarks_all.cpp:4701
sleep_all_day
Definition: Treatment.h:33
strigling_sow
Definition: Treatment.h:107