![]() |
ALMaSS
1.2 (after EcoStack, March 2024)
The Animal, Landscape and Man Simulation System
|
The class for male voles. More...
#include <vole_all.h>
Public Member Functions | |
Vole_Male (struct_Vole_Adult *p_aVoleStruct) | |
Vole_Male constructor. More... | |
void | ReInit (struct_Vole_Adult *p_aVoleStruct) override |
~Vole_Male () override | |
void | Step () override |
Male vole Step. More... | |
void | EndStep () override |
Male vole EndStep. More... | |
![]() | |
Vole_JuvenileMale (struct_Vole_Adult *p_aVoleStruct) | |
Vole_JuvenileMale constructor. More... | |
~Vole_JuvenileMale () override | |
bool | OnFarmEvent (FarmToDo event) override |
JuvenileMale vole exernal event handler. More... | |
void | BeginStep () override |
Juvenile Male vole BeginStep. More... | |
void | OnKilled () override |
JuvenileMale vole death by external entity. More... | |
![]() | |
Vole_Base (struct_Vole_Adult *a_AVoleStruct_ptr) | |
Constructor for Vole_Base. More... | |
~Vole_Base () override | |
virtual void | Init (struct_Vole_Adult *a_AVoleStruct_ptr) |
void | st_Dying () |
All voles end here on death. More... | |
void | SetBreedingSeason (bool a_flag) |
Set Breeding Season flag. More... | |
void | SetWeight (double W) |
void | Setm_Mature () |
void | Set_BirthYear (int BirthYear) |
void | Set_MotherId (unsigned MotherIdNo) |
void | Set_FatherId (unsigned FatherIdNo) |
void | Set_NoYoungTot (int a_NoOfYoung) |
void | Set_XBorn (int a_Location_x) |
void | Set_YBorn (int a_Location_y) |
void | Set_ElemBorn (int a_Location_x, int a_Location_y) |
void | Set_VegBorn (int a_Location_x, int a_Location_y) |
void | Set_PolyRefBorn (int a_Location_x, int a_Location_y) |
void | Set_Age (int Age) |
int | WhatState () override |
bool | SupplyBornLastYear () |
Were we born this year? More... | |
bool | SupplyTerritorial () |
int | SupplyFatherId () |
int | SupplyMotherId () |
bool | SupplySex () |
int | SupplyBirthYear () |
int | SupplyTotNoYoung () |
int | SupplyXBorn () |
int | SupplyYBorn () |
int | SupplyPolyRefBorn () |
int | SupplyElemBorn () |
TTypesOfLandscapeElement | SupplyElemType () |
int | SupplyVegBorn () |
int | SupplyTerrRange () |
double | SupplyWeight () |
int | SupplyIDNo () |
bool | SupplyMature () |
int | SupplyDeathCause () |
unsigned | SupplyAge () |
unsigned | SupplyX () |
unsigned | SupplyY () |
bool | SupplyInTrap () |
InTrapPosition | SupplyTrapPosition () |
void | SetFree () |
int | SupplyHomoZyg () |
int | SupplyHeteroZyg () |
int | SupplyAllele (int locus, int allele) |
uint32 | SupplyMyAllele (int i, int j) |
int | GetGeneticFlag () |
int | GetDirectFlag () |
void | SetGeneticFlag () |
void | SetDirectFlag () |
void | UnsetGeneticFlag () |
void | UnsetDirectFlag () |
GeneticMaterial | SupplyGenes () |
void | CopyMyself (VoleObject a_vole) |
Duplicates a vole. More... | |
void | SetFertile (bool f) |
Set the male vole fertility. More... | |
bool | GetFertile () |
Get the male vole fertility. More... | |
![]() | |
TAnimal (int x, int y, Landscape *L) | |
The TAnimal constructor saving the x,y, location and the landscape pointer. More... | |
TAnimal (int x, int y) | |
The TAnimal constructor saving the x,y used if landscape is already set. More... | |
void | SetGuardMapIndex (int a_index_x, int a_index_y) |
Set the guard map index, this is used to avoid two animals operating in the same location when using multithread. More... | |
unsigned | SupplyFarmOwnerRef () const |
Get the current location farm ref if any. More... | |
AnimalPosition | SupplyPosition () const |
Returns the objects location and habitat type and veg type. More... | |
APoint | SupplyPoint () const |
Returns the objects location in ALMaSS coordinates. More... | |
int | SupplyPolygonRef () const |
Returns the polygon reference where the object is located. More... | |
TTypesOfLandscapeElement | SupplyPolygonType () const |
Returns the polygon type where the object is located. More... | |
int | Supply_m_Location_x () const |
Returns the ALMaSS x-coordinate. More... | |
int | Supply_m_Location_y () const |
Returns the ALMaSS y-coordinate. More... | |
int | SupplyGuardCellX () const |
Returns the x-index to the guard cell. More... | |
int | SupplyGuardCellY () const |
Returns the y-index to the guard cell. More... | |
int | SupplyAge () const |
Returns the animals age in days. More... | |
void | SetAge (int a_age) |
Sets the animals age in days. More... | |
virtual void | KillThis () |
Sets all parameters ready for object destruction. More... | |
virtual void | CopyMyself () |
Used to copy the object details to another in descendent classes. More... | |
void | SetX (const int a_x) |
Sets the x-coordinate. More... | |
void | SetY (const int a_y) |
Sets the y-coordinate. More... | |
virtual void | ReinitialiseObject (int a_x, int a_y, Landscape *a_l_ptr) |
virtual void | ReinitialiseObject (int a_x, int a_y) |
Used to re-use an object - must be implemented in descendent classes. More... | |
virtual void | Dying () |
A wrapped for KillThis - ideally should not be used. More... | |
void | CheckManagement () |
Used to start a check for any management related effects at the objects current location. More... | |
void | CheckManagementXY (int a_x, int a_y) |
Used to start a check for any management related effects at x,y. More... | |
![]() | |
int | GetCurrentStateNo () const |
Returns the current state number. More... | |
void | SetCurrentStateNo (int a_num) |
Sets the current state number. More... | |
bool | GetStepDone () const |
Returns the step done indicator flag. More... | |
void | SetStepDone (bool a_bool) |
Sets the step done indicator flag. More... | |
void | ReinitialiseObjectBase () |
Used to initialise an object. More... | |
TALMaSSObject () | |
The constructor for TALMaSSObject. More... | |
virtual | ~TALMaSSObject ()=default |
The destructor for TALMaSSObject. More... | |
Protected Member Functions | |
VoleDispersalReturns | Dispersal (double p_OldQual, int p_Distance) |
Male vole dispersal behaviour. More... | |
void | DetermineTerritorySize () |
Calculates the territory size needed for a vole of his weight. More... | |
bool | CanFeed () const |
Currently not used. More... | |
int | st_Maturation (void) const |
Male vole maturation control. More... | |
void | st_Infanticide (void) const |
Male vole infanticide behaviour. More... | |
bool | MortalityTest () override |
Do a mortality test. More... | |
TTypeOfVoleState | st_Eval_n_Explore (void) |
Male vole main territory assessment behaviour. More... | |
![]() | |
void | SetLocation () override |
Map location function. More... | |
void | FreeLocation () override |
Map location function. More... | |
bool | GetLocation (int px, int py) override |
Map location function. More... | |
TTypeOfVoleState | Dispersal (double p_OldQual, int p_Distance) |
JuvenileMale vole dispersal behaviour. More... | |
void | DetermineTerritorySize () |
bool | CanFeed () |
void | st_JuvenileExplore (void) |
Extra movement on weaning. More... | |
void | st_BecomeSubAdult (void) |
TTypeOfVoleState | st_Eval_n_Explore (void) |
JuvenileMale vole main territory assessment behaviour. More... | |
![]() | |
virtual void | RodenticideIngestion (void) |
double | CalculateCarryingCapacity (int x, int y, int a_ddep) const |
int | MoveQuality (int p_x, int p_y) const |
Test a location for quality while moving. More... | |
void | MoveTo (int p_Vector, int p_Distance, int iterations) |
Movement. More... | |
void | DoWalking (int p_Distance, int &p_Vector, int &vx, int &vy) const |
Walking. More... | |
void | DoWalkingCorrect (int p_Distance, int &p_Vector, int &vx, int &vy) const |
Walking where there is a danger of stepping off the world. More... | |
void | Escape (int p_Vector, int p_Distance) |
Dispersal - directed movement. More... | |
void | CheckTraps () |
![]() | |
void | CorrectWrapRound () |
Corrects wrap around co-ordinate problems. More... | |
Additional Inherited Members | |
![]() | |
static void | SetSimulationWidth (int a_value) |
Sets the simulation width. More... | |
static void | SetSimulationHeight (int a_value) |
Sets the simulation height. More... | |
static void | SetDayInYear (int a_value) |
Sets the day in year attribute. More... | |
static void | SetOurLandscape (Landscape *a_value) |
Sets the landscape pointer. More... | |
static void | SetTempToday (double a_value) |
Sets the temperature today attribute. More... | |
![]() | |
static void | OnArrayBoundsError () |
Used for debugging only, tests basic object properties. More... | |
![]() | |
TTypeOfVoleState | CurrentVState |
Vole_Population_Manager * | m_OurPopulation |
![]() | |
int | m_BirthYear |
bool | m_BornLastYear |
A flag set if the female was born the year before. More... | |
unsigned int | m_MinTerrRange |
unsigned | m_MotherId |
unsigned | m_FatherId |
int | m_Death |
int | m_TerrRange |
bool | m_Sex |
bool | m_Mature |
int | m_Age |
int | m_XBorn |
int | m_YBorn |
int | m_PolyRefBorn |
int | m_ElemBorn |
int | m_VegBorn |
int | m_LifeSpan |
double | m_Weight |
bool | m_fertile |
Flag indicating the fertility state (true means fertile) More... | |
int | m_NoOfYoungTotal |
int | m_DispVector |
bool | m_Have_Territory |
int | m_Reserves |
unsigned | IDNo |
int | m_SimH |
int | m_SimW |
GeneticMaterial | m_MyGenes |
InTrapPosition | m_intrappos |
![]() | |
int | m_Location_x |
The objects ALMaSS x coordinate. More... | |
int | m_Location_y |
The objects ALMaSS y coordinate. More... | |
int | m_guard_cell_x |
The index x to the guard cell. More... | |
int | m_guard_cell_y |
The index y to the guard cell. More... | |
int | m_AgeDays {0} |
To hold the age in days. More... | |
PesticideToxicity | m_my_pesticide |
![]() | |
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... | |
![]() | |
static unsigned int | m_MaxMaleTerritorySize = 0 |
static unsigned int | m_MaxFemaleTerritorySize = 0 |
static unsigned int | m_MinMaleTerritorySize = 0 |
static unsigned int | m_MinFemaleTerritorySize = 0 |
static double | m_MinFVoleHabQual = 0 |
static double | m_MinJMVoleHabQual = 0 |
static double | m_MinMVoleHabQual = 0 |
static double | m_MaleTerritoryRangeSlope = 0 |
static double | m_FemaleTerritoryRangeSlope = 0 |
static double | m_FHabQualThreshold3 |
static double | m_FHabQualThreshold2 |
static double | m_FHabQualThreshold1 |
static double | m_MHabQualThreshold3 |
static double | m_MHabQualThreshold2 |
static double | m_MHabQualThreshold1 |
static bool | m_BreedingSeason = false |
![]() | |
static Landscape * | m_OurLandscape = nullptr |
A pointer to the landscape object shared with all TAnimal objects. More... | |
static int | m_SimulationWidth = 0 |
A static member for the simulation width because it is often used by descendent classes. More... | |
static int | m_SimulationHeight = 0 |
A static member for the simulation height because it is often used by descendent classes. More... | |
static double | m_TemperatureToday = 0.0 |
A holder for the temperature today shared with all TAnimal objects. More... | |
static int | m_DayInYear = 0 |
A holder for the day in year shared with all TAnimal objects. More... | |
The class for male voles.
Contains all the behaviour specific to the male vole. Only st_Infanticide and st_JuvenileExplore are specific to the male, other behaviours differ only in details from the female.
Vole_Male::Vole_Male | ( | struct_Vole_Adult * | p_aVoleStruct | ) |
Vole_Male constructor.
References struct_Vole_Adult::age, struct_Vole_Adult::BirthYear, Vole_Base::m_Age, Vole_Base::m_BirthYear, Vole_Base::m_MinMaleTerritorySize, Vole_Base::m_MinTerrRange, Vole_Base::m_Sex, Vole_Base::m_TerrRange, Vole_Base::m_Weight, and struct_Vole_Adult::weight.
|
inlineprotected |
Currently not used.
Check whether our location is of sufficient quality to allow use to feed, ie. is it over or under min suitable quality (m_MinMVoleHabQual).
References Vole_Base::CalculateCarryingCapacity(), cfg_VoleDDepConst, TAnimal::m_Location_x, TAnimal::m_Location_y, Vole_Base::m_MinMVoleHabQual, and CfgInt::value().
|
inlineprotected |
Calculates the territory size needed for a vole of his weight.
References Vole_Base::m_MaleTerritoryRangeSlope, Vole_Base::m_MinMaleTerritorySize, Vole_Base::m_TerrRange, Vole_Base::m_Weight, and MinReproWeightM.
Referenced by EndStep().
|
protected |
Male vole dispersal behaviour.
Works like female dispersal - but a return code of 3 will trigger infanticide
Checks p_Distance away to see if it can find a territory in the next MHabQualThreshold category or with
an improved quality of 1.1* p_OldQual if already in optimal habitat
This entails some risk though, so there is a fixed increase in the mortality chance when it does this.
References Vole_Base::CalculateCarryingCapacity(), cfg_RecordVoleMort, cfg_VoleDDepConst, VoleSummaryOutput::ChangeData(), Vole_JuvenileMale::FreeLocation(), g_extradispmort, g_rand_uni_fnc(), g_random_fnc(), Vole_Base::m_Age, Vole_Base::m_BreedingSeason, Vole_Base::m_DispVector, TAnimal::m_guard_cell_x, TAnimal::m_guard_cell_y, Vole_Base::m_Have_Territory, TAnimal::m_Location_x, TAnimal::m_Location_y, Vole_Base::m_Mature, Vole_Base::m_MinMVoleHabQual, Vole_Base::m_OurPopulation, Vole_Base::m_TerrRange, Vole_Population_Manager::m_VoleRecordMort, Vole_Base::MoveTo(), Vole_JuvenileMale::SetLocation(), Vole_Population_Manager::SupplyInOlderTerr(), tovmort_MDisp, Population_Manager::UpdateGuardMap(), CfgInt::value(), CfgBool::value(), vdisp_CarryOn, vdisp_Die, vdisp_Infanticide, and vdisp_Mature.
Referenced by st_Eval_n_Explore().
|
overridevirtual |
Male vole EndStep.
The EndStep is one of the three timestep divisions. This is called once for each vole after BeginStep and Step.
The main function here is to remove voles that have died during step and otherwise to grow if not at max weight. It also checks if the vole was killed due to human management and determines the potential territory size.
Reimplemented from Vole_JuvenileMale.
References cfg_RecordVoleMort, VoleSummaryOutput::ChangeData(), TAnimal::CheckManagement(), Vole_Base::CurrentVState, DetermineTerritorySize(), growthperdayM, Vole_Base::m_Age, Vole_Base::m_BornLastYear, Vole_Base::m_Have_Territory, Vole_Base::m_Mature, TAnimal::m_OurLandscape, Vole_Base::m_OurPopulation, Vole_Population_Manager::m_VoleRecordMort, Vole_Base::m_Weight, MaxWeightM, Vole_Base::st_Dying(), Landscape::SupplyDayInYear(), Vole_Population_Manager::SupplyGrowthStartDate(), tovmort_MStarve, tovs_MDying, and CfgBool::value().
|
overrideprotectedvirtual |
Do a mortality test.
Takes both physiological lifespan and background mortality into account to determine whether the vole should die - repeated calls increase the risk of dying
Reimplemented from Vole_Base.
References g_DailyMortChance, g_DailyMortChanceMaleTerr, g_rand_uni_fnc(), and Vole_Base::m_Have_Territory.
|
overridevirtual |
Reimplemented from Vole_JuvenileMale.
References struct_Vole_Adult::age, struct_Vole_Adult::BirthYear, Vole_Base::Init(), Vole_Base::m_Age, Vole_Base::m_BirthYear, Vole_Base::m_MinMaleTerritorySize, Vole_Base::m_MinTerrRange, Vole_Base::m_Sex, Vole_Base::m_TerrRange, Vole_Base::m_Weight, and struct_Vole_Adult::weight.
|
protected |
Male vole main territory assessment behaviour.
Evaluates the quality of his habitat and does some limited exploration in the surrounding area to see if she can improve it by moving.
References Vole_Base::CalculateCarryingCapacity(), Vole_Base::CheckTraps(), Vole_Base::CurrentVState, Dispersal(), Vole_Population_Manager::FindClosestFemale(), Vole_JuvenileMale::FreeLocation(), g_NoFemalesMove, g_rand_uni_fnc(), g_random_fnc(), Vole_JuvenileMale::GetLocation(), Vole_Base::m_Age, Vole_Base::m_BornLastYear, Vole_Base::m_BreedingSeason, Vole_Base::m_DispVector, TAnimal::m_guard_cell_x, TAnimal::m_guard_cell_y, Vole_Base::m_Have_Territory, TAnimal::m_Location_x, TAnimal::m_Location_y, Vole_Base::m_Mature, Vole_Base::m_MinFVoleHabQual, Vole_Base::m_OurPopulation, Vole_Base::m_SimH, Vole_Base::m_SimW, Vole_Base::m_TerrRange, AnimalPosition::m_x, AnimalPosition::m_y, MaleMovement, Vole_Base::MoveQuality(), Vole_JuvenileMale::SetLocation(), Vole_Base::Setm_Mature(), Vole_Population_Manager::SupplyInOlderTerr(), TAnimal::SupplyPosition(), tovs_Infanticide, tovs_MDying, tovs_MMaturation, Population_Manager::UpdateGuardMap(), vdisp_CarryOn, vdisp_Die, vdisp_Infanticide, and vdisp_Mature.
Referenced by Step().
|
protected |
Male vole infanticide behaviour.
Will only enter here if have taken over a new area a reasonable distance from the old one and will only commit infanticide in 10% of his attempts in his minimum territory range.
Tells the population manager to send an infanticide message to all females in the territory.
References cfg_InfanticideProbability, g_rand_uni_fnc(), TAnimal::m_Location_x, TAnimal::m_Location_y, Vole_Base::m_MinTerrRange, Vole_Base::m_OurPopulation, Vole_Base::m_Weight, Vole_Population_Manager::SendMessage(), tovm_Infanticide, and CfgFloat::value().
Referenced by Step().
|
protected |
Male vole maturation control.
Decide whether to become mature or not
References TAnimal::m_OurLandscape, Vole_Base::m_OurPopulation, Landscape::SupplyDayInYear(), and Vole_Population_Manager::SupplyGrowthStartDate().
Referenced by Step().
|
overridevirtual |
Male vole Step.
The Step is one of the three timestep divisions. This is called repeatedly after BeginStep and before EndStep, until all voles report that they are done with Step.
Most of the behaviours are controlled by moving voles between behavioural states in Step (for other models this is also done in BeginStep and EndStep).
When a vole is done for the day it will signal this by setting m_StepDone==true. NB that a call to one behaviour may trigger a call to another behaviour on the next call to step inside the same timestep. In this way a daily cycle of activity can be undertaken.
Reimplemented from Vole_JuvenileMale.
References Vole_Base::CurrentVState, Vole_JuvenileMale::FreeLocation(), TALMaSSObject::m_CurrentStateNo, TAnimal::m_OurLandscape, TALMaSSObject::m_StepDone, Vole_Base::Setm_Mature(), st_Eval_n_Explore(), st_Infanticide(), st_Maturation(), tovs_Infanticide, tovs_InitialState, tovs_MDying, tovs_MEvaluateExplore, tovs_MMaturation, and Landscape::Warn().