ALMaSS Rabbit ODdox  1.1
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 
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 
624 #ifdef __RABBITDEBUG
626 {
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 #else
645 {
646 #endif
647  SetDigging(-1);
648  SetHasBurrow(true);
650 #ifdef __RABBITDEBUG
652 #endif
653 }
654 //---------------------------------------------------------------------------
655 
656 #ifdef __RABBITDEBUG
658 {
659  if (a_mate->GetRabbitType() == m_RabbitType)
660  {
661  m_OurLandscape->Warn("Rabbit_Adult::OnMateDead","homosexual rabbit!");
662  exit(1);
663  }
664  if ((m_myMate != a_mate) && (m_CurrentRState != toRabbits_Die))
665  {
666  m_OurLandscape->Warn("Rabbit_Adult::OnMateDead","rabbit bigamy, mate not recognised!");
667  exit(1);
668  }
669 #else
671 {
672 #endif
673  m_myMate = NULL;
674 }
675 //---------------------------------------------------------------------------
676 
678 {
687  return toRabbits_Explore;
688 }
689 //---------------------------------------------------------------------------
690 
692 {
700  if ( m_myWarren != NULL )
701  {
702  m_myWarren->Leave(this);
703  }
704  if (m_myMate != NULL)
705  {
706  m_myMate->OnMateDead( this );
707  m_myMate = NULL;
708  }
709  m_CurrentStateNo = -1; // this will kill the animal object and free up space
710  m_StepDone = true;
711 }
712 //---------------------------------------------------------------------------
713 
714 
715 //********************************************************************************************************************
716 // Rabbit_Male
717 //********************************************************************************************************************
718 
719 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)
720 {
722  if (a_warren != NULL) a_warren->RabbitProductionRecord(rob_Male, 1);
723 }
724 //---------------------------------------------------------------------------
725 
727 {
728  ;
729 }
730 //---------------------------------------------------------------------------
731 
733 {
734  if (m_StepDone || m_CurrentStateNo == -1) return;
735  switch (m_CurrentRState)
736  {
737  case toRabbits_InitialState: // Initial state always starts with develop
739  break;
740  case toRabbits_EvaluateTerritory: // Initial state always starts with develop
742  m_StepDone=true;
743  break;
744  case toRabbits_Foraging:
746  break;
747  case toRabbits_Die:
748  st_Dying(); // No return value - no behaviour after this
749  m_StepDone=true;
750  break;
751  case toRabbits_Remove:
752  m_CurrentStateNo = -1;
753  m_StepDone=true;
754  break;
755  default:
756  m_OurLandscape->Warn("Rabbit_Male::Step()","unknown state - default");
757  exit(1);
758  }
759 }
760 //---------------------------------------------------------------------------
761 
763 {
773 }
774 //---------------------------------------------------------------------------
775 
793  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
794  if (m_myMate != NULL) {
795 #ifdef __RABBITDEBUG
796  if (m_digging < 0) {
797  int rubbish = 0;
798  }
799  if (m_haveBurrow) {
800  int rubbish = 0;
801  }
802 #endif
803  return toRabbits_Foraging; // Must be digging a burrow
804  }
805 
806  if (m_myWarren == NULL) {
807  // Must find a warren - finds the closest - NB this code should not often be used, so efficiency here has not been optimised
810  bool survived = WalkTo( aRW->Supply_m_Location_x(), aRW->Supply_m_Location_y() );
811  if (!survived) return toRabbits_Die;
812  if (aRW->IsFreeFemale()) {
813  aRW->JoinNMate( this, rob_Female );
814  }
819  else {
820  int burrow = aRW->IsFreeBurrow();
821  if (burrow == 1) {
822  aRW->JoinNOccupy( this );
823  }
824  else
825  if (burrow == 2) {
826  aRW->OccupyWarren( this );
827  }
828  }
829  return toRabbits_Foraging;
830  }
831  else if (m_myWarren->IsFreeFemale()) {
832  m_myWarren->Mate( this, rob_Female );
833  }
834  else if (m_myWarren->IsFreeBurrow() == 1) {
836  SetDigging( -1 );
838  SetHasBurrow( true );
839  }
840  else if (m_digging > 0) {
841  return toRabbits_Foraging;
842  }
843  else
849  {
851  if (aWarren != NULL) {
852  if (aWarren->IsFreeFemale()) {
853  bool survived = WalkTo( aWarren->Supply_m_Location_x(), aWarren->Supply_m_Location_y() );
854  if (!survived) return toRabbits_Die;
855  m_myWarren->Leave( this );
856  aWarren->JoinNMate( this, rob_Female );
857  }
858  else {
859  int burrows = aWarren->IsFreeBurrow();
860  if (burrows == 1) {
861  bool survived = WalkTo( aWarren->Supply_m_Location_x(), aWarren->Supply_m_Location_y() );
862  if (!survived) return toRabbits_Die;
863  m_myWarren->Leave( this );
864  aWarren->JoinNOccupy( this );
866  }
867  else if (burrows == 2) {
868  bool survived = WalkTo( aWarren->Supply_m_Location_x(), aWarren->Supply_m_Location_y() );
869  if (!survived) return toRabbits_Die;
870  m_myWarren->Leave( this );
871  aWarren->OccupyWarren( this );
872  m_socialstatus = rabbit_socialstatus_subordinate; // Can dig a burrow but don't have one
873  }
874  else {
875  // No room but we may need to move anyway
876  int c = m_myWarren->GetCarryingCapacity();
877  int n = m_myWarren->GetPopulationSize() - (c * 2); // c is number of pairs, but there are 2 + a litter (average 6) as a minimum
878  double occupation = n / (double)c;
879  if (g_rand_uni() < occupation) {
880  bool survived = WalkTo( aWarren->Supply_m_Location_x(), aWarren->Supply_m_Location_y() );
881  if (!survived) return toRabbits_Die;
882  m_myWarren->Leave( this );
883  aWarren->Join( this );
884  SetDigging( -1 );
886  }
887  }
888  }
889  }
890  }
891  return toRabbits_Foraging; // Do it all again tomorrow
892 }
893 //---------------------------------------------------------------------------
894 
895 
896 //********************************************************************************************************************
897 // Rabbit_Female
898 //********************************************************************************************************************
899 
900 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)
901 {
903  if (a_warren != NULL) a_warren->RabbitProductionRecord(rob_Female, 1);
904  m_lactating = false;
905  m_pregnant = false;
906  m_gestationcounter = 0;
907  m_myLitterSize = 0;
908  m_MyOffspring = 0;
909  m_MyTotalLitters = 0;
910 #ifdef __RABBITDEBUG
911  if (m_myWarren != NULL) if (m_myWarren->IsMember(this)==false)
912  {
913  m_OurLandscape->Warn("Rabbit_Female::Rabbit_Female","not a member of our warren");
914  exit(1);
915  }
916 #endif
917 }
918 //---------------------------------------------------------------------------
919 
921 {
922  ;
923 }
924 //---------------------------------------------------------------------------
925 
927 {
933  if (m_StepDone || m_CurrentStateNo == -1) return;
934  switch (m_CurrentRState)
935  {
936  case toRabbits_InitialState: // Initial state always starts with develop
938  break;
939  case toRabbits_Foraging:
941  m_StepDone = true;
942  break;
943  case toRabbits_EvaluateTerritory: // Initial state always starts with develop
945  break;
948  break;
949  case toRabbits_Gestation:
951  break;
952  case toRabbits_GiveBirth:
954  break;
955  case toRabbits_Lactating:
957  break;
958  case toRabbits_Die:
959  st_Dying(); // No return value - no behaviour after this
960  m_StepDone=true;
961  break;
962  case toRabbits_Remove:
963  m_CurrentStateNo = -1;
964  m_StepDone=true;
965  break;
966  default:
967  m_OurLandscape->Warn("Rabbit_Female::Step()","unknown state - default");
968  exit(1);
969  }
970 }
971 //---------------------------------------------------------------------------
972 
974 {
981  for(int l=0; l<m_myLitterSize; l++)
982  {
983  m_myLitter[l]->OnMumDead();
984  }
987  }
988  // Record our repro output if needed
991 }
992 //---------------------------------------------------------------------------
993 
1008  // We need to manage our annual repro info
1009  int today = m_OurLandscape->SupplyGlobalDate();
1010  for (int l = static_cast<int>(m_AnnualLitters.size()-1); l >= 0; l--) {
1011  if (today - m_AnnualLitters[ l ] > 365) {
1012  m_AnnualLitters.erase( m_AnnualLitters.begin() + (l) );
1013  }
1014  }
1015 #ifdef __RABBITDEBUG
1016  if (m_myWarren != NULL)
1017  {
1018  if (m_myWarren->IsMember( this ) == false) {
1019  m_OurLandscape->Warn( "Rabbit_Female::st_EvaluateTerritory", "not a member of our warren" );
1020  exit( 1 );
1021  }
1022  }
1023 #endif
1025 #ifdef __RABBITDEBUG
1026  if (m_myMate != NULL) {
1027  int rubbish = 0;
1028  }
1029 #endif
1030  return toRabbits_UpdateBreedingStatus; // No need to check the rest we have it all
1031  }
1032  // Update breeding status needs StepDone == false, but otherwise we need to set StepDone here.
1033  m_StepDone = true;
1034  if (m_myMate != NULL) {
1035  return toRabbits_Foraging; // Must be digging a burrow
1036  }
1040  if (m_myWarren == NULL) {
1046  bool survived = WalkTo( aRW->Supply_m_Location_x(), aRW->Supply_m_Location_y() );
1047  if (!survived) return toRabbits_Die;
1048  if (aRW->IsFreeMale()) {
1049  aRW->JoinNMate( this, rob_Male );
1050  }
1055  else {
1056  int burrow = aRW->IsFreeBurrow();
1057  if (burrow == 1) {
1058  aRW->JoinNOccupy( this );
1059  }
1060  else
1061  if (burrow == 2) {
1062  aRW->OccupyWarren( this );
1063  }
1064 
1065  }
1066  return toRabbits_Foraging;
1067  }
1068  // We have a warren but no mate or burrow
1069  else if (m_myWarren->IsFreeMale()) {
1070  m_myWarren->Mate( this, rob_Male );
1071  }
1072  else if (m_myWarren->IsFreeBurrow() == 1) {
1074  SetDigging( -1 );
1076  SetHasBurrow( true );
1077  }
1078  else if (m_digging > 0) {
1079  return toRabbits_Foraging;
1080  }
1081  else
1088  {
1090  if (aWarren != NULL) {
1091  if (aWarren->IsFreeMale()) {
1092  bool survived = WalkTo( aWarren->Supply_m_Location_x(), aWarren->Supply_m_Location_y() );
1093  if (!survived) return toRabbits_Die;
1094  m_myWarren->Leave( this );
1095  aWarren->JoinNMate( this, rob_Male );
1096  }
1097  else {
1098  int burrows = aWarren->IsFreeBurrow();
1099  if (burrows == 1) {
1100  bool survived = WalkTo( aWarren->Supply_m_Location_x(), aWarren->Supply_m_Location_y() );
1101  if (!survived) return toRabbits_Die;
1102  m_myWarren->Leave( this );
1103  aWarren->JoinNOccupy( this );
1105  }
1106  else if (burrows == 2) {
1107  bool survived = WalkTo( aWarren->Supply_m_Location_x(), aWarren->Supply_m_Location_y() );
1108  if (!survived) return toRabbits_Die;
1109  m_myWarren->Leave( this );
1110  aWarren->OccupyWarren( this );
1112  }
1113  else {
1114  // No room but we may need to move anyway
1115  double dispersalchance = m_myWarren->GetAvailableForage()/5.0;
1116  if (g_rand_uni() < dispersalchance) {
1117  bool survived = WalkTo( aWarren->Supply_m_Location_x(), aWarren->Supply_m_Location_y() );
1118  if (!survived) return toRabbits_Die;
1119  m_myWarren->Leave( this );
1120  aWarren->Join( this );
1121  SetDigging( -1 );
1123  }
1124  }
1125  }
1126  }
1127  }
1128 #ifdef __RABBITDEBUG
1129  if (m_myWarren != NULL) if (m_myWarren->IsMember( this ) == false) {
1130  m_OurLandscape->Warn( "Rabbit_Female::st_EvaluateTerritory", "not a member of our warren" );
1131  exit( 1 );
1132  }
1133 #endif
1134  return toRabbits_Foraging; // Do it all again tomorrow
1135 }
1136 //---------------------------------------------------------------------------
1137 
1139 {
1152  {
1153  // Do we have a litter on the way?
1154  if (m_pregnant)
1155  {
1156  return toRabbits_Gestation;
1157  }
1158  else
1159  {
1160  // Not pregnant but breeding season so check if there is a mate.
1161  if (m_myMate != NULL)
1162  {
1163  m_pregnant = true;
1164  m_gestationcounter = 0;
1165  }
1166  else if (m_myWarren->IsFreeMale())
1167  {
1168  m_myWarren->Mate( this, rob_Male );
1169  }
1170  }
1171  return toRabbits_Foraging;
1172  }
1173  // Not breeding season but may have young
1174  if (m_lactating) return toRabbits_Lactating;
1175  else
1176  {
1177  m_gestationcounter = 0;
1178  return toRabbits_Foraging;
1179  }
1180 }
1181 //---------------------------------------------------------------------------
1182 
1194 }
1195 //---------------------------------------------------------------------------
1196 
1203  if (m_myLitterSize > 0) {
1204  for (int l = 0; l < m_myLitterSize; l++) {
1205  m_myLitter[ l ]->OnEvicted();
1206  m_myLitter[ l ] = NULL;
1207  }
1208  m_myLitterSize = 0;
1209  }
1210  if (!m_pesticideInfluenced1) {
1211  // Here we take both social status and weight into account
1214  }
1215  int kits = 0;
1216  // Here we have a test for re-abosorption of the litter depending on forage conditions. Low forage high chance of re-absorption
1218  struct_Rabbit* sR = new struct_Rabbit;
1219  sR->m_age = 0;
1220  sR->m_L = m_OurLandscape;
1222  sR->m_x = m_Location_x;
1223  sR->m_y = m_Location_y;
1224  sR->m_x2 = m_Location_x;
1225  sR->m_y2 = m_Location_y;
1226  sR->m_Warren = m_myWarren;
1227  kits = CalcLitterSize();
1228  m_OurPopulationManager->CreateObjects( rob_Young, this, sR, kits );
1230  delete sR;
1231  }
1232  if (kits > 0) {
1233  m_lactating = true;
1234  // Record our success
1235  m_MyTotalLitters++;
1236  m_MyOffspring += kits;
1237  // We also need to manage our annual repro info
1239  }
1240  }
1241  else {
1242  m_pesticideInfluenced1 = false; // Reset the pesticide flag since we lost the litter
1244  }
1246  if (m_myMate != NULL) {
1247  m_pregnant = true;
1248  m_gestationcounter = 0;
1249  }
1250  }
1251  return toRabbits_Foraging;
1252 }
1253 //---------------------------------------------------------------------------
1254 
1256 {
1262  return int(floor(m_MinKitsNo + g_rand_uni() * m_MaxKitsNo));
1263 }
1264 //---------------------------------------------------------------------------
1265 
1267 {
1271  for(int lit=0; lit<m_myLitterSize; lit++)
1272  {
1273  m_myLitter[lit]->OnFed();
1274  }
1275  return toRabbits_Foraging;
1276 }
1277 //---------------------------------------------------------------------------
1278 
1280 {
1285  if (m_gestationcounter >= 30) {
1286  return toRabbits_GiveBirth;
1287  }
1288  if (m_lactating) return toRabbits_Lactating;
1289  return toRabbits_Foraging;
1290 }
1291 //---------------------------------------------------------------------------
1292 
1294 {
1298  for(int l=0; l<m_myLitterSize; l++)
1299  {
1300  if (m_myLitter[l] == a_young)
1301  {
1302  for (int n=l; n<m_myLitterSize; n++)
1303  {
1304  m_myLitter[n] = m_myLitter[n+1];
1305  }
1306  m_myLitter[--m_myLitterSize] = NULL;
1307  if (m_myLitterSize == 0) m_lactating = false;
1308  return;
1309  }
1310  }
1311  // If we get here there is an error
1312  m_OurLandscape->Warn("Rabbit_Female::OnYoungDeath","unknown litter member");
1313  exit(1);
1314 }
1315 //---------------------------------------------------------------------------
1316 
1318 {
1322  for(int l=0; l<m_myLitterSize; l++)
1323  {
1324  if (m_myLitter[l] == a_young)
1325  {
1326  for (int n=l; n<m_myLitterSize; n++)
1327  {
1328  m_myLitter[n] = m_myLitter[n+1];
1329  }
1330  m_myLitter[--m_myLitterSize] = NULL;
1331  if (m_myLitterSize == 0) m_lactating = false;
1332  return;
1333  }
1334  }
1335  // If we get here there is an error
1336  m_OurLandscape->Warn("Rabbit_Female::Weaned","unknown litter member");
1337  exit(1);
1338 }
1339 //---------------------------------------------------------------------------
1340 
1341 //*************************************************************************************
1342 //**************** PESTICIDE RESPONSE CODE FOR ALL RABBIT CLASSES IS HERE *************
1343 //*************************************************************************************
1344 
1351  double pesticideInternalConc = m_pesticide_burden / m_weight;
1352 
1353  if (pesticideInternalConc > cfg_RabbitPesticideResponse.value()) {
1354  switch (tp) {
1355  case ttop_NoPesticide:
1356  break;
1358  break;
1359  case ttop_AcuteEffects:
1360  GeneralOrganoPhosphate( pesticideInternalConc ); // Calls the GeneralOrganophosphate action code
1361  break;
1362  default:
1363  g_msg->Warn( "Unknown pesticide type used in Rabbit_Juvenile::InternalPesticideHandlingAndResponse() pesticide code ", int( tp ) );
1364  exit( 47 );
1365  }
1366  }
1367  m_pesticide_burden *= m_pesticidedegradationrate; // Does nothing by default except internal degredation of the pesticide
1368 }
1369 
1376  double pesticideInternalConc = m_pesticide_burden / m_weight;
1377 
1378  if (pesticideInternalConc > cfg_RabbitPesticideResponse.value()) {
1379  switch (tp) {
1380  case ttop_NoPesticide:
1381  break;
1383  break;
1384  case ttop_AcuteEffects:
1385  GeneralOrganoPhosphate( pesticideInternalConc ); // Calls the GeneralOrganophosphate action code
1386  break;
1387  default:
1388  g_msg->Warn( "Unknown pesticide type used in Rabbit_Male::InternalPesticideHandlingAndResponse() pesticide code ", int( tp ) );
1389  exit( 47 );
1390  }
1391  }
1392  m_pesticide_burden *= m_pesticidedegradationrate; // Does nothing by default except internal degredation of the pesticide
1393 }
1394 
1401  double pesticideInternalConc = m_pesticide_burden / m_weight;
1402 
1403  if (pesticideInternalConc > cfg_RabbitPesticideResponse.value()) {
1404  switch (tp) {
1405  case ttop_NoPesticide:
1406  break;
1408  GeneralEndocrineDisruptor( pesticideInternalConc ); // Calls the EndocrineDisruptor action code
1409  break;
1410  case ttop_AcuteEffects:
1411  GeneralOrganoPhosphate( pesticideInternalConc ); // Calls the GeneralOrganophosphate action code
1412  break;
1413  default:
1414  g_msg->Warn( "Unknown pesticide type used in Rabbit_Female::InternalPesticideHandlingAndResponse() pesticide code ", int( tp ) );
1415  exit( 47 );
1416  }
1417  }
1418  m_pesticide_burden *= m_pesticidedegradationrate; // Does nothing by default except internal degredation of the pesticide
1419 }
1420 //-------------------------------------------------------------------------------------
1421 //-------------------- GENERAL ENDOCRINE DISRUPTOR EFFECT CODE ------------------------
1422 //-------------------------------------------------------------------------------------
1423 
1424 void Rabbit_Female::GeneralEndocrineDisruptor( double /* a_dose */ ) {
1428  // May also wish to specify certain gestation days for the effects here
1429  if (m_gestationcounter > 0) {
1430  m_pesticideInfluenced1 = true;
1431  }
1432 }
1433 
1434 //-------------------------------------------------------------------------------------
1435 //------------------------ GENERAL ORGANOPHOSPHATE EFFECT CODE ------------------------
1436 //-------------------------------------------------------------------------------------
1437 
1438 void Rabbit_Base::GeneralOrganoPhosphate( double /* a_dose */ ) {
1439  //if (g_rand_uni() > l_pest_daily_mort.value()) return;
1442  m_StepDone = true;
1443  return;
1444 }
1445 
1446 //*************************************************************************************
1447 //************************** END PESTICIDE RESPONSE CODE ******************************
1448 //*************************************************************************************
1449 
1450 
1451 //********************************************************************************************************************
1452 // Rabbit_Warren
1453 //********************************************************************************************************************
1454 
1455 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)
1456 {
1458  m_OurPopulationManager = p_NPM;
1459  m_size = a_size;
1460  m_maintenence = 0;
1461  m_NoOccupiedBurrows = 0;
1463  m_CarryingCapacity = 0;
1464  m_CarryingCapacityRatio = -1; // No effect for the first period until it is properly calculated
1465  m_InhabitantsList.resize(0);
1466  m_soiltype = a_soil;
1468  m_diseaseconstant = 0.0;
1470  m_BigFemaleRabbitsR = 0.0;
1471  m_runningavCount=0;
1472  m_runningavFemales = 0;
1476  m_Location_x = m_Location_x + (m_size / 2);
1477  m_Location_y = m_Location_y + (m_size / 2);
1478  // Now get the forage size.
1479  m_foragesize = m_size * 2;
1480  m_TL_x = m_Location_x - (m_foragesize / 2);
1481  if (m_TL_x < 0) m_TL_x = 0;
1482  m_TL_y = m_Location_x - (m_foragesize / 2);
1483  if (m_TL_y < 0) m_TL_y = 0;
1487  InitEvaluation();
1488 }
1489 //---------------------------------------------------------------------------
1490 
1492 {
1493  ;
1494 }
1495 //---------------------------------------------------------------------------
1496 
1498 {
1511  for (int i=m_TL_x; i<m_TL_x + m_foragesize; i++)
1512  {
1513  for (int j=m_TL_y; j<m_TL_y + m_foragesize; j++)
1514  {
1518  int PRef = m_OurLandscape->SupplyPolyRef(i,j);
1519  bool found=false;
1520  for (vector<RabbitWarrenLEInfo>::size_type k=0; k<m_LEList.size(); k++)
1521  {
1522  if (m_LEList[k].m_ref == PRef)
1523  {
1524  m_LEList[k].m_area++;
1525  found = true;
1526  break;
1527  }
1528  }
1529  if (!found)
1530  {
1531  RabbitWarrenLEInfo a_ele;
1532  a_ele.m_ref = PRef;
1533  a_ele.m_area = 1;
1535  a_ele.m_pesticide_conc = 0;
1536  a_ele.m_forage = 0;
1537  a_ele.m_foragearea = 0;
1538  // don't have this one
1539  m_LEList.push_back(a_ele);
1540  }
1541  }
1542  }
1544  for (vector<RabbitWarrenLEInfo>::size_type k=0; k<m_LEList.size(); k++)
1545  {
1546  TTypesOfLandscapeElement tole = m_LEList[k].m_ele->GetElementType();
1547  m_LEList[k].m_torh = m_OurPopulationManager->ClassifyHabitat(tole);
1548  // Do a little bit of forage managing here
1549  if (m_LEList[k].m_torh == torh_Forage) m_LEList[k].m_foragearea = m_LEList[k].m_area;
1550  else if (m_LEList[k].m_torh == torh_TemporaryForage)
1551  {
1552  // We assume only 50 m strip of fields is usable
1553  int fr = 50 * m_size;
1554  if (m_LEList[k].m_area < fr) fr = m_LEList[k].m_area;
1555  m_LEList[k].m_foragearea = fr;
1556  }
1557  else m_LEList[k].m_foragearea = 0;
1558  }
1562  double minpct = 1.0 / 16.0; // Divide by 16 because the minimum is based on 1/16th of the area used for forage
1563  double pct = m_foragearea/ (double) (m_foragesize * m_foragesize);
1564  if (pct<minpct)
1565  {
1566  // We have a problem, no rabbits can be here
1567  m_CarryingCapacity = 0;
1568  return;
1569  }
1570  if (pct > 0.9) pct = 0.9;
1571  // 1 is the lowest density until soil type is taken into account
1572  // We use the diff between min and actual pct cover, and then add pro-rata the extra proportion of 12 pairs
1573  // NB minpct must never be >= 0.9
1574  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
1575  if (m_soiltype == 0) m_CarryingCapacity /= 2;
1576  m_NoBurrows = 0;
1578  m_CarryingCapacityR2 = m_CarryingCapacityR / 2.0; // Done here once to prevent it being recalculated possibly a lot of times later.
1579 
1580 }
1581 //---------------------------------------------------------------------------
1582 
1584 {
1597  // Get the numbers we need
1598  unsigned totalrabbits = m_OurPopulationManager->SupplyAllBigRabbits();
1599  unsigned warrens = m_OurPopulationManager->GetLiveArraySize(rob_Warren);
1600  // Some of this should be done by the population managerfor efficiency but it is here to keep it together.
1601  //The big chance based on global density
1602  double prob_density = (totalrabbits / (double)warrens) * (totalrabbits / (double)warrens) * cfg_globaldisease_probability.value();
1603  // Now the local stuff
1604  m_diseaseconstant = prob_density * GetCarryingCapacityRatio();
1605 }
1606 //---------------------------------------------------------------------------
1607 
1617  m_forageP = 0.0;
1618  if (!m_OurLandscape->SupplyPesticideDecay(ppp_1)) return;
1619  for (int i = m_TL_x; i < m_TL_x + m_foragesize; i++) {
1620  for (int j = m_TL_y; j < m_TL_y + m_foragesize; j++) {
1621  // Unfortunately we need to check for each square whether the rabbit can forage here.
1622  int ele = m_OurLandscape->SupplyPolyRef( i, j );
1623  for (vector<RabbitWarrenLEInfo>::size_type k = 0; k < m_LEList.size(); k++) {
1624  if (m_LEList[ k ].m_ref == ele) {
1625  if (m_LEList[ k ].m_forage > 0.0) {
1626 #ifdef __RABBITMEANPESTICIDECONC
1628 #else
1629  double pe = m_OurLandscape->SupplyPesticide( i, j , ppp_1);
1630  if (m_forageP< pe ) m_forageP = pe;
1631 #endif
1632  }
1633  break;
1634  }
1635  }
1636  }
1637  }
1638  // Now calculate the mean concentration and mean forage concentration if needed
1639 #ifdef __RABBITMEANPESTICIDECONC
1640  m_forageP /= (double)m_availableforage;
1641 #endif
1642 }
1643 //---------------------------------------------------------------------------
1644 
1653  double availableforage = m_permforagearea;
1654  for (vector<RabbitWarrenLEInfo>::size_type k = 0; k < m_LEList.size(); k++) {
1655  if (m_LEList[ k ].m_torh == torh_TemporaryForage) {
1656  double vegheight = m_OurLandscape->SupplyVegHeight( m_LEList[ k ].m_ref ); // m_ref is the landscape polyref
1657  double vegdigestability = m_OurLandscape->SupplyVegDigestability( m_LEList[ k ].m_ref );
1658  if ((vegheight < m_maxForageHeight) && (vegdigestability > m_minForageDigestability)) {
1659  // 30 cm
1660  m_LEList[ k ].m_forage = m_LEList[ k ].m_foragearea;
1661  availableforage += m_LEList[ k ].m_foragearea;
1662  }
1663  else m_LEList[ k ].m_forage = 0.0;
1664  }
1665  }
1666  // Only do the expensive pesticide update if there is a chance that there is some pesticide to work with
1668 
1671  m_CarryingCapacityRatio = CalcCarryingCapacityRatio2(); // Normally this is the same as m_BigFemaleRabbitsR, which gets bigger as rabbits get close to CC
1672  }
1673  m_foragearearatio = availableforage / m_foragearea;
1677  }
1678  else {
1679  m_availableforage = 1.0;
1680  m_inv_availableforage = 0.0;
1681  }
1684  }
1685 }
1686 //---------------------------------------------------------------------------
1687 
1689  m_BigFemaleRabbitsR = GetAllBigFemaleRabbits() / (m_CarryingCapacityR2); // m_CarryingCapacityR is (m_CarryingCapacity * cfg_rabbitdendepscaler.value())/2
1690 }
1691 
1702 #ifdef __EnclosureTest
1703  double CCRatio = m_BigFemaleRabbitsR;
1704  int nsz = (int)m_LocalWarrenNetwork.size();
1705  for (int i = 0; i < nsz; i++) {
1706  CCRatio += m_LocalWarrenNetwork[i].m_aWarren->GetCCRabbitsR();
1707  }
1708  CCRatio /= (nsz + 1);
1709  return CCRatio;
1710 #endif
1711  return m_BigFemaleRabbitsR; // Is the number of big female rabbits / ((m_CarryingCapacity * cfg_rabbitdendepscaler.value())/2)
1712 }
1713 
1714 
1716 {
1717  int nsz = (int) m_LocalWarrenNetwork.size();
1721  random_shuffle (m_LocalWarrenNetwork.begin(), m_LocalWarrenNetwork.end() );
1722  for (int i=0; i< nsz; i++ )
1723  {
1724  // Probability calculated as m_size/dist
1725  m_LocalWarrenNetwork[i].m_visitprob = m_foragesize / (double) (m_LocalWarrenNetwork[i].m_dist);
1726  }
1727 }
1728 //---------------------------------------------------------------------------
1729 
1731 {
1735  int area = 0;
1736  for (vector<RabbitWarrenLEInfo>::size_type k = 0; k<m_LEList.size(); k++)
1737  {
1738  area += m_LEList[k].m_foragearea;
1739  }
1740  return area;
1741 }
1742 //---------------------------------------------------------------------------
1743 
1745 {
1749  int area = 0;
1750  for (vector<RabbitWarrenLEInfo>::size_type k = 0; k<m_LEList.size(); k++)
1751  {
1752  if (m_LEList[k].m_torh == torh_Forage) area += m_LEList[k].m_area;
1753  }
1754  return area;
1755 }
1756 //---------------------------------------------------------------------------
1757 
1759 {
1763  int area = 0;
1764  for (vector<RabbitWarrenLEInfo>::size_type k=0; k<m_LEList.size(); k++)
1765  {
1766  if (m_LEList[k].m_torh == torh_TemporaryForage) area += m_LEList[k].m_area;
1767  }
1768  return area;
1769 }
1770 //---------------------------------------------------------------------------
1771 
1773 {
1777  int area = 0;
1778  for (vector<RabbitWarrenLEInfo>::size_type k=0; k<m_LEList.size(); k++)
1779  {
1780  if (m_LEList[k].m_torh == torh_Cover) area += m_LEList[k].m_area;
1781  }
1782  return area;
1783 }
1784 //---------------------------------------------------------------------------
1785 
1787 {
1791  int area = 0;
1792  for (vector<RabbitWarrenLEInfo>::size_type k=0; k<m_LEList.size(); k++)
1793  {
1794  if (m_LEList[k].m_torh == torh_TemporaryForage)
1795  {
1796  if (m_LEList[k].m_ele->GetVegHeight() < m_maxForageHeight )
1797  {
1798  area += m_LEList[k].m_area;
1799  }
1800  }
1801  }
1802  return area;
1803 }
1804 //---------------------------------------------------------------------------
1805 
1810  int area = 0;
1811  for (vector<RabbitWarrenLEInfo>::size_type k = 0; k<m_LEList.size(); k++) {
1812  if (m_LEList[ k ].m_ele->GetVegHeight() >= m_maxForageHeight) {
1813  if (m_LEList[ k ].m_torh != torh_Other) area += m_LEList[ k ].m_area;
1814  }
1815  }
1816  return area;
1817 }
1818 //---------------------------------------------------------------------------
1819 
1820 
1827  m_breedingfemales = 0;
1829  m_1yrOldFemales = 0;
1830  m_littersthisyear = 0;
1831  int sz = static_cast<int>(m_InhabitantsList.size());
1832  for (int r = 0; r < sz; r++) {
1833  if (m_InhabitantsList[ r ]->GetRabbitType() == rob_Female) {
1834  if (m_InhabitantsList[ r ]->GetAge() < 300) {
1835  m_1yrOldFemales++;
1836  }else{
1837  int litters = dynamic_cast<Rabbit_Female*>(m_InhabitantsList[ r ])->GetLittersThisYear();
1838  if (litters > 0) m_breedingfemales++; else m_nonbreedingfemales++;
1839  m_littersthisyear += litters;
1840  }
1841  }
1842  }
1843 }
1844 //---------------------------------------------------------------------------
1845 
1847 {
1848  if (m_StepDone || m_CurrentStateNo == -1) return;
1849  switch (m_CurrentRState)
1850  {
1851  case toRabbits_InitialState:
1853  break;
1854  case toRabbits_WarrenBeing: // Being state is never left for warrens - 'they just are'
1855  st_WarrenBeing();
1856  m_StepDone=true;
1857  break;
1858  default:
1859  m_OurLandscape->Warn("Rabbit_Warren::Step()","unknown state - default");
1860  exit(1);
1861  }
1862 }
1863 //---------------------------------------------------------------------------
1864 
1866 {
1877 #ifdef __RABBITDEBUG
1879 #endif
1880 
1881  if (m_InhabitantsList.size() == 0)
1882  {
1883  m_maintenence -= 2 - m_soiltype; // Double rate of maintenence for light soil
1884  }
1886  if (m_maintenence < 0)
1887  {
1889  if (m_NoBurrows > 0) m_NoBurrows--;
1890  }
1891  // Dominance check
1892  UpdateDominance();
1893  // Food update
1895  // Now calculates the mortality chance for today
1896  double foragemult = 0;
1897  if (!m_OurPopulationManager->GetForageDay()) foragemult = 1 + cfg_forageareamortscaler.value(); // *(1 - m_availableforage); // m_foragearearatio is 0-1 and larger available forage is reduced.
1898  m_mortalitymultiplierA = 1 + m_diseaseconstant + foragemult; // Disease is the only density dependent death for adults
1899  // We need to de-couple mortality of juveniles and density
1900  m_mortalitymultiplierJ = 1 + foragemult;
1901 #ifdef __RABBITDEBUG
1903 #endif
1904  // Keep track of breeding females for POM
1906  m_runningavCount++;
1908  }
1909 }
1910 //---------------------------------------------------------------------------
1911 
1912 
1914 {
1919  // Pick a warren
1920  int nsz = (int) m_LocalWarrenNetwork.size();
1921  int loopstart = (int) floor(nsz * g_rand_uni());
1922  for (int i=0; i< nsz; i++ )
1923  {
1924  double chance = g_rand_uni();
1925  int index = (i + loopstart);
1926  if (index >= nsz) index-=nsz;
1927  if (chance>m_LocalWarrenNetwork[i].m_visitprob)
1928  {
1929  return m_LocalWarrenNetwork[i].m_aWarren;
1930  }
1931  }
1932  return NULL;
1933 }
1934 //---------------------------------------------------------------------------
1935 
1941  int sz = (int)m_InhabitantsList.size();
1942  for (int i = 0; i<sz; i++) {
1943  if (m_InhabitantsList[ i ]->GetRabbitType() == rob_Female) {
1944  if (dynamic_cast<Rabbit_Female*>(m_InhabitantsList[ i ])->GetSocialStatus() == rabbit_socialstatus_subdominant) return;
1945  }
1946  }
1947  // If we get here we have no dominant female, so see if one can be created.
1949 }
1950 //---------------------------------------------------------------------------
1951 
1956  Rabbit_Female* rfemale = NULL;
1957  Rabbit_Female* rfemaleBig = NULL;
1958  int bigWeight = 0;
1959  int sz = (int)m_InhabitantsList.size();
1960  for (int i = 0; i < sz; i++) {
1961  if (m_InhabitantsList[ i ]->GetRabbitType() == rob_Female) {
1962  rfemale = dynamic_cast<Rabbit_Female*>(m_InhabitantsList[ i ]);
1964  if (rfemale->GetweightAge() >= 300) { // 300 represents max growth
1966  return;
1967  }
1968  else if (rfemale->GetweightAge() > bigWeight) {
1969  bigWeight = rfemale->GetweightAge();
1970  rfemaleBig = rfemale;
1971  }
1972  }
1973  }
1974  }
1975  if (rfemaleBig!=NULL) rfemaleBig->SetSocialStatus( rabbit_socialstatus_dominant );
1976 }
1977 //---------------------------------------------------------------------------
1978 
1984  int sz = (int)m_InhabitantsList.size();
1985  for (int i = 0; i<sz; i++) {
1986  if (m_InhabitantsList[ i ]->GetRabbitType() == rob_Female) {
1987  if (m_InhabitantsList[ i ]->GetMate() == NULL) {
1988  if ((m_InhabitantsList[ i ]->GetHasBurrow()) || (m_InhabitantsList[ i ]->GetDigging() > -1)) return true;
1989  }
1990  }
1991  }
1992  return false;
1993 }
1994 //---------------------------------------------------------------------------
1995 
1997 {
2002  int sz = (int) m_InhabitantsList.size();
2003  for (int i=0; i<sz; i++)
2004  {
2005  if (m_InhabitantsList[i] == a_rabbit )
2006  {
2007  return true;
2008  }
2009  }
2010  return false;
2011 }
2012 //---------------------------------------------------------------------------
2013 
2015 {
2020  int sz = (int) m_InhabitantsList.size();
2021  for (int i=0; i<sz; i++)
2022  {
2023  if ( m_InhabitantsList[i]->GetRabbitType() == rob_Male )
2024  {
2025  if ( m_InhabitantsList[i]->GetMate()==NULL )
2026  {
2027  if ( (m_InhabitantsList[i]->GetHasBurrow() ) || ( m_InhabitantsList[i]->GetDigging() > -1) ) return true;
2028  }
2029  }
2030  }
2031  return false;
2032 }
2033 //---------------------------------------------------------------------------
2034 
2036 {
2045 #ifdef __RABBITDEBUG
2046  this->DEBUG_InternalTest();
2047 #endif
2048 
2050  {
2051 #ifdef __RABBITDEBUG
2052  this->DEBUG_InternalTest2();
2053 #endif
2054  return 1; // There is a free burrow
2055  }
2057  return 0;
2058 }
2059 //---------------------------------------------------------------------------
2060 
2062 {
2064  m_InhabitantsList.push_back(a_rabbit);
2065  a_rabbit->SetWarren(this);
2066 }
2067 //---------------------------------------------------------------------------
2068 
2070 {
2072  m_NoBurrows++;
2074 }
2075 //---------------------------------------------------------------------------
2076 
2078 {
2080 }
2081 //---------------------------------------------------------------------------
2082 
2084 {
2086  a_rabbit->SetDigging( m_rabbitdiggingtime ); // Heavy soil has double digging time
2087  Join(a_rabbit);
2088 }
2089 //---------------------------------------------------------------------------
2090 
2092 {
2094 #ifdef __RABBITDEBUG
2095  // Do some safety checks here.
2096  if ((m_NoBurrows <= m_NoOccupiedBurrows) && (m_NoBurrows!=0))
2097  {
2098  m_OurLandscape->Warn("Rabbit_Warren::JoinNOccupy","Attempt to occupy a burrow that is occupied or does not exist.");
2099  exit(1);
2100  }
2101 #endif
2102 #ifdef __RABBITDEBUG
2103  this->DEBUG_InternalTest2();
2104 #endif
2105  Join(a_rabbit);
2106  OccupyBurrow( );
2107  a_rabbit->SetDigging(-1);
2109  a_rabbit->SetHasBurrow( true );
2110 
2111 #ifdef __RABBITDEBUG
2112  this->DEBUG_InternalTest();
2113 #endif
2114 }
2115 //---------------------------------------------------------------------------
2116 
2118 {
2124  int sz = (int) m_InhabitantsList.size();
2125  for (int i=0; i<sz; i++)
2126  {
2127  if (m_InhabitantsList[i]==a_rabbit)
2128  {
2129  // Found the rabbit.
2130 #ifdef __RABBITDEBUG
2131  // Do some safety checks here.
2132  if ( (a_rabbit->GetRabbitType() >= rob_Male ) && (a_rabbit->GetCurrentRState() != toRabbits_Die) )
2133  {
2134  if ((a_rabbit->GetMate()!=NULL) && (a_rabbit->GetCurrentStateNo() != -1))
2135  {
2136  m_OurLandscape->Warn("Rabbit_Warren::Leave","Attempt to leave a warren with a mate.");
2137  exit(1);
2138  }
2139  // Do some safety checks here.
2140  if ((m_InhabitantsList[i]->GetHasBurrow()) && (a_rabbit->GetMate() != NULL) && (a_rabbit->GetCurrentStateNo() != -1))
2141  {
2142  m_OurLandscape->Warn("Rabbit_Warren::Leave","Attempt to leave a warren with a burrow and mate.");
2143  exit(1);
2144  }
2145  }
2146 #endif
2147  if (a_rabbit->GetRabbitType() > rob_Juvenile)
2148  {
2149  if ((a_rabbit->GetHasBurrow()) && (a_rabbit->GetMate() == NULL)) {
2150  // Single burrow occupier leaving
2152  a_rabbit->SetHasBurrow( false );
2153  }
2154  if ((a_rabbit->GetDigging()!=-1) && (a_rabbit->GetMate() == NULL)) {
2155  // Single digger leaving
2157  a_rabbit->SetDigging( -1 );
2158  }
2159  }
2160  a_rabbit->SetWarren(NULL);
2161  // remove the rabbit from the warren list
2162  m_InhabitantsList.erase(m_InhabitantsList.begin() + i);
2163  break;
2164  }
2165  }
2166 }
2167 //---------------------------------------------------------------------------
2168 
2170 {
2174 #ifdef __RABBITDEBUG
2175  this->DEBUG_InternalTest();
2176 #endif
2177  int sz = (int) m_InhabitantsList.size();
2178  for (int i=0; i<sz; i++)
2179  {
2180  Rabbit_Adult * p_rabAdult = dynamic_cast<Rabbit_Adult*>(m_InhabitantsList[ i ]);
2181  if ((m_InhabitantsList[ i ]->GetRabbitType() == rob_type) && (p_rabAdult->GetMate() == NULL))
2182  {
2183  if (p_rabAdult->GetHasBurrow())
2184  {
2185 #ifdef __RABBITDEBUG
2186  if (p_rabAdult->GetDigging() != -1)
2187  {
2188  int rubbish = 0;
2189  }
2190 #endif
2191  a_mate->SetDigging( -1 );
2192  a_mate->SetMate( p_rabAdult );
2193  p_rabAdult->SetMate( a_mate );
2194  // If the rabbit already has a burrow then we have a free one now
2195  if (a_mate->GetHasBurrow()) {
2197  }
2198  else a_mate->SetHasBurrow( true );
2201  break;
2202  }
2203  else
2204  if (p_rabAdult->GetDigging() > -1)
2205  {
2206  a_mate->SetMate(dynamic_cast<Rabbit_Adult*>(m_InhabitantsList[i]));
2207  p_rabAdult->SetMate( a_mate );
2208  int digging = p_rabAdult->GetDigging() / 2; // We have help so half the time
2209  p_rabAdult->SetDigging( digging );
2210  a_mate->SetDigging(digging);
2213  break;
2214  }
2215  // Else they are not interesting and we ignore them
2216  }
2217  }
2218 #ifdef __RABBITDEBUG
2219  this->DEBUG_InternalTest();
2220 #endif
2221 }
2222 //---------------------------------------------------------------------------
2223 
2225 {
2230 #ifdef __RABBITDEBUG
2231  this->DEBUG_InternalTest();
2232 #endif
2233  int sz = (int) m_InhabitantsList.size();
2234  for (int r=0; r<sz; r++)
2235  {
2236  Rabbit_Adult* p_rabAdult = dynamic_cast<Rabbit_Adult*>(m_InhabitantsList[ r ]);
2237  if ((m_InhabitantsList[r]->GetRabbitType() == rob_type) && (p_rabAdult->GetMate() == NULL) )
2238  {
2239 #ifdef __RABBITDEBUG
2240  this->DEBUG_InternalTest();
2241 #endif
2242  if (p_rabAdult->GetHasBurrow())
2243  {
2244  a_mate->SetDigging(-1);
2245  a_mate->SetMate(dynamic_cast<Rabbit_Adult*>(m_InhabitantsList[r]));
2246  a_mate->SetHasBurrow(true);
2249  p_rabAdult->SetMate( a_mate );
2250  Join(a_mate);
2251  break;
2252  }
2253  else
2254  if (p_rabAdult->GetDigging() > -1)
2255  {
2256  a_mate->SetMate( p_rabAdult );
2259  p_rabAdult->SetMate( a_mate );
2260  int digging = p_rabAdult->GetDigging();
2261  a_mate->SetDigging(digging);
2262  Join(a_mate);
2263  break;
2264  }
2265 
2266  }
2267  }
2268 #ifdef __RABBITDEBUG
2269  this->DEBUG_InternalTest();
2270 #endif
2271 }
2272 //---------------------------------------------------------------------------
2273 
2275  int breeders = 0;
2276  int sz = (int)m_InhabitantsList.size();
2277  for (int i = 0; i < sz; i++) {
2278  if (m_InhabitantsList[ i ]->GetRabbitType() == rob_Female) {
2279  if (dynamic_cast<Rabbit_Female*>(m_InhabitantsList[ i ])->GetSocialStatus()>rabbit_socialstatus_subordinate) breeders++;
2280  }
2281  }
2282  return breeders;
2283 }
2284 //---------------------------------------------------------------------------
2285 
2287  int biggies = 0;
2288  int sz = (int)m_InhabitantsList.size();
2289  for (int i = 0; i < sz; i++) {
2290  if (m_InhabitantsList[ i ]->GetRabbitType() == rob_Female) {
2291  if (m_InhabitantsList[ i ]->GetAge()>300) biggies++;
2292  }
2293  }
2294  return biggies;
2295 }
2296 //---------------------------------------------------------------------------
2297 
2299 {
2300  int Mburrs = 0;
2301  int Mmates = 0;
2302  int MBM = 0;
2303  int Fburrs = 0;
2304  int Fmates = 0;
2305  int FBM = 0;
2306  int siz = (int) m_InhabitantsList.size();
2307  int Mdigs = 0;
2308  int Fdigs = 0;
2309  for (int i = 0; i<siz; i++)
2310  {
2311  if (m_InhabitantsList[i]->GetCurrentStateNo() != -1)
2312  {
2313  if (m_InhabitantsList[i]->GetRabbitType() == rob_Male)
2314  {
2315  if (m_InhabitantsList[i]->GetHasBurrow()) Mburrs++; // No males with burrow
2316  if (m_InhabitantsList[i]->GetDigging()>-1) Mdigs++; // No males digging
2317  if (dynamic_cast<Rabbit_Adult*>(m_InhabitantsList[i])->GetMate() != NULL) Mmates++; // No males with mates
2318  if ((dynamic_cast<Rabbit_Adult*>(m_InhabitantsList[i])->GetMate() != NULL) && (m_InhabitantsList[i]->GetHasBurrow())) MBM++; // No males with mates and burrows
2319  }
2320  if (m_InhabitantsList[i]->GetRabbitType() == rob_Female)
2321  {
2322  if (m_InhabitantsList[i]->GetHasBurrow()) Fburrs++;
2323  if (m_InhabitantsList[i]->GetDigging() > -1) Fdigs++;
2324  if (dynamic_cast<Rabbit_Adult*>(m_InhabitantsList[i])->GetMate() != NULL) Fmates++;
2325  if ((dynamic_cast<Rabbit_Adult*>(m_InhabitantsList[i])->GetMate() != NULL) && (m_InhabitantsList[i]->GetHasBurrow())) FBM++;
2326  }
2327  }
2328  }
2329  int alonemales = Mburrs-MBM;
2330  int alonefemales = Fburrs-FBM;
2331  if (MBM != FBM)
2332  {
2333  m_OurLandscape->Warn("IsFreeBurrow","Inconsistent mates and burrows MBM != FBM.");
2334  exit(1);
2335  }
2336  if (MBM + alonemales + alonefemales > m_NoBurrows)
2337  {
2338  m_OurLandscape->Warn("IsFreeBurrow","Too many burrows occupied.");
2339  exit(1);
2340  }
2341  if (MBM + alonemales + alonefemales != this->m_NoOccupiedBurrows)
2342  {
2343  m_OurLandscape->Warn("IsFreeBurrow","Too many burrows occupied.");
2344  exit(1);
2345  }
2346  return true;
2347 }
2348 //---------------------------------------------------------------------------
2349 
2351 {
2352  int Mburrs = 0;
2353  int Mmates = 0;
2354  int MBM = 0;
2355  int Fburrs = 0;
2356  int Fmates = 0;
2357  int FBM = 0;
2358  int siz = (int) m_InhabitantsList.size();
2359  for (int i=0; i<siz; i++)
2360  {
2361  if ( m_InhabitantsList[i]->GetRabbitType() == rob_Male)
2362  {
2363  if ( m_InhabitantsList[i]->GetHasBurrow()) Mburrs++;
2364  if ( dynamic_cast<Rabbit_Adult*>(m_InhabitantsList[i])->GetMate()!= NULL) Mmates++;
2365  if (( dynamic_cast<Rabbit_Adult*>(m_InhabitantsList[i])->GetMate()!= NULL) && (m_InhabitantsList[i]->GetHasBurrow())) MBM++;
2366  }
2367  if ( m_InhabitantsList[i]->GetRabbitType() == rob_Female)
2368  {
2369  if ( m_InhabitantsList[i]->GetHasBurrow()) Fburrs++;
2370  if ( dynamic_cast<Rabbit_Adult*>(m_InhabitantsList[i])->GetMate()!= NULL) Fmates++;
2371  if (( dynamic_cast<Rabbit_Adult*>(m_InhabitantsList[i])->GetMate()!= NULL) && (m_InhabitantsList[i]->GetHasBurrow())) FBM++;
2372  }
2373  }
2374  int alonemales = Mburrs-MBM;
2375  int alonefemales = Fburrs-FBM;
2376  if (MBM + alonemales + alonefemales >= m_NoBurrows)
2377  {
2378  m_OurLandscape->Warn("IsFreeBurrow","Too many burrows occupied.");
2379  exit(1);
2380  }
2381  return true;
2382 }
2383 //---------------------------------------------------------------------------
2384 
RabbitMemoryLocation
The information needed to hold a single rabbit memory.
Definition: Rabbit.h:131
Rabbit_Warren::m_diseaseconstant
double m_diseaseconstant
a measure of disease mortality likelihood
Definition: Rabbit.h:738
ttop_ReproductiveEffects
Definition: landscape.h:69
RabbitObjectTypes
RabbitObjectTypes
Definition: Rabbit.h:68
Rabbit_Female::InternalPesticideHandlingAndResponse
virtual void InternalPesticideHandlingAndResponse()
Handles internal effects of pesticide exposure - reimplemented from base class.
Definition: Rabbit.cpp:1395
Rabbit_Warren::IsFreeFemale
bool IsFreeFemale(void)
Returns true if there is a female with a burrow and no mate.
Definition: Rabbit.cpp:1979
Rabbit_Base::SetWarren
void SetWarren(Rabbit_Warren *a_warren)
Set the warren pointer.
Definition: Rabbit.h:238
Landscape::SupplyVegDigestability
double SupplyVegDigestability(int a_polyref)
Definition: landscape.h:919
Rabbit_Base::st_Dying
virtual void st_Dying(void)
Default dying state.
Definition: Rabbit.cpp:187
Rabbit_Female::m_MyOffspring
int m_MyOffspring
The total number of kits born to her.
Definition: Rabbit.h:503
Landscape::SupplyLEPointer
LE * SupplyLEPointer(int a_polyref)
Definition: landscape.h:1099
Rabbit_Base::m_haveBurrow
bool m_haveBurrow
Flag to record burrow status.
Definition: Rabbit.h:185
Rabbit_Base::OnFed
void OnFed(void)
Signals food arrived today.
Definition: Rabbit.h:276
rabbit_socialstatus_subdominant
Definition: Rabbit.h:114
Rabbit_Warren::GetTemporaryForageArea
int GetTemporaryForageArea(void)
Returns the total area of temporary forage.
Definition: Rabbit.cpp:1758
Rabbit_Young::BeingStep
virtual void BeingStep(void)
The BeginStep is the first 'part' of the timestep that an animal can behave in.
Definition: Rabbit.cpp:305
Rabbit_Female::m_gestationcounter
int m_gestationcounter
Counter to record the number of days gestating.
Definition: Rabbit.h:493
toRabbits_Mature
Definition: Rabbit.h:86
Rabbit_Warren::IsFreeBurrow
int IsFreeBurrow(void)
Is there a vacent burrow?
Definition: Rabbit.cpp:2035
cfg_rabbitmaxwarrensize
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.
Rabbit_Base::SetHasBurrow
void SetHasBurrow(bool a_status)
Set/unset burrow status.
Definition: Rabbit.h:246
Rabbit_Adult::m_socialstatus
TTypesOfRabbitSocialStatus m_socialstatus
Flag to record dominance status (0-4)
Definition: Rabbit.h:405
Rabbit_Young::Step
virtual void Step(void)
The Step is the second 'part' of the timestep that an animal can behave in. It is called continuously...
Definition: Rabbit.cpp:316
cfg_minForageDigestability
CfgFloat cfg_minForageDigestability("RABBIT_MINFORAGEDIGESTABILITY", CFG_CUSTOM, 0.50)
Input variable. Input variable. The minimum digestability desirable for forage vegetation.
Rabbit_Juvenile::InternalPesticideHandlingAndResponse
virtual void InternalPesticideHandlingAndResponse()
Handles internal effects of pesticide exposure - reimplemented from base class.
Definition: Rabbit.cpp:1345
Landscape::SupplyPesticideDecay
bool SupplyPesticideDecay(PlantProtectionProducts a_ppp)
Returns true if there is any pesticide in the system at all at this point.
Definition: Landscape.cpp:776
Rabbit_Warren::UpdateThisYearsBreeders
void UpdateThisYearsBreeders()
Calculates and stores the number of breeders and non-breeders.
Definition: Rabbit.cpp:1821
struct_Rabbit::m_y
int m_y
y-coord
Definition: Rabbit_Population_Manager.h:64
cfg_forageareamortscaler
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 ...
Rabbit_Warren::m_rabbitdiggingtime
int m_rabbitdiggingtime
The time taken for burrow construction.
Definition: Rabbit.h:722
Rabbit_Warren::m_foragesize
int m_foragesize
Warren forage size in m.
Definition: Rabbit.h:696
Rabbit_Warren::m_permforagearea
int m_permforagearea
Variable holding the total permanent forage area.
Definition: Rabbit.h:724
toRabbits_Lactating
Definition: Rabbit.h:89
Rabbit_Base::GetHasBurrow
bool GetHasBurrow(void)
Get burrow status.
Definition: Rabbit.h:242
Rabbit_Female::st_Lactating
virtual TTypeOfRabbitState st_Lactating(void)
Female lactating state.
Definition: Rabbit.cpp:1266
Rabbit_Warren::UpdateDominance
void UpdateDominance(void)
Checks for a dominant female and promotes one if necessary and possible.
Definition: Rabbit.cpp:1936
Rabbit_Warren::m_inv_availableforage
double m_inv_availableforage
The inverse of m_availableforage, prevents multiple re-calculation.
Definition: Rabbit.h:732
g_rand_uni
boost::variate_generator< base_generator_type &, boost::uniform_real<> > g_rand_uni
Rabbit_Base::WalkTo
bool WalkTo(int a_x, int a_y)
Walks to a location from current location.
Definition: Rabbit.cpp:205
Rabbit_Base::m_pesticideInfluenced1
bool m_pesticideInfluenced1
Flag to indicate pesticide effects (e.g. can be used for endocrine distruptors with delayed effects u...
Definition: Rabbit.h:205
Rabbit_Population_Manager::PesticideDeathRecord
void PesticideDeathRecord(RabbitObjectTypes ob_type)
Records pesticide poisoning incidents.
Definition: Rabbit_Population_Manager.cpp:768
g_counter
int g_counter
Definition: Rabbit.cpp:76
toRabbits_Explore
Definition: Rabbit.h:87
Rabbit_Population_Manager::FindClosestWarren
Rabbit_Warren * FindClosestWarren(int a_x, int a_y, int a_rank)
Finds the closest warren as the crow flies.
Definition: Rabbit_Population_Manager.cpp:692
Rabbit_Female::st_UpdateBreedingStatus
virtual TTypeOfRabbitState st_UpdateBreedingStatus(void)
Female reproductive update - handles oestrous, gestation, lactation and birth.
Definition: Rabbit.cpp:1138
Rabbit_Young::EndStep
virtual void EndStep(void)
The EndStep is the last 'part' of the timestep that an animal can behave in.
Definition: Rabbit.cpp:347
cfg_rabbit_pesticidedegradationrate
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 ...
Rabbit_Warren::m_LEList
vector< RabbitWarrenLEInfo > m_LEList
List of polygons and the area which is part of the warren.
Definition: Rabbit.h:748
Rabbit_Base::BeginStep
virtual void BeginStep(void)
The BeginStep is the first 'part' of the timestep that an animal can behave in. It is called once per...
Definition: Rabbit.cpp:182
Rabbit_Female::OnYoungDeath
void OnYoungDeath(Rabbit_Young *a_young)
Message on death of a young.
Definition: Rabbit.cpp:1293
Rabbit_Warren::GetForagePesticide
double GetForagePesticide(void)
Gets the current mean pesticide concentration per unit forage.
Definition: Rabbit.h:628
Rabbit_Adult::OnMateDead
void OnMateDead(Rabbit_Adult *a_mate)
Set/unset mate status.
Definition: Rabbit.cpp:670
Rabbit_Warren::Rabbit_Warren
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:1455
toRabbits_EvaluateTerritory
Definition: Rabbit.h:93
TTypeOfRabbitState
TTypeOfRabbitState
Definition: Rabbit.h:82
Rabbit_Female
The rabbit female class. All special female behaviour is described here.
Definition: Rabbit.h:443
Rabbit_Warren::GetAvailableForage
double GetAvailableForage(void)
Returns the available forage realtive to rabbit numbers.
Definition: Rabbit.h:642
ttop_NoPesticide
Definition: landscape.h:67
Rabbit_Population_Manager::SupplyAllBigRabbits
unsigned SupplyAllBigRabbits()
Returns the total number of rabbits.
Definition: Rabbit_Population_Manager.h:110
rabbit_socialstatus_dominant
Definition: Rabbit.h:115
Rabbit_Base::m_digging
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
Rabbit_Warren::DEBUG_InternalTest
bool DEBUG_InternalTest()
Definition: Rabbit.cpp:2298
Rabbit_Base::GetweightAge
int GetweightAge(void)
Get age method.
Definition: Rabbit.h:230
Rabbit_Warren::m_litterreabosorptionchance
double m_litterreabosorptionchance
Chance of litter reaborption based on the m_availableforage.
Definition: Rabbit.h:734
RabbitWarrenLEInfo::m_forage
double m_forage
Definition: Rabbit.h:125
Rabbit_Warren::OccupyWarren
void OccupyWarren(Rabbit_Adult *a_rabbit)
Adds the first rabbit to the warren list.
Definition: Rabbit.cpp:2083
Rabbit_Base::InternalPesticideHandlingAndResponse
virtual void InternalPesticideHandlingAndResponse()
Handles internal effects of pesticide exposure. If any effects are needed this method must be re-impl...
Definition: Rabbit.h:303
toRabbits_Gestation
Definition: Rabbit.h:88
TAnimal::m_OurLandscape
Landscape * m_OurLandscape
Definition: populationmanager.h:229
cfg_juvenile_base_mort
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.
Rabbit_Warren::GetCoverAreaVeg
int GetCoverAreaVeg(void)
Returns the total area of cover based on veg height.
Definition: Rabbit.cpp:1806
Rabbit_Warren::m_mortalitymultiplierJ
double m_mortalitymultiplierJ
a measure of mortality likelihood - juveniles
Definition: Rabbit.h:742
Rabbit_Warren::m_1yrOldFemales
int m_1yrOldFemales
The number of 1 year old females.
Definition: Rabbit.h:547
Rabbit_Young::st_BecomeJuvenile
TTypeOfRabbitState st_BecomeJuvenile(void)
Young maturation.
Definition: Rabbit.cpp:283
Rabbit_Warren::m_BigFemaleRabbitsR
double m_BigFemaleRabbitsR
Records the number of big female rabbits divided by m_CarryingCapacityR2.
Definition: Rabbit.h:710
Rabbit_Warren::GetTempForageAreaVeg
int GetTempForageAreaVeg(void)
Returns the total area of temporary forage based on veg height
Definition: Rabbit.cpp:1786
Rabbit_Population_Manager::IsBreedingSeason
bool IsBreedingSeason(void)
Get whether it is breeding season.
Definition: Rabbit_Population_Manager.h:106
Rabbit_Warren::OccupyBurrow
void OccupyBurrow()
a_rabbit occupies a free burrow
Definition: Rabbit.cpp:2077
Rabbit_Base::m_MyMortChance
double m_MyMortChance
Definition: Rabbit.h:183
Rabbit_Warren::m_CurrentRState
TTypeOfRabbitState m_CurrentRState
Variable to record current behavioural state.
Definition: Rabbit.h:746
cfg_globaldisease_probability
CfgFloat cfg_globaldisease_probability("RABBIT_GLOBALDISEASEPROBCONSTANT", CFG_CUSTOM, 0.05)
Input variable. A constant use to calculate the probability of density related disease.
Rabbit_Female::~Rabbit_Female
virtual ~Rabbit_Female(void)
Rabbit_Female destructor.
Definition: Rabbit.cpp:920
Rabbit_Population_Manager
The class to handle all predator population related matters.
Definition: Rabbit_Population_Manager.h:89
Rabbit_Male::Step
virtual void Step(void)
The male rabbit step code.
Definition: Rabbit.cpp:732
cfg_RabbitPesticideResponse
CfgFloat cfg_RabbitPesticideResponse("RABBIT_PESTICDERESPONSETHRESHOLD", CFG_CUSTOM, 0.00001)
Input variable. The threshold above which a rabbit will be killed if it ingests pesticide.
Rabbit_Warren::m_NoBurrows
int m_NoBurrows
Records the maintenence restricted current carrying capacity (burrow number)
Definition: Rabbit.h:714
Rabbit_Juvenile::EndStep
virtual void EndStep(void)
The EndStep is the last 'part' of the timestep that an animal can behave in.
Definition: Rabbit.cpp:487
Rabbit_Base::GetMate
virtual Rabbit_Adult * GetMate(void)
Get mate pointer.
Definition: Rabbit.h:288
Rabbit_Base::m_Age
int m_Age
The rabbit's age.
Definition: Rabbit.h:177
rob_Male
Definition: Rabbit.h:72
Rabbit_Warren::NetworkEvaluation
void NetworkEvaluation(void)
Calculates and saves distance probabilities.
Definition: Rabbit.cpp:1715
toRabbits_WarrenBeing
Definition: Rabbit.h:97
Rabbit_Adult::m_myMate
Rabbit_Adult * m_myMate
Pointer to the mate if any.
Definition: Rabbit.h:409
toRabbits_Foraging
Definition: Rabbit.h:92
Rabbit_Warren::JoinNOccupy
void JoinNOccupy(Rabbit_Adult *a_rabbit)
Adds this adult to the warren list and house them in a suitable burrow.
Definition: Rabbit.cpp:2091
Population_Manager::GetLiveArraySize
unsigned GetLiveArraySize(int a_listindex)
Gets the number of 'live' objects for a list index in the TheArray.
Definition: populationmanager.h:433
rabbit_socialstatus_subordinate
Definition: Rabbit.h:113
g_rabbitexploredistance
int g_rabbitexploredistance
TAnimal::Supply_m_Location_x
int Supply_m_Location_x()
Definition: populationmanager.h:213
Rabbit_Base::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)
Rabbit constructor.
Definition: Rabbit.cpp:161
Rabbit_Juvenile::~Rabbit_Juvenile
virtual ~Rabbit_Juvenile(void)
Rabbit_Young destructor.
Definition: Rabbit.cpp:387
struct_Rabbit
Used for creation of a new Rabbit object.
Definition: Rabbit_Population_Manager.h:58
RabbitWarrenLEInfo
The basic information needed for an LE present in a warren area.
Definition: Rabbit.h:119
Rabbit_Warren::IsFreeMale
bool IsFreeMale(void)
Returns true if there is a male with a burrow and no mate.
Definition: Rabbit.cpp:2014
Rabbit_Base::m_weight
double m_weight
The weight in g.
Definition: Rabbit.h:195
Rabbit_Warren::m_BurrowsUnderConstruction
int m_BurrowsUnderConstruction
Records the burrows that are being dug.
Definition: Rabbit.h:718
Rabbit_Warren::m_LocalWarrenNetwork
vector< LocalWarrenNewtorkEntry > m_LocalWarrenNetwork
List of local warrens and their accessibility from this warren.
Definition: Rabbit.h:750
Rabbit_Population_Manager::NatalDispersalRecordOutput
void NatalDispersalRecordOutput(Rabbit_Base *a_rabbit)
Records the natal dispersal.
Definition: Rabbit_Population_Manager.cpp:912
Rabbit_Warren::~Rabbit_Warren
virtual ~Rabbit_Warren()
Rabbit warren destructor.
Definition: Rabbit.cpp:1491
Rabbit_Male::st_Forage
virtual TTypeOfRabbitState st_Forage(void)
Adult male forage behaviour.
Definition: Rabbit.cpp:762
Rabbit_Female::st_Gestating
virtual TTypeOfRabbitState st_Gestating(void)
Female gestating state.
Definition: Rabbit.cpp:1279
Rabbit_Adult::~Rabbit_Adult
virtual ~Rabbit_Adult()
Rabbit_Adult destructor.
Definition: Rabbit.cpp:541
Rabbit_Warren::DEBUG_InternalTest2
bool DEBUG_InternalTest2()
Definition: Rabbit.cpp:2350
cfg_rabbitminwarrensize
static CfgFloat cfg_rabbitminwarrensize("RABBIT_MINWARRENSIZE", CFG_CUSTOM, 2)
The minimum size of a warren.
Rabbit_Male::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_Male constructor.
Definition: Rabbit.cpp:719
Rabbit_Warren::m_maintenence
int m_maintenence
Warren maintenence score - if not max then houseing capacity is reduced.
Definition: Rabbit.h:702
Rabbit_Adult::st_Dying
virtual void st_Dying(void)
Default dying state.
Definition: Rabbit.cpp:691
RabbitMemory::Update
void Update(void)
daily update of the memory
Definition: Rabbit.cpp:132
Rabbit_Juvenile::ShouldMature
virtual bool ShouldMature(void)
Tests for maturation to the next stage.
Definition: Rabbit.cpp:512
cfg_RabbitUseNatalDispersalRecordAge
CfgInt cfg_RabbitUseNatalDispersalRecordAge
Flag to denote using lifetime repro output file or not.
Rabbit_Warren::JoinNMate
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:2224
Rabbit_Warren::m_maxForageHeight
static double m_maxForageHeight
The maximum vegetation height assumed for forage potential.
Definition: Rabbit.h:541
Rabbit_Base::m_Mum
Rabbit_Female * m_Mum
Pointer to mum.
Definition: Rabbit.h:191
Rabbit_Warren::CalcDisease
void CalcDisease()
Calculate the current disease mortality constant.
Definition: Rabbit.cpp:1583
Rabbit_Male::~Rabbit_Male
virtual ~Rabbit_Male(void)
Rabbit_Male destructor.
Definition: Rabbit.cpp:726
Rabbit_Base::OnEvicted
void OnEvicted(void)
Signals mum has a new litter to look after.
Definition: Rabbit.h:284
Rabbit_Warren::m_CarryingCapacityR2
double m_CarryingCapacityR2
Records the max number of rabbits possible here divided by 2.
Definition: Rabbit.h:708
cfg_maxForageHeight
CfgFloat cfg_maxForageHeight("RABBIT_MAXFORAGEHEIGHT", CFG_CUSTOM, 30.0)
Input variable. The maximum height desirable for forage vegetation.
Rabbit_Base::m_pesticidedegradationrate
static double m_pesticidedegradationrate
State variable used to hold the daily degredation rate of the pesticide in the body.
Definition: Rabbit.h:174
toRabbits_Remove
Definition: Rabbit.h:95
Rabbit_Warren::m_mortalitymultiplierA
double m_mortalitymultiplierA
a measure of mortality likelihood - adults
Definition: Rabbit.h:740
Rabbit_Warren::GetCarryingCapacity
int GetCarryingCapacity()
Returns the carrying capacity in burrows.
Definition: Rabbit.h:578
struct_Rabbit::m_age
int m_age
The rabbit age.
Definition: Rabbit_Population_Manager.h:74
cfg_rabbitsocialreproductionthreshold
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 ...
Landscape
The landscape class containing all environmental and topographical data.
Definition: landscape.h:112
Rabbit_Warren::m_forageP
double m_forageP
Records the amount of pesticde as a mean concentration per unit area forage.
Definition: Rabbit.h:736
l_pest_enable_pesticide_engine
CfgBool l_pest_enable_pesticide_engine
Used to turn on or off the PPP functionality of ALMaSS.
Rabbit_Warren::m_runningavCount
int m_runningavCount
Keeps track of the number of breeding days.
Definition: Rabbit.h:758
Rabbit_Population_Manager::ClassifyHabitat
TTypesOfRabbitHabitat ClassifyHabitat(TTypesOfLandscapeElement a_tole)
Classify a landscape element type according to the rabbit habitat classification.
Definition: Rabbit_Population_Manager.cpp:457
Rabbit_Female::GeneralEndocrineDisruptor
virtual void GeneralEndocrineDisruptor(double)
Handles internal effects of endocrine distrupter pesticide exposure.
Definition: Rabbit.cpp:1424
struct_Rabbit::m_NPM
Rabbit_Population_Manager * m_NPM
Rabbit_Population_Manager pointer.
Definition: Rabbit_Population_Manager.h:72
rob_Young
Definition: Rabbit.h:70
struct_Rabbit::m_rabbit
Rabbit_Young * m_rabbit
A pointer to a rabbit base - useful for extra information.
Definition: Rabbit_Population_Manager.h:78
Rabbit_Base::m_dispersalmortperm
static double m_dispersalmortperm
The extra dispersal mortality per m travelled.
Definition: Rabbit.h:172
Rabbit_Warren::RabbitProductionRecord
void RabbitProductionRecord(RabbitObjectTypes YoungType, int kits)
Stores data about production of rabbits throughout year.
Definition: Rabbit.h:582
Rabbit_Population_Manager::CreateObjects
void CreateObjects(RabbitObjectTypes ob_type, TAnimal *pvo, struct_Rabbit *a_data, int a_number)
Method for creating a new individual Rabbit.
Definition: Rabbit_Population_Manager.cpp:250
Landscape::SupplyPesticide
double SupplyPesticide(int a_x, int a_y, PlantProtectionProducts a_ppp)
Gets total pesticide for a location.
Definition: Landscape.cpp:586
Rabbit_Adult::GetSocialStatus
TTypesOfRabbitSocialStatus GetSocialStatus(void)
Return the dominance status.
Definition: Rabbit.h:387
RabbitMemory::GetBestLocation
RabbitMemoryLocation GetBestLocation(void)
Get the best current location
Definition: Rabbit.cpp:146
Rabbit_Warren::st_WarrenBeing
void st_WarrenBeing(void)
The only warren behaviour - it just is.
Definition: Rabbit.cpp:1865
cfg_RabbitUseNatalDispersalRecord
CfgBool cfg_RabbitUseNatalDispersalRecord
Flag to denote using lifetime repro output file or not.
Rabbit_Base::GetDigging
int GetDigging()
Get number of days to dig.
Definition: Rabbit.h:254
Landscape::SupplySimAreaHeight
int SupplySimAreaHeight(void)
Definition: landscape.h:1637
Rabbit_Warren::GetAllBigFemaleRabbits
int GetAllBigFemaleRabbits()
Supplies the number of big rabbits currently in the warren.
Definition: Rabbit.cpp:2286
Rabbit_Warren::UpdatePesticide
void UpdatePesticide(void)
Updates the pesticide concentration in forage polygons.
Definition: Rabbit.cpp:1608
Rabbit_Female::st_Forage
virtual TTypeOfRabbitState st_Forage(void)
Adult female forage behaviour.
Definition: Rabbit.cpp:1183
MapErrorMsg
Definition: maperrormsg.h:43
Landscape::SupplySimAreaWidth
int SupplySimAreaWidth(void)
Definition: landscape.h:1632
cfg_rabbitdendepscaler
CfgFloat cfg_rabbitdendepscaler("RABBIT_DENSITYDEPSCALER", CFG_CUSTOM, 4.5)
Input variable. Average family size for calculating carrying capacity.
Rabbit_Female::CalcLitterSize
int CalcLitterSize(void)
Calculates the litter size at birth.
Definition: Rabbit.cpp:1255
TAnimal::m_Location_y
int m_Location_y
Definition: populationmanager.h:228
Rabbit_Female::m_AnnualLitters
vector< int > m_AnnualLitters
The number of litters produced.
Definition: Rabbit.h:507
Rabbit_Warren::Leave
void Leave(Rabbit_Base *a_rabbit)
Remove this adult from the warren list.
Definition: Rabbit.cpp:2117
Rabbit_Base::~Rabbit_Base
virtual ~Rabbit_Base(void)
Rabbit destructor.
Definition: Rabbit.cpp:176
CfgBool
Bool configurator entry class.
Definition: configurator.h:127
Rabbit_Warren::m_foragearea
int m_foragearea
Variable holding the total potential forage area.
Definition: Rabbit.h:726
struct_Rabbit::m_L
Landscape * m_L
Landscape pointer.
Definition: Rabbit_Population_Manager.h:70
Rabbit_Warren::m_foragearearatio
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
Rabbit_Population_Manager::GetGrowth
double GetGrowth(int a_age)
Get method for the rabbit growth with age.
Definition: Rabbit_Population_Manager.h:116
Rabbit_Base::m_RabbitType
RabbitObjectTypes m_RabbitType
The rabbits type.
Definition: Rabbit.h:170
Rabbit_Adult
The rabbit adult class. All generic adult behaviour is described here.
Definition: Rabbit.h:378
struct_Rabbit::m_x2
int m_x2
x-coord of birth
Definition: Rabbit_Population_Manager.h:66
Rabbit_Base::m_born_location
APoint m_born_location
The x,y location at birth.
Definition: Rabbit.h:201
Rabbit_Base::m_myWarren
Rabbit_Warren * m_myWarren
True if currently mated.
Definition: Rabbit.h:189
TAnimal
The base class for all ALMaSS animal classes.
Definition: populationmanager.h:205
RabbitWarrenLEInfo::m_pesticide_conc
double m_pesticide_conc
Definition: Rabbit.h:124
Rabbit_Juvenile::Step
virtual void Step(void)
The Step is the second 'part' of the timestep that an animal can behave in. It is called continuously...
Definition: Rabbit.cpp:450
Rabbit_Adult::OnMateFinishedDigging
void OnMateFinishedDigging(Rabbit_Adult *a_mate)
Action when a mate has finished digging a burrow.
Definition: Rabbit.cpp:644
Rabbit_Male::st_EvaluateTerritory
virtual TTypeOfRabbitState st_EvaluateTerritory(void)
Male Evaluate Territory Step.
Definition: Rabbit.cpp:776
Rabbit_Base::GeneralOrganoPhosphate
virtual void GeneralOrganoPhosphate(double)
Handles internal effects of organophosphate pesticide exposure.
Definition: Rabbit.cpp:1438
Rabbit_Warren::m_TL_x
int m_TL_x
Stores original m_Location_x.
Definition: Rabbit.h:698
cfg_young_base_mort
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.
Rabbit_Base::SetDigging
void SetDigging(int a_days)
Set number of days to dig.
Definition: Rabbit.h:250
rob_Warren
Definition: Rabbit.h:74
Rabbit_Warren::m_InhabitantsList
vector< Rabbit_Base * > m_InhabitantsList
List of rabbits that live here - for easy communication purposes.
Definition: Rabbit.h:752
struct_Rabbit::m_Warren
Rabbit_Warren * m_Warren
A pointer to the current warren.
Definition: Rabbit_Population_Manager.h:80
Rabbit_Warren::m_minForageDigestability
static double m_minForageDigestability
The minimum vegetation digestability allowed for foraging.
Definition: Rabbit.h:543
Rabbit_Young::st_Develop
TTypeOfRabbitState st_Develop(void)
Development state for young.
Definition: Rabbit.cpp:262
Rabbit_Female::m_MinKitsNo
static double m_MinKitsNo
The minimum number of kits.
Definition: Rabbit.h:499
Rabbit_Adult::SetSocialStatus
void SetSocialStatus(TTypesOfRabbitSocialStatus a_status)
Sets the dominance status.
Definition: Rabbit.h:391
toRabbits_UpdateBreedingStatus
Definition: Rabbit.h:94
Rabbit_Adult::SetMate
void SetMate(Rabbit_Adult *a_mate)
Set/unset mate status.
Definition: Rabbit.cpp:606
MapErrorMsg::Warn
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: maperrormsg.cpp:59
Rabbit_Warren::CalcPermForageArea
int CalcPermForageArea(void)
Returns the total area of permanent forage.
Definition: Rabbit.cpp:1744
Landscape::SupplyDayInYear
int SupplyDayInYear(void)
Definition: landscape.h:1596
Rabbit_Juvenile::st_Forage
TTypeOfRabbitState st_Forage(void)
Juvenile forage behaviour.
Definition: Rabbit.cpp:677
Rabbit_Warren::GetCarryingCapacityRatio
double GetCarryingCapacityRatio()
Checks whether all possible burrows are filled with rabbits. This is updated daily by Rabbit_Warren::...
Definition: Rabbit.h:576
cfg_dispersalmortperm
CfgFloat cfg_dispersalmortperm("RABBIT_DISPERSALMORTPERM", CFG_CUSTOM, 0.0002)
Input variable. The additional mortality rate with distance for between warren dispersal.
Rabbit_Base::m_weightAge
int m_weightAge
A physiological age parameter, this is the growth age based on an optimal curve (if optimal condition...
Definition: Rabbit.h:197
Rabbit_Juvenile::st_Develop
TTypeOfRabbitState st_Develop()
Development state for young.
Definition: Rabbit.cpp:400
Rabbit_Warren::m_TL_y
int m_TL_y
Stores original m_Location_y.
Definition: Rabbit.h:700
cfg_rabbitdensitydependencedelay
CfgInt cfg_rabbitdensitydependencedelay
Input variable. The period between recalculation of rabbit disease probability.
RabbitWarrenLEInfo::m_ref
int m_ref
Definition: Rabbit.h:123
Rabbit_Female::m_MyTotalLitters
int m_MyTotalLitters
The number of litters produced.
Definition: Rabbit.h:505
TALMaSSObject::m_StepDone
bool m_StepDone
Indicates whether the iterative step code is done for this timestep.
Definition: populationmanager.h:118
cfg_RabbitUseReproOutput
CfgBool cfg_RabbitUseReproOutput
Flag to denote using lifetime repro output file or not.
Landscape::SupplyPesticideType
TTypesOfPesticide SupplyPesticideType(void)
Definition: landscape.h:433
Rabbit_Adult::m_lifespan
int m_lifespan
The rabbit's alloted lifespan.
Definition: Rabbit.h:407
Rabbit_Warren::InitEvaluation
void InitEvaluation(void)
Intiates the evaluation of the warren area.
Definition: Rabbit.cpp:1497
g_msg
MapErrorMsg * g_msg
Definition: maperrormsg.cpp:41
struct_Rabbit::m_weightage
int m_weightage
The rabbit age in terms of weight.
Definition: Rabbit_Population_Manager.h:76
Rabbit_Warren::m_runningavFemales
int m_runningavFemales
Keeps track of the number of breeding females.
Definition: Rabbit.h:756
Rabbit_Warren::GetPopulationSize
int GetPopulationSize()
Gets the total warren population of rabbits.
Definition: Rabbit.h:572
Rabbit_Young::~Rabbit_Young
virtual ~Rabbit_Young(void)
Rabbit_Young destructor.
Definition: Rabbit.cpp:244
Rabbit_Warren::GetDailyMortalityChanceJ
double GetDailyMortalityChanceJ()
Returns the juvenile daily mortality multiplier.
Definition: Rabbit.h:684
toRabbits_Weaning
Definition: Rabbit.h:91
CfgFloat::value
double value(void)
Definition: configurator.h:118
Rabbit_Adult::GetMate
virtual Rabbit_Adult * GetMate(void)
Get mate pointer.
Definition: Rabbit.h:397
Rabbit_Female::m_myLitter
Rabbit_Young * m_myLitter[20]
Holds the current young (for lactation)
Definition: Rabbit.h:495
Rabbit_Warren::CalcForageArea
int CalcForageArea(void)
Returns the total area of forage.
Definition: Rabbit.cpp:1730
Rabbit_Warren::GetAllBreedingFemaleRabbits
int GetAllBreedingFemaleRabbits()
Supplies the number of breeding rabbits currently in the warren.
Definition: Rabbit.cpp:2274
torh_Forage
Definition: Rabbit.h:103
Rabbit_Base::m_CurrentRState
TTypeOfRabbitState m_CurrentRState
Variable to record current behavioural state.
Definition: Rabbit.h:179
Rabbit_Warren::GetDailyMortalityChanceA
double GetDailyMortalityChanceA()
Returns the adult daily mortality multiplier.
Definition: Rabbit.h:680
Rabbit_Adult::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_Adult constructor.
Definition: Rabbit.cpp:523
Rabbit_Juvenile::st_Dying
virtual void st_Dying(void)
Young dying state.
Definition: Rabbit.cpp:393
Rabbit_Base::GetRabbitType
RabbitObjectTypes GetRabbitType(void)
Get rabbit type.
Definition: Rabbit.h:218
Rabbit_Female::Step
virtual void Step(void)
The female rabbit step code.
Definition: Rabbit.cpp:926
Rabbit_Warren::m_breedingfemales
int m_breedingfemales
The number of females that bred this year.
Definition: Rabbit.h:545
Rabbit_Warren::m_soiltype
int m_soiltype
Variable holding the soil type, 1 = heavy, 0 = sandy, 3 = unsuitable (never used in warrens)
Definition: Rabbit.h:720
Rabbit_Warren::Mate
void Mate(Rabbit_Adult *a_mate, RabbitObjectTypes rob_type)
Mate him with un-mated female/male with a burrow.
Definition: Rabbit.cpp:2169
cfg_rabbitminkits
CfgFloat cfg_rabbitminkits("RABBIT_MINKITS", CFG_CUSTOM, 1.0)
The minimum number of kits in a litter.
Rabbit_Female::m_lactating
bool m_lactating
Flag to indicate lactating.
Definition: Rabbit.h:491
ppp_1
Definition: farm.h:422
Rabbit_Female::m_pregnant
bool m_pregnant
Flag to indicate pregnancy.
Definition: Rabbit.h:489
CFG_CUSTOM
Definition: configurator.h:60
Rabbit_Female::Weaned
void Weaned(Rabbit_Young *a_young)
Message on weaning of a young.
Definition: Rabbit.cpp:1317
RabbitMemory::AddMemory
void AddMemory(RabbitMemoryLocation a_mem)
Add a memory location.
Definition: Rabbit.cpp:140
Rabbit_Female::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_Female constructor.
Definition: Rabbit.cpp:900
g_land_width
int g_land_width
Definition: Rabbit_Population_Manager.cpp:114
Landscape::SupplyVegHeight
double SupplyVegHeight(int a_polyref)
Definition: landscape.h:936
toRabbits_Die
Definition: Rabbit.h:96
ttop_AcuteEffects
Definition: landscape.h:68
Rabbit_Base::MortalityTest
bool MortalityTest(double a_prop)
A simple probability based test.
Definition: Rabbit.cpp:194
cfg_litterabsorptionconstant
static CfgFloat cfg_litterabsorptionconstant("RABBIT_LITTERABSOPRTIONCONST", CFG_CUSTOM, 1.8)
Used to calculate the chance of litter reabsorption depending on forage conditions.
Rabbit_Female::st_EvaluateTerritory
virtual TTypeOfRabbitState st_EvaluateTerritory(void)
Female Evaluate Territory Step.
Definition: Rabbit.cpp:994
Rabbit_Base::GetCurrentRState
TTypeOfRabbitState GetCurrentRState()
Definition: Rabbit.h:210
Rabbit_Population_Manager::ReproOutputRecordOutput
void ReproOutputRecordOutput(Rabbit_Female *a_female)
Print reproductive record to file.
Definition: Rabbit_Population_Manager.cpp:888
Rabbit_Female::m_myLitterSize
int m_myLitterSize
Holds the current litter size.
Definition: Rabbit.h:497
Rabbit_Warren::GetLitterReabsortionConst
double GetLitterReabsortionConst(void)
Returns litter reabsorption chance.
Definition: Rabbit.h:650
torh_Other
Definition: Rabbit.h:106
Rabbit_Young::st_Dying
virtual void st_Dying(void)
Young dying state.
Definition: Rabbit.cpp:250
toRabbits_GiveBirth
Definition: Rabbit.h:90
CfgInt
Integer configurator entry class.
Definition: configurator.h:87
Rabbit_Warren::GetCoverArea
int GetCoverArea(void)
Returns the total area of cover.
Definition: Rabbit.cpp:1772
TALMaSSObject::GetCurrentStateNo
int GetCurrentStateNo()
Returns the current state number.
Definition: populationmanager.h:121
Rabbit_Warren::m_size
int m_size
Warren core size in m.
Definition: Rabbit.h:694
cfg_rabbitmaxkits
CfgFloat cfg_rabbitmaxkits("RABBIT_MAXKITS", CFG_CUSTOM, 9.6)
The maximum number of kits in a litter.
Rabbit_Adult::EndStep
virtual void EndStep(void)
The EndStep is the last 'part' of the timestep that an animal can behave in.
Definition: Rabbit.cpp:547
TTypesOfLandscapeElement
TTypesOfLandscapeElement
Definition: tole_declaration.h:36
RabbitMemory::RabbitMemory
RabbitMemory(void)
Rabbit Memory constructor.
Definition: Rabbit.cpp:127
rob_Female
Definition: Rabbit.h:73
TAnimal::Supply_m_Location_y
int Supply_m_Location_y()
Definition: populationmanager.h:216
toRabbits_Develop
Definition: Rabbit.h:85
CfgFloat
Double configurator entry class.
Definition: configurator.h:106
Rabbit_Warren::CalcCarryingCapacityRatio2
double CalcCarryingCapacityRatio2()
calculates the ratio of rabbits to the carrying capacity for the local area
Definition: Rabbit.cpp:1692
RabbitWarrenLEInfo::m_foragearea
int m_foragearea
Definition: Rabbit.h:126
Rabbit_Warren
A class to describe the rabbits warren system.
Definition: Rabbit.h:518
Rabbit_Young::ShouldMature
virtual bool ShouldMature(void)
Tests for maturation to the next stage.
Definition: Rabbit.cpp:362
Rabbit_Warren::Step
virtual void Step()
Warren step code.
Definition: Rabbit.cpp:1846
Rabbit_Warren::ResetAllRabbitProductionRecord
void ResetAllRabbitProductionRecord(void)
Reset data about production of rabbits throughout year.
Definition: Rabbit.h:588
torh_TemporaryForage
Definition: Rabbit.h:104
CfgInt::value
int value(void)
Definition: configurator.h:98
Rabbit_Warren::CalcCarryingCapacityRatio1
void CalcCarryingCapacityRatio1()
calculates the ratio of rabbits to the carrying capacity
Definition: Rabbit.cpp:1688
Rabbit_Young::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_Young constructor.
Definition: Rabbit.cpp:232
Rabbit_Warren::ChooseNewDominant
void ChooseNewDominant(void)
Finds a subdominantfemale and promotes them to dominant.
Definition: Rabbit.cpp:1952
Rabbit_Warren::m_availableforage
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
Rabbit_Warren::m_OurPopulationManager
Rabbit_Population_Manager * m_OurPopulationManager
This is a time saving pointer to the correct population manager object.
Definition: Rabbit.h:754
cfg_adult_base_mort
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.
RabbitMemoryLocation::m_decay
int m_decay
Definition: Rabbit.h:136
rob_Juvenile
Definition: Rabbit.h:71
toRabbits_InitialState
Definition: Rabbit.h:84
Rabbit_Base::m_OurPopulationManager
Rabbit_Population_Manager * m_OurPopulationManager
This is a time saving pointer to the correct population manager object.
Definition: Rabbit.h:181
Rabbit_Female::st_GiveBirth
virtual TTypeOfRabbitState st_GiveBirth(void)
Female give birth state.
Definition: Rabbit.cpp:1197
Rabbit_Warren::GetNetworkWarren
Rabbit_Warren * GetNetworkWarren(void)
Chooses a warren to evaluate based on distance.
Definition: Rabbit.cpp:1913
TALMaSSObject::m_CurrentStateNo
int m_CurrentStateNo
The basic state number for all objects - '-1' indicates death.
Definition: populationmanager.h:116
Rabbit_Base::m_FedToday
bool m_FedToday
Flag for been fed today.
Definition: Rabbit.h:193
Rabbit_Warren::m_NoOccupiedBurrows
int m_NoOccupiedBurrows
Records the burrows that are occupied.
Definition: Rabbit.h:716
rabbit_socialstatus_zero
Definition: Rabbit.h:112
Rabbit_Warren::m_CarryingCapacityR
double m_CarryingCapacityR
Records the max number of rabbits possible here.
Definition: Rabbit.h:706
Rabbit_Juvenile::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 constructor.
Definition: Rabbit.cpp:376
Rabbit_Population_Manager::GetForageDay
bool GetForageDay()
Get method for the forage day flag.
Definition: Rabbit_Population_Manager.h:123
RabbitWarrenLEInfo::m_ele
LE * m_ele
Definition: Rabbit.h:121
Rabbit_Warren::m_CarryingCapacityRatio
double m_CarryingCapacityRatio
Records the ratio between carrying capacity and no rabbits in warren.
Definition: Rabbit.h:712
Landscape::Warn
void Warn(std::string a_msg1, std::string a_msg2)
Definition: landscape.h:1579
Rabbit_Base::OnMumDead
void OnMumDead(void)
Signals death of mum.
Definition: Rabbit.h:280
Rabbit_Warren::OccupyNewBurrow
void OccupyNewBurrow()
a_rabbit occupies a newly dug burrow
Definition: Rabbit.cpp:2069
struct_Rabbit::m_y2
int m_y2
y-coord of birth
Definition: Rabbit_Population_Manager.h:68
CfgBool::value
bool value(void)
Definition: configurator.h:135
Rabbit_Warren::UpdateForageInformation
void UpdateForageInformation(void)
Updates the forage information depending upon the vegetation state.
Definition: Rabbit.cpp:1645
cfg_rabbitdiggingtime
CfgInt cfg_rabbitdiggingtime("RABBIT_DIGGINGTIME", CFG_CUSTOM, 10)
Input variable. Minimum burrow construction time in days.
Rabbit_Warren::m_littersthisyear
int m_littersthisyear
The number of litters produced this year.
Definition: Rabbit.h:549
TAnimal::m_Location_x
int m_Location_x
Definition: populationmanager.h:225
Rabbit_Warren::m_nonbreedingfemales
int m_nonbreedingfemales
The number of females that did not breed this year but are older than 1 year.
Definition: Rabbit.h:551
TTypesOfPesticide
TTypesOfPesticide
Definition: landscape.h:65
Landscape::SupplyPolyRef
int SupplyPolyRef(int a_x, int a_y)
Definition: landscape.h:1488
torh_Cover
Definition: Rabbit.h:105
Rabbit_Warren::Join
void Join(Rabbit_Base *a_rabbit)
Adds this rabbit to the warren list.
Definition: Rabbit.cpp:2061
Rabbit_Juvenile::st_Explore
TTypeOfRabbitState st_Explore(void)
Juvenile local exploration.
Definition: Rabbit.cpp:415
Rabbit_Warren::m_CarryingCapacity
int m_CarryingCapacity
Records the max number of rabbit pairs possible here.
Definition: Rabbit.h:704
Rabbit_Base::m_pesticide_burden
double m_pesticide_burden
State variable used to hold the current body-burden of pesticide.
Definition: Rabbit.h:203
RabbitWarrenLEInfo::m_area
int m_area
Definition: Rabbit.h:122
Landscape::SupplyGlobalDate
long SupplyGlobalDate(void)
Definition: landscape.h:1621
Rabbit_Female::m_MaxKitsNo
static double m_MaxKitsNo
The maximum number of kits.
Definition: Rabbit.h:501
Rabbit_Base
Definition: Rabbit.h:166
Rabbit_Juvenile::st_BecomeAdult
TTypeOfRabbitState st_BecomeAdult(void)
Juvenile maturation.
Definition: Rabbit.cpp:424
Rabbit_Female::st_Dying
virtual void st_Dying(void)
Female dying state.
Definition: Rabbit.cpp:973
Rabbit_Young
The rabbit young class. All special young behaviour is described here.
Definition: Rabbit.h:319
struct_Rabbit::m_x
int m_x
x-coord
Definition: Rabbit_Population_Manager.h:62
Rabbit_Male::InternalPesticideHandlingAndResponse
virtual void InternalPesticideHandlingAndResponse()
Handles internal effects of pesticide exposure - reimplemented from base class.
Definition: Rabbit.cpp:1370
Rabbit_Warren::IsMember
bool IsMember(Rabbit_Base *a_rabbit)
Returns true if this rabbit belongs to the warren.
Definition: Rabbit.cpp:1996