ALMaSS Partridge ODdox
1.1
The partridge model description following ODdox protocol
|
The partridge male class. More...
#include <Partridge_All.h>
Public Member Functions | |
int | AmIaMember () |
A debug function. More... | |
virtual void | Dying () |
General dying handler. More... | |
virtual void | BeginStep (void) |
Male BeginStep. More... | |
virtual void | Step (void) |
Male Step. More... | |
virtual void | EndStep (void) |
Male EndStep. More... | |
virtual bool | DailyMortality () |
Background mortality check. More... | |
virtual bool | OnFarmEvent (FarmToDo event) |
Management event handler. More... | |
virtual void | KillThis () |
General direct mortality handler. More... | |
void | UnSetMate (void) |
remove mate pointer More... | |
virtual bool | ArePaired () |
Are we paired? More... | |
Partridge_Female * | GetMate (void) |
Are we paired? More... | |
Partridge_Male (int a_born_x, int a_born_y, int a_x, int a_y, Partridge_Covey *a_flock, Landscape *a_map, int a_family_counter, Partridge_Population_Manager *a_manager) | |
Constructor. More... | |
virtual | ~Partridge_Male (void) |
Destructor. More... | |
void | OnLookAfterKids (void) |
Message handler. More... | |
void | StartBreedingBehaviour (void) |
Message handler. More... | |
void | OnMating (Partridge_Female *a_mate) |
Message handler. More... | |
void | OnMateDying () |
Message handler. More... | |
void | OnFoundATerrtitory () |
Message handler. More... | |
void | OnChicksMatured () |
Message handler. More... | |
void | OnChicksDead () |
Message handler. More... | |
void | OnStoppingBreeding () |
Message handler. More... | |
void | OnFemaleGivingUp () |
Message handler. More... | |
void | OnMovingHome () |
Message handler. More... | |
void | SetOldMate (Partridge_Female *pf) |
Set old mate pointer. More... | |
Partridge_Female * | GetOldMate (void) |
Supply old mate pointer. More... | |
void | RemoveOldMate (bool a_knockon) |
Forget any old mate. More... | |
Public Member Functions inherited from Partridge_Base | |
Partridge_Object | GetObjectType () |
Supply object type. More... | |
bool | GetUncleStatus () |
Supply uncle status. More... | |
void | SetUncleStatus (bool a_Status) |
Set uncle status. More... | |
bool | PossibleMate (Partridge_Base *a_partridge) |
Can we mate? More... | |
Partridge_Covey * | GetCovey (void) |
Supply covey pointer. More... | |
Partridge_State | GetState (void) |
Supply state. More... | |
void | SetState (Partridge_State a_pars) |
Set state. More... | |
int | GetFamily (void) |
Supply family ID. More... | |
int | GetAge (void) |
Supply age. More... | |
void | SetAge (int a_age) |
Set age. More... | |
long | GetID (void) |
Supply ID. More... | |
void | SetFamily (unsigned int family) |
Set family ID. More... | |
void | SetCovey (Partridge_Covey *a_covey) |
Set covey pointer. More... | |
void | MakeCovey () |
Create our own covey. More... | |
void | SwitchCovey (Partridge_Covey *a_covey) |
Swap coveys. More... | |
Partridge_Base (int a_born_x, int a_born_y, int a_x, int a_y, int a_family_counter, Partridge_Covey *a_covey, Landscape *a_map, Partridge_Population_Manager *a_manager) | |
Constructor for Partridge_Base. More... | |
virtual | ~Partridge_Base (void) |
Destructor. More... | |
virtual void | CopyMyself (int a_Ptype) |
Duplicate this object. More... | |
Public Member Functions inherited from TAnimal | |
unsigned | SupplyFarmOwnerRef () |
AnimalPosition | SupplyPosition () |
APoint | SupplyPoint () |
int | SupplyPolygonRef () |
int | Supply_m_Location_x () |
int | Supply_m_Location_y () |
virtual void | CopyMyself () |
void | SetX (int a_x) |
void | SetY (int a_y) |
TAnimal (int x, int y, Landscape *L) | |
virtual void | ReinitialiseObject (int x, int y, Landscape *L) |
Used to re-use an object - must be implemented in descendent classes. More... | |
virtual int | WhatState () |
void | CheckManagement (void) |
void | CheckManagementXY (int x, int y) |
Public Member Functions inherited from TALMaSSObject | |
int | GetCurrentStateNo () |
Returns the current state number. More... | |
void | SetCurrentStateNo (int a_num) |
Sets the current state number. More... | |
bool | GetStepDone () |
Returns the step done indicator flag. More... | |
void | SetStepDone (bool a_bool) |
Sets the step done indicator flag. More... | |
virtual void | ReinitialiseObject () |
Used to re-use an object - must be implemented in descendent classes. More... | |
TALMaSSObject () | |
The constructor for TALMaSSObject. More... | |
virtual | ~TALMaSSObject () |
The destructor for TALMaSSObject. More... | |
void | OnArrayBoundsError () |
Used for debugging only, tests basic object properties. More... | |
Private Member Functions | |
Partridge_State | MFlocking (void) |
State male flocking. More... | |
Partridge_State | MFindingMate (void) |
State male finding mate. More... | |
Partridge_State | MPairing (void) |
State male pairing. More... | |
Partridge_State | MGuardingMate (void) |
State male guarding mate. More... | |
Partridge_State | MCaringForYoung (void) |
State male caring for young. More... | |
Partridge_State | MFollowingMate (void) |
State male follow mate. More... | |
void | MDying (void) |
State male dying. More... | |
virtual void | CheckMatePointers () |
A debug function. More... | |
Private Attributes | |
int | m_lifespan |
Physiological lifespan. More... | |
Partridge_Female * | m_MyOldWife |
Old mate pointer. More... | |
Partridge_Female * | m_MyMate |
Current mate pointer. More... | |
Additional Inherited Members | |
Public Attributes inherited from Partridge_Base | |
Partridge_Population_Manager * | m_OurPopulationManager |
Pointer to the population manager. More... | |
Protected Member Functions inherited from TAnimal | |
void | CorrectWrapRound () |
Corrects wrap around co-ordinate problems. More... | |
Protected Attributes inherited from Partridge_Base | |
int | m_signal |
Used to pass information to outputs. More... | |
long | m_id |
Individual bird ID. More... | |
int | m_family_counter |
Family ID. More... | |
int | m_age |
Age in days. More... | |
int | m_born_x |
x-coord of birth More... | |
int | m_born_y |
y-coord of birth More... | |
bool | m_UncleStatus |
If has uncle status in the covey. More... | |
Partridge_Object | m_object_type |
Type of pob object this is. More... | |
Partridge_Covey * | m_covey |
Pointer to the covey. More... | |
Partridge_State | m_state |
Current behavioural state. More... | |
Protected Attributes inherited from TAnimal | |
int | m_Location_x |
int | m_Location_y |
Landscape * | m_OurLandscape |
Protected Attributes inherited from TALMaSSObject | |
int | m_CurrentStateNo |
The basic state number for all objects - '-1' indicates death. More... | |
bool | m_StepDone |
Indicates whether the iterative step code is done for this timestep. More... | |
The partridge male class.
Definition at line 657 of file Partridge_All.h.
Partridge_Male::Partridge_Male | ( | int | a_born_x, |
int | a_born_y, | ||
int | a_x, | ||
int | a_y, | ||
Partridge_Covey * | a_flock, | ||
Landscape * | a_map, | ||
int | a_family_counter, | ||
Partridge_Population_Manager * | a_manager | ||
) |
Constructor.
Definition at line 2183 of file Partridge_All.cpp.
References cfg_par_max_lifespan, cfg_par_min_lifespan, m_lifespan, m_MyMate, m_MyOldWife, Partridge_Base::m_object_type, pob_Male, and CfgInt::value().
|
inlinevirtual |
int Partridge_Male::AmIaMember | ( | ) |
A debug function.
A debug function.
Definition at line 3159 of file Partridge_All.cpp.
References TALMaSSObject::GetCurrentStateNo(), Partridge_Covey::IsMember(), and Partridge_Base::m_covey.
Referenced by Partridge_Population_Manager::DoMaleSanityCheck().
|
inlinevirtual |
Are we paired?
Reimplemented from Partridge_Base.
Definition at line 713 of file Partridge_All.h.
References m_MyMate.
|
virtual |
Male BeginStep.
The BeginStep code for the male partridge. Its only function is the test for mortality of different kinds. Might as well remove him here than waste CPU time thinking about the Step code later this time-step.
Reimplemented from TAnimal.
Definition at line 2202 of file Partridge_All.cpp.
References TAnimal::CheckManagement(), CheckMatePointers(), DailyMortality(), Partridge_Base::m_age, m_lifespan, Partridge_Base::m_signal, and MDying().
|
privatevirtual |
A debug function.
This is a debug function.
Reimplemented from Partridge_Base.
Definition at line 2800 of file Partridge_All.cpp.
References TALMaSSObject::GetCurrentStateNo(), Partridge_Female::GetMate(), m_MyMate, TAnimal::m_OurLandscape, Partridge_Base::m_state, pars_MFlocking, and Landscape::Warn().
Referenced by BeginStep(), MFindingMate(), MFollowingMate(), MPairing(), OnFemaleGivingUp(), OnLookAfterKids(), OnMateDying(), OnMating(), and Step().
|
virtual |
Background mortality check.
Test for background mortality - identical to the female except that the male responds to female activity.
Reimplemented from Partridge_Base.
Definition at line 2446 of file Partridge_All.cpp.
References April, cfg_par_adult_mortality_alone, cfg_par_adult_mortalitySpring, cfg_par_adult_mortalitySummer, cfg_par_adult_mortalityWinter, g_rand_uni, Partridge_Covey::GetCoveySize(), Partridge_Base::m_covey, m_MyMate, TAnimal::m_OurLandscape, Partridge_Base::m_OurPopulationManager, October, pars_FFindingTerritory, Landscape::SupplyDayInYear(), Partridge_Population_Manager::SupplyShouldFlock(), CfgFloat::value(), and TAnimal::WhatState().
Referenced by BeginStep().
|
inlinevirtual |
General dying handler.
Reimplemented from TAnimal.
Definition at line 687 of file Partridge_All.h.
References MDying().
|
virtual |
Male EndStep.
Male EndStep - nothing to do here. Currently just checks for unknown states.
Reimplemented from TAnimal.
Definition at line 2285 of file Partridge_All.cpp.
References TAnimal::m_OurLandscape, Partridge_Base::m_state, pars_Destroy, pars_Initiation, pars_MCaringForYoung, pars_MDying, pars_MFindingMate, pars_MFlocking, pars_MFollowingMate, pars_MGuardingMate, pars_MPairing, and Landscape::Warn().
|
inline |
Are we paired?
Definition at line 719 of file Partridge_All.h.
References m_MyMate.
Referenced by Partridge_Covey::ArePaired(), Partridge_Female::CheckMatePointers(), Partridge_Covey::FindMeAHusband(), and Partridge_Communication::PassMessage().
|
inline |
Supply old mate pointer.
Definition at line 757 of file Partridge_All.h.
References m_MyOldWife.
Referenced by Partridge_Communication::PassMessage().
|
inlinevirtual |
General direct mortality handler.
Reimplemented from TAnimal.
Definition at line 703 of file Partridge_All.h.
References MDying().
Referenced by Partridge_Population_Manager::DoFirst().
|
private |
State male caring for young.
This simple ensures that there is a call to a foraging movement, the size of which is dependent upon the age of the young.
Definition at line 2617 of file Partridge_All.cpp.
References g_MaxWalk, Partridge_Covey::GetChickAge(), Partridge_Base::m_covey, Partridge_Covey::MoveDistance(), and pars_MCaringForYoung.
Referenced by Step().
|
private |
State male dying.
Do the housekeeping for dying.
Definition at line 2630 of file Partridge_All.cpp.
References population_attributes::incNoDeadMales(), Partridge_Population_Manager::m_comms_data, Partridge_Base::m_covey, TALMaSSObject::m_CurrentStateNo, PartridgeCommunicationData::m_female, PartridgeCommunicationData::m_male, Partridge_Population_Manager::m_messagecentre, m_MyMate, Partridge_Population_Manager::m_Ourkfactors, Partridge_Base::m_OurPopulationManager, Partridge_Base::m_state, TALMaSSObject::m_StepDone, k_factors::m_ThisYear, pars_Destroy, Partridge_Communication::PassMessage(), pcomm_MaleDying, Partridge_Covey::RemoveMember(), and RemoveOldMate().
Referenced by BeginStep(), Dying(), KillThis(), and OnFarmEvent().
|
private |
State male finding mate.
Caused by being unpaired on covey dissolve, he must find a mate. If the date is early then he'll try to hop into a nearby covey to find a mate if there is one. Later he goes on a more desparate search alone (which incurs a higher mortality if unsuccessful see Partridge_Male::DailyMortality.
Definition at line 2499 of file Partridge_All.cpp.
References cfg_par_MaleFlyingDistance, cfg_par_MaleMateSearchArea, cfg_par_start_dissolve, CheckMatePointers(), Partridge_Population_Manager::FillCoveyNeigbourList(), Partridge_Covey::FindMateInArea(), Partridge_Covey::FindMeAMateInCovey(), Partridge_Covey::FindNeighbour(), Partridge_Covey::FlyTo(), Partridge_Covey::GetCoveySize(), Partridge_Female::HaveTerritory(), Partridge_Population_Manager::m_comms_data, PartridgeCommunicationData::m_covey, Partridge_Base::m_covey, Partridge_Base::m_family_counter, PartridgeCommunicationData::m_female, TAnimal::m_Location_x, TAnimal::m_Location_y, PartridgeCommunicationData::m_male, Partridge_Population_Manager::m_messagecentre, m_MyMate, TAnimal::m_OurLandscape, Partridge_Base::m_OurPopulationManager, Partridge_Base::m_UncleStatus, Partridge_Base::MakeCovey(), pars_MFindingMate, pars_MFlocking, pars_MFollowingMate, pars_MGuardingMate, Partridge_Communication::PassMessage(), pcomm_Mating, Partridge_Covey::RemoveMember(), Partridge_Covey::SetFixed(), Landscape::SupplyDayInYear(), Partridge_Population_Manager::SupplyShouldFlock(), and CfgInt::value().
Referenced by Step().
|
private |
State male flocking.
Flocking. Do Nothing but wait for the covey to tell us OnStartBreedingBehaviour
Definition at line 2489 of file Partridge_All.cpp.
References Partridge_Base::m_covey, Partridge_Covey::MoveDistance(), and pars_MFlocking.
Referenced by Step().
|
private |
State male follow mate.
Will enter this state if he is paired, but the female has not yet found a territory.
Waits here until the mate has found a territory
Definition at line 2587 of file Partridge_All.cpp.
References CheckMatePointers(), Partridge_Female::HaveTerritory(), m_MyMate, pars_MFollowingMate, and pars_MGuardingMate.
Referenced by Step().
|
private |
State male guarding mate.
He will sit here until he is told to do otherwise - either mate dead, eggs have hatched or female given up.
Definition at line 2605 of file Partridge_All.cpp.
References pars_MGuardingMate.
Referenced by Step().
|
private |
State male pairing.
If he has a territory then he is must go to mate guarding otherwise he must carry on and find one by following her lead.
Definition at line 2576 of file Partridge_All.cpp.
References CheckMatePointers(), Partridge_Female::HaveTerritory(), m_MyMate, pars_MFollowingMate, and pars_MGuardingMate.
Referenced by Step().
void Partridge_Male::OnChicksDead | ( | void | ) |
Message handler.
Response to pcomm_AllChicksDead message arriving when the last chick dies.
Definition at line 2689 of file Partridge_All.cpp.
References m_MyMate, Partridge_Base::m_state, and pars_MFlocking.
Referenced by Partridge_Communication::PassMessage().
void Partridge_Male::OnChicksMatured | ( | void | ) |
Message handler.
Response to pcomm_ChicksMature message arriving when the last chick matures.
Definition at line 2699 of file Partridge_All.cpp.
References m_MyMate, Partridge_Base::m_state, and pars_MFlocking.
Referenced by Partridge_Communication::PassMessage().
|
virtual |
Management event handler.
Check for and respond to management events.
Reimplemented from TAnimal.
Definition at line 2309 of file Partridge_All.cpp.
References autumn_harrow, autumn_or_spring_plough, autumn_plough, autumn_roll, autumn_sow, burn_straw_stubble, cattle_out, cattle_out_low, cfg_par_ad_cut, cut_to_hay, cut_to_silage, cut_weeds, deep_ploughing, Landscape::EventtypeToString(), fa_ammoniumsulphate, fa_greenmanure, fa_manure, fa_npk, fa_pk, fa_sludge, fa_slurry, fp_greenmanure, fp_liquidNH3, fp_manganesesulphate, fp_manure, fp_npk, fp_npks, fp_pk, fp_sludge, fp_slurry, fungicide_treat, g_rand_uni, glyphosate, growth_regulator, harvest, hay_bailing, hay_turning, herbicide_treat, hilling_up, insecticide_treat, TAnimal::m_OurLandscape, Partridge_Base::m_state, MDying(), molluscicide, mow, pars_Destroy, pigs_out, product_treat, row_cultivation, sleep_all_day, spring_harrow, spring_plough, spring_roll, spring_sow, straw_chopping, strigling, strigling_sow, stubble_harrowing, swathing, syninsecticide_treat, CfgFloat::value(), Landscape::Warn(), water, and winter_plough.
void Partridge_Male::OnFemaleGivingUp | ( | ) |
Message handler.
Response to a pcomm_FemaleGivingUp message received if the female gives up during territory finding.
Definition at line 2783 of file Partridge_All.cpp.
References CheckMatePointers(), Partridge_Base::m_covey, m_MyMate, Partridge_Base::m_state, pars_MFlocking, RemoveOldMate(), and Partridge_Covey::SetFixed().
Referenced by Partridge_Communication::PassMessage().
void Partridge_Male::OnFoundATerrtitory | ( | ) |
Message handler.
void Partridge_Male::OnLookAfterKids | ( | void | ) |
Message handler.
Response to pcomm_EggsHatch message arriving on clutch hatching.
Definition at line 2675 of file Partridge_All.cpp.
References CheckMatePointers(), Partridge_Base::m_state, and pars_MCaringForYoung.
Referenced by Partridge_Communication::PassMessage().
void Partridge_Male::OnMateDying | ( | ) |
Message handler.
Response to a pcomm_MumDeadC message received when the female dies.
Definition at line 2761 of file Partridge_All.cpp.
References CheckMatePointers(), Partridge_Covey::GetOurChicks(), Partridge_Base::m_covey, m_MyMate, Partridge_Base::m_state, pars_MFindingMate, and RemoveOldMate().
Referenced by Partridge_Communication::PassMessage().
void Partridge_Male::OnMating | ( | Partridge_Female * | a_mate | ) |
Message handler.
Arrives here following pcomm_MatingM message from Partridge_Population_Manager::DissolveCovey.
Definition at line 2738 of file Partridge_All.cpp.
References CheckMatePointers(), Partridge_Base::GetFamily(), m_MyMate, TAnimal::m_OurLandscape, Partridge_Base::m_state, pars_MPairing, RemoveOldMate(), Partridge_Base::SetFamily(), and Landscape::Warn().
Referenced by Partridge_Communication::PassMessage().
void Partridge_Male::OnMovingHome | ( | void | ) |
Message handler.
A pcomm_MovingHome message from the female if she cannot find a nest location in the current 'territory'.
Definition at line 2729 of file Partridge_All.cpp.
References Partridge_Base::m_state, and pars_MGuardingMate.
Referenced by Partridge_Communication::PassMessage().
void Partridge_Male::OnStoppingBreeding | ( | void | ) |
Message handler.
Response to the pcomm_StoppingBreeding message, caused by the female giving up breeding.
Definition at line 2709 of file Partridge_All.cpp.
References m_MyMate, Partridge_Base::m_state, and pars_MFlocking.
Referenced by Partridge_Communication::PassMessage().
void Partridge_Male::RemoveOldMate | ( | bool | a_knockon | ) |
Forget any old mate.
Removes a memory of the old mate. If knockon is true this is reciprocal.
Definition at line 2661 of file Partridge_All.cpp.
References m_MyOldWife, and Partridge_Female::RemoveOldMate().
Referenced by MDying(), OnFemaleGivingUp(), OnMateDying(), OnMating(), Partridge_Communication::PassMessage(), Partridge_Female::RemoveOldMate(), and StartBreedingBehaviour().
|
inline |
Set old mate pointer.
Definition at line 752 of file Partridge_All.h.
References m_MyOldWife.
Referenced by Partridge_Female::FLaying().
void Partridge_Male::StartBreedingBehaviour | ( | void | ) |
Message handler.
Got this message from Partridge_Population_Manager::DissolveCovey because he has no mate and covey dissolve has happended.
Definition at line 2719 of file Partridge_All.cpp.
References Partridge_Base::m_state, pars_MFindingMate, and RemoveOldMate().
Referenced by Partridge_Population_Manager::DissolveCovey().
|
virtual |
Male Step.
Male Step code is where all his behaviour is carried out.
Reimplemented from TAnimal.
Definition at line 2228 of file Partridge_All.cpp.
References CheckMatePointers(), TALMaSSObject::m_CurrentStateNo, TAnimal::m_OurLandscape, Partridge_Base::m_state, TALMaSSObject::m_StepDone, MCaringForYoung(), MFindingMate(), MFlocking(), MFollowingMate(), MGuardingMate(), MPairing(), pars_Destroy, pars_Initiation, pars_MCaringForYoung, pars_MDying, pars_MFindingMate, pars_MFlocking, pars_MFollowingMate, pars_MGuardingMate, pars_MPairing, and Landscape::Warn().
|
inline |
|
private |
Physiological lifespan.
Definition at line 674 of file Partridge_All.h.
Referenced by BeginStep(), and Partridge_Male().
|
private |
Current mate pointer.
Definition at line 678 of file Partridge_All.h.
Referenced by ArePaired(), CheckMatePointers(), DailyMortality(), GetMate(), MDying(), MFindingMate(), MFollowingMate(), MPairing(), OnChicksDead(), OnChicksMatured(), OnFemaleGivingUp(), OnMateDying(), OnMating(), OnStoppingBreeding(), Partridge_Male(), and UnSetMate().
|
private |
Old mate pointer.
Definition at line 676 of file Partridge_All.h.
Referenced by GetOldMate(), Partridge_Male(), RemoveOldMate(), and SetOldMate().