ALMaSS Rabbit ODdox  1.00
The rabbit model description following ODdox protocol
Rabbit.cpp
Go to the documentation of this file.
1 
2 
3 
4 /*
5 *******************************************************************************************************
6 
7 Copyright (c) 2015, Christopher John Topping, Faarupvej 54, DK-8410 Rønde
8 ADAMA Makhteshim Ltd., PO Box 60, Beer-Sheva 84100, Israel
9 
10 All rights reserved.
11 
12 Redistribution and use in source and binary forms, with or without
13 modification, are permitted provided that the following conditions are met:
14 
15 1. Redistributions of source code must retain the above copyright notice, this
16 list of conditions and the following disclaimer.
17 2. Redistributions in binary form must reproduce the above copyright notice,
18 this list of conditions and the following disclaimer in the documentation
19 and/or other materials provided with the distribution.
20 
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
25 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
28 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 
32 The views and conclusions contained in the software and documentation are those
33 of the authors and should not be interpreted as representing official policies,
34 either expressed or implied, of the FreeBSD Project.
35 
36 ********************************************************************************************************
37 
38 */
47 //#define __RABBITDEBUG
48 //#define __EnclosureTest // Used only for testing POM on rabbits in an enclosure (Bayreuth study)
49 
50 #include <iostream>
51 #include <fstream>
52 #include <vector>
53 #include "../BatchALMaSS/ALMaSS_Setup.h"
54 #include "../ALMaSSDefines.h"
55 #include "../Landscape/ls.h"
56 #include "../BatchALMaSS/PopulationManager.h"
57 #include "../Rabbit/Rabbit.h"
58 #include "../Rabbit/Rabbit_Population_Manager.h"
59 #include "../BatchALMaSS/BoostRandomGenerators.h"
60 
61 using namespace std;
62 
63 // Externs
64 
65 extern boost::variate_generator<base_generator_type&, boost::uniform_real<> > g_rand_uni;
66 extern MapErrorMsg *g_msg;
67 extern int g_rabbitexploredistance;
68 extern int g_land_width;
69 
75 
76 int g_counter = 0;
77 
79 static CfgFloat cfg_young_base_mort("RABBIT_YOUNGBASEMORT",CFG_CUSTOM,0.038);
81 static CfgFloat cfg_juvenile_base_mort("RABBIT_JUVENILEBASEMORT",CFG_CUSTOM,0.004);
83 static CfgFloat cfg_adult_base_mort("RABBIT_ADULTBASEMORT",CFG_CUSTOM,0.00013);
85 CfgFloat cfg_maxForageHeight("RABBIT_MAXFORAGEHEIGHT", CFG_CUSTOM, 30.0);
87 CfgFloat cfg_minForageDigestability("RABBIT_MINFORAGEDIGESTABILITY", CFG_CUSTOM, 0.50); // range 0.5 to 0.8
89 CfgFloat cfg_dispersalmortperm("RABBIT_DISPERSALMORTPERM", CFG_CUSTOM, 0.0002);
91 CfgFloat cfg_RabbitPesticideResponse("RABBIT_PESTICDERESPONSETHRESHOLD",CFG_CUSTOM, 0.00001);
93 CfgFloat cfg_globaldisease_probability("RABBIT_GLOBALDISEASEPROBCONSTANT", CFG_CUSTOM, 0.05);
95 CfgInt cfg_rabbitdiggingtime("RABBIT_DIGGINGTIME", CFG_CUSTOM, 10);
97 CfgFloat cfg_rabbitdendepscaler("RABBIT_DENSITYDEPSCALER", CFG_CUSTOM, 4.5); // 2 adults and 5.5 kits
99 static CfgFloat cfg_forageareamortscaler("RABBIT_FORAGEAREAMORTSCALER", CFG_CUSTOM, 60.0);
101 CfgFloat cfg_rabbitminkits("RABBIT_MINKITS", CFG_CUSTOM, 1.0);
103 CfgFloat cfg_rabbitmaxkits("RABBIT_MAXKITS", CFG_CUSTOM, 9.6);
105 static CfgFloat cfg_rabbitsocialreproductionthreshold( "RABBIT_SOCIALREPROTHRESHOLD", CFG_CUSTOM, 2.3 );
107 static CfgFloat cfg_rabbitminwarrensize( "RABBIT_MINWARRENSIZE", CFG_CUSTOM, 2 );
109 static CfgFloat cfg_rabbitmaxwarrensize( "RABBIT_MAXWARRENSIZE", CFG_CUSTOM, 10 );
111 static CfgFloat cfg_litterabsorptionconstant( "RABBIT_LITTERABSOPRTIONCONST", CFG_CUSTOM, 1.8 );
113 CfgFloat cfg_rabbit_pesticidedegradationrate( "RABBIT_PESTICIDEDEGRADATIONRATE", CFG_CUSTOM, 0.0 );
114 // Assign the static variables - NB this will just assign the defaults
115 double Rabbit_Base::m_pesticidedegradationrate = cfg_rabbit_pesticidedegradationrate.value(); // default of 0.0 will remove all body burden pesticide at the end of each day
120 double Rabbit_Female::m_MaxKitsNo = cfg_rabbitmaxkits.value() - cfg_rabbitminkits.value(); // Here we actually use the difference to calculate range
121 // End static assigns
122 
123 //********************************************************************************************************************
124 //*********************************************RabbitMemory***********************************************************
125 //********************************************************************************************************************
126 
128 {
129  m_MyMemory.resize(0);
130 }
131 
133 {
134  for(vector<RabbitMemoryLocation>::iterator it = m_MyMemory.begin(); it != m_MyMemory.end(); ++it)
135  {
136  if ((*it).m_decay-- < 1) m_MyMemory.erase(it);
137  }
138 }
139 
141 {
142  a_mem.m_decay=100; // Assuming 100 days memory
143  m_MyMemory.push_back(a_mem);
144 }
145 
147 {
148  vector<RabbitMemoryLocation>::iterator best;
149  int score = -1;
150  for(vector<RabbitMemoryLocation>::iterator it = m_MyMemory.begin(); it != m_MyMemory.end(); ++it)
151  {
152  if ((*it).m_quality > score) best=it;
153  }
154  return (*best);
155 }
156 
157 //********************************************************************************************************************
158 // Rabbit_Base
159 //********************************************************************************************************************
160 
161 Rabbit_Base::Rabbit_Base(int p_x, int p_y, int p_x2, int p_y2, Landscape* p_L, Rabbit_Population_Manager* p_NPM, Rabbit_Warren* a_warren) : TAnimal(p_x, p_y, p_L)
162 {
163  // Assign the pointer to the population manager
164  m_OurPopulationManager = p_NPM;
166  m_haveBurrow = false;
167  m_myWarren = a_warren;
168  m_born_location.m_x = p_x2;
169  m_born_location.m_y = p_y2;
170  if (m_myWarren != NULL) m_myWarren->Join(this);
171  m_pesticideInfluenced1 = false;
172  m_pesticide_burden = 0.0;
173 }
174 //---------------------------------------------------------------------------
175 
177 {
178  if (m_myWarren != NULL ) m_myWarren->Leave(this);
179 }
180 //---------------------------------------------------------------------------
181 
183  if (m_Age == cfg_RabbitUseNatalDispersalRecordAge.value()) if (cfg_RabbitUseNatalDispersalRecord.value()) m_OurPopulationManager->NatalDispersalRecordOutput( this );
184 }
185 //---------------------------------------------------------------------------
186 
188 {
189  m_CurrentStateNo = -1; // this will kill the animal object and free up space
190  m_StepDone = true;
191 }
192 //---------------------------------------------------------------------------
193 
194 inline bool Rabbit_Base::MortalityTest(double a_prop)
195 {
200  if (g_rand_uni() < a_prop) return true;
201  else return false;
202 }
203 //---------------------------------------------------------------------------
204 
205 bool Rabbit_Base::WalkTo(int a_x, int a_y)
206 {
214  int dist = abs(a_x-m_Location_x) + abs(a_y-m_Location_y);
215  double prob = dist * m_dispersalmortperm;
216  m_Location_x = a_x;
217  m_Location_y = a_y;
218  if (g_rand_uni() > prob) return true;
219  else
220  {
221  st_Dying();
222  g_counter++;
223  return false;
224  }
225 }
226 //---------------------------------------------------------------------------
227 
228 //********************************************************************************************************************
229 // Rabbit_Young
230 //********************************************************************************************************************
231 
232 Rabbit_Young::Rabbit_Young(int p_x, int p_y, int p_x2, int p_y2, Rabbit_Female* a_mum, Landscape* p_L, Rabbit_Population_Manager* p_NPM, Rabbit_Warren* a_warren) : Rabbit_Base(p_x, p_y, p_x2, p_y2, p_L, p_NPM, a_warren)
233 {
234  m_Age=0;
235  m_weightAge = 0;
236  m_weight = 0;
239  m_Mum = a_mum;
240  m_FedToday = true;
241 }
242 //---------------------------------------------------------------------------
243 
245 {
246  ; // Nothing to do
247 }
248 //---------------------------------------------------------------------------
249 
251 {
252  /*
253  * Only differs from base states by the need to tell the mother that they are dead (if she exists).
254  */
255  if (m_Mum!=NULL) m_Mum->OnYoungDeath(this);
256  m_CurrentStateNo = -1; // this will kill the animal object and free up space
257  m_StepDone = true;
258 }
259 //---------------------------------------------------------------------------
260 
261 
263 {
271  m_Age++;
273  {
274  return toRabbits_Die; // m_MyMortChance% chance of death
275  }
276  if (ShouldMature()) return toRabbits_Weaning;
279  return toRabbits_Develop;
280 }
281 //---------------------------------------------------------------------------
282 
284 {
288  struct_Rabbit sR;
290  sR.m_L = m_OurLandscape;
291  sR.m_age = m_Age;
293  sR.m_x = m_Location_x;
294  sR.m_y = m_Location_y;
295  sR.m_x2 = m_born_location.m_x;
296  sR.m_y2 = m_born_location.m_y;
297  sR.m_Warren = m_myWarren;
298  sR.m_rabbit = this;
299  if (m_Mum != NULL ) m_Mum->Weaned(this);
301  return toRabbits_Remove; // Used to remove the object without causing other system effects
302 }
303 //---------------------------------------------------------------------------
304 
306 {
312  m_FedToday = false;
313 }
314 //---------------------------------------------------------------------------
315 
317 {
318  if (m_StepDone || m_CurrentStateNo == -1) return;
319  switch (m_CurrentRState)
320  {
321  case toRabbits_InitialState: // Initial state always starts with develop
323  break;
324  case toRabbits_Develop:
325  m_CurrentRState=st_Develop(); // Will return movement or die
326  m_StepDone=true;
327  break;
328  case toRabbits_Weaning:
329  m_CurrentRState=st_BecomeJuvenile(); // Will return develop
330  m_StepDone=true;
331  break;
332  case toRabbits_Die:
333  st_Dying(); // No return value - no behaviour after this
334  m_StepDone=true;
335  break;
336  case toRabbits_Remove:
337  m_CurrentStateNo = -1;
338  m_StepDone=true;
339  break;
340  default:
341  m_OurLandscape->Warn("Rabbit_Young::Step()","unknown state - default");
342  exit(1);
343  }
344 }
345 //---------------------------------------------------------------------------
346 
348 {
349  /*
350  * Controls death by starvation if under solid food age, currently set at 3 weeks. If this happens then a message is sent to mum if she still exists.
351 
352  */
353  if ((m_FedToday == false) && (m_Age <= 21))
354  {
356  if (m_Mum != NULL) m_Mum->OnYoungDeath( this );
357  }
358 
359 }
360 //---------------------------------------------------------------------------
361 
363 {
368  if (m_Age>=30) return true;
369  return false;
370 }
371 
372 //********************************************************************************************************************
373 // Rabbit_Juvenile
374 //********************************************************************************************************************
375 
376 Rabbit_Juvenile::Rabbit_Juvenile(int p_x, int p_y, int p_x2, int p_y2, Rabbit_Female* p_M, Landscape* p_L, Rabbit_Population_Manager* p_NPM, int a_age, int a_weightage, Rabbit_Warren* a_warren) : Rabbit_Young(p_x, p_y, p_x2, p_y2, p_M, p_L, p_NPM, a_warren)
377 {
378  m_Age = a_age;
379  m_weightAge = a_weightage;
380  m_weight = m_OurPopulationManager->GetGrowth( a_weightage );
382  if (a_warren != NULL) a_warren->RabbitProductionRecord(rob_Juvenile, 1);
384 }
385 //---------------------------------------------------------------------------
386 
388 {
389  ;
390 }
391 //---------------------------------------------------------------------------
392 
394 {
395  m_CurrentStateNo = -1; // this will kill the animal object and free up space
396  m_StepDone = true;
397 }
398 //---------------------------------------------------------------------------
399 
401 {
407  m_Age++;
408  if (ShouldMature()) return toRabbits_Mature;
411  return toRabbits_Explore;
412 }
413 //---------------------------------------------------------------------------
414 
416 {
420  return toRabbits_Develop;
421 }
422 //---------------------------------------------------------------------------
423 
425 {
431  struct_Rabbit sR;
433  sR.m_L = m_OurLandscape;
434  sR.m_age = m_Age;
436  sR.m_x = m_Location_x;
437  sR.m_y = m_Location_y;
438  sR.m_x2 = m_born_location.m_x;
439  sR.m_y2 = m_born_location.m_y;
440  sR.m_Warren = m_myWarren;
444  if (g_rand_uni()<0.4854) m_OurPopulationManager->CreateObjects(rob_Male,NULL,&sR,1); // 100:106 M:F ratio (Brambell (1942) & Stephens (1952))
446  return toRabbits_Remove;
447 }
448 //---------------------------------------------------------------------------
449 
451 {
452  if (m_StepDone || m_CurrentStateNo == -1) return;
453  switch (m_CurrentRState)
454  {
455  case toRabbits_InitialState: // Initial state always starts with develop
457  break;
458  case toRabbits_Develop:
459  m_CurrentRState=st_Develop(); // Will return movement or die
461  break;
462  case toRabbits_Mature:
464  break;
465  case toRabbits_Foraging:
467  break;
468  case toRabbits_Die:
469  st_Dying(); // No return value - no behaviour after this
470  m_StepDone=true;
471  break;
472  case toRabbits_Explore:
474  m_StepDone=true;
475  break;
476  case toRabbits_Remove:
477  m_CurrentStateNo = -1;
478  m_StepDone=true;
479  break;
480  default:
481  m_OurLandscape->Warn("Rabbit_Juvenile::Step()","unknown state - default");
482  exit(1);
483  }
484 }
485 //---------------------------------------------------------------------------
486 
488 {
495  if (m_CurrentStateNo == -1) return; // Already dead
496  double mult = 1.0;
497  if (m_myWarren != NULL)
498  {
500  }
501  if (MortalityTest(m_MyMortChance * mult))
502  {
504  st_Dying(); // m_MyMortChance% chance of death
505  return;
506  }
507  // Deal with pesticides if necessary
509 }
510 //---------------------------------------------------------------------------
511 
513 {
514  if (m_weightAge>=105) return true; // Development linked to weight gain
515  return false;
516 }
517 //---------------------------------------------------------------------------
518 
519 //********************************************************************************************************************
520 // Rabbit_Adult
521 //********************************************************************************************************************
522 
523 Rabbit_Adult::Rabbit_Adult(int p_x, int p_y, int p_x2, int p_y2, Landscape* p_L, Rabbit_Population_Manager* p_NPM, int a_age, int a_weightage, Rabbit_Warren* a_warren) : Rabbit_Base(p_x, p_y, p_x2, p_y2, p_L, p_NPM, a_warren)
524 {
529  m_Age = a_age;
530  m_weightAge = a_weightage;
531  m_weight = m_OurPopulationManager->GetGrowth( a_weightage );
532  m_lifespan = int ( (730.0*g_rand_uni()) + 4.5*365); // This allows for the maximum age found by Rodel et al in the German study.
533  //m_lifespan = 6.5 * 365; // This allows for the maximum age found by Rodel et al in the German study.
534  SetSocialStatus( rabbit_socialstatus_zero ); // Default not dominant
535  m_digging = -1;
536  m_myMate = NULL;
538 }
539 //---------------------------------------------------------------------------
540 
542 {
543  ;
544 }
545 //---------------------------------------------------------------------------
546 
547 void Rabbit_Adult::EndStep( void ) {
562  if (m_CurrentStateNo == -1) return; // Already dead
563  double mult = 1.0;
564  if (m_myWarren != NULL) {
566  }
567  // Mortality depends on the social status
569  mult *= mult2;
570  if (MortalityTest( m_MyMortChance * mult )) {
572  st_Dying(); // m_MyMortChance% chance of death
573  return;
574  }
575  if (++m_Age > m_lifespan) {
577  st_Dying();
578  return;
579  }
580  if (m_digging > -1)
581  // We are digging a burrow
582  {
583 #ifdef __RABBITDEBUG
584  if (m_myMate != NULL) {
585  if (m_myMate->GetHasBurrow()) {
586  int rubbish = 0;
587  }
588  }
589 #endif
590  if (--m_digging < 0)
591  // Finished digging
592  {
594  SetHasBurrow( true );
596  if (m_myMate != NULL) m_myMate->OnMateFinishedDigging( this );
597  }
598  }
601  // Deal with pesticides if necessary
603 }
604 //---------------------------------------------------------------------------
605 
607 {
608 #ifdef __RABBITDEBUG
609  if (a_mate->GetRabbitType() == m_RabbitType)
610  {
611  m_OurLandscape->Warn("Rabbit_Adult::SetMate","homosexual rabbit!");
612  exit(1);
613  }
614  if (m_myMate != NULL)
615  {
616  m_OurLandscape->Warn("Rabbit_Adult::SetMate","rabbit bigamy!");
617  exit(1);
618  }
619 #endif
620  m_myMate = a_mate;
621 }
622 //---------------------------------------------------------------------------
623 
625 {
626 #ifdef __RABBITDEBUG
627  if (a_mate->GetRabbitType() == m_RabbitType)
628  {
629  m_OurLandscape->Warn("Rabbit_Adult::OnMateFinishedDigging","homosexual rabbit!");
630  exit(1);
631  }
632  if ((m_myMate != a_mate) && (m_CurrentRState != toRabbits_Die))
633  {
634  m_OurLandscape->Warn("Rabbit_Adult::OnMateFinishedDigging","rabbit bigamy, mate not recognised!");
635  exit(1);
636  }
637  if (m_digging < 0) {
638  int rubbish = 0;
639  }
640  if (m_haveBurrow) {
641  int rubbish = 0;
642  }
643 #endif
644  SetDigging(-1);
645  SetHasBurrow(true);
647 #ifdef __RABBITDEBUG
649 #endif
650 }
651 //---------------------------------------------------------------------------
652 
654 {
655 #ifdef __RABBITDEBUG
656  if (a_mate->GetRabbitType() == m_RabbitType)
657  {
658  m_OurLandscape->Warn("Rabbit_Adult::OnMateDead","homosexual rabbit!");
659  exit(1);
660  }
661  if ((m_myMate != a_mate) && (m_CurrentRState != toRabbits_Die))
662  {
663  m_OurLandscape->Warn("Rabbit_Adult::OnMateDead","rabbit bigamy, mate not recognised!");
664  exit(1);
665  }
666 #endif
667  m_myMate = NULL;
668 }
669 //---------------------------------------------------------------------------
670 
672 {
681  return toRabbits_Explore;
682 }
683 //---------------------------------------------------------------------------
684 
686 {
694  if ( m_myWarren != NULL )
695  {
696  m_myWarren->Leave(this);
697  }
698  if (m_myMate != NULL)
699  {
700  m_myMate->OnMateDead( this );
701  m_myMate = NULL;
702  }
703  m_CurrentStateNo = -1; // this will kill the animal object and free up space
704  m_StepDone = true;
705 }
706 //---------------------------------------------------------------------------
707 
708 
709 //********************************************************************************************************************
710 // Rabbit_Male
711 //********************************************************************************************************************
712 
713 Rabbit_Male::Rabbit_Male(int p_x, int p_y, int p_x2, int p_y2, Landscape* p_L, Rabbit_Population_Manager* p_NPM, int a_age, int a_weightage, Rabbit_Warren* a_warren) : Rabbit_Adult(p_x, p_y, p_x2, p_y2, p_L, p_NPM, a_age, a_weightage, a_warren)
714 {
716  if (a_warren != NULL) a_warren->RabbitProductionRecord(rob_Male, 1);
717 }
718 //---------------------------------------------------------------------------
719 
721 {
722  ;
723 }
724 //---------------------------------------------------------------------------
725 
727 {
728  if (m_StepDone || m_CurrentStateNo == -1) return;
729  switch (m_CurrentRState)
730  {
731  case toRabbits_InitialState: // Initial state always starts with develop
733  break;
734  case toRabbits_EvaluateTerritory: // Initial state always starts with develop
736  m_StepDone=true;
737  break;
738  case toRabbits_Foraging:
740  break;
741  case toRabbits_Die:
742  st_Dying(); // No return value - no behaviour after this
743  m_StepDone=true;
744  break;
745  case toRabbits_Remove:
746  m_CurrentStateNo = -1;
747  m_StepDone=true;
748  break;
749  default:
750  m_OurLandscape->Warn("Rabbit_Male::Step()","unknown state - default");
751  exit(1);
752  }
753 }
754 //---------------------------------------------------------------------------
755 
757 {
767 }
768 //---------------------------------------------------------------------------
769 
787  if (m_socialstatus > rabbit_socialstatus_subordinate) return toRabbits_Foraging; // Do it all again tomorrow, we are at the top or near the top of the heap in social terms
788  if (m_myMate != NULL) {
789 #ifdef __RABBITDEBUG
790  if (m_digging < 0) {
791  int rubbish = 0;
792  }
793  if (m_haveBurrow) {
794  int rubbish = 0;
795  }
796 #endif
797  return toRabbits_Foraging; // Must be digging a burrow
798  }
799 
800  if (m_myWarren == NULL) {
801  // Must find a warren - finds the closest - NB this code should not often be used, so efficiency here has not been optimised
804  bool survived = WalkTo( aRW->Supply_m_Location_x(), aRW->Supply_m_Location_y() );
805  if (!survived) return toRabbits_Die;
806  if (aRW->IsFreeFemale()) {
807  aRW->JoinNMate( this, rob_Female );
808  }
813  else {
814  int burrow = aRW->IsFreeBurrow();
815  if (burrow == 1) {
816  aRW->JoinNOccupy( this );
817  }
818  else
819  if (burrow == 2) {
820  aRW->OccupyWarren( this );
821  }
822  }
823  return toRabbits_Foraging;
824  }
825  else if (m_myWarren->IsFreeFemale()) {
826  m_myWarren->Mate( this, rob_Female );
827  }
828  else if (m_myWarren->IsFreeBurrow() == 1) {
830  SetDigging( -1 );
832  SetHasBurrow( true );
833  }
834  else if (m_digging > 0) {
835  return toRabbits_Foraging;
836  }
837  else
843  {
845  if (aWarren != NULL) {
846  if (aWarren->IsFreeFemale()) {
847  bool survived = WalkTo( aWarren->Supply_m_Location_x(), aWarren->Supply_m_Location_y() );
848  if (!survived) return toRabbits_Die;
849  m_myWarren->Leave( this );
850  aWarren->JoinNMate( this, rob_Female );
851  }
852  else {
853  int burrows = aWarren->IsFreeBurrow();
854  if (burrows == 1) {
855  bool survived = WalkTo( aWarren->Supply_m_Location_x(), aWarren->Supply_m_Location_y() );
856  if (!survived) return toRabbits_Die;
857  m_myWarren->Leave( this );
858  aWarren->JoinNOccupy( this );
860  }
861  else if (burrows == 2) {
862  bool survived = WalkTo( aWarren->Supply_m_Location_x(), aWarren->Supply_m_Location_y() );
863  if (!survived) return toRabbits_Die;
864  m_myWarren->Leave( this );
865  aWarren->OccupyWarren( this );
866  m_socialstatus = rabbit_socialstatus_subordinate; // Can dig a burrow but don't have one
867  }
868  else {
869  // No room but we may need to move anyway
870  int c = m_myWarren->GetCarryingCapacity();
871  int n = m_myWarren->GetPopulationSize() - (c * 2); // c is number of pairs, but there are 2 + a litter (average 6) as a minimum
872  double occupation = n / (double)c;
873  if (g_rand_uni() < occupation) {
874  bool survived = WalkTo( aWarren->Supply_m_Location_x(), aWarren->Supply_m_Location_y() );
875  if (!survived) return toRabbits_Die;
876  m_myWarren->Leave( this );
877  aWarren->Join( this );
878  SetDigging( -1 );
880  }
881  }
882  }
883  }
884  }
885  return toRabbits_Foraging; // Do it all again tomorrow
886 }
887 //---------------------------------------------------------------------------
888 
889 
890 //********************************************************************************************************************
891 // Rabbit_Female
892 //********************************************************************************************************************
893 
894 Rabbit_Female::Rabbit_Female(int p_x, int p_y, int p_x2, int p_y2, Landscape* p_L, Rabbit_Population_Manager* p_NPM, int a_age, int a_weightage, Rabbit_Warren* a_warren) : Rabbit_Adult(p_x, p_y, p_x2, p_y2, p_L, p_NPM, a_age, a_weightage, a_warren)
895 {
897  if (a_warren != NULL) a_warren->RabbitProductionRecord(rob_Female, 1);
898  m_lactating = false;
899  m_pregnant = false;
900  m_gestationcounter = 0;
901  m_myLitterSize = 0;
902  m_MyOffspring = 0;
903  m_MyTotalLitters = 0;
904 #ifdef __RABBITDEBUG
905  if (m_myWarren != NULL) if (m_myWarren->IsMember(this)==false)
906  {
907  m_OurLandscape->Warn("Rabbit_Female::Rabbit_Female","not a member of our warren");
908  exit(1);
909  }
910 #endif
911 }
912 //---------------------------------------------------------------------------
913 
915 {
916  ;
917 }
918 //---------------------------------------------------------------------------
919 
921 {
927  if (m_StepDone || m_CurrentStateNo == -1) return;
928  switch (m_CurrentRState)
929  {
930  case toRabbits_InitialState: // Initial state always starts with develop
932  break;
933  case toRabbits_Foraging:
935  m_StepDone = true;
936  break;
937  case toRabbits_EvaluateTerritory: // Initial state always starts with develop
939  break;
942  break;
943  case toRabbits_Gestation:
945  break;
946  case toRabbits_GiveBirth:
948  break;
949  case toRabbits_Lactating:
951  break;
952  case toRabbits_Die:
953  st_Dying(); // No return value - no behaviour after this
954  m_StepDone=true;
955  break;
956  case toRabbits_Remove:
957  m_CurrentStateNo = -1;
958  m_StepDone=true;
959  break;
960  default:
961  m_OurLandscape->Warn("Rabbit_Female::Step()","unknown state - default");
962  exit(1);
963  }
964 }
965 //---------------------------------------------------------------------------
966 
968 {
975  for(int l=0; l<m_myLitterSize; l++)
976  {
977  m_myLitter[l]->OnMumDead();
978  }
981  }
982  // Record our repro output if needed
983  if (cfg_RabbitUseReproOutput.value()) m_OurPopulationManager->ReproOutputRecordOutput(this);
985 }
986 //---------------------------------------------------------------------------
987 
1002  // We need to manage our annual repro info
1003  int today = m_OurLandscape->SupplyGlobalDate();
1004  for (int l = static_cast<int>(m_AnnualLitters.size()-1); l >= 0; l--) {
1005  if (today - m_AnnualLitters[ l ] > 365) {
1006  m_AnnualLitters.erase( m_AnnualLitters.begin() + (l) );
1007  }
1008  }
1009 #ifdef __RABBITDEBUG
1010  if (m_myWarren != NULL)
1011  {
1012  if (m_myWarren->IsMember( this ) == false) {
1013  m_OurLandscape->Warn( "Rabbit_Female::st_EvaluateTerritory", "not a member of our warren" );
1014  exit( 1 );
1015  }
1016  }
1017 #endif
1019 #ifdef __RABBITDEBUG
1020  if (m_myMate != NULL) {
1021  int rubbish = 0;
1022  }
1023 #endif
1024  return toRabbits_UpdateBreedingStatus; // No need to check the rest we have it all
1025  }
1026  // Update breeding status needs StepDone == false, but otherwise we need to set StepDone here.
1027  m_StepDone = true;
1028  if (m_myMate != NULL) {
1029  return toRabbits_Foraging; // Must be digging a burrow
1030  }
1034  if (m_myWarren == NULL) {
1040  bool survived = WalkTo( aRW->Supply_m_Location_x(), aRW->Supply_m_Location_y() );
1041  if (!survived) return toRabbits_Die;
1042  if (aRW->IsFreeMale()) {
1043  aRW->JoinNMate( this, rob_Male );
1044  }
1049  else {
1050  int burrow = aRW->IsFreeBurrow();
1051  if (burrow == 1) {
1052  aRW->JoinNOccupy( this );
1053  }
1054  else
1055  if (burrow == 2) {
1056  aRW->OccupyWarren( this );
1057  }
1058 
1059  }
1060  return toRabbits_Foraging;
1061  }
1062  // We have a warren but no mate or burrow
1063  else if (m_myWarren->IsFreeMale()) {
1064  m_myWarren->Mate( this, rob_Male );
1065  }
1066  else if (m_myWarren->IsFreeBurrow() == 1) {
1068  SetDigging( -1 );
1070  SetHasBurrow( true );
1071  }
1072  else if (m_digging > 0) {
1073  return toRabbits_Foraging;
1074  }
1075  else
1082  {
1084  if (aWarren != NULL) {
1085  if (aWarren->IsFreeMale()) {
1086  bool survived = WalkTo( aWarren->Supply_m_Location_x(), aWarren->Supply_m_Location_y() );
1087  if (!survived) return toRabbits_Die;
1088  m_myWarren->Leave( this );
1089  aWarren->JoinNMate( this, rob_Male );
1090  }
1091  else {
1092  int burrows = aWarren->IsFreeBurrow();
1093  if (burrows == 1) {
1094  bool survived = WalkTo( aWarren->Supply_m_Location_x(), aWarren->Supply_m_Location_y() );
1095  if (!survived) return toRabbits_Die;
1096  m_myWarren->Leave( this );
1097  aWarren->JoinNOccupy( this );
1099  }
1100  else if (burrows == 2) {
1101  bool survived = WalkTo( aWarren->Supply_m_Location_x(), aWarren->Supply_m_Location_y() );
1102  if (!survived) return toRabbits_Die;
1103  m_myWarren->Leave( this );
1104  aWarren->OccupyWarren( this );
1106  }
1107  else {
1108  // No room but we may need to move anyway
1109  double dispersalchance = m_myWarren->GetAvailableForage()/5.0;
1110  if (g_rand_uni() < dispersalchance) {
1111  bool survived = WalkTo( aWarren->Supply_m_Location_x(), aWarren->Supply_m_Location_y() );
1112  if (!survived) return toRabbits_Die;
1113  m_myWarren->Leave( this );
1114  aWarren->Join( this );
1115  SetDigging( -1 );
1117  }
1118  }
1119  }
1120  }
1121  }
1122 #ifdef __RABBITDEBUG
1123  if (m_myWarren != NULL) if (m_myWarren->IsMember( this ) == false) {
1124  m_OurLandscape->Warn( "Rabbit_Female::st_EvaluateTerritory", "not a member of our warren" );
1125  exit( 1 );
1126  }
1127 #endif
1128  return toRabbits_Foraging; // Do it all again tomorrow
1129 }
1130 //---------------------------------------------------------------------------
1131 
1133 {
1146  {
1147  // Do we have a litter on the way?
1148  if (m_pregnant)
1149  {
1150  return toRabbits_Gestation;
1151  }
1152  else
1153  {
1154  // Not pregnant but breeding season so check if there is a mate.
1155  if (m_myMate != NULL)
1156  {
1157  m_pregnant = true;
1158  m_gestationcounter = 0;
1159  }
1160  else if (m_myWarren->IsFreeMale())
1161  {
1162  m_myWarren->Mate( this, rob_Male );
1163  }
1164  }
1165  return toRabbits_Foraging;
1166  }
1167  // Not breeding season but may have young
1168  if (m_lactating) return toRabbits_Lactating;
1169  else
1170  {
1171  m_gestationcounter = 0;
1172  return toRabbits_Foraging;
1173  }
1174 }
1175 //---------------------------------------------------------------------------
1176 
1188 }
1189 //---------------------------------------------------------------------------
1190 
1197  if (m_myLitterSize > 0) {
1198  for (int l = 0; l < m_myLitterSize; l++) {
1199  m_myLitter[ l ]->OnEvicted();
1200  m_myLitter[ l ] = NULL;
1201  }
1202  m_myLitterSize = 0;
1203  }
1204  if (!m_pesticideInfluenced1) {
1205  // Here we take both social status and weight into account
1208  }
1209  int kits = 0;
1210  // Here we have a test for re-abosorption of the litter depending on forage conditions. Low forage high chance of re-absorption
1212  struct_Rabbit* sR = new struct_Rabbit;
1213  sR->m_age = 0;
1214  sR->m_L = m_OurLandscape;
1216  sR->m_x = m_Location_x;
1217  sR->m_y = m_Location_y;
1218  sR->m_x2 = m_Location_x;
1219  sR->m_y2 = m_Location_y;
1220  sR->m_Warren = m_myWarren;
1221  kits = CalcLitterSize();
1222  m_OurPopulationManager->CreateObjects( rob_Young, this, sR, kits );
1224  delete sR;
1225  }
1226  if (kits > 0) {
1227  m_lactating = true;
1228  // Record our success
1229  m_MyTotalLitters++;
1230  m_MyOffspring += kits;
1231  // We also need to manage our annual repro info
1233  }
1234  }
1235  else {
1236  m_pesticideInfluenced1 = false; // Reset the pesticide flag since we lost the litter
1238  }
1240  if (m_myMate != NULL) {
1241  m_pregnant = true;
1242  m_gestationcounter = 0;
1243  }
1244  }
1245  return toRabbits_Foraging;
1246 }
1247 //---------------------------------------------------------------------------
1248 
1250 {
1256  return int(floor(m_MinKitsNo + g_rand_uni() * m_MaxKitsNo));
1257 }
1258 //---------------------------------------------------------------------------
1259 
1261 {
1265  for(int lit=0; lit<m_myLitterSize; lit++)
1266  {
1267  m_myLitter[lit]->OnFed();
1268  }
1269  return toRabbits_Foraging;
1270 }
1271 //---------------------------------------------------------------------------
1272 
1274 {
1279  if (m_gestationcounter >= 30) {
1280  return toRabbits_GiveBirth;
1281  }
1282  if (m_lactating) return toRabbits_Lactating;
1283  return toRabbits_Foraging;
1284 }
1285 //---------------------------------------------------------------------------
1286 
1288 {
1292  for(int l=0; l<m_myLitterSize; l++)
1293  {
1294  if (m_myLitter[l] == a_young)
1295  {
1296  for (int n=l; n<m_myLitterSize; n++)
1297  {
1298  m_myLitter[n] = m_myLitter[n+1];
1299  }
1300  m_myLitter[--m_myLitterSize] = NULL;
1301  if (m_myLitterSize == 0) m_lactating = false;
1302  return;
1303  }
1304  }
1305  // If we get here there is an error
1306  m_OurLandscape->Warn("Rabbit_Female::OnYoungDeath","unknown litter member");
1307  exit(1);
1308 }
1309 //---------------------------------------------------------------------------
1310 
1312 {
1316  for(int l=0; l<m_myLitterSize; l++)
1317  {
1318  if (m_myLitter[l] == a_young)
1319  {
1320  for (int n=l; n<m_myLitterSize; n++)
1321  {
1322  m_myLitter[n] = m_myLitter[n+1];
1323  }
1324  m_myLitter[--m_myLitterSize] = NULL;
1325  if (m_myLitterSize == 0) m_lactating = false;
1326  return;
1327  }
1328  }
1329  // If we get here there is an error
1330  m_OurLandscape->Warn("Rabbit_Female::Weaned","unknown litter member");
1331  exit(1);
1332 }
1333 //---------------------------------------------------------------------------
1334 
1335 //*************************************************************************************
1336 //**************** PESTICIDE RESPONSE CODE FOR ALL RABBIT CLASSES IS HERE *************
1337 //*************************************************************************************
1338 
1345  double pesticideInternalConc = m_pesticide_burden / m_weight;
1346 
1347  if (pesticideInternalConc > cfg_RabbitPesticideResponse.value()) {
1348  switch (tp) {
1349  case ttop_NoPesticide:
1350  break;
1352  break;
1353  case ttop_AcuteEffects:
1354  GeneralOrganoPhosphate( pesticideInternalConc ); // Calls the GeneralOrganophosphate action code
1355  break;
1356  default:
1357  g_msg->Warn( "Unknown pesticide type used in Rabbit_Juvenile::InternalPesticideHandlingAndResponse() pesticide code ", int( tp ) );
1358  exit( 47 );
1359  }
1360  }
1361  m_pesticide_burden *= m_pesticidedegradationrate; // Does nothing by default except internal degredation of the pesticide
1362 }
1363 
1370  double pesticideInternalConc = m_pesticide_burden / m_weight;
1371 
1372  if (pesticideInternalConc > cfg_RabbitPesticideResponse.value()) {
1373  switch (tp) {
1374  case ttop_NoPesticide:
1375  break;
1377  break;
1378  case ttop_AcuteEffects:
1379  GeneralOrganoPhosphate( pesticideInternalConc ); // Calls the GeneralOrganophosphate action code
1380  break;
1381  default:
1382  g_msg->Warn( "Unknown pesticide type used in Rabbit_Male::InternalPesticideHandlingAndResponse() pesticide code ", int( tp ) );
1383  exit( 47 );
1384  }
1385  }
1386  m_pesticide_burden *= m_pesticidedegradationrate; // Does nothing by default except internal degredation of the pesticide
1387 }
1388 
1395  double pesticideInternalConc = m_pesticide_burden / m_weight;
1396 
1397  if (pesticideInternalConc > cfg_RabbitPesticideResponse.value()) {
1398  switch (tp) {
1399  case ttop_NoPesticide:
1400  break;
1402  GeneralEndocrineDisruptor( pesticideInternalConc ); // Calls the EndocrineDisruptor action code
1403  break;
1404  case ttop_AcuteEffects:
1405  GeneralOrganoPhosphate( pesticideInternalConc ); // Calls the GeneralOrganophosphate action code
1406  break;
1407  default:
1408  g_msg->Warn( "Unknown pesticide type used in Rabbit_Female::InternalPesticideHandlingAndResponse() pesticide code ", int( tp ) );
1409  exit( 47 );
1410  }
1411  }
1412  m_pesticide_burden *= m_pesticidedegradationrate; // Does nothing by default except internal degredation of the pesticide
1413 }
1414 //-------------------------------------------------------------------------------------
1415 //-------------------- GENERAL ENDOCRINE DISRUPTOR EFFECT CODE ------------------------
1416 //-------------------------------------------------------------------------------------
1417 
1418 void Rabbit_Female::GeneralEndocrineDisruptor( double /* a_dose */ ) {
1422  // May also wish to specify certain gestation days for the effects here
1423  if (m_gestationcounter > 0) {
1424  m_pesticideInfluenced1 = true;
1425  }
1426 }
1427 
1428 //-------------------------------------------------------------------------------------
1429 //------------------------ GENERAL ORGANOPHOSPHATE EFFECT CODE ------------------------
1430 //-------------------------------------------------------------------------------------
1431 
1432 void Rabbit_Base::GeneralOrganoPhosphate( double /* a_dose */ ) {
1433  //if (g_rand_uni() > l_pest_daily_mort.value()) return;
1436  m_StepDone = true;
1437  return;
1438 }
1439 
1440 //*************************************************************************************
1441 //************************** END PESTICIDE RESPONSE CODE ******************************
1442 //*************************************************************************************
1443 
1444 
1445 //********************************************************************************************************************
1446 // Rabbit_Warren
1447 //********************************************************************************************************************
1448 
1449 Rabbit_Warren::Rabbit_Warren(int p_x, int p_y,Landscape* p_L, Rabbit_Population_Manager* p_NPM, int a_size, int a_soil) : TAnimal(p_x,p_y,p_L)
1450 {
1452  m_OurPopulationManager = p_NPM;
1453  m_size = a_size;
1454  m_maintenence = 0;
1455  m_NoOccupiedBurrows = 0;
1457  m_CarryingCapacity = 0;
1458  m_CarryingCapacityRatio = -1; // No effect for the first period until it is properly calculated
1459  m_InhabitantsList.resize(0);
1460  m_soiltype = a_soil;
1462  m_diseaseconstant = 0.0;
1464  m_BigFemaleRabbitsR = 0.0;
1465  m_runningavCount=0;
1466  m_runningavFemales = 0;
1470  m_Location_x = m_Location_x + (m_size / 2);
1471  m_Location_y = m_Location_y + (m_size / 2);
1472  // Now get the forage size.
1473  m_foragesize = m_size * 2;
1474  m_TL_x = m_Location_x - (m_foragesize / 2);
1475  if (m_TL_x < 0) m_TL_x = 0;
1476  m_TL_y = m_Location_x - (m_foragesize / 2);
1477  if (m_TL_y < 0) m_TL_y = 0;
1481  InitEvaluation();
1482 }
1483 //---------------------------------------------------------------------------
1484 
1486 {
1487  ;
1488 }
1489 //---------------------------------------------------------------------------
1490 
1492 {
1505  for (int i=m_TL_x; i<m_TL_x + m_foragesize; i++)
1506  {
1507  for (int j=m_TL_y; j<m_TL_y + m_foragesize; j++)
1508  {
1512  int PRef = m_OurLandscape->SupplyPolyRef(i,j);
1513  bool found=false;
1514  for (vector<RabbitWarrenLEInfo>::size_type k=0; k<m_LEList.size(); k++)
1515  {
1516  if (m_LEList[k].m_ref == PRef)
1517  {
1518  m_LEList[k].m_area++;
1519  found = true;
1520  break;
1521  }
1522  }
1523  if (!found)
1524  {
1525  RabbitWarrenLEInfo a_ele;
1526  a_ele.m_ref = PRef;
1527  a_ele.m_area = 1;
1529  a_ele.m_pesticide_conc = 0;
1530  a_ele.m_forage = 0;
1531  a_ele.m_foragearea = 0;
1532  // don't have this one
1533  m_LEList.push_back(a_ele);
1534  }
1535  }
1536  }
1538  for (vector<RabbitWarrenLEInfo>::size_type k=0; k<m_LEList.size(); k++)
1539  {
1540  TTypesOfLandscapeElement tole = m_LEList[k].m_ele->GetElementType();
1541  m_LEList[k].m_torh = m_OurPopulationManager->ClassifyHabitat(tole);
1542  // Do a little bit of forage managing here
1543  if (m_LEList[k].m_torh == torh_Forage) m_LEList[k].m_foragearea = m_LEList[k].m_area;
1544  else if (m_LEList[k].m_torh == torh_TemporaryForage)
1545  {
1546  // We assume only 50 m strip of fields is usable
1547  int fr = 50 * m_size;
1548  if (m_LEList[k].m_area < fr) fr = m_LEList[k].m_area;
1549  m_LEList[k].m_foragearea = fr;
1550  }
1551  else m_LEList[k].m_foragearea = 0;
1552  }
1556  double minpct = 1.0 / 16.0; // Divide by 16 because the minimum is based on 1/16th of the area used for forage
1557  double pct = m_foragearea/ (double) (m_foragesize * m_foragesize);
1558  if (pct<minpct)
1559  {
1560  // We have a problem, no rabbits can be here
1561  m_CarryingCapacity = 0;
1562  return;
1563  }
1564  if (pct > 0.9) pct = 0.9;
1565  // 1 is the lowest density until soil type is taken into account
1566  // We use the diff between min and actual pct cover, and then add pro-rata the extra proportion of 12 pairs
1567  // NB minpct must never be >= 0.9
1568  m_CarryingCapacity = static_cast<int>(cfg_rabbitminwarrensize.value() + (int)((pct - minpct) / (0.9 - minpct) * cfg_rabbitmaxwarrensize.value())); // e.g. 3 + (0.1 / 0.8 *9) = 3+1.5 for minpct 0.2, pct 0.3
1569  if (m_soiltype == 0) m_CarryingCapacity /= 2;
1570  m_NoBurrows = 0;
1572  m_CarryingCapacityR2 = m_CarryingCapacityR / 2.0; // Done here once to prevent it being recalculated possibly a lot of times later.
1573 
1574 }
1575 //---------------------------------------------------------------------------
1576 
1578 {
1591  // Get the numbers we need
1592  unsigned totalrabbits = m_OurPopulationManager->SupplyAllBigRabbits();
1593  unsigned warrens = m_OurPopulationManager->GetLiveArraySize(rob_Warren);
1594  // Some of this should be done by the population managerfor efficiency but it is here to keep it together.
1595  //The big chance based on global density
1596  double prob_density = (totalrabbits / (double)warrens) * (totalrabbits / (double)warrens) * cfg_globaldisease_probability.value();
1597  // Now the local stuff
1598  m_diseaseconstant = prob_density * GetCarryingCapacityRatio();
1599 }
1600 //---------------------------------------------------------------------------
1601 
1611  m_forageP = 0.0;
1612  if (!m_OurLandscape->SupplyPesticideDecay()) return;
1613  for (int i = m_TL_x; i < m_TL_x + m_foragesize; i++) {
1614  for (int j = m_TL_y; j < m_TL_y + m_foragesize; j++) {
1615  // Unfortunately we need to check for each square whether the rabbit can forage here.
1616  int ele = m_OurLandscape->SupplyPolyRef( i, j );
1617  for (vector<RabbitWarrenLEInfo>::size_type k = 0; k < m_LEList.size(); k++) {
1618  if (m_LEList[ k ].m_ref == ele) {
1619  if (m_LEList[ k ].m_forage > 0.0) {
1620 #ifdef __RABBITMEANPESTICIDECONC
1622 #else
1623  double pe = m_OurLandscape->SupplyPesticide( i, j );
1624  if (m_forageP< pe ) m_forageP = pe;
1625 #endif
1626  }
1627  break;
1628  }
1629  }
1630  }
1631  }
1632  // Now calculate the mean concentration and mean forage concentration if needed
1633 #ifdef __RABBITMEANPESTICIDECONC
1634  m_forageP /= (double)m_availableforage;
1635 #endif
1636 }
1637 //---------------------------------------------------------------------------
1638 
1647  double availableforage = m_permforagearea;
1648  for (vector<RabbitWarrenLEInfo>::size_type k = 0; k < m_LEList.size(); k++) {
1649  if (m_LEList[ k ].m_torh == torh_TemporaryForage) {
1650  double vegheight = m_OurLandscape->SupplyVegHeight( m_LEList[ k ].m_ref ); // m_ref is the landscape polyref
1651  double vegdigestability = m_OurLandscape->SupplyVegDigestability( m_LEList[ k ].m_ref );
1652  if ((vegheight < m_maxForageHeight) && (vegdigestability > m_minForageDigestability)) {
1653  // 30 cm
1654  m_LEList[ k ].m_forage = m_LEList[ k ].m_foragearea;
1655  availableforage += m_LEList[ k ].m_foragearea;
1656  }
1657  else m_LEList[ k ].m_forage = 0.0;
1658  }
1659  }
1660  // Only do the expensive pesticide update if there is a chance that there is some pesticide to work with
1661  if (l_pest_enable_pesticide_engine.value()) UpdatePesticide();
1662 
1664  if (m_OurLandscape->SupplyGlobalDate() % cfg_rabbitdensitydependencedelay.value() ==0) {
1665  m_CarryingCapacityRatio = CalcCarryingCapacityRatio2(); // Normally this is the same as m_BigFemaleRabbitsR, which gets bigger as rabbits get close to CC
1666  }
1667  m_foragearearatio = availableforage / m_foragearea;
1671  }
1672  else {
1673  m_availableforage = 1.0;
1674  m_inv_availableforage = 0.0;
1675  }
1676  if (m_OurLandscape->SupplyDayInYear() == cfg_rabbitdensitydependencedelay.value()) {
1678  }
1679 }
1680 //---------------------------------------------------------------------------
1681 
1683  m_BigFemaleRabbitsR = GetAllBigFemaleRabbits() / (m_CarryingCapacityR2); // m_CarryingCapacityR is (m_CarryingCapacity * cfg_rabbitdendepscaler.value())/2
1684 }
1685 
1696 #ifdef __EnclosureTest
1697  double CCRatio = m_BigFemaleRabbitsR;
1698  int nsz = (int)m_LocalWarrenNetwork.size();
1699  for (int i = 0; i < nsz; i++) {
1700  CCRatio += m_LocalWarrenNetwork[i].m_aWarren->GetCCRabbitsR();
1701  }
1702  CCRatio /= (nsz + 1);
1703  return CCRatio;
1704 #endif
1705  return m_BigFemaleRabbitsR; // Is the number of big female rabbits / ((m_CarryingCapacity * cfg_rabbitdendepscaler.value())/2)
1706 }
1707 
1708 
1710 {
1711  int nsz = (int) m_LocalWarrenNetwork.size();
1715  random_shuffle (m_LocalWarrenNetwork.begin(), m_LocalWarrenNetwork.end() );
1716  for (int i=0; i< nsz; i++ )
1717  {
1718  // Probability calculated as m_size/dist
1719  m_LocalWarrenNetwork[i].m_visitprob = m_foragesize / (double) (m_LocalWarrenNetwork[i].m_dist);
1720  }
1721 }
1722 //---------------------------------------------------------------------------
1723 
1725 {
1729  int area = 0;
1730  for (vector<RabbitWarrenLEInfo>::size_type k = 0; k<m_LEList.size(); k++)
1731  {
1732  area += m_LEList[k].m_foragearea;
1733  }
1734  return area;
1735 }
1736 //---------------------------------------------------------------------------
1737 
1739 {
1743  int area = 0;
1744  for (vector<RabbitWarrenLEInfo>::size_type k = 0; k<m_LEList.size(); k++)
1745  {
1746  if (m_LEList[k].m_torh == torh_Forage) area += m_LEList[k].m_area;
1747  }
1748  return area;
1749 }
1750 //---------------------------------------------------------------------------
1751 
1753 {
1757  int area = 0;
1758  for (vector<RabbitWarrenLEInfo>::size_type k=0; k<m_LEList.size(); k++)
1759  {
1760  if (m_LEList[k].m_torh == torh_TemporaryForage) area += m_LEList[k].m_area;
1761  }
1762  return area;
1763 }
1764 //---------------------------------------------------------------------------
1765 
1767 {
1771  int area = 0;
1772  for (vector<RabbitWarrenLEInfo>::size_type k=0; k<m_LEList.size(); k++)
1773  {
1774  if (m_LEList[k].m_torh == torh_Cover) area += m_LEList[k].m_area;
1775  }
1776  return area;
1777 }
1778 //---------------------------------------------------------------------------
1779 
1781 {
1785  int area = 0;
1786  for (vector<RabbitWarrenLEInfo>::size_type k=0; k<m_LEList.size(); k++)
1787  {
1788  if (m_LEList[k].m_torh == torh_TemporaryForage)
1789  {
1790  if (m_LEList[k].m_ele->GetVegHeight() < m_maxForageHeight )
1791  {
1792  area += m_LEList[k].m_area;
1793  }
1794  }
1795  }
1796  return area;
1797 }
1798 //---------------------------------------------------------------------------
1799 
1804  int area = 0;
1805  for (vector<RabbitWarrenLEInfo>::size_type k = 0; k<m_LEList.size(); k++) {
1806  if (m_LEList[ k ].m_ele->GetVegHeight() >= m_maxForageHeight) {
1807  if (m_LEList[ k ].m_torh != torh_Other) area += m_LEList[ k ].m_area;
1808  }
1809  }
1810  return area;
1811 }
1812 //---------------------------------------------------------------------------
1813 
1814 
1821  m_breedingfemales = 0;
1823  m_1yrOldFemales = 0;
1824  m_littersthisyear = 0;
1825  int sz = static_cast<int>(m_InhabitantsList.size());
1826  for (int r = 0; r < sz; r++) {
1827  if (m_InhabitantsList[ r ]->GetRabbitType() == rob_Female) {
1828  if (m_InhabitantsList[ r ]->GetAge() < 300) {
1829  m_1yrOldFemales++;
1830  }else{
1831  int litters = dynamic_cast<Rabbit_Female*>(m_InhabitantsList[ r ])->GetLittersThisYear();
1832  if (litters > 0) m_breedingfemales++; else m_nonbreedingfemales++;
1833  m_littersthisyear += litters;
1834  }
1835  }
1836  }
1837 }
1838 //---------------------------------------------------------------------------
1839 
1841 {
1842  if (m_StepDone || m_CurrentStateNo == -1) return;
1843  switch (m_CurrentRState)
1844  {
1845  case toRabbits_InitialState:
1847  break;
1848  case toRabbits_WarrenBeing: // Being state is never left for warrens - 'they just are'
1849  st_WarrenBeing();
1850  m_StepDone=true;
1851  break;
1852  default:
1853  m_OurLandscape->Warn("Rabbit_Warren::Step()","unknown state - default");
1854  exit(1);
1855  }
1856 }
1857 //---------------------------------------------------------------------------
1858 
1860 {
1871 #ifdef __RABBITDEBUG
1873 #endif
1874 
1875  if (m_InhabitantsList.size() == 0)
1876  {
1877  m_maintenence -= 2 - m_soiltype; // Double rate of maintenence for light soil
1878  }
1880  if (m_maintenence < 0)
1881  {
1883  if (m_NoBurrows > 0) m_NoBurrows--;
1884  }
1885  // Dominance check
1886  UpdateDominance();
1887  // Food update
1889  // Now calculates the mortality chance for today
1890  double foragemult = 0;
1891  if (!m_OurPopulationManager->GetForageDay()) foragemult = 1 + cfg_forageareamortscaler.value(); // *(1 - m_availableforage); // m_foragearearatio is 0-1 and larger available forage is reduced.
1892  m_mortalitymultiplierA = 1 + m_diseaseconstant + foragemult; // Disease is the only density dependent death for adults
1893  // We need to de-couple mortality of juveniles and density
1894  m_mortalitymultiplierJ = 1 + foragemult;
1895 #ifdef __RABBITDEBUG
1897 #endif
1898  // Keep track of breeding females for POM
1900  m_runningavCount++;
1902  }
1903 }
1904 //---------------------------------------------------------------------------
1905 
1906 
1908 {
1913  // Pick a warren
1914  int nsz = (int) m_LocalWarrenNetwork.size();
1915  int loopstart = (int) floor(nsz * g_rand_uni());
1916  for (int i=0; i< nsz; i++ )
1917  {
1918  double chance = g_rand_uni();
1919  int index = (i + loopstart);
1920  if (index >= nsz) index-=nsz;
1921  if (chance>m_LocalWarrenNetwork[i].m_visitprob)
1922  {
1923  return m_LocalWarrenNetwork[i].m_aWarren;
1924  }
1925  }
1926  return NULL;
1927 }
1928 //---------------------------------------------------------------------------
1929 
1935  int sz = (int)m_InhabitantsList.size();
1936  for (int i = 0; i<sz; i++) {
1937  if (m_InhabitantsList[ i ]->GetRabbitType() == rob_Female) {
1938  if (dynamic_cast<Rabbit_Female*>(m_InhabitantsList[ i ])->GetSocialStatus() == rabbit_socialstatus_subdominant) return;
1939  }
1940  }
1941  // If we get here we have no dominant female, so see if one can be created.
1943 }
1944 //---------------------------------------------------------------------------
1945 
1950  Rabbit_Female* rfemale = NULL;
1951  Rabbit_Female* rfemaleBig = NULL;
1952  int bigWeight = 0;
1953  int sz = (int)m_InhabitantsList.size();
1954  for (int i = 0; i < sz; i++) {
1955  if (m_InhabitantsList[ i ]->GetRabbitType() == rob_Female) {
1956  rfemale = dynamic_cast<Rabbit_Female*>(m_InhabitantsList[ i ]);
1958  if (rfemale->GetweightAge() >= 300) { // 300 represents max growth
1960  return;
1961  }
1962  else if (rfemale->GetweightAge() > bigWeight) {
1963  bigWeight = rfemale->GetweightAge();
1964  rfemaleBig = rfemale;
1965  }
1966  }
1967  }
1968  }
1969  if (rfemaleBig!=NULL) rfemaleBig->SetSocialStatus( rabbit_socialstatus_dominant );
1970 }
1971 //---------------------------------------------------------------------------
1972 
1978  int sz = (int)m_InhabitantsList.size();
1979  for (int i = 0; i<sz; i++) {
1980  if (m_InhabitantsList[ i ]->GetRabbitType() == rob_Female) {
1981  if (m_InhabitantsList[ i ]->GetMate() == NULL) {
1982  if ((m_InhabitantsList[ i ]->GetHasBurrow()) || (m_InhabitantsList[ i ]->GetDigging() > -1)) return true;
1983  }
1984  }
1985  }
1986  return false;
1987 }
1988 //---------------------------------------------------------------------------
1989 
1991 {
1996  int sz = (int) m_InhabitantsList.size();
1997  for (int i=0; i<sz; i++)
1998  {
1999  if (m_InhabitantsList[i] == a_rabbit )
2000  {
2001  return true;
2002  }
2003  }
2004  return false;
2005 }
2006 //---------------------------------------------------------------------------
2007 
2009 {
2014  int sz = (int) m_InhabitantsList.size();
2015  for (int i=0; i<sz; i++)
2016  {
2017  if ( m_InhabitantsList[i]->GetRabbitType() == rob_Male )
2018  {
2019  if ( m_InhabitantsList[i]->GetMate()==NULL )
2020  {
2021  if ( (m_InhabitantsList[i]->GetHasBurrow() ) || ( m_InhabitantsList[i]->GetDigging() > -1) ) return true;
2022  }
2023  }
2024  }
2025  return false;
2026 }
2027 //---------------------------------------------------------------------------
2028 
2030 {
2039 #ifdef __RABBITDEBUG
2040  this->DEBUG_InternalTest();
2041 #endif
2042 
2044  {
2045 #ifdef __RABBITDEBUG
2046  this->DEBUG_InternalTest2();
2047 #endif
2048  return 1; // There is a free burrow
2049  }
2051  return 0;
2052 }
2053 //---------------------------------------------------------------------------
2054 
2056 {
2058  m_InhabitantsList.push_back(a_rabbit);
2059  a_rabbit->SetWarren(this);
2060 }
2061 //---------------------------------------------------------------------------
2062 
2064 {
2066  m_NoBurrows++;
2068 }
2069 //---------------------------------------------------------------------------
2070 
2072 {
2074 }
2075 //---------------------------------------------------------------------------
2076 
2078 {
2080  a_rabbit->SetDigging( m_rabbitdiggingtime ); // Heavy soil has double digging time
2081  Join(a_rabbit);
2082 }
2083 //---------------------------------------------------------------------------
2084 
2086 {
2088 #ifdef __RABBITDEBUG
2089  // Do some safety checks here.
2090  if ((m_NoBurrows <= m_NoOccupiedBurrows) && (m_NoBurrows!=0))
2091  {
2092  m_OurLandscape->Warn("Rabbit_Warren::JoinNOccupy","Attempt to occupy a burrow that is occupied or does not exist.");
2093  exit(1);
2094  }
2095 #endif
2096 #ifdef __RABBITDEBUG
2097  this->DEBUG_InternalTest2();
2098 #endif
2099  Join(a_rabbit);
2100  OccupyBurrow( );
2101  a_rabbit->SetDigging(-1);
2103  a_rabbit->SetHasBurrow( true );
2104 
2105 #ifdef __RABBITDEBUG
2106  this->DEBUG_InternalTest();
2107 #endif
2108 }
2109 //---------------------------------------------------------------------------
2110 
2112 {
2118  int sz = (int) m_InhabitantsList.size();
2119  for (int i=0; i<sz; i++)
2120  {
2121  if (m_InhabitantsList[i]==a_rabbit)
2122  {
2123  // Found the rabbit.
2124 #ifdef __RABBITDEBUG
2125  // Do some safety checks here.
2126  if ( (a_rabbit->GetRabbitType() >= rob_Male ) && (a_rabbit->GetCurrentRState() != toRabbits_Die) )
2127  {
2128  if ((a_rabbit->GetMate()!=NULL) && (a_rabbit->GetCurrentStateNo() != -1))
2129  {
2130  m_OurLandscape->Warn("Rabbit_Warren::Leave","Attempt to leave a warren with a mate.");
2131  exit(1);
2132  }
2133  // Do some safety checks here.
2134  if ((m_InhabitantsList[i]->GetHasBurrow()) && (a_rabbit->GetMate() != NULL) && (a_rabbit->GetCurrentStateNo() != -1))
2135  {
2136  m_OurLandscape->Warn("Rabbit_Warren::Leave","Attempt to leave a warren with a burrow and mate.");
2137  exit(1);
2138  }
2139  }
2140 #endif
2141  if (a_rabbit->GetRabbitType() > rob_Juvenile)
2142  {
2143  if ((a_rabbit->GetHasBurrow()) && (a_rabbit->GetMate() == NULL)) {
2144  // Single burrow occupier leaving
2146  a_rabbit->SetHasBurrow( false );
2147  }
2148  if ((a_rabbit->GetDigging()!=-1) && (a_rabbit->GetMate() == NULL)) {
2149  // Single digger leaving
2151  a_rabbit->SetDigging( -1 );
2152  }
2153  }
2154  a_rabbit->SetWarren(NULL);
2155  // remove the rabbit from the warren list
2156  m_InhabitantsList.erase(m_InhabitantsList.begin() + i);
2157  break;
2158  }
2159  }
2160 }
2161 //---------------------------------------------------------------------------
2162 
2164 {
2168 #ifdef __RABBITDEBUG
2169  this->DEBUG_InternalTest();
2170 #endif
2171  int sz = (int) m_InhabitantsList.size();
2172  for (int i=0; i<sz; i++)
2173  {
2174  Rabbit_Adult * p_rabAdult = dynamic_cast<Rabbit_Adult*>(m_InhabitantsList[ i ]);
2175  if ((m_InhabitantsList[ i ]->GetRabbitType() == rob_type) && (p_rabAdult->GetMate() == NULL))
2176  {
2177  if (p_rabAdult->GetHasBurrow())
2178  {
2179 #ifdef __RABBITDEBUG
2180  if (p_rabAdult->GetDigging() != -1)
2181  {
2182  int rubbish = 0;
2183  }
2184 #endif
2185  a_mate->SetDigging( -1 );
2186  a_mate->SetMate( p_rabAdult );
2187  p_rabAdult->SetMate( a_mate );
2188  // If the rabbit already has a burrow then we have a free one now
2189  if (a_mate->GetHasBurrow()) {
2191  }
2192  else a_mate->SetHasBurrow( true );
2195  break;
2196  }
2197  else
2198  if (p_rabAdult->GetDigging() > -1)
2199  {
2200  a_mate->SetMate(dynamic_cast<Rabbit_Adult*>(m_InhabitantsList[i]));
2201  p_rabAdult->SetMate( a_mate );
2202  int digging = p_rabAdult->GetDigging() / 2; // We have help so half the time
2203  p_rabAdult->SetDigging( digging );
2204  a_mate->SetDigging(digging);
2207  break;
2208  }
2209  // Else they are not interesting and we ignore them
2210  }
2211  }
2212 #ifdef __RABBITDEBUG
2213  this->DEBUG_InternalTest();
2214 #endif
2215 }
2216 //---------------------------------------------------------------------------
2217 
2219 {
2224 #ifdef __RABBITDEBUG
2225  this->DEBUG_InternalTest();
2226 #endif
2227  int sz = (int) m_InhabitantsList.size();
2228  for (int r=0; r<sz; r++)
2229  {
2230  Rabbit_Adult* p_rabAdult = dynamic_cast<Rabbit_Adult*>(m_InhabitantsList[ r ]);
2231  if ((m_InhabitantsList[r]->GetRabbitType() == rob_type) && (p_rabAdult->GetMate() == NULL) )
2232  {
2233 #ifdef __RABBITDEBUG
2234  this->DEBUG_InternalTest();
2235 #endif
2236  if (p_rabAdult->GetHasBurrow())
2237  {
2238  a_mate->SetDigging(-1);
2239  a_mate->SetMate(dynamic_cast<Rabbit_Adult*>(m_InhabitantsList[r]));
2240  a_mate->SetHasBurrow(true);
2243  p_rabAdult->SetMate( a_mate );
2244  Join(a_mate);
2245  break;
2246  }
2247  else
2248  if (p_rabAdult->GetDigging() > -1)
2249  {
2250  a_mate->SetMate( p_rabAdult );
2253  p_rabAdult->SetMate( a_mate );
2254  int digging = p_rabAdult->GetDigging();
2255  a_mate->SetDigging(digging);
2256  Join(a_mate);
2257  break;
2258  }
2259 
2260  }
2261  }
2262 #ifdef __RABBITDEBUG
2263  this->DEBUG_InternalTest();
2264 #endif
2265 }
2266 //---------------------------------------------------------------------------
2267 
2269  int breeders = 0;
2270  int sz = (int)m_InhabitantsList.size();
2271  for (int i = 0; i < sz; i++) {
2272  if (m_InhabitantsList[ i ]->GetRabbitType() == rob_Female) {
2273  if (dynamic_cast<Rabbit_Female*>(m_InhabitantsList[ i ])->GetSocialStatus()>rabbit_socialstatus_subordinate) breeders++;
2274  }
2275  }
2276  return breeders;
2277 }
2278 //---------------------------------------------------------------------------
2279 
2281  int biggies = 0;
2282  int sz = (int)m_InhabitantsList.size();
2283  for (int i = 0; i < sz; i++) {
2284  if (m_InhabitantsList[ i ]->GetRabbitType() == rob_Female) {
2285  if (m_InhabitantsList[ i ]->GetAge()>300) biggies++;
2286  }
2287  }
2288  return biggies;
2289 }
2290 //---------------------------------------------------------------------------
2291 
2293 {
2294  int Mburrs = 0;
2295  int Mmates = 0;
2296  int MBM = 0;
2297  int Fburrs = 0;
2298  int Fmates = 0;
2299  int FBM = 0;
2300  int siz = (int) m_InhabitantsList.size();
2301  int Mdigs = 0;
2302  int Fdigs = 0;
2303  for (int i = 0; i<siz; i++)
2304  {
2305  if (m_InhabitantsList[i]->GetCurrentStateNo() != -1)
2306  {
2307  if (m_InhabitantsList[i]->GetRabbitType() == rob_Male)
2308  {
2309  if (m_InhabitantsList[i]->GetHasBurrow()) Mburrs++; // No males with burrow
2310  if (m_InhabitantsList[i]->GetDigging()>-1) Mdigs++; // No males digging
2311  if (dynamic_cast<Rabbit_Adult*>(m_InhabitantsList[i])->GetMate() != NULL) Mmates++; // No males with mates
2312  if ((dynamic_cast<Rabbit_Adult*>(m_InhabitantsList[i])->GetMate() != NULL) && (m_InhabitantsList[i]->GetHasBurrow())) MBM++; // No males with mates and burrows
2313  }
2314  if (m_InhabitantsList[i]->GetRabbitType() == rob_Female)
2315  {
2316  if (m_InhabitantsList[i]->GetHasBurrow()) Fburrs++;
2317  if (m_InhabitantsList[i]->GetDigging() > -1) Fdigs++;
2318  if (dynamic_cast<Rabbit_Adult*>(m_InhabitantsList[i])->GetMate() != NULL) Fmates++;
2319  if ((dynamic_cast<Rabbit_Adult*>(m_InhabitantsList[i])->GetMate() != NULL) && (m_InhabitantsList[i]->GetHasBurrow())) FBM++;
2320  }
2321  }
2322  }
2323  int alonemales = Mburrs-MBM;
2324  int alonefemales = Fburrs-FBM;
2325  if (MBM != FBM)
2326  {
2327  m_OurLandscape->Warn("IsFreeBurrow","Inconsistent mates and burrows MBM != FBM.");
2328  exit(1);
2329  }
2330  if (MBM + alonemales + alonefemales > m_NoBurrows)
2331  {
2332  m_OurLandscape->Warn("IsFreeBurrow","Too many burrows occupied.");
2333  exit(1);
2334  }
2335  if (MBM + alonemales + alonefemales != this->m_NoOccupiedBurrows)
2336  {
2337  m_OurLandscape->Warn("IsFreeBurrow","Too many burrows occupied.");
2338  exit(1);
2339  }
2340  return true;
2341 }
2342 //---------------------------------------------------------------------------
2343 
2345 {
2346  int Mburrs = 0;
2347  int Mmates = 0;
2348  int MBM = 0;
2349  int Fburrs = 0;
2350  int Fmates = 0;
2351  int FBM = 0;
2352  int siz = (int) m_InhabitantsList.size();
2353  for (int i=0; i<siz; i++)
2354  {
2355  if ( m_InhabitantsList[i]->GetRabbitType() == rob_Male)
2356  {
2357  if ( m_InhabitantsList[i]->GetHasBurrow()) Mburrs++;
2358  if ( dynamic_cast<Rabbit_Adult*>(m_InhabitantsList[i])->GetMate()!= NULL) Mmates++;
2359  if (( dynamic_cast<Rabbit_Adult*>(m_InhabitantsList[i])->GetMate()!= NULL) && (m_InhabitantsList[i]->GetHasBurrow())) MBM++;
2360  }
2361  if ( m_InhabitantsList[i]->GetRabbitType() == rob_Female)
2362  {
2363  if ( m_InhabitantsList[i]->GetHasBurrow()) Fburrs++;
2364  if ( dynamic_cast<Rabbit_Adult*>(m_InhabitantsList[i])->GetMate()!= NULL) Fmates++;
2365  if (( dynamic_cast<Rabbit_Adult*>(m_InhabitantsList[i])->GetMate()!= NULL) && (m_InhabitantsList[i]->GetHasBurrow())) FBM++;
2366  }
2367  }
2368  int alonemales = Mburrs-MBM;
2369  int alonefemales = Fburrs-FBM;
2370  if (MBM + alonemales + alonefemales >= m_NoBurrows)
2371  {
2372  m_OurLandscape->Warn("IsFreeBurrow","Too many burrows occupied.");
2373  exit(1);
2374  }
2375  return true;
2376 }
2377 //---------------------------------------------------------------------------
2378 
void Leave(Rabbit_Base *a_rabbit)
Remove this adult from the warren list.
Definition: Rabbit.cpp:2111
int GetAllBigFemaleRabbits()
Supplies the number of big rabbits currently in the warren.
Definition: Rabbit.cpp:2280
virtual Rabbit_Adult * GetMate(void)
Get mate pointer.
Definition: Rabbit.h:288
virtual void st_Dying(void)
Young dying state.
Definition: Rabbit.cpp:250
int m_myLitterSize
Holds the current litter size.
Definition: Rabbit.h:497
Rabbit_Adult(int p_x, int p_y, int p_x2, int p_y2, Landscape *p_L, Rabbit_Population_Manager *p_NPM, int a_age, int a_weightage, Rabbit_Warren *a_warren)
Rabbit_Adult constructor.
Definition: Rabbit.cpp:523
Rabbit_Warren * FindClosestWarren(int a_x, int a_y, int a_rank)
Finds the closest warren as the crow flies.
int SupplyPolyRef(int a_x, int a_y)
Definition: landscape.h:1414
int CalcPermForageArea(void)
Returns the total area of permanent forage.
Definition: Rabbit.cpp:1738
The rabbit young class. All special young behaviour is described here.
Definition: Rabbit.h:319
bool m_FedToday
Flag for been fed today.
Definition: Rabbit.h:193
The landscape class containing all environmental and topographical data.
Definition: landscape.h:109
static CfgFloat cfg_adult_base_mort("RABBIT_ADULTBASEMORT", CFG_CUSTOM, 0.00013)
Input variable. The daily base level for adult mortality before any modifiers are applied...
void Weaned(Rabbit_Young *a_young)
Message on weaning of a young.
Definition: Rabbit.cpp:1311
void SetSocialStatus(TTypesOfRabbitSocialStatus a_status)
Sets the dominance status.
Definition: Rabbit.h:391
Rabbit_Female(int p_x, int p_y, int p_x2, int p_y2, Landscape *p_L, Rabbit_Population_Manager *p_NPM, int a_age, int a_weightage, Rabbit_Warren *a_warren)
Rabbit_Female constructor.
Definition: Rabbit.cpp:894
The rabbit female class. All special female behaviour is described here.
Definition: Rabbit.h:443
CfgInt cfg_RabbitUseNatalDispersalRecordAge
Flag to denote using lifetime repro output file or not.
The information needed to hold a single rabbit memory.
Definition: Rabbit.h:131
RabbitObjectTypes
Definition: Rabbit.h:68
void SetHasBurrow(bool a_status)
Set/unset burrow status.
Definition: Rabbit.h:246
unsigned GetLiveArraySize(int a_listindex)
Gets the number of &#39;live&#39; objects for a list index in the TheArray.
double GetDailyMortalityChanceJ()
Returns the juvenile daily mortality multiplier.
Definition: Rabbit.h:684
LE * SupplyLEPointer(int a_polyref)
Definition: landscape.h:1020
vector< Rabbit_Base * > m_InhabitantsList
List of rabbits that live here - for easy communication purposes.
Definition: Rabbit.h:752
int CalcLitterSize(void)
Calculates the litter size at birth.
Definition: Rabbit.cpp:1249
Rabbit_Warren * m_Warren
A pointer to the current warren.
static double m_minForageDigestability
The minimum vegetation digestability allowed for foraging.
Definition: Rabbit.h:543
int m_lifespan
The rabbit&#39;s alloted lifespan.
Definition: Rabbit.h:407
bool GetForageDay()
Get method for the forage day flag.
int CalcForageArea(void)
Returns the total area of forage.
Definition: Rabbit.cpp:1724
void SetMate(Rabbit_Adult *a_mate)
Set/unset mate status.
Definition: Rabbit.cpp:606
Rabbit_Population_Manager * m_NPM
Rabbit_Population_Manager pointer.
int GetAllBreedingFemaleRabbits()
Supplies the number of breeding rabbits currently in the warren.
Definition: Rabbit.cpp:2268
static CfgFloat cfg_rabbitsocialreproductionthreshold("RABBIT_SOCIALREPROTHRESHOLD", CFG_CUSTOM, 2.3)
The threshold at which social reproduction reduction is tested. 1.0 means 50% chance of reproduction ...
virtual void BeginStep(void)
The BeginStep is the first &#39;part&#39; of the timestep that an animal can behave in. It is called once per...
Definition: Rabbit.cpp:182
Rabbit_Population_Manager * m_OurPopulationManager
This is a time saving pointer to the correct population manager object.
Definition: Rabbit.h:181
double GetCarryingCapacityRatio()
Checks whether all possible burrows are filled with rabbits. This is updated daily by Rabbit_Warren::...
Definition: Rabbit.h:576
virtual void Step(void)
The male rabbit step code.
Definition: Rabbit.cpp:726
Rabbit_Base(int p_x, int p_y, int p_x2, int p_y2, Landscape *p_L, Rabbit_Population_Manager *p_NPM, Rabbit_Warren *a_warren)
Rabbit constructor.
Definition: Rabbit.cpp:161
CfgInt cfg_rabbitdiggingtime("RABBIT_DIGGINGTIME", CFG_CUSTOM, 10)
Input variable. Minimum burrow construction time in days.
int m_TL_y
Stores original m_Location_y.
Definition: Rabbit.h:700
void NatalDispersalRecordOutput(Rabbit_Base *a_rabbit)
Records the natal dispersal.
bool SupplyPesticideDecay()
Returns true if there is any pesticide in the system at all at this point.
Definition: Landscape.cpp:639
Rabbit_Adult * m_myMate
Pointer to the mate if any.
Definition: Rabbit.h:409
virtual void GeneralEndocrineDisruptor(double)
Handles internal effects of endocrine distrupter pesticide exposure.
Definition: Rabbit.cpp:1418
void InitEvaluation(void)
Intiates the evaluation of the warren area.
Definition: Rabbit.cpp:1491
CfgBool l_pest_enable_pesticide_engine
int m_runningavFemales
Keeps track of the number of breeding females.
Definition: Rabbit.h:756
CfgFloat cfg_dispersalmortperm("RABBIT_DISPERSALMORTPERM", CFG_CUSTOM, 0.0002)
Input variable. The additional mortality rate with distance for between warren dispersal.
int GetPopulationSize()
Gets the total warren population of rabbits.
Definition: Rabbit.h:572
Rabbit_Female * m_Mum
Pointer to mum.
Definition: Rabbit.h:191
CfgFloat cfg_rabbitdendepscaler("RABBIT_DENSITYDEPSCALER", CFG_CUSTOM, 4.5)
Input variable. Average family size for calculating carrying capacity.
double GetLitterReabsortionConst(void)
Returns litter reabsorption chance.
Definition: Rabbit.h:650
double GetDailyMortalityChanceA()
Returns the adult daily mortality multiplier.
Definition: Rabbit.h:680
virtual TTypeOfRabbitState st_Forage(void)
Adult female forage behaviour.
Definition: Rabbit.cpp:1177
int GetweightAge(void)
Get age method.
Definition: Rabbit.h:230
Integer configurator entry class.
Definition: configurator.h:85
int m_breedingfemales
The number of females that bred this year.
Definition: Rabbit.h:545
virtual void st_Dying(void)
Default dying state.
Definition: Rabbit.cpp:685
CfgBool cfg_RabbitUseNatalDispersalRecord
Flag to denote using lifetime repro output file or not.
static double m_pesticidedegradationrate
State variable used to hold the daily degredation rate of the pesticide in the body.
Definition: Rabbit.h:174
int m_soiltype
Variable holding the soil type, 1 = heavy, 0 = sandy, 3 = unsuitable (never used in warrens) ...
Definition: Rabbit.h:720
int m_size
Warren core size in m.
Definition: Rabbit.h:694
void Mate(Rabbit_Adult *a_mate, RabbitObjectTypes rob_type)
Mate him with un-mated female/male with a burrow.
Definition: Rabbit.cpp:2163
A class to describe the rabbits warren system.
Definition: Rabbit.h:518
int m_y2
y-coord of birth
double CalcCarryingCapacityRatio2()
calculates the ratio of rabbits to the carrying capacity for the local area
Definition: Rabbit.cpp:1686
virtual ~Rabbit_Male(void)
Rabbit_Male destructor.
Definition: Rabbit.cpp:720
virtual bool ShouldMature(void)
Tests for maturation to the next stage.
Definition: Rabbit.cpp:362
void ResetAllRabbitProductionRecord(void)
Reset data about production of rabbits throughout year.
Definition: Rabbit.h:588
virtual void InternalPesticideHandlingAndResponse()
Handles internal effects of pesticide exposure - reimplemented from base class.
Definition: Rabbit.cpp:1389
virtual void EndStep(void)
The EndStep is the last &#39;part&#39; of the timestep that an animal can behave in.
Definition: Rabbit.cpp:547
void CalcCarryingCapacityRatio1()
calculates the ratio of rabbits to the carrying capacity
Definition: Rabbit.cpp:1682
static double m_MinKitsNo
The minimum number of kits.
Definition: Rabbit.h:499
double m_weight
The weight in g.
Definition: Rabbit.h:195
Rabbit_Young(int p_x, int p_y, int p_x2, int p_y2, Rabbit_Female *a_mum, Landscape *p_L, Rabbit_Population_Manager *p_NPM, Rabbit_Warren *a_warren)
Rabbit_Young constructor.
Definition: Rabbit.cpp:232
int m_Age
The rabbit&#39;s age.
Definition: Rabbit.h:177
double value(void)
Definition: configurator.h:107
virtual Rabbit_Adult * GetMate(void)
Get mate pointer.
Definition: Rabbit.h:397
int SupplySimAreaWidth(void)
Definition: landscape.h:1558
Rabbit_Population_Manager * m_OurPopulationManager
This is a time saving pointer to the correct population manager object.
Definition: Rabbit.h:754
int GetDigging()
Get number of days to dig.
Definition: Rabbit.h:254
int GetCoverArea(void)
Returns the total area of cover.
Definition: Rabbit.cpp:1766
CfgFloat cfg_minForageDigestability("RABBIT_MINFORAGEDIGESTABILITY", CFG_CUSTOM, 0.50)
Input variable. Input variable. The minimum digestability desirable for forage vegetation.
double m_availableforage
Records the amount of forage currently available in the warren area as a proportion of what is the po...
Definition: Rabbit.h:728
virtual void BeingStep(void)
The BeginStep is the first &#39;part&#39; of the timestep that an animal can behave in.
Definition: Rabbit.cpp:305
CfgFloat cfg_rabbitminkits("RABBIT_MINKITS", CFG_CUSTOM, 1.0)
The minimum number of kits in a litter.
void ChooseNewDominant(void)
Finds a subdominantfemale and promotes them to dominant.
Definition: Rabbit.cpp:1946
TTypeOfRabbitState st_Develop()
Development state for young.
Definition: Rabbit.cpp:400
virtual void InternalPesticideHandlingAndResponse()
Handles internal effects of pesticide exposure. If any effects are needed this method must be re-impl...
Definition: Rabbit.h:303
int m_NoOccupiedBurrows
Records the burrows that are occupied.
Definition: Rabbit.h:716
Rabbit_Warren * GetNetworkWarren(void)
Chooses a warren to evaluate based on distance.
Definition: Rabbit.cpp:1907
int m_digging
Flag to denote digging behaviour. This keeps the rabbit in a warren without burrows whilst it tries t...
Definition: Rabbit.h:199
TTypeOfRabbitState
Definition: Rabbit.h:82
bool m_lactating
Flag to indicate lactating.
Definition: Rabbit.h:491
void CreateObjects(RabbitObjectTypes ob_type, TAnimal *pvo, struct_Rabbit *a_data, int a_number)
Method for creating a new individual Rabbit.
double m_CarryingCapacityR
Records the max number of rabbits possible here.
Definition: Rabbit.h:706
APoint m_born_location
The x,y location at birth.
Definition: Rabbit.h:201
The rabbit adult class. All generic adult behaviour is described here.
Definition: Rabbit.h:378
virtual void st_Dying(void)
Female dying state.
Definition: Rabbit.cpp:967
Rabbit_Male(int p_x, int p_y, int p_x2, int p_y2, Landscape *p_L, Rabbit_Population_Manager *p_NPM, int a_age, int a_weightage, Rabbit_Warren *a_warren)
Rabbit_Male constructor.
Definition: Rabbit.cpp:713
Used for creation of a new Rabbit object.
CfgFloat cfg_rabbit_pesticidedegradationrate("RABBIT_PESTICIDEDEGRADATIONRATE", CFG_CUSTOM, 0.0)
Holds 1-proportion of decay of body burden of pesticide per day. Default of 0.0 will remove all body ...
virtual void Step()
Warren step code.
Definition: Rabbit.cpp:1840
virtual TTypeOfRabbitState st_Lactating(void)
Female lactating state.
Definition: Rabbit.cpp:1260
double SupplyPesticide(int a_x, int a_y)
Gets total pesticide for a location.
Definition: Landscape.cpp:481
The class to handle all predator population related matters.
boost::variate_generator< base_generator_type &, boost::uniform_real<> > g_rand_uni
virtual void Step(void)
The Step is the second &#39;part&#39; of the timestep that an animal can behave in. It is called continuously...
Definition: Rabbit.cpp:316
void OccupyNewBurrow()
a_rabbit occupies a newly dug burrow
Definition: Rabbit.cpp:2063
void OnEvicted(void)
Signals mum has a new litter to look after.
Definition: Rabbit.h:284
virtual void Step(void)
The Step is the second &#39;part&#39; of the timestep that an animal can behave in. It is called continuously...
Definition: Rabbit.cpp:450
static CfgFloat cfg_rabbitminwarrensize("RABBIT_MINWARRENSIZE", CFG_CUSTOM, 2)
The minimum size of a warren.
void OnYoungDeath(Rabbit_Young *a_young)
Message on death of a young.
Definition: Rabbit.cpp:1287
int m_gestationcounter
Counter to record the number of days gestating.
Definition: Rabbit.h:493
static CfgFloat cfg_juvenile_base_mort("RABBIT_JUVENILEBASEMORT", CFG_CUSTOM, 0.004)
Input variable. The daily base level for juvenile mortality before any modifiers are applied...
int GetLittersThisYear()
Returns the number litters produced in the last 12 months.
Definition: Rabbit.h:670
void Join(Rabbit_Base *a_rabbit)
Adds this rabbit to the warren list.
Definition: Rabbit.cpp:2055
TTypesOfRabbitSocialStatus m_socialstatus
Flag to record dominance status (0-4)
Definition: Rabbit.h:405
Rabbit_Juvenile(int p_x, int p_y, int p_x2, int p_y2, Rabbit_Female *p_M, Landscape *p_L, Rabbit_Population_Manager *p_NPM, int a_age, int a_weightage, Rabbit_Warren *a_warren)
Rabbit_Young constructor.
Definition: Rabbit.cpp:376
virtual TTypeOfRabbitState st_Forage(void)
Adult male forage behaviour.
Definition: Rabbit.cpp:756
bool IsMember(Rabbit_Base *a_rabbit)
Returns true if this rabbit belongs to the warren.
Definition: Rabbit.cpp:1990
virtual void EndStep(void)
The EndStep is the last &#39;part&#39; of the timestep that an animal can behave in.
Definition: Rabbit.cpp:347
virtual void InternalPesticideHandlingAndResponse()
Handles internal effects of pesticide exposure - reimplemented from base class.
Definition: Rabbit.cpp:1339
void Update(void)
daily update of the memory
Definition: Rabbit.cpp:132
double m_CarryingCapacityRatio
Records the ratio between carrying capacity and no rabbits in warren.
Definition: Rabbit.h:712
virtual TTypeOfRabbitState st_EvaluateTerritory(void)
Female Evaluate Territory Step.
Definition: Rabbit.cpp:988
bool value(void)
Definition: configurator.h:123
virtual ~Rabbit_Juvenile(void)
Rabbit_Young destructor.
Definition: Rabbit.cpp:387
RabbitObjectTypes m_RabbitType
The rabbits type.
Definition: Rabbit.h:170
int Supply_m_Location_y()
void UpdateForageInformation(void)
Updates the forage information depending upon the vegetation state.
Definition: Rabbit.cpp:1639
int m_littersthisyear
The number of litters produced this year.
Definition: Rabbit.h:549
int m_CurrentStateNo
The basic state number for all objects - &#39;-1&#39; indicates death.
bool IsBreedingSeason(void)
Get whether it is breeding season.
virtual ~Rabbit_Base(void)
Rabbit destructor.
Definition: Rabbit.cpp:176
int m_weightage
The rabbit age in terms of weight.
CfgFloat cfg_globaldisease_probability("RABBIT_GLOBALDISEASEPROBCONSTANT", CFG_CUSTOM, 0.05)
Input variable. A constant use to calculate the probability of density related disease.
int m_nonbreedingfemales
The number of females that did not breed this year but are older than 1 year.
Definition: Rabbit.h:551
TTypeOfRabbitState st_Forage(void)
Juvenile forage behaviour.
Definition: Rabbit.cpp:671
virtual TTypeOfRabbitState st_EvaluateTerritory(void)
Male Evaluate Territory Step.
Definition: Rabbit.cpp:770
int m_age
The rabbit age.
TTypesOfRabbitSocialStatus GetSocialStatus(void)
Return the dominance status.
Definition: Rabbit.h:387
int m_CarryingCapacity
Records the max number of rabbit pairs possible here.
Definition: Rabbit.h:704
int m_rabbitdiggingtime
The time taken for burrow construction.
Definition: Rabbit.h:722
void UpdateThisYearsBreeders()
Calculates and stores the number of breeders and non-breeders.
Definition: Rabbit.cpp:1815
int g_counter
Definition: Rabbit.cpp:76
int Supply_m_Location_x()
The base class for all ALMaSS animal classes.
void UpdateDominance(void)
Checks for a dominant female and promotes one if necessary and possible.
Definition: Rabbit.cpp:1930
bool IsFreeFemale(void)
Returns true if there is a female with a burrow and no mate.
Definition: Rabbit.cpp:1973
int m_weightAge
A physiological age parameter, this is the growth age based on an optimal curve (if optimal condition...
Definition: Rabbit.h:197
double m_inv_availableforage
The inverse of m_availableforage, prevents multiple re-calculation.
Definition: Rabbit.h:732
virtual TTypeOfRabbitState st_Gestating(void)
Female gestating state.
Definition: Rabbit.cpp:1273
double m_diseaseconstant
a measure of disease mortality likelihood
Definition: Rabbit.h:738
The basic information needed for an LE present in a warren area.
Definition: Rabbit.h:119
vector< RabbitWarrenLEInfo > m_LEList
List of polygons and the area which is part of the warren.
Definition: Rabbit.h:748
void OnMateFinishedDigging(Rabbit_Adult *a_mate)
Action when a mate has finished digging a burrow.
Definition: Rabbit.cpp:624
MapErrorMsg * g_msg
Definition: maperrormsg.cpp:38
double GetForagePesticide(void)
Gets the current mean pesticide concentration per unit forage.
Definition: Rabbit.h:628
int GetTemporaryForageArea(void)
Returns the total area of temporary forage.
Definition: Rabbit.cpp:1752
CfgFloat cfg_rabbitmaxkits("RABBIT_MAXKITS", CFG_CUSTOM, 9.6)
The maximum number of kits in a litter.
int IsFreeBurrow(void)
Is there a vacent burrow?
Definition: Rabbit.cpp:2029
virtual ~Rabbit_Female(void)
Rabbit_Female destructor.
Definition: Rabbit.cpp:914
virtual void EndStep(void)
The EndStep is the last &#39;part&#39; of the timestep that an animal can behave in.
Definition: Rabbit.cpp:487
CfgInt cfg_rabbitdensitydependencedelay
Input variable. The period between recalculation of rabbit disease probability.
double m_pesticide_conc
Definition: Rabbit.h:124
double GetAvailableForage(void)
Returns the available forage realtive to rabbit numbers.
Definition: Rabbit.h:642
virtual TTypeOfRabbitState st_GiveBirth(void)
Female give birth state.
Definition: Rabbit.cpp:1191
RabbitMemory(void)
Rabbit Memory constructor.
Definition: Rabbit.cpp:127
Bool configurator entry class.
Definition: configurator.h:116
TTypesOfRabbitHabitat ClassifyHabitat(TTypesOfLandscapeElement a_tole)
Classify a landscape element type according to the rabbit habitat classification. ...
int SupplySimAreaHeight(void)
Definition: landscape.h:1563
double m_litterreabosorptionchance
Chance of litter reaborption based on the m_availableforage.
Definition: Rabbit.h:734
int m_foragesize
Warren forage size in m.
Definition: Rabbit.h:696
bool DEBUG_InternalTest()
Definition: Rabbit.cpp:2292
static CfgFloat cfg_rabbitmaxwarrensize("RABBIT_MAXWARRENSIZE", CFG_CUSTOM, 10)
Use to calculate the maximum size of a warren. Add min to get the real maximum warren size...
int SupplyDayInYear(void)
Definition: landscape.h:1522
double GetGrowth(int a_age)
Get method for the rabbit growth with age.
int m_permforagearea
Variable holding the total permanent forage area.
Definition: Rabbit.h:724
Landscape * m_OurLandscape
int m_1yrOldFemales
The number of 1 year old females.
Definition: Rabbit.h:547
double m_mortalitymultiplierJ
a measure of mortality likelihood - juveniles
Definition: Rabbit.h:742
int GetTempForageAreaVeg(void)
Returns the total area of temporary forage based on veg height.
Definition: Rabbit.cpp:1780
TTypeOfRabbitState st_Develop(void)
Development state for young.
Definition: Rabbit.cpp:262
virtual void GeneralOrganoPhosphate(double)
Handles internal effects of organophosphate pesticide exposure.
Definition: Rabbit.cpp:1432
static double m_dispersalmortperm
The extra dispersal mortality per m travelled.
Definition: Rabbit.h:172
void AddMemory(RabbitMemoryLocation a_mem)
Add a memory location.
Definition: Rabbit.cpp:140
static CfgFloat cfg_litterabsorptionconstant("RABBIT_LITTERABSOPRTIONCONST", CFG_CUSTOM, 1.8)
Used to calculate the chance of litter reabsorption depending on forage conditions.
void SetDigging(int a_days)
Set number of days to dig.
Definition: Rabbit.h:250
TTypeOfRabbitState m_CurrentRState
Variable to record current behavioural state.
Definition: Rabbit.h:746
void OccupyBurrow()
a_rabbit occupies a free burrow
Definition: Rabbit.cpp:2071
virtual void st_Dying(void)
Young dying state.
Definition: Rabbit.cpp:393
CfgFloat cfg_RabbitPesticideResponse("RABBIT_PESTICDERESPONSETHRESHOLD", CFG_CUSTOM, 0.00001)
Input variable. The threshold above which a rabbit will be killed if it ingests pesticide.
RabbitMemoryLocation GetBestLocation(void)
Get the best current location.
Definition: Rabbit.cpp:146
Rabbit_Warren(int p_x, int p_y, Landscape *p_L, Rabbit_Population_Manager *p_NPM, int a_size, int a_soil)
Rabbit warren constructor.
Definition: Rabbit.cpp:1449
int m_NoBurrows
Records the maintenence restricted current carrying capacity (burrow number)
Definition: Rabbit.h:714
static double m_MaxKitsNo
The maximum number of kits.
Definition: Rabbit.h:501
TTypeOfRabbitState GetCurrentRState()
Definition: Rabbit.h:210
virtual bool ShouldMature(void)
Tests for maturation to the next stage.
Definition: Rabbit.cpp:512
void JoinNOccupy(Rabbit_Adult *a_rabbit)
Adds this adult to the warren list and house them in a suitable burrow.
Definition: Rabbit.cpp:2085
void NetworkEvaluation(void)
Calculates and saves distance probabilities.
Definition: Rabbit.cpp:1709
void Warn(std::string a_msg1, std::string a_msg2)
Definition: landscape.h:1505
bool IsFreeMale(void)
Returns true if there is a male with a burrow and no mate.
Definition: Rabbit.cpp:2008
int m_x2
x-coord of birth
Rabbit_Warren * m_myWarren
True if currently mated.
Definition: Rabbit.h:189
int value(void)
Definition: configurator.h:92
void OccupyWarren(Rabbit_Adult *a_rabbit)
Adds the first rabbit to the warren list.
Definition: Rabbit.cpp:2077
static CfgFloat cfg_forageareamortscaler("RABBIT_FORAGEAREAMORTSCALER", CFG_CUSTOM, 60.0)
Input variable. A constant used to increase bad weather mortality as a function of the proportion of ...
int GetCoverAreaVeg(void)
Returns the total area of cover based on veg height.
Definition: Rabbit.cpp:1800
int m_MyOffspring
The total number of kits born to her.
Definition: Rabbit.h:503
TTypesOfPesticide SupplyPesticideType(void)
Definition: landscape.h:401
virtual void st_Dying(void)
Default dying state.
Definition: Rabbit.cpp:187
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: maperrormsg.cpp:56
double SupplyVegHeight(int a_polyref)
Definition: landscape.h:857
bool DEBUG_InternalTest2()
Definition: Rabbit.cpp:2344
double m_BigFemaleRabbitsR
Records the number of big female rabbits divided by m_CarryingCapacityR2.
Definition: Rabbit.h:710
RabbitObjectTypes GetRabbitType(void)
Get rabbit type.
Definition: Rabbit.h:218
int m_maintenence
Warren maintenence score - if not max then houseing capacity is reduced.
Definition: Rabbit.h:702
void OnMumDead(void)
Signals death of mum.
Definition: Rabbit.h:280
double m_pesticide_burden
State variable used to hold the current body-burden of pesticide.
Definition: Rabbit.h:203
virtual ~Rabbit_Adult()
Rabbit_Adult destructor.
Definition: Rabbit.cpp:541
TTypesOfLandscapeElement
vector< int > m_AnnualLitters
The number of litters produced.
Definition: Rabbit.h:507
long SupplyGlobalDate(void)
Definition: landscape.h:1547
void OnMateDead(Rabbit_Adult *a_mate)
Set/unset mate status.
Definition: Rabbit.cpp:653
double m_forage
Definition: Rabbit.h:125
double m_CarryingCapacityR2
Records the max number of rabbits possible here divided by 2.
Definition: Rabbit.h:708
double m_mortalitymultiplierA
a measure of mortality likelihood - adults
Definition: Rabbit.h:740
void ReproOutputRecordOutput(Rabbit_Female *a_female)
Print reproductive record to file.
bool m_StepDone
Indicates whether the iterative step code is done for this timestep.
int m_MyTotalLitters
The number of litters produced.
Definition: Rabbit.h:505
virtual ~Rabbit_Warren()
Rabbit warren destructor.
Definition: Rabbit.cpp:1485
vector< LocalWarrenNewtorkEntry > m_LocalWarrenNetwork
List of local warrens and their accessibility from this warren.
Definition: Rabbit.h:750
double m_forageP
Records the amount of pesticde as a mean concentration per unit area forage.
Definition: Rabbit.h:736
CfgBool cfg_RabbitUseReproOutput
Flag to denote using lifetime repro output file or not.
virtual TTypeOfRabbitState st_UpdateBreedingStatus(void)
Female reproductive update - handles oestrous, gestation, lactation and birth.
Definition: Rabbit.cpp:1132
int m_BurrowsUnderConstruction
Records the burrows that are being dug.
Definition: Rabbit.h:718
virtual void InternalPesticideHandlingAndResponse()
Handles internal effects of pesticide exposure - reimplemented from base class.
Definition: Rabbit.cpp:1364
void RabbitProductionRecord(RabbitObjectTypes YoungType, int kits)
Stores data about production of rabbits throughout year.
Definition: Rabbit.h:582
void OnFed(void)
Signals food arrived today.
Definition: Rabbit.h:276
int m_runningavCount
Keeps track of the number of breeding days.
Definition: Rabbit.h:758
TTypeOfRabbitState st_Explore(void)
Juvenile local exploration.
Definition: Rabbit.cpp:415
int g_rabbitexploredistance
void JoinNMate(Rabbit_Adult *a_mate, RabbitObjectTypes rob_type)
Adds this rabbit to the warren list and mate him with un-mated female/male with a burrow...
Definition: Rabbit.cpp:2218
void UpdatePesticide(void)
Updates the pesticide concentration in forage polygons.
Definition: Rabbit.cpp:1602
Double configurator entry class.
Definition: configurator.h:100
void st_WarrenBeing(void)
The only warren behaviour - it just is.
Definition: Rabbit.cpp:1859
void SetWarren(Rabbit_Warren *a_warren)
Set the warren pointer.
Definition: Rabbit.h:238
Rabbit_Young * m_myLitter[20]
Holds the current young (for lactation)
Definition: Rabbit.h:495
TTypeOfRabbitState st_BecomeJuvenile(void)
Young maturation.
Definition: Rabbit.cpp:283
static double m_maxForageHeight
The maximum vegetation height assumed for forage potential.
Definition: Rabbit.h:541
bool m_haveBurrow
Flag to record burrow status.
Definition: Rabbit.h:185
void CalcDisease()
Calculate the current disease mortality constant.
Definition: Rabbit.cpp:1577
TTypeOfRabbitState m_CurrentRState
Variable to record current behavioural state.
Definition: Rabbit.h:179
int GetCurrentStateNo()
Returns the current state number.
virtual void Step(void)
The female rabbit step code.
Definition: Rabbit.cpp:920
Landscape * m_L
Landscape pointer.
double m_foragearearatio
Records the amount of forage currently available in the warren area as a proportion of total forage a...
Definition: Rabbit.h:730
int m_foragearea
Variable holding the total potential forage area.
Definition: Rabbit.h:726
int GetCarryingCapacity()
Returns the carrying capacity in burrows.
Definition: Rabbit.h:578
bool m_pregnant
Flag to indicate pregnancy.
Definition: Rabbit.h:489
virtual ~Rabbit_Young(void)
Rabbit_Young destructor.
Definition: Rabbit.cpp:244
bool WalkTo(int a_x, int a_y)
Walks to a location from current location.
Definition: Rabbit.cpp:205
bool m_pesticideInfluenced1
Flag to indicate pesticide effects (e.g. can be used for endocrine distruptors with delayed effects u...
Definition: Rabbit.h:205
TTypeOfRabbitState st_BecomeAdult(void)
Juvenile maturation.
Definition: Rabbit.cpp:424
void PesticideDeathRecord(RabbitObjectTypes ob_type)
Records pesticide poisoning incidents.
TTypesOfPesticide
Definition: landscape.h:64
unsigned SupplyAllBigRabbits()
Returns the total number of rabbits.
double SupplyVegDigestability(int a_polyref)
Definition: landscape.h:840
Rabbit_Young * m_rabbit
A pointer to a rabbit base - useful for extra information.
static CfgFloat cfg_young_base_mort("RABBIT_YOUNGBASEMORT", CFG_CUSTOM, 0.038)
Input variable. The daily base level for young mortality before any modifiers are applied...
int m_TL_x
Stores original m_Location_x.
Definition: Rabbit.h:698
double m_MyMortChance
Definition: Rabbit.h:183
bool GetHasBurrow(void)
Get burrow status.
Definition: Rabbit.h:242
bool MortalityTest(double a_prop)
A simple probability based test.
Definition: Rabbit.cpp:194
CfgFloat cfg_maxForageHeight("RABBIT_MAXFORAGEHEIGHT", CFG_CUSTOM, 30.0)
Input variable. The maximum height desirable for forage vegetation.