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_Clutch Class Reference

#include <skylarks_all.h>

Inheritance diagram for Skylark_Clutch:
Skylark_Base TAnimal TALMaSSObject

Public Member Functions

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...
 
 Skylark_Clutch (Skylark_Female *Mum, SkTerritories *Terrs, Landscape *L, int NoEggs, int x, int y, int mh, Skylark_Population_Manager *SPM)
 
virtual void ReInit (Skylark_Female *Mum, SkTerritories *Terrs, Landscape *L, int NoEggs, int x, int y, int mh, Skylark_Population_Manager *SPM)
 
void OnMumGone ()
 
void AddEgg ()
 
void StartDeveloping ()
 
- 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 (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...
 

Public Attributes

int Clutch_Size
 
Skylark_FemaleMother
 
- 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
 

Protected Member Functions

int st_Developing ()
 
int st_Hatching ()
 
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

int MinDegrees
 
int m_baddays
 
- 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...
 
- 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_Clutch()

Skylark_Clutch::Skylark_Clutch ( Skylark_Female Mum,
SkTerritories Terrs,
Landscape L,
int  NoEggs,
int  x,
int  y,
int  mh,
Skylark_Population_Manager SPM 
)
2121  : Skylark_Base(x, y, Terrs, L, SPM, x, y, m_MyHome) {
2122  Age = 0;
2123  Clutch_Size = NoEggs;
2124  MinDegrees = 0;
2125  Mother = Mum;
2126  m_baddays = 0;
2127 }

References Skylark_Base::Age, Clutch_Size, m_baddays, MinDegrees, and Mother.

Member Function Documentation

◆ AddEgg()

void Skylark_Clutch::AddEgg ( )
inline
573 { Clutch_Size++; }

Referenced by Skylark_Female::st_Laying().

◆ BeginStep()

void Skylark_Clutch::BeginStep ( void  )
overridevirtual

BeingStep behaviour - must be implemented in descendent classes.

Reimplemented from TALMaSSObject.

2358 { CheckManagement(); }

References TAnimal::CheckManagement().

◆ EndStep()

void Skylark_Clutch::EndStep ( void  )
overridevirtual

EndStep behaviour - must be implemented in descendent classes.

Reimplemented from TALMaSSObject.

2398  {
2399 #ifdef __CJTDebug_5
2400  if ( IsAlive() != 0x0DEADC0DE ) DEADCODEError();
2401 #endif
2402  if (m_CurrentSkState == toss_Destroy) return;
2403  switch (m_CurrentSkState)
2404  {
2405  case toss_Initiation:
2406  break;
2407  case toss_Developing: // Develop
2408  switch (st_Developing())
2409  {
2410  case 2:
2411 #ifdef TEST_ISSUE_DEATH_WARRANT
2412  printf( "Skylark_Clutch::EndStep() st_Developing() %d\n", ( int )g_date->Date() );
2413 #endif
2414  m_CurrentSkState = toss_CDying; // die
2415  break;
2416  case 1:
2417  m_CurrentSkState = toss_Hatching; // hatch
2418  break;
2419  case 0:
2420  break;
2421  }
2422  break;
2423  case toss_Hatching: // Hatching
2424  switch (st_Hatching())
2425  {
2426  case 0:
2427 #ifdef TEST_ISSUE_DEATH_WARRANT
2428  printf( "Skylark_Clutch::EndStep() st_Hatching() %d\n", ( int )g_date->Date() );
2429 #endif
2430  m_CurrentSkState = toss_CDying;
2431  break;
2432  case 1: // Successful hatch
2433  m_CurrentSkState = toss_Destroy; // will kill it at end of step!
2434  m_CurrentStateNo = -1;
2435  m_StepDone = true; // otherwise it will loop forever
2436  break;
2437  }
2438  break;
2439  case toss_CDying: // Dying
2440  st_Dying();
2441  m_StepDone = true;
2442  break;
2443  default:
2444  g_msg->Warn("Skylark_Clutch::EndStep(): Unknown state: ", m_CurrentSkState);
2445  exit(0);
2446  break;
2447  }
2448 }

References Calendar::Date(), g_date, g_msg, Skylark_Base::m_CurrentSkState, TALMaSSObject::m_CurrentStateNo, TALMaSSObject::m_StepDone, st_Developing(), st_Dying(), st_Hatching(), and MapErrorMsg::Warn().

◆ OnFarmEvent()

bool Skylark_Clutch::OnFarmEvent ( FarmToDo  )
overrideprotectedvirtual

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

Reimplemented from TAnimal.

2141  {
2142  switch (event)
2143  {
2144  case sleep_all_day:
2145  break;
2146 // Here begins soil cultivation and cutting mortality
2147  case autumn_plough:
2148  case stubble_plough:
2151  case autumn_harrow:
2152  case preseeding_cultivator:
2154  case autumn_roll:
2155  case autumn_sow:
2156  case autumn_sow_with_ferti:
2157  case winter_plough:
2158  case deep_ploughing:
2159  case spring_plough:
2160  case spring_harrow:
2161  case shallow_harrow:
2162  case spring_roll:
2163  case spring_sow:
2164  case spring_sow_with_ferti:
2165  case fp_liquidNH3:
2166  case fp_greenmanure:
2167  case row_cultivation:
2168  case hilling_up:
2169  case harvest:
2170  case green_harvest:
2171  case harvestshoots:
2172  case harvest_bushfruit:
2173  case cut_to_hay:
2174  case cut_to_silage:
2175  case straw_chopping:
2176  case hay_turning:
2178  case burn_straw_stubble:
2179  case burn_top:
2180  case flammebehandling:
2181  case mow:
2182  case bed_forming:
2183  case flower_cutting:
2184  case bulb_harvest:
2185  case pruning:
2186  case shredding:
2187  case winter_harrow:
2188  case suckering:
2189  case summer_harrow:
2190  case summer_plough:
2191  case summer_sow:
2192 #ifdef TEST_ISSUE_DEATH_WARRANT
2193  printf( "Skylark_Clutch::OnFarmEvent() : %d : %d\n", event, ( int )g_date->Date() );
2194 #endif
2195  m_CurrentSkState = toss_CDying;
2196  break;
2197 // Here begins spray mortality
2198  case fp_npks:
2199  case fp_npk:
2200  case fp_pk:
2201  case fp_k:
2202  case fp_p:
2203  case fp_ammoniumsulphate:
2204  case fp_manganesesulphate:
2205  case fp_manure:
2206  case fp_sludge:
2207  case fp_rsm:
2208  case fp_calcium:
2209  case fp_cu:
2210  case fp_n:
2211  case fp_nc:
2212  case fp_nk:
2213  case fp_ns:
2214  case fp_pks:
2215  case fp_sk:
2216  case fp_boron:
2217  case fa_npks:
2218  case fa_npk:
2219  case fa_n:
2220  case fa_boron:
2221  case fa_cu:
2222  case fa_nk:
2223  case fa_pks:
2224  case fa_pk:
2225  case fa_k:
2226  case fa_p:
2227  case fa_sk:
2228  case fa_ammoniumsulphate:
2229  case fa_manganesesulphate:
2230  case fa_manure:
2231  case fa_greenmanure:
2232  case fa_sludge:
2233  case fa_rsm:
2234  case fa_calcium:
2235  case herbicide_treat:
2236  case growth_regulator:
2237  case fungicide_treat:
2238  case insecticide_treat:
2239  case org_insecticide:
2241  case syninsecticide_treat:
2242  case org_fungicide:
2243  case org_herbicide:
2245  {
2246 #ifdef TEST_ISSUE_DEATH_WARRANT
2247  printf( "Skylark_Female::OnFarmEvent() : %d : %d\n", event, ( int )g_date->Date() );
2248 #endif
2249  m_CurrentSkState = toss_CDying;
2250  }
2251  break;
2252  case fp_slurry:
2253  case fa_slurry:
2254  case swathing: /*\todo why are these three different from other spray/cultivation effects? */
2255  if (g_random_fnc(100) < 2)
2256  {
2257 #ifdef TEST_ISSUE_DEATH_WARRANT
2258  printf( "Skylark_Clutch::OnFarmEvent() : %d : %d\n", event, ( int )g_date->Date() );
2259 #endif
2260  m_CurrentSkState = toss_CDying;
2261  }
2262  break;
2263 // Here begins strigling mortality
2264  case strigling_sow:
2265  case strigling_hill:
2266  case strigling:
2267 #ifndef __NoStriglingEffect
2269  {
2270 #ifdef TEST_ISSUE_DEATH_WARRANT
2271  printf( "Skylark_Clutch::OnFarmEvent() : %d : %d\n", event, ( int )g_date->Date() );
2272 #endif
2273  m_CurrentSkState = toss_CDying;
2274  AddStriglingMort(1);
2275  }
2276 #endif
2277  break;
2278 // Here begins grazing mortality
2279  case cattle_out:
2281  if (g_random_fnc(1000) < 20)
2282  {
2283  // was 20
2284 #ifdef TEST_ISSUE_DEATH_WARRANT
2285  printf( "Skylark_Clutch::OnFarmEvent() : %d : %d\n", event, ( int )g_date->Date() );
2286 #endif
2287  m_CurrentSkState = toss_CDying;
2288  }
2289  break;
2290  case cattle_out_low:
2292  if (g_random_fnc(1000) < 5)
2293  {
2294  //was 5
2295 #ifdef TEST_ISSUE_DEATH_WARRANT
2296  printf( "Skylark_Clutch::OnFarmEvent() : %d : %d\n", event, ( int )g_date->Date() );
2297 #endif
2298  m_CurrentSkState = toss_CDying;
2299  }
2300  break;
2301  case pigs_out:
2302 #ifndef __NoPigsOutEffect
2303  if (g_random_fnc(100) < 20)
2304  {
2305 #ifdef TEST_ISSUE_DEATH_WARRANT
2306  printf( "Skylark_Clutch::OnFarmEvent() : %d : %d\n", event, ( int )g_date->Date() );
2307 #endif
2308  m_CurrentSkState = toss_CDying;
2309  }
2310 #endif
2311  break;
2312 //Here begins non-mortality events
2313  /*\todo should these be reassessed? */
2314  case product_treat:
2315  case glyphosate:
2316  case biocide:
2317  case molluscicide:
2318  case last_treatment:
2319  case pheromone:
2320  case water:
2321  case hay_bailing:
2322  case stubble_harrowing:
2323  case cut_weeds:
2324  case manual_weeding:
2325  case straw_covering:
2326  case straw_removal:
2327  case fiber_removal:
2328  case fiber_covering:
2329  case trial_control:
2330  case trial_toxiccontrol:
2331  break;
2332  default:
2333  g_land->Warn("Skylark_Clutch::OnFarmEvent(): Unknown event type:", m_OurLandscape->EventtypeToString(event));
2334  exit(1);
2335  }
2336  if (m_CurrentSkState == toss_CDying) return true;
2337  return false;
2338 }

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_mortE, cfg_strigling_clutch, 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.

◆ OnMumGone()

void Skylark_Clutch::OnMumGone ( void  )
2342  {
2343 #ifdef __CJTDebug_5
2344  if ( IsAlive() != 0x0DEADC0DE )
2345  DEADCODEError();
2346 #endif
2347  // the clutch cannot survive so go directly to die and do not pass go
2348  Mother = nullptr;
2349 #ifdef TEST_ISSUE_DEATH_WARRANT
2350  printf( "Skylark_Clutch::OnMumGone() %d\n", ( int )g_date->Date() );
2351 #endif
2352  m_CurrentSkState = toss_Destroy; // will kill it at end of step!
2353  m_CurrentStateNo = -1;
2354 }

References Calendar::Date(), g_date, Skylark_Base::m_CurrentSkState, TALMaSSObject::m_CurrentStateNo, and Mother.

Referenced by Skylark_Female::OnMateDying(), Skylark_Female::OnMateHomeless(), Skylark_Female::st_Dying(), Skylark_Female::st_GivingUpTerritory(), Skylark_Female::st_StartingNewBrood(), Skylark_Female::st_StoppingBreeding(), and Skylark_Female::Step().

◆ ReInit()

void Skylark_Clutch::ReInit ( Skylark_Female Mum,
SkTerritories Terrs,
Landscape L,
int  NoEggs,
int  x,
int  y,
int  mh,
Skylark_Population_Manager SPM 
)
virtual
2131  {
2132  Skylark_Base::ReInit(x, y, Terrs, L, SPM, x, y, a_MyHome);
2133  Age = 0;
2134  Clutch_Size = NoEggs;
2135  MinDegrees = 0;
2136  Mother = Mum;
2137  m_baddays = 0;
2138 }

References Skylark_Base::Age, Clutch_Size, m_baddays, MinDegrees, Mother, and Skylark_Base::ReInit().

◆ st_Developing()

int Skylark_Clutch::st_Developing ( )
protected
2451  {
2452 #ifdef __CJTDebug_5
2453  if ( IsAlive() != 0x0DEADC0DE ) DEADCODEError();
2454 #endif
2456  {
2457 #ifdef __SKPOM
2459 #endif
2460  return 2; //transfer to state die
2461  }
2462  if (Age > 0) // No development on the first day when just laid
2463  {
2464  // Timing : This function is called once at the end of each day before
2465  // the next day
2466  // Develop according to ambient temperature, and how long the female
2467  // is incubating for
2468  const int incubated_time = Mother->Supply_NestTime(); // this includes night
2469  const int off_nest_time = 24 * 60 - incubated_time;
2470  //double Rain = m_OurLandscape->SupplyRain();
2471  //int Daylength = m_OurLandscape->SupplyDaylength();
2472 
2473  //m_OurPopulationManager->WriteToTest2File(m_OurLandscape->SupplyDayInYear(),off_nest_time);
2474  // they start at EggTemp degrees and cool to 'cool'
2475  const double cool_rate_pmin = Cooling_Rate_Eggs / 60.0;
2476  double Temp = m_OurLandscape->SupplyTemp(); // 9.97 = COrrection for day/night temps in �tjylland
2477  if (Temp >= EggTemp) Temp = EggTemp - 0.000001;
2478 
2479  // If off_nest_time > daylength/2 then the birds are spending more time off the nest than on.
2480  // in this case the trip length must go up
2481  //double TripNumber=cfg_FoodTripsPerDay.value();
2482  const double TripLength = cfg_sk_triplength.value();
2483  /*
2484  if ( off_nest_time >= ( Daylength - 10 ) ) { // -10 allows us not to get a division by zero later
2485  if ( ++m_baddays > 5 ) {
2486  #ifdef __SKPOM
2487  m_OurPopulationManager->WriteSKPOM1( m_OurLandscape->SupplyDayInYear(), 1003 );
2488  #endif
2489  return 2; //TransferToState(Die);
2490  }
2491  } else {
2492  if ( off_nest_time > ( Daylength / 2.0 ) ) {
2493  // getting cold, so assume a different strategy or maximising the number of on nest times of 10 minutes
2494  int on_nest = Daylength - off_nest_time;
2495  TripNumber = on_nest / 10.0;
2496  TripLength = off_nest_time / TripNumber;
2497  }
2498  else {
2499  TripLength = 10;
2500  }
2501  }
2502  */
2503  //
2504  // We have the time incubated - but this includes re-warming time. So make
2505  // the assumption that warming/cooling are linear and equal rates
2506  // Now calculate the minimum temperature
2507  // double cool = EggTemp - ( ( cool_rate_pmin * TripLength ) * ( ( EggTemp - Temp ) / 2.0 ) );
2508  double cool = EggTemp - cool_rate_pmin * TripLength * ((EggTemp - Temp) / 2.0);
2509  // This cannot be lower than ambient (There is a problem here since ambient
2510  // temperature when the eggs are not incubated is higher than the mean used
2511  // here because foraging is in the daytime
2512  if (cool < Temp) cool = Temp;
2513  // Now calculate how many minutes were spent cooling down to this temp (if
2514  // cool is higher than Temp then cooltime should be the same as TripLength
2515  // Next line to prevent overflow
2516  const double cooltime = (EggTemp - cool) / (cool_rate_pmin * ((EggTemp - Temp) / 2.0));
2517  // Eggs will spend incubated time-cooltime at EggTemp, off_nest_time-cooltime
2518  // at cool, and 2xcooltime at the mean of EggTemp and cool
2519  const double AverageOffNestTemp = (cool + EggTemp) / 2.0;
2520  /* if ( Rain > 5 ) { MinDegrees += ( ( 24 * 60 ) - Daylength ) * ( EggTemp - MD_Threshold ); if ( m_baddays++ > 5 ) {
2521  m_OurPopulationManager->WriteToTest2File( m_OurLandscape->SupplyDayInYear(), 1009 );
2522  return 2; //TransferToState(Die); } } else */
2523  {
2524  MinDegrees += static_cast<int>((incubated_time - cooltime * 2.0) * (EggTemp - MD_Threshold)); // took *2 away
2525  double offnesttemp = cool - MD_Threshold;
2526  if (offnesttemp < 0) offnesttemp = 0; // No development, rather than minus
2527  MinDegrees += static_cast<int>((off_nest_time - cooltime) * offnesttemp);
2528  double transitiontemp = static_cast<int>(AverageOffNestTemp) - MD_Threshold;
2529  if (transitiontemp < 0) transitiontemp = 0; // No development, rather than minus
2530  MinDegrees += static_cast<int>(2.0 * cooltime * transitiontemp); // was 1.0 - this change assumes immediate re-heating
2531  }
2532  /* double scalingfactor = 1.0; int Daylength = m_OurLandscape->SupplyDaylength( );
2533  int daytimeonnest=Daylength-off_nest_time; double Rain = m_OurLandscape->SupplyRain(); if (Rain >10) {
2534  MinDegrees+=(24*60)-Daylength; if (m_baddays++>5) {
2535  m_OurPopulationManager->WriteToTest2File( m_OurLandscape->SupplyDayInYear(), 1009 ); return 2; //TransferToState(Die); } }
2536  else { if ((daytimeonnest * scalingfactor) >= off_nest_time) { MinDegrees+=24*60; // No problem, got all day } else {
2537  if (daytimeonnest<=0) { MinDegrees+=incubated_time; if (m_baddays++>5) {
2538  m_OurPopulationManager->WriteToTest2File( m_OurLandscape->SupplyDayInYear(), 1009 ); return 2; //TransferToState(Die);
2539  }; // This counter just keeps going up until death } else { // Here we have used some time being cold, but not too much
2540  int uncompensatedtime=off_nest_time-(daytimeonnest*scalingfactor);
2541  MinDegrees+=(24*60)-uncompensatedtime; // Only part of the day } } } */
2542  }
2543 
2544  // Have we achieved enough minute degrees
2545  if (MinDegrees > MD_Hatch)
2546  {
2547 #ifdef __SKPOM
2549 #endif
2550  return 1; //TransferToState(Hatch);
2551  } // if they reach the age of 18 they die if not hatched
2552  if (Age == 18)
2553  {
2554 #ifdef __SKPOM
2556 #endif
2557  return 2; //TransferToState(Die);
2558  }
2559  Age++;
2560  return 0;
2561 }

References Skylark_Base::Age, cfg_sk_triplength, ClutchMortProb, Cooling_Rate_Eggs, Skylark_Base::DailyMortality(), EggTemp, TAnimal::m_OurLandscape, Skylark_Base::m_OurPopulationManager, MD_Hatch, MD_Threshold, MinDegrees, Mother, Skylark_Female::Supply_NestTime(), Landscape::SupplyDayInYear(), Landscape::SupplyTemp(), CfgFloat::value(), and Skylark_Population_Manager::WriteSKPOM1().

Referenced by EndStep().

◆ st_Dying()

void Skylark_Clutch::st_Dying ( void  )
protected
2602  {
2603 #ifdef __CJTDebug_5
2604  if ( IsAlive() != 0x0DEADC0DE ) DEADCODEError();
2605 #endif
2606  // Timing: Zero time
2607  // Only called before object is destroyed
2608  if (Mother) Mother->OnClutchDeath();
2609  m_CurrentSkState = toss_Destroy; // will kill it at end of step!
2610  m_CurrentStateNo = -1;
2611 }

References Skylark_Base::m_CurrentSkState, TALMaSSObject::m_CurrentStateNo, Mother, and Skylark_Female::OnClutchDeath().

Referenced by EndStep().

◆ st_Hatching()

int Skylark_Clutch::st_Hatching ( )
protected
2565  {
2566 #ifdef __CJTDebug_5
2567  if ( IsAlive() != 0x0DEADC0DE ) DEADCODEError();
2568 #endif
2569  // Timing: Occurs at the end of a day (e.g. midnight-1 minute)
2570  // Must create Clutch_Size number of Skylark_Hatchling Objects
2571  // They tell Mother that they have been created when they exist in the system
2572 
2573  if (Mother->Paired)
2574  {
2575  const auto Ch = new Nestling_struct;
2576  Ch->Dad = Mother->MyMate; // Needs a pointer to dad not mum
2577  Ch->x = m_Location_x;
2578  Ch->y = m_Location_y;
2579  Ch->L = m_OurLandscape;
2580  Ch->Terrs = m_OurTerritories;
2581  Ch->bx = m_Born_x;
2582  Ch->by = m_Born_y;
2583  Ch->mh = m_MyHome;
2584 #ifdef __CJTDebug_7
2585  if (Clutch_Size == 0)
2586  {
2587  g_land->Warn("Skylark_Clutch::st_Hatching(): DeBug7 ", nullptr);
2588  exit(1);
2589  }
2590 #endif
2591  m_OurPopulationManager->CreateObjects(1, this, nullptr, Ch, Clutch_Size);
2592  // object destroyed by m_OurPopulationManager
2593  delete Ch;
2594  Mother->OnEggsHatch(); // Sets in motion feeding and she tells male
2595  return 1;
2596  }
2597  return 0;
2598 }

References Clutch_Size, Skylark_Population_Manager::CreateObjects(), Nestling_struct::Dad, g_land, Skylark_Base::m_Born_x, Skylark_Base::m_Born_y, TAnimal::m_Location_x, TAnimal::m_Location_y, Skylark_Base::m_MyHome, TAnimal::m_OurLandscape, Skylark_Base::m_OurPopulationManager, Skylark_Base::m_OurTerritories, Mother, Skylark_Female::MyMate, Skylark_Female::OnEggsHatch(), Skylark_Adult::Paired, and Landscape::Warn().

Referenced by EndStep().

◆ StartDeveloping()

void Skylark_Clutch::StartDeveloping ( )
inline
575  {
576  m_CurrentSkState = toss_Developing;
577  // Must tell the pop man how many eggs were made
579  }

Referenced by Skylark_Female::st_Laying().

◆ Step()

void Skylark_Clutch::Step ( void  )
overridevirtual

Step behaviour - must be implemented in descendent classes.

Reimplemented from TALMaSSObject.

2362  {
2363 #ifdef __CJTDebug_5
2364  if ( IsAlive() != 0x0DEADC0DE ) DEADCODEError();
2365 #endif
2366  if (m_StepDone || m_CurrentSkState == toss_Destroy) return;
2367 #ifdef __CJTDebug_5
2368  if ( Mother ) {
2369  if ( Mother->SupplyMyClutch() != this ) {
2370  g_land->Warn( "Skylark_Step::Step(): Debug_5 ", "" );
2371  exit( 1 );
2372  }
2373  }
2374 #endif
2375  switch (m_CurrentSkState)
2376  {
2377  case toss_Initiation: // Initial state. Will wait here until told by female that she is incubatig
2378  m_StepDone = true;
2379  m_CurrentSkState = toss_Initiation;
2380  break;
2381  case toss_Developing:
2382  m_StepDone = true;
2383  break;
2384  case toss_Hatching:
2385  m_StepDone = true;
2386  break;
2387  case toss_CDying:
2388  m_StepDone = true;
2389  break;
2390  default:
2391  g_land->Warn("Skylark_CLutch::Step(): Unknown State ", "");
2392  exit(1);
2393  }
2394 }

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

Member Data Documentation

◆ Clutch_Size

int Skylark_Clutch::Clutch_Size

Referenced by ReInit(), Skylark_Clutch(), and st_Hatching().

◆ m_baddays

int Skylark_Clutch::m_baddays
protected

Referenced by ReInit(), and Skylark_Clutch().

◆ MinDegrees

int Skylark_Clutch::MinDegrees
protected

◆ Mother


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
row_cultivation
Definition: Treatment.h:88
fa_pk
Definition: Treatment.h:68
Skylark_Population_Manager::incTotalEggs
void incTotalEggs(const int eggs)
Definition: skylarks_all.h:484
winter_harrow
Definition: Treatment.h:144
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
ClutchMortProb
static int ClutchMortProb
Definition: skylarks_all.cpp:158
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
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_Female::SupplyMyClutch
Skylark_Clutch * SupplyMyClutch() const
Definition: skylarks_all.h:738
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
Skylark_Population_Manager::WriteSKPOM1
void WriteSKPOM1(const int n, const int n2) const
Definition: skylarks_all.h:451
EggTemp
static double EggTemp
Definition: skylarks_all.cpp:163
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
Skylark_Clutch::st_Developing
int st_Developing()
Definition: skylarks_all.cpp:2451
burn_top
Definition: Treatment.h:143
fp_nk
Definition: Treatment.h:133
Skylark_Base::m_Born_y
int m_Born_y
Definition: skylarks_all.h:521
Skylark_Clutch::st_Dying
void st_Dying()
Definition: skylarks_all.cpp:2602
burn_straw_stubble
Definition: Treatment.h:104
org_herbicide
Definition: Treatment.h:85
cfg_sk_triplength
CfgFloat cfg_sk_triplength
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
heavy_cultivator_aggregate
Definition: Treatment.h:120
fp_manganesesulphate
Definition: Treatment.h:59
hay_turning
Definition: Treatment.h:100
last_treatment
Definition: Treatment.h:150
straw_removal
Definition: Treatment.h:124
fa_n
Definition: Treatment.h:139
MD_Hatch
static double MD_Hatch
Definition: skylarks_all.cpp:168
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
spring_harrow
Definition: Treatment.h:45
cut_to_silage
Definition: Treatment.h:98
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
Skylark_Clutch::MinDegrees
int MinDegrees
Definition: skylarks_all.h:559
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
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
MD_Threshold
static double MD_Threshold
Definition: skylarks_all.cpp:164
fa_k
Definition: Treatment.h:70
spring_roll
Definition: Treatment.h:46
Cooling_Rate_Eggs
static double Cooling_Rate_Eggs
Definition: skylarks_all.cpp:162
TAnimal::m_OurLandscape
static Landscape * m_OurLandscape
A pointer to the landscape object shared with all TAnimal objects.
Definition: PopulationManager.h:342
cfg_strigling_clutch
CfgInt cfg_strigling_clutch
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
Skylark_Clutch::st_Hatching
int st_Hatching()
Definition: skylarks_all.cpp:2565
syninsecticide_treat
Definition: Treatment.h:111
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
MapErrorMsg::Warn
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: MapErrorMsg.cpp:69
fa_pks
Definition: Treatment.h:145
org_fungicide
Definition: Treatment.h:86
summer_harrow
Definition: Treatment.h:49
cfg_insecticide_direct_mortE
CfgInt cfg_insecticide_direct_mortE
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
Skylark_Adult::Paired
bool Paired
Definition: skylarks_all.h:670
glyphosate
Definition: Treatment.h:114
Skylark_Clutch::Clutch_Size
int Clutch_Size
Definition: skylarks_all.h:582
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
Skylark_Female::Supply_NestTime
int Supply_NestTime() const
Definition: skylarks_all.h:736
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
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
g_msg
MapErrorMsg * g_msg
Definition: MapErrorMsg.cpp:41
autumn_sow
Definition: Treatment.h:41
Skylark_Clutch::m_baddays
int m_baddays
Definition: skylarks_all.h:560
Skylark_Base::m_OurPopulationManager
Skylark_Population_Manager * m_OurPopulationManager
Definition: skylarks_all.h:526
autumn_harrow
Definition: Treatment.h:37
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
Skylark_Female::OnClutchDeath
void OnClutchDeath()
Definition: skylarks_all.cpp:5786
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
Nestling_struct::Dad
Skylark_Male * Dad
Definition: skylarks_all.h:233
fa_rsm
Definition: Treatment.h:78
g_random_fnc
int g_random_fnc(const int a_range)
Definition: ALMaSS_Random.cpp:74
fa_npks
Definition: Treatment.h:66
water
Definition: Treatment.h:92
stubble_harrowing
Definition: Treatment.h:102
Skylark_Female::MyMate
Skylark_Male * MyMate
Definition: skylarks_all.h:724
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
Skylark_Female::OnEggsHatch
void OnEggsHatch()
Definition: skylarks_all.cpp:5808
fa_manganesesulphate
Definition: Treatment.h:73
Skylark_Clutch::Mother
Skylark_Female * Mother
Definition: skylarks_all.h:583
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
Nestling_struct
Definition: skylarks_all.h:231
fp_slurry
Definition: Treatment.h:58
fiber_covering
Definition: Treatment.h:128
summer_sow
Definition: Treatment.h:50
spring_sow_with_ferti
Definition: Treatment.h:115
sleep_all_day
Definition: Treatment.h:33
strigling_sow
Definition: Treatment.h:107