Farm Class Reference

The base class for all farm types. More...

#include <farm.h>

List of all members.

Public Member Functions

void AddField (LE *a_newfield)
 Adds a field to a farm.
void AddNewEvent (TTypesOfVegetation a_event, long a_date, LE *a_field, int a_todo, long a_num, bool a_lock, int a_start, bool a_first_year, TTypesOfVegetation a_crop)
 Adds an event to the event queue for a farm.
virtual bool AutumnHarrow (LE *a_field, double a_user, int a_days)
 Carry out a harrow event in the autumn on a_field.
virtual bool AutumnPlough (LE *a_field, double a_user, int a_days)
 Carry out a ploughing event in the autumn on a_field.
virtual bool AutumnRoll (LE *a_field, double a_user, int a_days)
 Carry out a roll event in the autumn on a_field.
virtual bool AutumnSow (LE *a_field, double a_user, int a_days)
 Carry out a sowing event in the autumn on a_field.
virtual bool BurnStrawStubble (LE *a_field, double a_user, int a_days)
 Burn stubble on a_field.
virtual bool CattleIsOut (LE *a_field, double a_user, int a_days, int a_max)
 Generate a 'cattle_out' event for every day the cattle are on a_field.
virtual bool CattleIsOutLow (LE *a_field, double a_user, int a_days, int a_max)
 Generate a 'cattle_out_low' event for every day the cattle are on a_field.
virtual bool CattleOut (LE *a_field, double a_user, int a_days)
 Start a grazing event on a_field today.
virtual bool CattleOutLowGrazing (LE *a_field, double a_user, int a_days)
 Start a extensive grazing event on a_field today.
virtual bool CutToHay (LE *a_field, double a_user, int a_days)
 Carry out hay cutting on a_field.
virtual bool CutToSilage (LE *a_field, double a_user, int a_days)
 Cut vegetation for silage on a_field.
virtual bool CutWeeds (LE *a_field, double a_user, int a_days)
 Carry out weed topping on a_field.
virtual bool DeepPlough (LE *a_field, double a_user, int a_days)
 Carry out a deep ploughing event on a_field.
bool DoIt (int a_probability)
 Return chance out of 100.
virtual bool FA_AmmoniumSulphate (LE *a_field, double a_user, int a_days)
 Apply ammonium supahte to a_field owned by an stock farmer.
virtual bool FA_GreenManure (LE *a_field, double a_user, int a_days)
 Spread green manure on a_field owned by an stock farmer.
virtual bool FA_Manure (LE *a_field, double a_user, int a_days)
 Spread manure on a_field owned by an stock farmer.
virtual bool FA_NPK (LE *a_field, double a_user, int a_days)
 Apply NPK fertilizer to a_field owned by an stock farmer.
virtual bool FA_PK (LE *a_field, double a_user, int a_days)
 Apply PK fertilizer to a_field owned by an stock farmer.
virtual bool FA_Sludge (LE *a_field, double a_user, int a_days)
 Spread sewege sludge on a_field owned by an stock farmer.
virtual bool FA_Slurry (LE *a_field, double a_user, int a_days)
 Spready slurry on a_field owned by an stock farmer.
 Farm (void)
 Farm constructor - creates an instance of each possible crop type.
virtual bool FP_GreenManure (LE *a_field, double a_user, int a_days)
 Spread green manure on a_field owned by an arable farmer.
virtual bool FP_LiquidNH3 (LE *a_field, double a_user, int a_days)
 Apply liquid ammonia fertilizer to a_field owned by an arable farmer.
virtual bool FP_ManganeseSulphate (LE *a_field, double a_user, int a_days)
 Apply Manganse Sulphate to a_field owned by an arable farmer.
virtual bool FP_Manure (LE *a_field, double a_user, int a_days)
 Spread manure on a_field owned by an arable farmer.
virtual bool FP_NPK (LE *a_field, double a_user, int a_days)
 Apply NPK fertilizer, on a_field owned by an arable farmer.
virtual bool FP_NPKS (LE *a_field, double a_user, int a_days)
 Apply NPKS fertilizer, on a_field owned by an arable farmer.
virtual bool FP_PK (LE *a_field, double a_user, int a_days)
 Apply PK fertilizer, on a_field owned by an arable farmer.
virtual bool FP_Sludge (LE *a_field, double a_user, int a_days)
 Spread sewege on a_field owned by an arable farmer.
virtual bool FP_Slurry (LE *a_field, double a_user, int a_days)
 Apply slurry to a_field owned by an arable farmer.
virtual bool FungicideTreat (LE *a_field, double a_user, int a_days)
 Apply fungicide to a_field.
int GetArea (void)
 Returns the area of arable fields owned by that farm.
int GetFarmNumber (void)
bool GetIntensity (void)
TTypesOfFarm GetType (void)
virtual bool Glyphosate (LE *a_field, double a_user, int a_days)
virtual bool GrowthRegulator (LE *a_field, double a_user, int a_days)
 Apply growth regulator to a_field.
virtual bool Harvest (LE *a_field, double a_user, int a_days)
 Carry out a harvest on a_field.
virtual bool HayBailing (LE *a_field, double a_user, int a_days)
 Carry out hay bailing on a_field.
virtual bool HayTurning (LE *a_field, double a_user, int a_days)
 Carry out hay turning on a_field.
virtual bool HerbicideTreat (LE *a_field, double a_user, int a_days)
 Apply herbicide to a_field.
virtual bool HillingUp (LE *a_field, double a_user, int a_days)
 Do hilling up on a_field, probably of potatoes.
virtual void InitiateManagement (void)
 Kicks of the farm's management.
virtual bool InsecticideTreat (LE *a_field, double a_user, int a_days)
 Apply insecticide to a_field.
bool IsStockFarmer (void)
virtual void MakeStockFarmer (void)
virtual void Management (void)
 Starts the main management loop for the farm and performs some error checking.
virtual bool Molluscicide (LE *a_field, double a_user, int a_days)
 Apply molluscidie to a_field.
virtual bool PigsAreOut (LE *a_field, double a_user, int a_days)
 Start a pig grazing event on a_field today or soon.
virtual bool PigsAreOutForced (LE *a_field, double a_user, int a_days)
 Start a pig grazing event on a_field today - no exceptions.
virtual bool PigsOut (LE *a_field, double a_user, int a_days)
 Generate a 'pigs_out' event for every day the cattle are on a_field.
virtual bool ProductApplication0 (LE *a_field, double a_user, int a_days)
 Apply test pesticide to a_field.
virtual bool ProductApplication1 (LE *a_field, double a_user, int a_days)
 Apply test pesticide to a_field.
void RemoveField (LE *a_field)
 Removes a field to a farm.
virtual bool RowCultivation (LE *a_field, double a_user, int a_days)
 Carry out a harrowing between crop rows on a_field.
void SetFarmNumber (int a_farm_num)
virtual bool SleepAllDay (LE *a_field, double a_user, int a_days)
 Nothing to to today on a_field.
virtual bool SpringHarrow (LE *a_field, double a_user, int a_days)
 Carry out a harrow event in the spring on a_field.
virtual bool SpringPlough (LE *a_field, double a_user, int a_days)
 Carry out a ploughing event in the spring on a_field.
virtual bool SpringRoll (LE *a_field, double a_user, int a_days)
 Carry out a roll event in the spring on a_field.
virtual bool SpringSow (LE *a_field, double a_user, int a_days)
 Carry out a sowing event in the spring on a_field.
virtual bool StrawChopping (LE *a_field, double a_user, int a_days)
 Carry out straw chopping on a_field.
virtual bool Strigling (LE *a_field, double a_user, int a_days)
 Carry out a mechanical weeding on a_field.
virtual bool StriglingSow (LE *a_field, double a_user, int a_days)
 Carry out a mechanical weeding followed by sowing on a_field.
virtual bool StubbleHarrowing (LE *a_field, double a_user, int a_days)
 Carry out stubble harrowing on a_field.
virtual bool Swathing (LE *a_field, double a_user, int a_days)
 Cut the crop on a_field and leave it lying (probably rape).
virtual bool SynInsecticideTreat (LE *a_field, double a_user, int a_days)
 Apply special insecticide to a_field.
TTypesOfVegetation TranslateCropCodes (const char *str)
virtual bool Trial_Control (LE *a_field, double a_user, int a_days)
 Special pesticide trial functionality.
virtual bool Trial_InsecticideTreat (LE *a_field, double a_user, int a_days)
 Special pesticide trial functionality.
virtual bool Trial_ToxicControl (LE *a_field, double a_user, int a_days)
 Special pesticide trial functionality.
virtual bool Water (LE *a_field, double a_user, int a_days)
 Carry out a watering on a_field.
virtual bool WinterPlough (LE *a_field, double a_user, int a_days)
 Carry out a ploughing event in the winter on a_field.
virtual ~Farm (void)
 Farm destructor - deletes all crop instances and empties event queues.

Protected Member Functions

void CheckRotationManagementLoop (FarmEvent *ev)
virtual int GetFirstCropIndex (TTypesOfLandscapeElement a_type)
 Gets the first crop for the farm.
int GetFirstDate (TTypesOfVegetation a_tov)
 Gets the start date for a crop type.
virtual int GetNextCropIndex (int a_rot_index)
 Returns the next crop in the rotation.
int GetNextCropStartDate (LE *a_field, TTypesOfVegetation &a_curr_veg)
 Returns the start date of the next crop in the rotation.
void HandleEvents (void)
 If there are events to carry out do this, and perhaps start a new crop.
bool LeSwitch (FarmEvent *ev)
 Call do function for any crop with an outstanding event. Signal if the crop has terminated.

Protected Attributes

AgroChemIndustryCereal * m_agrochemindustrycereal
Carrots * m_carrots
CloverGrassGrazed1 * m_CGG1
CloverGrassGrazed2 * m_CGG2
int m_farm_num
TTypesOfFarm m_farmtype
FieldPeas * m_fieldpeas
FieldPeasStrigling * m_fieldpeasstrigling
vector< LE * > m_fields
Fodderbeet * m_fodderbeet
FodderGrass * m_foddergrass
bool m_intensity
Maize * m_maize
MaizeSilage * m_maizesilage
MaizeStrigling * m_maizestrigling
Oats * m_oats
OBarleyPeaCloverGrass * m_OBarleyPCG
OCarrots * m_ocarrots
OCloverGrassGrazed1 * m_OCGG1
OCloverGrassGrazed2 * m_OCGG2
OCloverGrassSilage1 * m_OCGS1
OFieldPeas * m_ofieldpeas
OFieldPeasSilage * m_ofieldpeassilage
OFirstYearDanger * m_ofirstyeardanger
OGrazingPigs * m_ograzingpigs
OOats * m_ooats
OPermanentGrassGrazed * m_opermgrassgrazed
OPotatoes * m_opotatoes
OSBarleySilage * m_OSBarleysilage
OSpringBarley * m_ospringbarley
OSpringBarleyPigs * m_ospringbarleypigs
OWinterBarley * m_owinterbarley
OWinterRape * m_owinterrape
OWinterRye * m_owinterrye
OWinterWheatUndersown * m_owinterwheatundersown
PermanentSetAside * m_permanentsetaside
PermanentGrassGrazed * m_permgrassgrazed
PermanentGrassLowYield * m_permgrasslowyield
PermanentGrassTussocky * m_permgrasstussocky
Potatoes * m_potatoes
PotatoesIndustry * m_potatoesindustry
LowPriority< FarmEvent * > m_queue
vector< TTypesOfVegetationm_rotation
int m_rotation_sync_index
SpringBarleyCloverGrass * m_sbarleyclovergrass
SeedGrass1 * m_seedgrass1
SeedGrass2 * m_seedgrass2
SetAsidem_setaside
SpringBarley * m_springbarley
SpringBarleyCloverGrassStrigling * m_springbarleyclovergrassstrigling
SpringBarleyPeaCloverGrassStrigling * m_springbarleypeaclovergrassstrigling
SpringBarleySeed * m_springbarleyseed
SpringBarleySilage * m_springbarleysilage
SpringBarleyStrigling * m_springbarleystrigling
SpringBarleyStriglingCulm * m_springbarleystriglingculm
SpringBarleyStriglingSingle * m_springbarleystriglingsingle
SpringRape * m_springrape
bool m_stockfarmer
Triticale * m_triticale
WinterBarley * m_winterbarley
WinterBarleyStrigling * m_winterbarleystrigling
WinterRape * m_winterrape
WinterRapeStrigling * m_winterrapestrigling
WinterRye * m_winterrye
WinterRyeStrigling * m_winterryestrigling
WinterWheatm_winterwheat
WinterWheatStrigling * m_winterwheatstrigling
WinterWheatStriglingCulm * m_winterwheatstriglingculm
WinterWheatStriglingSingle * m_winterwheatstriglingsingle
WWheatPControl * m_wwheatpcontrol
WWheatPToxicControl * m_wwheatptoxiccontrol
WWheatPTreatment * m_wwheatptreatment
YoungForestCrop * m_youngforest


Detailed Description

The base class for all farm types.

Constructor & Destructor Documentation

Farm::Farm ( void   ) 

Farm constructor - creates an instance of each possible crop type.

References m_agrochemindustrycereal, m_carrots, m_CGG1, m_CGG2, m_fieldpeas, m_fieldpeasstrigling, m_fodderbeet, m_foddergrass, m_intensity, m_maize, m_maizesilage, m_maizestrigling, m_oats, m_OBarleyPCG, m_ocarrots, m_OCGG1, m_OCGG2, m_OCGS1, m_ofieldpeas, m_ofieldpeassilage, m_ofirstyeardanger, m_ograzingpigs, m_ooats, m_opermgrassgrazed, m_opotatoes, m_OSBarleysilage, m_ospringbarley, m_ospringbarleypigs, m_owinterbarley, m_owinterrape, m_owinterrye, m_owinterwheatundersown, m_permanentsetaside, m_permgrassgrazed, m_permgrasslowyield, m_permgrasstussocky, m_potatoes, m_potatoesindustry, m_rotation_sync_index, m_sbarleyclovergrass, m_seedgrass1, m_seedgrass2, m_setaside, m_springbarley, m_springbarleyclovergrassstrigling, m_springbarleypeaclovergrassstrigling, m_springbarleyseed, m_springbarleysilage, m_springbarleystrigling, m_springbarleystriglingculm, m_springbarleystriglingsingle, m_springrape, m_stockfarmer, m_triticale, m_winterbarley, m_winterbarleystrigling, m_winterrape, m_winterrapestrigling, m_winterrye, m_winterryestrigling, m_winterwheat, m_winterwheatstrigling, m_winterwheatstriglingculm, m_winterwheatstriglingsingle, m_wwheatpcontrol, m_wwheatptoxiccontrol, m_wwheatptreatment, and m_youngforest.

00602                  {
00603   m_carrots = new Carrots;
00604   m_CGG1 = new CloverGrassGrazed1;
00605   m_CGG2 = new CloverGrassGrazed2;
00606   m_fieldpeas = new FieldPeas;
00607   m_fodderbeet = new Fodderbeet;
00608   m_foddergrass = new FodderGrass;
00609   m_maize = new Maize;
00610   m_maizesilage = new MaizeSilage;
00611   m_OBarleyPCG = new OBarleyPeaCloverGrass;
00612   m_OSBarleysilage = new OSBarleySilage;
00613   m_ocarrots = new OCarrots;
00614   m_OCGG1 = new OCloverGrassGrazed1;
00615   m_OCGG2 = new OCloverGrassGrazed2;
00616   m_OCGS1 = new OCloverGrassSilage1;
00617   m_ofieldpeas = new OFieldPeas;
00618   m_ofieldpeassilage = new OFieldPeasSilage;
00619   m_ofirstyeardanger = new OFirstYearDanger;
00620   m_ograzingpigs = new OGrazingPigs;
00621   m_oats = new Oats;
00622   m_ooats = new OOats;
00623   m_opermgrassgrazed = new OPermanentGrassGrazed;
00624   m_opotatoes = new OPotatoes;
00625   m_ospringbarley = new OSpringBarley;
00626   m_ospringbarleypigs = new OSpringBarleyPigs;
00627   m_owinterbarley = new OWinterBarley;
00628   m_owinterrape = new OWinterRape;
00629   m_owinterrye = new OWinterRye;
00630   m_owinterwheatundersown = new OWinterWheatUndersown;
00631   m_permanentsetaside = new PermanentSetAside;
00632   m_permgrassgrazed = new PermanentGrassGrazed;
00633   m_permgrasslowyield = new PermanentGrassLowYield;
00634   m_permgrasstussocky = new PermanentGrassTussocky;
00635   m_potatoes = new Potatoes;
00636   m_potatoesindustry = new PotatoesIndustry;
00637   m_sbarleyclovergrass = new SpringBarleyCloverGrass;
00638   m_seedgrass1 = new SeedGrass1;
00639   m_seedgrass2 = new SeedGrass2;
00640   m_setaside = new SetAside;
00641   m_springbarley = new SpringBarley;
00642   m_springbarleyseed = new SpringBarleySeed;
00643   m_springbarleysilage = new SpringBarleySilage;
00644   m_springrape = new SpringRape;
00645   m_triticale = new Triticale;
00646   m_winterbarley = new WinterBarley;
00647   m_winterrape = new WinterRape;
00648   m_winterrye = new WinterRye;
00649   m_winterwheat = new WinterWheat;
00650   m_wwheatpcontrol = new WWheatPControl;
00651   m_wwheatptoxiccontrol = new WWheatPToxicControl;
00652   m_wwheatptreatment = new WWheatPTreatment;
00653   m_agrochemindustrycereal = new AgroChemIndustryCereal;
00654   m_winterwheatstrigling = new WinterWheatStrigling;
00655   m_winterwheatstriglingsingle = new WinterWheatStriglingSingle;
00656   m_winterwheatstriglingculm = new WinterWheatStriglingCulm;
00657   m_springbarleyclovergrassstrigling = new SpringBarleyCloverGrassStrigling;
00658   m_springbarleystrigling = new SpringBarleyStrigling;
00659   m_springbarleystriglingsingle = new SpringBarleyStriglingSingle;
00660   m_springbarleystriglingculm = new SpringBarleyStriglingCulm;
00661   m_maizestrigling = new MaizeStrigling;
00662   m_winterrapestrigling = new WinterRapeStrigling;
00663   m_winterryestrigling = new WinterRyeStrigling;
00664   m_winterbarleystrigling = new WinterBarleyStrigling;
00665   m_fieldpeasstrigling = new FieldPeasStrigling;
00666   m_springbarleypeaclovergrassstrigling = new SpringBarleyPeaCloverGrassStrigling;
00667   m_youngforest = new YoungForestCrop;
00668   m_stockfarmer = false;
00669   m_rotation_sync_index = -1;
00670   m_intensity = (random(2)==0);
00671 }

Farm::~Farm ( void   )  [virtual]

Farm destructor - deletes all crop instances and empties event queues.

References m_agrochemindustrycereal, m_carrots, m_CGG1, m_CGG2, m_fieldpeas, m_fieldpeasstrigling, m_fodderbeet, m_foddergrass, m_maize, m_maizesilage, m_maizestrigling, m_oats, m_OBarleyPCG, m_ocarrots, m_OCGG1, m_OCGG2, m_OCGS1, m_ofieldpeas, m_ofieldpeassilage, m_ofirstyeardanger, m_ograzingpigs, m_ooats, m_opermgrassgrazed, m_opotatoes, m_OSBarleysilage, m_ospringbarley, m_ospringbarleypigs, m_owinterbarley, m_owinterrape, m_owinterrye, m_owinterwheatundersown, m_permanentsetaside, m_permgrassgrazed, m_permgrasslowyield, m_permgrasstussocky, m_potatoes, m_queue, m_sbarleyclovergrass, m_seedgrass1, m_seedgrass2, m_setaside, m_springbarley, m_springbarleyclovergrassstrigling, m_springbarleypeaclovergrassstrigling, m_springbarleyseed, m_springbarleysilage, m_springbarleystrigling, m_springbarleystriglingculm, m_springbarleystriglingsingle, m_springrape, m_triticale, m_winterbarley, m_winterbarleystrigling, m_winterrape, m_winterrapestrigling, m_winterrye, m_winterryestrigling, m_winterwheat, m_winterwheatstrigling, m_winterwheatstriglingculm, m_winterwheatstriglingsingle, m_wwheatpcontrol, m_wwheatptoxiccontrol, m_wwheatptreatment, and m_youngforest.

00678                   {
00679   delete m_carrots;
00680   delete m_CGG2;
00681   delete m_CGG1;
00682   delete m_fieldpeas;
00683   delete m_fodderbeet;
00684   delete m_foddergrass;
00685   delete m_maizesilage;
00686   delete m_maize;
00687   delete m_ocarrots;
00688   delete m_OCGG1;
00689   delete m_OCGG2;
00690   delete m_OCGS1;
00691   delete m_ofieldpeas;
00692   delete m_ofieldpeassilage;
00693   delete m_ofirstyeardanger;
00694   delete m_ograzingpigs;
00695   delete m_ooats;
00696   delete m_oats;
00697   delete m_opermgrassgrazed;
00698   delete m_opotatoes;
00699   delete m_ospringbarley;
00700   delete m_ospringbarleypigs;
00701   delete m_owinterbarley;
00702   delete m_owinterrape;
00703   delete m_owinterrye;
00704   delete m_owinterwheatundersown;
00705   delete m_OBarleyPCG;
00706   delete m_OSBarleysilage;
00707   delete m_permanentsetaside;
00708   delete m_permgrassgrazed;
00709   delete m_permgrasstussocky;
00710   delete m_permgrasslowyield;
00711   delete m_potatoes;
00712   delete m_sbarleyclovergrass;
00713   delete m_seedgrass2;
00714   delete m_seedgrass1;
00715   delete m_setaside;
00716   delete m_springbarley;
00717   delete m_springbarleyseed;
00718   delete m_springrape;
00719   delete m_springbarleysilage;
00720   delete m_agrochemindustrycereal;
00721   delete m_triticale;
00722   delete m_winterbarley;
00723   delete m_winterrape;
00724   delete m_winterrye;
00725   delete m_winterwheat;
00726   delete m_wwheatpcontrol;
00727   delete m_wwheatptoxiccontrol;
00728   delete m_wwheatptreatment;
00729   delete  m_winterwheatstrigling;
00730   delete  m_winterwheatstriglingsingle;
00731   delete  m_winterwheatstriglingculm;
00732   delete  m_springbarleyclovergrassstrigling;
00733   delete  m_springbarleystrigling;
00734   delete  m_springbarleystriglingsingle;
00735   delete  m_springbarleystriglingculm;
00736   delete  m_maizestrigling;
00737   delete  m_winterrapestrigling;
00738   delete  m_winterryestrigling;
00739   delete  m_winterbarleystrigling;
00740   delete  m_fieldpeasstrigling;
00741   delete  m_springbarleypeaclovergrassstrigling;
00742   delete  m_youngforest;
00743   LowPriPair < FarmEvent * > pair;
00744 
00745   while ( !m_queue.Empty() ) {
00746     pair = m_queue.Bottom();
00747     m_queue.Pop();
00748     delete pair.m_element;
00749   }
00750 }


Member Function Documentation

void Farm::AddField ( LE *  a_newfield  ) 

Adds a field to a farm.

References m_fields.

00830                                      {
00831   int i = (int) m_fields.size();
00832 
00833   m_fields.resize( i + 1 );
00834   m_fields[ i ] = a_newfield;
00835 }

void Farm::AddNewEvent ( TTypesOfVegetation  a_event,
long  a_date,
LE *  a_field,
int  a_todo,
long  a_num,
bool  a_lock,
int  a_start,
bool  a_first_year,
TTypesOfVegetation  a_crop 
)

Adds an event to the event queue for a farm.

References m_queue.

Referenced by HandleEvents(), InitiateManagement(), and Crop::SimpleEvent().

00461                                                                  {
00462 
00463        FarmEvent * ev = new FarmEvent( a_event, a_field, a_todo, a_run, a_lock, a_start, a_first_year, a_crop );
00464        m_queue.Push( ev, a_date );
00465 }

bool Farm::AutumnHarrow ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Carry out a harrow event in the autumn on a_field.

References autumn_harrow, DO_IT_PROB, DoIt(), g_landscape_p, and UNREFERENCED_PARAMETER.

Referenced by WinterWheat::Do().

00143 {
00144     UNREFERENCED_PARAMETER( a_user );
00145   if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
00146     a_field->Trace( autumn_harrow );
00147     a_field->SetLastTreatment( autumn_harrow );
00148    // Apply 90% mortality to the insects
00149     a_field->InsectMortality( 0.1 );
00150    // Reduce the vegetation to zero
00151     a_field->ZeroVeg();
00152     int pref=a_field->GetUnsprayedMarginPolyRef();
00153     if (pref!=-1){
00154       // Must have an unsprayed margin so need to pass the information on to it
00155       LE* um=g_landscape_p->SupplyLEPointer(pref);
00156       um->SetLastTreatment( autumn_harrow );
00157       um->InsectMortality( 0.1 );
00158       um->ZeroVeg();
00159     }
00160     return true;
00161   }
00162   return false;
00163 }

bool Farm::AutumnPlough ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Carry out a ploughing event in the autumn on a_field.

References autumn_plough, DO_IT_PROB, DoIt(), g_landscape_p, and UNREFERENCED_PARAMETER.

Referenced by WinterWheat::Do().

00088 {
00089         UNREFERENCED_PARAMETER( a_user );
00090         // LE is a pointer to the field element
00091         // a_user is a pointer to the farm
00092         // a_days is the end of the operation time - today
00093         // if a_days <0 then the time to do it is passed
00094         // the line below reads 'plough if last day possible OR if not raining and pass a probability test
00095         if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
00096                 // this bit sets up the events to occur when ploughing occurs
00097                 // The trace below is for debugging checks
00098                 a_field->Trace( autumn_plough );
00099                 // Record the event for this field, so other objects can find out it has happened
00100                 a_field->SetLastTreatment( autumn_plough );
00101                 // Apply mortality to the insects present, in this case 90%. This only affects the general insect model, any ALMaSS model species need to take their specific action.
00102                 a_field->InsectMortality( 0.1 );
00103                 // Reduce the vegetation, in this case to zero
00104                 a_field->ZeroVeg();
00105                 // If the field has a field margin, then do all this to the field margin too. In events that don't occur on an unsprayed margin, e.g. insecticide, then is part is skipped.
00106                 int pref=a_field->GetUnsprayedMarginPolyRef();
00107                 if (pref!=-1){
00108                         // Must have an unsprayed margin so need to pass the information on to it
00109                         LE* um=g_landscape_p->SupplyLEPointer(pref);
00110                         um->SetLastTreatment( autumn_plough );
00111                         um->InsectMortality( 0.1 );
00112                         um->ZeroVeg();
00113                 }
00114                 return true;      // completed
00115         }
00116         return false;       // not completed
00117 }

bool Farm::AutumnRoll ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Carry out a roll event in the autumn on a_field.

References autumn_roll, DO_IT_PROB, DoIt(), g_landscape_p, and UNREFERENCED_PARAMETER.

Referenced by WinterWheat::Do().

00170 {
00171     UNREFERENCED_PARAMETER( a_user );
00172   if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
00173     a_field->Trace( autumn_roll );
00174     a_field->SetLastTreatment( autumn_roll );
00175     a_field->ZeroVeg();
00176     int pref=a_field->GetUnsprayedMarginPolyRef();
00177     if (pref!=-1){
00178       // Must have an unsprayed margin so need to pass the information on to it
00179       LE* um=g_landscape_p->SupplyLEPointer(pref);
00180       um->SetLastTreatment( autumn_roll );
00181       um->ZeroVeg();
00182     }
00183     return true;
00184   }
00185   return false;
00186 }

bool Farm::AutumnSow ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Carry out a sowing event in the autumn on a_field.

References autumn_sow, DO_IT_PROB, DoIt(), g_landscape_p, and UNREFERENCED_PARAMETER.

Referenced by WinterWheat::Do().

00193 {
00194     UNREFERENCED_PARAMETER( a_user );
00195   if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
00196     a_field->Trace( autumn_sow );
00197     a_field->SetLastTreatment( autumn_sow );
00198     a_field->SetGrowthPhase( sow );
00199    // Reduce the vegetation to zero
00200     a_field->ZeroVeg();
00201     int pref=a_field->GetUnsprayedMarginPolyRef();
00202     if (pref!=-1){
00203       // Must have an unsprayed margin so need to pass the information on to it
00204       LE* um=g_landscape_p->SupplyLEPointer(pref);
00205       um->SetLastTreatment( autumn_sow );
00206       um->SetGrowthPhase( sow );
00207       um->ZeroVeg();
00208     }
00209     return true;
00210   }
00211   return false;
00212 }

bool Farm::BurnStrawStubble ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Burn stubble on a_field.

References burn_straw_stubble, DO_IT_PROB, DoIt(), g_landscape_p, and UNREFERENCED_PARAMETER.

01584 {
01585   UNREFERENCED_PARAMETER( a_user );
01586   if ( (0 >= a_days) && (g_weather->GetRainPeriod(g_date->Date(),3)>0.1))
01587   {
01588     return true;
01589   }
01590   if ( (0 >= a_days) || ((g_weather->GetRainPeriod(g_date->Date(),3)<0.1)
01591           && DoIt(DO_IT_PROB)))
01592   {
01593     a_field->Trace( burn_straw_stubble );
01594     a_field->SetLastTreatment( burn_straw_stubble );
01595     a_field->InsectMortality( 0.4 );
01596     a_field->ReduceVeg( 0.2 );
01597     a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
01598     int pref=a_field->GetUnsprayedMarginPolyRef();
01599     if (pref!=-1){
01600       // Must have an unsprayed margin so need to pass the information on to it
01601       LE* um=g_landscape_p->SupplyLEPointer(pref);
01602       um->SetLastTreatment( burn_straw_stubble );
01603       um->ReduceVeg( 0.2 );
01604       um->InsectMortality( 0.4 );
01605       um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
01606     }
01607     return true;
01608   }
01609   return false;
01610 }

bool Farm::CattleIsOut ( LE *  a_field,
double  a_user,
int  a_days,
int  a_max 
) [virtual]

Generate a 'cattle_out' event for every day the cattle are on a_field.

References cattle_out, DoIt(), g_landscape_p, l_farm_cattle_veg_reduce(), and UNREFERENCED_PARAMETER.

Referenced by SetAside::Do().

01327 {
01328   UNREFERENCED_PARAMETER( a_user );
01329   a_field->SetLastTreatment( cattle_out );
01330   a_field->Trace( cattle_out );
01331   // Reduce the vegetation because of grazing
01332   double h=a_field->GetVegHeight();
01333   double reduc = 1-(l_farm_cattle_veg_reduce.value()*((h-15)/15));
01334   a_field->ReduceVeg_Extended( reduc );
01335   int pref=a_field->GetUnsprayedMarginPolyRef();
01336   if (pref!=-1){
01337     // Must have an unsprayed margin so need to pass the information on to it
01338     LE* um=g_landscape_p->SupplyLEPointer(pref);
01339     um->SetLastTreatment( cattle_out );
01340     um->ReduceVeg_Extended( reduc );
01341   }
01342   // **cjt** added 24/05/03 to prevent conflict with date checking code
01343   // in the management plans
01344   int d1=g_date->DayInYear(5,9);
01345   if (d1>a_max)
01346     d1=a_max;
01347   if ( ( g_date->DayInYear()> d1 ) &&
01348        ((0 >= a_days)||  DoIt(50/a_days))
01349        ) {
01350     a_field->ToggleCattleGrazing();
01351     int pref=a_field->GetUnsprayedMarginPolyRef();
01352     if (pref!=-1){
01353       // Must have an unsprayed margin so need to pass the information on to it
01354       LE* um=g_landscape_p->SupplyLEPointer(pref);
01355       um->ToggleCattleGrazing();
01356     }
01357     return true;
01358   }
01359   return false;
01360 }

bool Farm::CattleIsOutLow ( LE *  a_field,
double  a_user,
int  a_days,
int  a_max 
) [virtual]

Generate a 'cattle_out_low' event for every day the cattle are on a_field.

References cattle_out_low, DoIt(), g_landscape_p, l_farm_cattle_veg_reduce2(), and UNREFERENCED_PARAMETER.

01367 {
01368   UNREFERENCED_PARAMETER( a_user );
01369   // Generate a 'cattle_in_out' event for every day the cattle is on the
01370   // field.
01371     a_field->SetLastTreatment( cattle_out_low );
01372     a_field->Trace( cattle_out_low );
01373     // Reduce the vegetation because of grazing
01374     double h=a_field->GetVegHeight();
01375     double reduc = 1-(l_farm_cattle_veg_reduce2.value()*((h-15)/15));
01376     a_field->ReduceVeg_Extended( reduc );
01377     int pref=a_field->GetUnsprayedMarginPolyRef();
01378     if (pref!=-1){
01379       // Must have an unsprayed margin so need to pass the information on to it
01380       LE* um=g_landscape_p->SupplyLEPointer(pref);
01381       um->SetLastTreatment( cattle_out_low );
01382       um->ReduceVeg_Extended( reduc );
01383     }
01384     // **cjt** added 24/05/03 to prevent conflict with date checking code
01385     // in the management plans
01386     int d1=g_date->DayInYear(5,9);
01387     if (d1>a_max) d1=a_max;
01388     if ( ( g_date->DayInYear()>g_date->DayInYear(5,9) )&&
01389            ((0 >= a_days)||  DoIt(50/a_days)))
01390     {
01391       a_field->ToggleCattleGrazing();
01392       int pref=a_field->GetUnsprayedMarginPolyRef();
01393       if (pref!=-1){
01394         // Must have an unsprayed margin so need to pass the information on to it
01395         LE* um=g_landscape_p->SupplyLEPointer(pref);
01396         um->ToggleCattleGrazing();
01397       }
01398       return true;
01399     }
01400   return false;
01401 }

bool Farm::CattleOut ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Start a grazing event on a_field today.

References cattle_out, DO_IT_PROB, DoIt(), g_landscape_p, l_farm_cattle_veg_reduce(), and UNREFERENCED_PARAMETER.

Referenced by SetAside::Do().

01269 {
01270   UNREFERENCED_PARAMETER( a_user );
01271   if ( (0 >= a_days)||  DoIt(DO_IT_PROB)) {
01272           a_field->ToggleCattleGrazing();
01273     a_field->Trace( cattle_out );
01274     a_field->SetLastTreatment( cattle_out );
01275     // Reduce the vegetation because of grazing
01276     double h=a_field->GetVegHeight();
01277     double reduc = 1-(l_farm_cattle_veg_reduce.value()*((h-15)/15));
01278     a_field->ReduceVeg_Extended( reduc );
01279     int pref=a_field->GetUnsprayedMarginPolyRef();
01280     if (pref!=-1){
01281       // Must have an unsprayed margin so need to pass the information on to it
01282          // This happens if all arable fields are given unsprayed margins - they have no effect on grass unless it is sprayed with pesticides
01283       LE* um=g_landscape_p->SupplyLEPointer(pref);
01284       um->ToggleCattleGrazing();
01285       um->SetLastTreatment( cattle_out );
01286       um->ReduceVeg_Extended( reduc );
01287     }
01288     return true;
01289   }
01290   return false;
01291 }

bool Farm::CattleOutLowGrazing ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Start a extensive grazing event on a_field today.

References cattle_out_low, DO_IT_PROB, DoIt(), g_landscape_p, l_farm_cattle_veg_reduce2(), and UNREFERENCED_PARAMETER.

01298 {
01299   UNREFERENCED_PARAMETER( a_user );
01300   if ( (0 >= a_days)||  DoIt(DO_IT_PROB)) {
01301           a_field->ToggleCattleGrazing();
01302     a_field->Trace( cattle_out_low );
01303     a_field->SetLastTreatment( cattle_out_low );
01304     // Reduce the vegetation because of grazing
01305     double h=a_field->GetVegHeight();
01306     double reduc = 1-(l_farm_cattle_veg_reduce2.value()*((h-15)/15));
01307     a_field->ReduceVeg_Extended( reduc );
01308     int pref=a_field->GetUnsprayedMarginPolyRef();
01309     if (pref!=-1){
01310       // Must have an unsprayed margin so need to pass the information on to it
01311          // This happens if all arable fields are given unsprayed margins - they have no effect on grass unless it is sprayed with pesticides
01312       LE* um=g_landscape_p->SupplyLEPointer(pref);
01313       um->ToggleCattleGrazing();
01314       um->SetLastTreatment( cattle_out_low );
01315       um->ReduceVeg_Extended( reduc );
01316     }
01317     return true;
01318   }
01319   return false;
01320 }

void Farm::CheckRotationManagementLoop ( FarmEvent ev  )  [protected]

Rotation error check function

References m_farmtype, FarmEvent::m_field, and m_rotation.

Referenced by HandleEvents().

00480                                                        {
00481   if ( ev->m_field->GetMgtLoopDetectDate() == g_date->Date() ) {
00482     // The last crop managment plan stopped on the same day as
00483     // it was started.
00484 
00485     // Bump loop counter.
00486     ev->m_field->SetMgtLoopDetectCount( ev->m_field->GetMgtLoopDetectCount() + 1 );
00487 
00488     if ( ev->m_field->GetMgtLoopDetectCount() > ( long )( m_rotation.size() + 2 ) ) {
00489       // We have a loop.
00490       char errornum[ 20 ];
00491       sprintf( errornum, "%d", m_farmtype );
00492       g_msg->Warn( WARN_BUG, "Rotation management loop detected in farmtype ", errornum );
00493       exit( 1 );
00494     }
00495   } else {
00496     ev->m_field->SetMgtLoopDetectCount( 0 );
00497   }
00498 }

bool Farm::CutToHay ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Carry out hay cutting on a_field.

References cut_to_hay, DO_IT_PROB, DoIt(), g_landscape_p, and UNREFERENCED_PARAMETER.

Referenced by SetAside::Do().

01617 {
01618   UNREFERENCED_PARAMETER( a_user );
01619   if ( (0 >= a_days) || ((g_weather->GetRainPeriod(g_date->Date(),5)<0.1)
01620           && DoIt(DO_IT_PROB)))
01621   {
01622     a_field->Trace( cut_to_hay );
01623     a_field->SetLastTreatment( cut_to_hay );
01624     a_field->InsectMortality( 0.4 );
01625     a_field->ReduceVeg_Extended( 0.2 );
01626     a_field->SetVegHeight( 10, 0.3, 0.0, 0 );
01627     a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
01628     int pref=a_field->GetUnsprayedMarginPolyRef();
01629     if (pref!=-1){
01630       // Must have an unsprayed margin so need to pass the information on to it
01631       LE* um=g_landscape_p->SupplyLEPointer(pref);
01632       um->SetLastTreatment( cut_to_hay );
01633       um->InsectMortality( 0.4 );
01634       um->ReduceVeg_Extended( 0.2 );
01635       um->SetVegHeight( 10, 0.3, 0.0, 0 );
01636       um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
01637     }
01638     return true;
01639   }
01640   return false;
01641 }

bool Farm::CutToSilage ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Cut vegetation for silage on a_field.

References cut_to_silage, DO_IT_PROB, DoIt(), g_landscape_p, and UNREFERENCED_PARAMETER.

Referenced by SetAside::Do().

01674 {
01675     UNREFERENCED_PARAMETER( a_user );
01676     if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
01677     a_field->Trace( cut_to_silage );
01678     a_field->SetLastTreatment( cut_to_silage );
01679     a_field->ReduceVeg_Extended( 0.2 );
01680     a_field->InsectMortality( 0.4 );
01681     a_field->SetVegHeight( 10, 0.3, 0.0, 0 );
01682     a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
01683     int pref=a_field->GetUnsprayedMarginPolyRef();
01684     if (pref!=-1){
01685       // Must have an unsprayed margin so need to pass the information on to it
01686       LE* um=g_landscape_p->SupplyLEPointer(pref);
01687       um->SetLastTreatment( cut_to_silage );
01688       um->ReduceVeg_Extended( 0.2 );
01689       um->InsectMortality( 0.4 );
01690       um->SetVegHeight( 10, 0.3, 0.0, 0 );
01691       um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
01692     }
01693     return true;
01694   }
01695   return false;
01696 }

bool Farm::CutWeeds ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Carry out weed topping on a_field.

References cut_weeds, DO_IT_PROB, DoIt(), g_landscape_p, and UNREFERENCED_PARAMETER.

01648 {
01649   UNREFERENCED_PARAMETER( a_user );
01650   if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB)))
01651   {
01652     a_field->Trace( cut_weeds );
01653     a_field->SetLastTreatment( cut_weeds );
01654     a_field->ReduceVeg( 0.8 );
01655     a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
01656     int pref=a_field->GetUnsprayedMarginPolyRef();
01657     if (pref!=-1){
01658       // Must have an unsprayed margin so need to pass the information on to it
01659       LE* um=g_landscape_p->SupplyLEPointer(pref);
01660       um->SetLastTreatment( cut_weeds );
01661       um->ReduceVeg( 0.8 );
01662       um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
01663     }
01664     return true;
01665   }
01666   return false;
01667 }

bool Farm::DeepPlough ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Carry out a deep ploughing event on a_field.

References deep_ploughing, DO_IT_PROB, DoIt(), g_landscape_p, and UNREFERENCED_PARAMETER.

Referenced by WinterWheat::Do().

00244 {
00245   UNREFERENCED_PARAMETER( a_user );
00246   if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
00247     a_field->Trace( deep_ploughing );
00248     a_field->SetLastTreatment( deep_ploughing );
00249    // Apply 90% mortality to the insects
00250     a_field->InsectMortality( 0.1 );
00251    // Reduce the vegetation to zero
00252     a_field->ZeroVeg();
00253     int pref=a_field->GetUnsprayedMarginPolyRef();
00254     if (pref!=-1){
00255       // Must have an unsprayed margin so need to pass the information on to it
00256       LE* um=g_landscape_p->SupplyLEPointer(pref);
00257       um->SetLastTreatment( deep_ploughing );
00258       um->InsectMortality( 0.1 );
00259       um->ZeroVeg();
00260     }
00261     return true;
00262   }
00263   return false;
00264 }

bool Farm::DoIt ( int  a_probability  ) 

bool Farm::FA_AmmoniumSulphate ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Apply ammonium supahte to a_field owned by an stock farmer.

References DO_IT_PROB, DoIt(), fa_ammoniumsulphate, g_landscape_p, and UNREFERENCED_PARAMETER.

00668 {
00669   UNREFERENCED_PARAMETER( a_user );
00670   if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
00671     a_field->Trace( fa_ammoniumsulphate );
00672     a_field->SetLastTreatment( fa_ammoniumsulphate );
00673     a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
00674     int pref=a_field->GetUnsprayedMarginPolyRef();
00675     if (pref!=-1){
00676       // Must have an unsprayed margin so need to pass the information on to it
00677       LE* um=g_landscape_p->SupplyLEPointer(pref);
00678       um->SetLastTreatment( fa_ammoniumsulphate );
00679       um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
00680     }
00681     return true;
00682   }
00683   return false;
00684 }

bool Farm::FA_GreenManure ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Spread green manure on a_field owned by an stock farmer.

References DO_IT_PROB, DoIt(), fa_greenmanure, g_landscape_p, and UNREFERENCED_PARAMETER.

00718 {
00719   UNREFERENCED_PARAMETER( a_user );
00720   if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
00721     a_field->Trace( fa_greenmanure );
00722     a_field->SetLastTreatment( fa_greenmanure );
00723     a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
00724     int pref=a_field->GetUnsprayedMarginPolyRef();
00725     if (pref!=-1){
00726       // Must have an unsprayed margin so need to pass the information on to it
00727       LE* um=g_landscape_p->SupplyLEPointer(pref);
00728       um->SetLastTreatment( fa_greenmanure );
00729       um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
00730     }
00731     return true;
00732   }
00733   return false;
00734 }

bool Farm::FA_Manure ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Spread manure on a_field owned by an stock farmer.

References DO_IT_PROB, DoIt(), fa_manure, g_landscape_p, and UNREFERENCED_PARAMETER.

Referenced by WinterWheat::Do().

00692 {
00693   UNREFERENCED_PARAMETER( a_user );
00694   if ( (0 >= a_days) || ((g_weather->GetTemp()>0)&&
00695                                  !g_weather->Raining() && DoIt(DO_IT_PROB)))
00696 {
00697     a_field->Trace( fa_manure );
00698     a_field->SetLastTreatment( fa_manure );
00699     a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
00700     int pref=a_field->GetUnsprayedMarginPolyRef();
00701     if (pref!=-1){
00702       // Must have an unsprayed margin so need to pass the information on to it
00703       LE* um=g_landscape_p->SupplyLEPointer(pref);
00704       um->SetLastTreatment( fa_manure );
00705       um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
00706     }
00707     return true;
00708   }
00709   return false;
00710 }

bool Farm::FA_NPK ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Apply NPK fertilizer to a_field owned by an stock farmer.

References DO_IT_PROB, DoIt(), fa_npk, g_landscape_p, and UNREFERENCED_PARAMETER.

Referenced by WinterWheat::Do().

00595 {
00596   UNREFERENCED_PARAMETER( a_user );
00597   if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
00598     a_field->Trace( fa_npk );
00599     a_field->SetLastTreatment( fa_npk );
00600     a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
00601     int pref=a_field->GetUnsprayedMarginPolyRef();
00602     if (pref!=-1){
00603       // Must have an unsprayed margin so need to pass the information on to it
00604       LE* um=g_landscape_p->SupplyLEPointer(pref);
00605       um->SetLastTreatment( fa_npk );
00606       um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
00607     }
00608     return true;
00609   }
00610   return false;
00611 }

bool Farm::FA_PK ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Apply PK fertilizer to a_field owned by an stock farmer.

References DO_IT_PROB, DoIt(), fa_pk, g_landscape_p, and UNREFERENCED_PARAMETER.

00619 {
00620   UNREFERENCED_PARAMETER( a_user );
00621   if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
00622     a_field->Trace( fa_pk );
00623     a_field->SetLastTreatment( fa_pk );
00624     a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
00625     int pref=a_field->GetUnsprayedMarginPolyRef();
00626     if (pref!=-1){
00627       // Must have an unsprayed margin so need to pass the information on to it
00628       LE* um=g_landscape_p->SupplyLEPointer(pref);
00629       um->SetLastTreatment( fa_pk );
00630       um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
00631     }
00632     return true;
00633   }
00634   return false;
00635 }

bool Farm::FA_Sludge ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Spread sewege sludge on a_field owned by an stock farmer.

References DO_IT_PROB, DoIt(), fa_sludge, g_landscape_p, and UNREFERENCED_PARAMETER.

00742 {
00743   UNREFERENCED_PARAMETER( a_user );
00744   if ( (0 >= a_days) || ((g_weather->GetTemp()>0)&&
00745                                  !g_weather->Raining() && DoIt(DO_IT_PROB)))
00746 {
00747     a_field->Trace( fa_sludge );
00748     a_field->SetLastTreatment( fa_sludge );
00749     a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
00750     int pref=a_field->GetUnsprayedMarginPolyRef();
00751     if (pref!=-1){
00752       // Must have an unsprayed margin so need to pass the information on to it
00753       LE* um=g_landscape_p->SupplyLEPointer(pref);
00754       um->SetLastTreatment( fa_sludge );
00755       um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
00756     }
00757     return true;
00758   }
00759   return false;
00760 }

bool Farm::FA_Slurry ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Spready slurry on a_field owned by an stock farmer.

References DO_IT_PROB, DoIt(), fa_slurry, g_landscape_p, and UNREFERENCED_PARAMETER.

Referenced by WinterWheat::Do().

00643 {
00644   UNREFERENCED_PARAMETER( a_user );
00645   if ( (0 >= a_days) || ((g_weather->GetTemp()>0)&&
00646                         !g_weather->Raining() && DoIt(DO_IT_PROB)))
00647 {
00648     a_field->Trace( fa_slurry );
00649     a_field->SetLastTreatment( fa_slurry );
00650     a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
00651     int pref=a_field->GetUnsprayedMarginPolyRef();
00652     if (pref!=-1){
00653       // Must have an unsprayed margin so need to pass the information on to it
00654       LE* um=g_landscape_p->SupplyLEPointer(pref);
00655       um->SetLastTreatment( fa_slurry );
00656       um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
00657     }
00658     return true;
00659   }
00660   return false;
00661 }

bool Farm::FP_GreenManure ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Spread green manure on a_field owned by an arable farmer.

References DO_IT_PROB, DoIt(), fp_greenmanure, g_landscape_p, and UNREFERENCED_PARAMETER.

00545 {
00546   UNREFERENCED_PARAMETER( a_user );
00547   if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
00548     a_field->Trace( fp_greenmanure );
00549     a_field->SetLastTreatment( fp_greenmanure );
00550     a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
00551     int pref=a_field->GetUnsprayedMarginPolyRef();
00552     if (pref!=-1){
00553       // Must have an unsprayed margin so need to pass the information on to it
00554       LE* um=g_landscape_p->SupplyLEPointer(pref);
00555       um->SetLastTreatment( fp_greenmanure );
00556       um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
00557     }
00558     return true;
00559   }
00560   return false;
00561 }

bool Farm::FP_LiquidNH3 ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Apply liquid ammonia fertilizer to a_field owned by an arable farmer.

References DO_IT_PROB, DoIt(), fp_liquidNH3, g_landscape_p, and UNREFERENCED_PARAMETER.

00446 {
00447   UNREFERENCED_PARAMETER( a_user );
00448   if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
00449     a_field->Trace( fp_liquidNH3 );
00450     a_field->SetLastTreatment( fp_liquidNH3 );
00451     a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
00452     int pref=a_field->GetUnsprayedMarginPolyRef();
00453     if (pref!=-1){
00454       // Must have an unsprayed margin so need to pass the information on to it
00455       LE* um=g_landscape_p->SupplyLEPointer(pref);
00456       um->SetLastTreatment(fp_liquidNH3);
00457       um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
00458     }
00459     return true;
00460   }
00461   return false;
00462 }

bool Farm::FP_ManganeseSulphate ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Apply Manganse Sulphate to a_field owned by an arable farmer.

References DO_IT_PROB, DoIt(), fp_manganesesulphate, g_landscape_p, and UNREFERENCED_PARAMETER.

Referenced by WinterWheat::Do().

00496 {
00497   UNREFERENCED_PARAMETER( a_user );
00498   if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
00499     a_field->Trace( fp_manganesesulphate );
00500     a_field->SetLastTreatment( fp_manganesesulphate );
00501     a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
00502     int pref=a_field->GetUnsprayedMarginPolyRef();
00503     if (pref!=-1){
00504       // Must have an unsprayed margin so need to pass the information on to it
00505       LE* um=g_landscape_p->SupplyLEPointer(pref);
00506       um->SetLastTreatment( fp_manganesesulphate );
00507       um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
00508     }
00509     return true;
00510   }
00511   return false;
00512 }

bool Farm::FP_Manure ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Spread manure on a_field owned by an arable farmer.

References DO_IT_PROB, DoIt(), fp_manure, g_landscape_p, and UNREFERENCED_PARAMETER.

00520 {
00521   UNREFERENCED_PARAMETER( a_user );
00522   if ( (0 >= a_days) || ((g_weather->GetTemp()>0)&&
00523                         !g_weather->Raining() && DoIt(DO_IT_PROB))) {
00524     a_field->Trace( fp_manure );
00525     a_field->SetLastTreatment( fp_manure );
00526     a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
00527     int pref=a_field->GetUnsprayedMarginPolyRef();
00528     if (pref!=-1){
00529       // Must have an unsprayed margin so need to pass the information on to it
00530       LE* um=g_landscape_p->SupplyLEPointer(pref);
00531       um->SetLastTreatment( fp_manure );
00532       um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
00533     }
00534     return true;
00535   }
00536   return false;
00537 }

bool Farm::FP_NPK ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Apply NPK fertilizer, on a_field owned by an arable farmer.

References DO_IT_PROB, DoIt(), fp_npk, g_landscape_p, and UNREFERENCED_PARAMETER.

Referenced by WinterWheat::Do().

00398 {
00399   UNREFERENCED_PARAMETER( a_user );
00400   if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
00401     a_field->Trace( fp_npk );
00402     a_field->SetLastTreatment( fp_npk );
00403     a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
00404     int pref=a_field->GetUnsprayedMarginPolyRef();
00405     if (pref!=-1){
00406       // Must have an unsprayed margin so need to pass the information on to it
00407       LE* um=g_landscape_p->SupplyLEPointer(pref);
00408       um->SetLastTreatment(fp_npk);
00409       um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
00410     }
00411     return true;
00412   }
00413   return false;
00414 }

bool Farm::FP_NPKS ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Apply NPKS fertilizer, on a_field owned by an arable farmer.

References DO_IT_PROB, DoIt(), fp_npks, g_landscape_p, sleep_all_day, and UNREFERENCED_PARAMETER.

00371 {
00372   UNREFERENCED_PARAMETER( a_user );
00373   if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
00374     a_field->Trace( fp_npks );
00375     a_field->SetLastTreatment( fp_npks );
00376     a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
00377     int pref=a_field->GetUnsprayedMarginPolyRef();
00378 if (pref!=-1){
00379   // Must have an unsprayed margin so need to pass the information on to it
00380   LE* um=g_landscape_p->SupplyLEPointer(pref);
00381   um->SetLastTreatment(sleep_all_day);
00382   um->SetGrowthPhase( harvest1 );
00383   um->InsectMortality( 0.4 );
00384   um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
00385 }
00386 
00387     return true;
00388   }
00389   return false;
00390 }

bool Farm::FP_PK ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Apply PK fertilizer, on a_field owned by an arable farmer.

References DO_IT_PROB, DoIt(), fp_pk, g_landscape_p, and UNREFERENCED_PARAMETER.

00422 {
00423   UNREFERENCED_PARAMETER( a_user );
00424   if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
00425     a_field->Trace( fp_pk );
00426     a_field->SetLastTreatment( fp_pk );
00427     a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
00428     int pref=a_field->GetUnsprayedMarginPolyRef();
00429     if (pref!=-1){
00430       // Must have an unsprayed margin so need to pass the information on to it
00431       LE* um=g_landscape_p->SupplyLEPointer(pref);
00432       um->SetLastTreatment(fp_pk);
00433       um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
00434     }
00435     return true;
00436   }
00437   return false;
00438 }

bool Farm::FP_Sludge ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Spread sewege on a_field owned by an arable farmer.

References DO_IT_PROB, DoIt(), fp_sludge, g_landscape_p, and UNREFERENCED_PARAMETER.

00569 {
00570   UNREFERENCED_PARAMETER( a_user );
00571   if ( (0 >= a_days) || ((g_weather->GetTemp()>0)&&
00572                                  !g_weather->Raining() && DoIt(DO_IT_PROB)))
00573 {
00574     a_field->Trace( fp_sludge );
00575     a_field->SetLastTreatment( fp_sludge );
00576     a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
00577     int pref=a_field->GetUnsprayedMarginPolyRef();
00578     if (pref!=-1){
00579       // Must have an unsprayed margin so need to pass the information on to it
00580       LE* um=g_landscape_p->SupplyLEPointer(pref);
00581       um->SetLastTreatment( fp_sludge );
00582       um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
00583     }
00584     return true;
00585   }
00586   return false;
00587 }

bool Farm::FP_Slurry ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Apply slurry to a_field owned by an arable farmer.

References DO_IT_PROB, DoIt(), fp_slurry, g_landscape_p, and UNREFERENCED_PARAMETER.

Referenced by WinterWheat::Do().

00470 {
00471   UNREFERENCED_PARAMETER( a_user );
00472   if ( (0 >= a_days) || ((g_weather->GetTemp()>0)&&
00473                                  !g_weather->Raining() && DoIt(DO_IT_PROB)))
00474 {
00475     a_field->Trace( fp_slurry );
00476     a_field->SetLastTreatment( fp_slurry );
00477     a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
00478     int pref=a_field->GetUnsprayedMarginPolyRef();
00479     if (pref!=-1){
00480       // Must have an unsprayed margin so need to pass the information on to it
00481       LE* um=g_landscape_p->SupplyLEPointer(pref);
00482       um->SetLastTreatment(fp_slurry);
00483       um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
00484     }
00485     return true;
00486   }
00487   return false;
00488 }

bool Farm::FungicideTreat ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Apply fungicide to a_field.

References DO_IT_PROB, DoIt(), fungicide_treat, and UNREFERENCED_PARAMETER.

Referenced by WinterWheat::Do().

00833 {
00834   UNREFERENCED_PARAMETER( a_user );
00835   if (0 >= a_days)
00836   {
00837     if ( (!g_weather->Raining()) && (g_weather->GetWind()<4.5) &&
00838         ( ! a_field->GetSignal() & LE_SIG_NO_FUNGICIDE )) {
00839       a_field->Trace( fungicide_treat );
00840       a_field->SetLastTreatment( fungicide_treat );
00841       a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
00842     }
00843     return true;
00844   }
00845   else if ( (g_weather->GetWind()<4.5) &&
00846             (!g_weather->Raining()) && DoIt(DO_IT_PROB)) {
00847     if ( ! (a_field->GetSignal() & LE_SIG_NO_FUNGICIDE) ) {
00848       a_field->Trace( fungicide_treat );
00849       a_field->SetLastTreatment( fungicide_treat );
00850       a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
00851     }
00852     return true;
00853   }
00854   return false;
00855 }

int Farm::GetArea ( void   ) 

Returns the area of arable fields owned by that farm.

References m_fields, and tole_Field.

00753                   {
00754         int area = 0;
00755         for ( unsigned int i = 0; i < m_fields.size(); i++ ) {
00756                 if (m_fields[i]->GetElementType()==tole_Field) area += (int) m_fields[i]->GetArea();
00757         }
00758         return area;
00759 }

int Farm::GetFarmNumber ( void   )  [inline]

References m_farm_num.

00458 { return m_farm_num; }

int Farm::GetFirstCropIndex ( TTypesOfLandscapeElement  a_type  )  [protected, virtual]

Gets the first crop for the farm.

This method also synchronises farm rotations either within or between farms if needed. This is useful to try simple what if scenarios.

References m_rotation, and m_rotation_sync_index.

Referenced by InitiateManagement().

00768                                                                    {
00769   // If g_farm_fixed_rotation, then determine the first
00770   // crop number in the rotation rotation number.
00771   if ( g_farm_fixed_rotation_enable.value() ) {
00772 
00773     if ( !g_farm_fixed_rotation_farms_async.value() ) {
00774       // We are running all the farms synchronized, so
00775       // simply set the first crop to run on all farm fields.
00776       return 0;
00777     }
00778 
00779     // Each farm runs its fields sync'ed but independently from
00780     // the other farmers.
00781 
00782     // Determine if this farm has selected its own start index
00783     // and set it if not. m_rotation_sync_index is initialized
00784     // to -1 by the Farm::Farm() constructor.
00785     if ( -1 == m_rotation_sync_index ) {
00786       m_rotation_sync_index = (int) (rand() % m_rotation.size());
00787     }
00788     // Return farm localized rotation index.
00789     return m_rotation_sync_index;
00790   }
00791 
00792   // Not synchronised, but we want to follow our rotation sequence, so check
00793   // if we have started this process, if not set the sync value.
00794   // afterwards just increment this.
00795   if ( -1 == m_rotation_sync_index ) {
00796       m_rotation_sync_index = (int) (rand() % m_rotation.size());
00797   }
00798   else m_rotation_sync_index = (int) ((m_rotation_sync_index+1) % m_rotation.size());
00799   return m_rotation_sync_index;
00800 }

int Farm::GetFirstDate ( TTypesOfVegetation  a_tov  )  [protected]

Gets the start date for a crop type.

References Crop::GetFirstDate(), m_agrochemindustrycereal, m_carrots, m_CGG1, m_CGG2, m_fieldpeas, m_fodderbeet, m_foddergrass, m_maize, m_maizesilage, m_oats, m_OBarleyPCG, m_ocarrots, m_OCGG1, m_OCGG2, m_OCGS1, m_ofieldpeas, m_ofirstyeardanger, m_ograzingpigs, m_ooats, m_opermgrassgrazed, m_opotatoes, m_OSBarleysilage, m_ospringbarley, m_ospringbarleypigs, m_owinterbarley, m_owinterrape, m_owinterrye, m_owinterwheatundersown, m_permanentsetaside, m_permgrassgrazed, m_permgrasslowyield, m_permgrasstussocky, m_potatoes, m_sbarleyclovergrass, m_seedgrass1, m_seedgrass2, m_setaside, m_springbarley, m_springbarleyseed, m_springbarleysilage, m_springbarleystrigling, m_springbarleystriglingculm, m_springbarleystriglingsingle, m_springrape, m_triticale, m_winterbarley, m_winterrape, m_winterrye, m_winterwheat, m_winterwheatstrigling, m_winterwheatstriglingculm, m_winterwheatstriglingsingle, m_wwheatpcontrol, m_wwheatptoxiccontrol, m_wwheatptreatment, m_youngforest, tov_AgroChemIndustryCereal, tov_Carrots, tov_CloverGrassGrazed1, tov_CloverGrassGrazed2, tov_FieldPeas, tov_FodderBeet, tov_FodderGrass, tov_Maize, tov_MaizeSilage, tov_Oats, tov_OBarleyPeaCloverGrass, tov_OCarrots, tov_OCloverGrassGrazed1, tov_OCloverGrassGrazed2, tov_OCloverGrassSilage1, tov_OFieldPeas, tov_OFirstYearDanger, tov_OGrazingPigs, tov_OOats, tov_OPermanentGrassGrazed, tov_OPotatoes, tov_OSBarleySilage, tov_OSpringBarley, tov_OSpringBarleyPigs, tov_OWinterBarley, tov_OWinterRape, tov_OWinterRye, tov_OWinterWheatUndersown, tov_PermanentGrassGrazed, tov_PermanentGrassLowYield, tov_PermanentGrassTussocky, tov_PermanentSetaside, tov_Potatoes, tov_SeedGrass1, tov_SeedGrass2, tov_Setaside, tov_SpringBarley, tov_SpringBarleyCloverGrass, tov_SpringBarleySeed, tov_SpringBarleySilage, tov_SpringBarleyStrigling, tov_SpringBarleyStriglingCulm, tov_SpringBarleyStriglingSingle, tov_SpringRape, tov_Triticale, tov_WinterBarley, tov_WinterRape, tov_WinterRye, tov_WinterWheat, tov_WinterWheatStrigling, tov_WinterWheatStriglingCulm, tov_WinterWheatStriglingSingle, tov_WWheatPControl, tov_WWheatPToxicControl, tov_WWheatPTreatment, and tov_YoungForest.

Referenced by GetNextCropStartDate().

00915                                                   {
00916   switch ( a_tov2 ) {
00917     case tov_Carrots:
00918       return m_carrots->GetFirstDate();
00919     case tov_FodderGrass:
00920       return m_foddergrass->GetFirstDate();
00921     case tov_CloverGrassGrazed1:
00922       return m_CGG1->GetFirstDate();
00923     case tov_CloverGrassGrazed2:
00924       return m_CGG2->GetFirstDate();
00925     case tov_FieldPeas:
00926       return m_fieldpeas->GetFirstDate();
00927     case tov_FodderBeet:
00928       return m_fodderbeet->GetFirstDate();
00929     case tov_Maize:
00930       return m_maize->GetFirstDate();
00931     case tov_MaizeSilage:
00932       return m_maizesilage->GetFirstDate();
00933     case tov_OBarleyPeaCloverGrass:
00934       return m_OBarleyPCG->GetFirstDate();
00935     case tov_OSBarleySilage:
00936       return m_OSBarleysilage->GetFirstDate();
00937     case tov_OCarrots:
00938       return m_ocarrots->GetFirstDate();
00939     case tov_OCloverGrassGrazed1:
00940       return m_OCGG1->GetFirstDate();
00941     case tov_OCloverGrassGrazed2:
00942       return m_OCGG2->GetFirstDate();
00943     case tov_OCloverGrassSilage1:
00944       return m_OCGS1->GetFirstDate();
00945     case tov_OFieldPeas:
00946       return m_ofieldpeas->GetFirstDate();
00947     case tov_OFirstYearDanger:
00948       return m_ofirstyeardanger->GetFirstDate();
00949     case tov_OGrazingPigs:
00950       return m_ograzingpigs->GetFirstDate();
00951     case tov_OOats:
00952       return m_ooats->GetFirstDate();
00953     case tov_Oats:
00954       return m_oats->GetFirstDate();
00955     case tov_OPermanentGrassGrazed:
00956       return m_opermgrassgrazed->GetFirstDate();
00957     case tov_OPotatoes:
00958       return m_opotatoes->GetFirstDate();
00959     case tov_OSpringBarley:
00960       return m_ospringbarley->GetFirstDate();
00961     case tov_OSpringBarleyPigs:
00962       return m_ospringbarleypigs->GetFirstDate();
00963     case tov_OWinterBarley:
00964       return m_owinterbarley->GetFirstDate();
00965     case tov_OWinterRape:
00966       return m_owinterrape->GetFirstDate();
00967     case tov_OWinterRye:
00968       return m_owinterrye->GetFirstDate();
00969     case tov_OWinterWheatUndersown:
00970       return m_owinterwheatundersown->GetFirstDate();
00971     case tov_PermanentGrassGrazed:
00972       return m_permgrassgrazed->GetFirstDate();
00973         case tov_PermanentGrassLowYield:
00974       return m_permgrasslowyield->GetFirstDate();
00975     case tov_PermanentGrassTussocky:  // Only used for tole_PermPastureTussocky
00976       return m_permgrasstussocky->GetFirstDate();
00977     case tov_PermanentSetaside:
00978       return m_permanentsetaside->GetFirstDate();
00979     case tov_Potatoes:
00980       return m_potatoes->GetFirstDate();
00981     case tov_SeedGrass1:
00982       return m_seedgrass1->GetFirstDate();
00983     case tov_SeedGrass2:
00984       return m_seedgrass2->GetFirstDate();
00985     case tov_Setaside:
00986       return m_setaside->GetFirstDate();
00987     case tov_SpringBarley:
00988       return m_springbarley->GetFirstDate();
00989     case tov_SpringBarleyCloverGrass:
00990       return m_sbarleyclovergrass->GetFirstDate();
00991     case tov_SpringBarleySeed:
00992       return m_springbarleyseed->GetFirstDate();
00993     case tov_SpringBarleySilage:
00994       return m_springbarleysilage->GetFirstDate();
00995     case tov_SpringBarleyStrigling:
00996       return m_springbarleystrigling->GetFirstDate();
00997     case tov_SpringBarleyStriglingSingle:
00998       return m_springbarleystriglingsingle->GetFirstDate();
00999     case tov_SpringBarleyStriglingCulm:
01000       return m_springbarleystriglingculm->GetFirstDate();
01001         case tov_SpringRape:
01002           return m_springrape->GetFirstDate();
01003     case tov_Triticale:
01004       return m_triticale->GetFirstDate();
01005     case tov_WinterBarley:
01006       return m_winterbarley->GetFirstDate();
01007     case tov_WinterRape:
01008       return m_winterrape->GetFirstDate();
01009     case tov_WinterRye:
01010       return m_winterrye->GetFirstDate();
01011     case tov_WinterWheat:
01012       return m_winterwheat->GetFirstDate();
01013     case tov_WinterWheatStrigling:
01014       return m_winterwheatstrigling->GetFirstDate();
01015     case tov_WinterWheatStriglingSingle:
01016       return m_winterwheatstriglingsingle->GetFirstDate();
01017     case tov_WinterWheatStriglingCulm:
01018       return m_winterwheatstriglingculm->GetFirstDate();
01019     case tov_WWheatPControl:
01020       return m_wwheatpcontrol->GetFirstDate();
01021     case tov_WWheatPToxicControl:
01022       return m_wwheatptoxiccontrol->GetFirstDate();
01023     case tov_WWheatPTreatment:
01024       return m_wwheatptreatment->GetFirstDate();
01025     case tov_AgroChemIndustryCereal:
01026       return m_agrochemindustrycereal->GetFirstDate();
01027     case tov_YoungForest:
01028       return m_youngforest->GetFirstDate();
01029     default:
01030       return 0;
01031   }
01032 }

bool Farm::GetIntensity ( void   )  [inline]

References m_intensity.

00535 { return m_intensity; }

int Farm::GetNextCropIndex ( int  a_rot_index  )  [protected, virtual]

Returns the next crop in the rotation.

Also provides the possibility of over-riding rotations using configuration settings

References m_rotation.

Referenced by GetNextCropStartDate(), and HandleEvents().

00810                                             {
00811   if ( !g_farm_enable_crop_rotation.value() ) {
00812     // Rotation not enabled.
00813     return a_rot_index;
00814   }
00815 
00816   if ( a_rot_index == -1 )
00817     return -1;
00818 
00819   if ( ( unsigned int ) ( ++a_rot_index ) == m_rotation.size() )
00820     a_rot_index = 0;
00821 
00822   return a_rot_index;
00823 }

int Farm::GetNextCropStartDate ( LE *  a_field,
TTypesOfVegetation a_curr_veg 
) [protected]

Returns the start date of the next crop in the rotation.

References GetFirstDate(), GetNextCropIndex(), and m_rotation.

Referenced by HandleEvents(), and InitiateManagement().

00505                                                                               {
00506   TTypesOfVegetation l_tov2;
00507 
00508   if ( a_field->GetRotIndex() < 0 || g_farm_fixed_crop_enable.value() //|| g_farm_test_crop.value() 
00509                                                                           ) {
00510     l_tov2 = a_curr_veg; // don't do it if no rotation
00511   } else {
00512     l_tov2 = m_rotation[ GetNextCropIndex( a_field->GetRotIndex() ) ];
00513   }
00514   a_curr_veg = l_tov2;
00515   return GetFirstDate( l_tov2 );
00516 }

TTypesOfFarm Farm::GetType ( void   )  [inline]

References m_farmtype.

00531 { return m_farmtype; }

bool Farm::Glyphosate ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

References glyphosate, and UNREFERENCED_PARAMETER.

Referenced by SetAside::Do().

01746 {
01747   UNREFERENCED_PARAMETER( a_user );
01748   UNREFERENCED_PARAMETER( a_days );
01749   // Will always do this at the first chance
01750   a_field->Trace( glyphosate );
01751   a_field->SetLastTreatment( glyphosate );
01752   a_field->InsectMortality( 0.5 );
01753   a_field->ReduceVeg_Extended( 0.05 );
01754   return true;
01755 }

bool Farm::GrowthRegulator ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Apply growth regulator to a_field.

References DO_IT_PROB, DoIt(), growth_regulator, and UNREFERENCED_PARAMETER.

Referenced by WinterWheat::Do().

00804 {
00805   UNREFERENCED_PARAMETER( a_user );
00806   if (0 >= a_days)
00807   {
00808     if ( (!g_weather->Raining()) && (g_weather->GetWind()<4.5) &&
00809         (!(a_field->GetSignal() & LE_SIG_NO_GROWTH_REG) )) {
00810       a_field->Trace( growth_regulator );
00811       a_field->SetLastTreatment( growth_regulator );
00812       a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
00813     }
00814     return true;
00815   }
00816   else if ( (g_weather->GetWind()<4.5) &&
00817            (!g_weather->Raining()) && DoIt(DO_IT_PROB)) {
00818     if ( ! (a_field->GetSignal() & LE_SIG_NO_GROWTH_REG) ) {
00819       a_field->Trace( growth_regulator );
00820       a_field->SetLastTreatment( growth_regulator );
00821       a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
00822     }
00823     return true;
00824   }
00825   return false;
00826 }

void Farm::HandleEvents ( void   )  [protected]

If there are events to carry out do this, and perhaps start a new crop.

References AddNewEvent(), CheckRotationManagementLoop(), GetNextCropIndex(), GetNextCropStartDate(), LeSwitch(), FarmEvent::m_field, m_queue, m_rotation, PROG_START, and tov_Undefined.

Referenced by Management().

00523                               {
00524   if ( m_queue.Empty() )
00525     return;
00526 
00527   LowPriPair < FarmEvent * > pair = m_queue.Bottom();
00528   FarmEvent * ev = pair.m_element;
00529   while ( pair.m_pri <= g_date->Date() ) {
00530     m_queue.Pop();
00531 
00532         if ( LeSwitch( ev ) ) {
00533       // This crop management plan has terminated.
00534 
00535       // First check for an infinite loop in the rotation scheme,
00536       // ie. a scenario where all crops decide not to run given
00537       // the date.
00538       CheckRotationManagementLoop( ev );
00539 
00540       // Outdate any remaining events for this field.
00541       ev->m_field->BumpRunNum();
00542 
00543       // Crop treatment done, select and initiate new crop if in rotation.
00544       TTypesOfVegetation new_veg = ev->m_field->GetVegType();
00545 
00546       if ( ev->m_field->GetRotIndex() >= 0 ) {
00547         int new_index = GetNextCropIndex( ev->m_field->GetRotIndex() );
00548         new_veg = m_rotation[ new_index ];
00549         // Running in fixed crop mode?
00550         if ( g_farm_fixed_crop_enable.value() ) {
00551           new_veg = g_letype->TranslateVegTypes( g_farm_fixed_crop_type.value() );
00552         }
00553         /*
00554                 if ( g_farm_test_crop.value() ) {
00555           new_veg = g_letype->TranslateVegTypes( g_farm_test_crop_type.value() );
00556         }
00557                 */
00558         ev->m_field->SetRotIndex( new_index );
00559         ev->m_field->SetVegType( new_veg, tov_Undefined );
00560         ev->m_field->ForceGrowthTest();
00561       }
00562 
00563       // Reset the event list for this field.
00564       ev->m_field->ResetTrace();
00565       // Reset event timeout counter.
00566       ev->m_field->SetVegStore( 0 );
00567 
00568       // The next bit simply determines the start date of the next crop in
00569       // the rotation and passes this to the start crop event.
00570       // The crop is responsible for raising an error if the next crop is
00571       // not possible or otherwise handling the problem
00572 
00573       // 19/5-2003: Note: This code was moved out into a dedicated
00574       // method of the Farm class, GetNextCropStartDate(), as precisely
00575       // the same piece of code needs to be run during initialization of
00576       // farm management.
00577       TTypesOfVegetation l_tov = new_veg;
00578       int l_nextcropstartdate = GetNextCropStartDate( ev->m_field, l_tov );
00579 
00580       // Create 'start' event for today and put it on the queue.
00581       AddNewEvent( new_veg, g_date->Date(), ev->m_field, PROG_START, ev->m_field->GetRunNum(),
00582            false, l_nextcropstartdate, false, l_tov );
00583 
00584       // Set starting date for rotation mgmt loop detection.
00585       ev->m_field->SetMgtLoopDetectDate( g_date->Date() );
00586     }
00587 
00588     delete ev;
00589 
00590     if ( m_queue.Empty() )
00591       return;
00592     pair = m_queue.Bottom();
00593     ev = pair.m_element;
00594   }
00595 }

bool Farm::Harvest ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Carry out a harvest on a_field.

References DO_IT_PROB, DoIt(), g_landscape_p, harvest, and UNREFERENCED_PARAMETER.

Referenced by WinterWheat::Do().

01235 {
01236   UNREFERENCED_PARAMETER( a_user );
01237   //5 days good weather before
01238   if ( (0 >= a_days) ||
01239        ((g_weather->GetRainPeriod(g_date->Date(),5)<0.1) && DoIt(DO_IT_PROB))
01240   ) {
01241     a_field->Trace( harvest );
01242     a_field->SetLastTreatment( harvest );
01243     a_field->SetGrowthPhase( harvest1 );
01244     // Here we have to do a little skip to avoid too low insect populations after harvest, but a correct veg biomass
01245     a_field->InsectMortality( 0.4 );
01246     double insects=a_field->GetInsectPop();
01247     a_field->RecalculateBugsNStuff();
01248     a_field->SetInsectPop(insects);
01249     a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
01250     int pref=a_field->GetUnsprayedMarginPolyRef();
01251     if (pref!=-1){
01252       // Must have an unsprayed margin so need to pass the information on to it
01253       LE* um=g_landscape_p->SupplyLEPointer(pref);
01254       um->SetLastTreatment(harvest);
01255       um->SetGrowthPhase( harvest1 );
01256       um->InsectMortality( 0.4 );
01257       um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
01258     }
01259     return true;
01260   }
01261   return false;
01262 }

bool Farm::HayBailing ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Carry out hay bailing on a_field.

References DO_IT_PROB, DoIt(), g_landscape_p, hay_bailing, and UNREFERENCED_PARAMETER.

Referenced by WinterWheat::Do().

01532 {
01533   UNREFERENCED_PARAMETER( a_user );
01534   if ( (0 >= a_days) ||
01535        ((g_weather->GetRainPeriod(g_date->Date(),5)<0.1) && DoIt(DO_IT_PROB))
01536   ) {
01537     a_field->Trace( hay_bailing );
01538     a_field->SetLastTreatment( hay_bailing );
01539     a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
01540     int pref=a_field->GetUnsprayedMarginPolyRef();
01541     if (pref!=-1){
01542       // Must have an unsprayed margin so need to pass the information on to it
01543       LE* um=g_landscape_p->SupplyLEPointer(pref);
01544       um->SetLastTreatment( hay_bailing );
01545       um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
01546     }
01547     return true;
01548   }
01549   return false;
01550 }

bool Farm::HayTurning ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Carry out hay turning on a_field.

References DO_IT_PROB, DoIt(), g_landscape_p, hay_turning, and UNREFERENCED_PARAMETER.

Referenced by WinterWheat::Do().

01507 {
01508   UNREFERENCED_PARAMETER( a_user );
01509   if ( (0 >= a_days) ||
01510        ((g_weather->GetRainPeriod(g_date->Date(),5)<0.1) && DoIt(DO_IT_PROB))
01511   ) {
01512     a_field->Trace( hay_turning );
01513     a_field->SetLastTreatment( hay_turning );
01514     a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
01515     int pref=a_field->GetUnsprayedMarginPolyRef();
01516     if (pref!=-1){
01517       // Must have an unsprayed margin so need to pass the information on to it
01518       LE* um=g_landscape_p->SupplyLEPointer(pref);
01519       um->SetLastTreatment( hay_turning );
01520       um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
01521     }
01522     return true;
01523   }
01524   return false;
01525 }

bool Farm::HerbicideTreat ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Apply herbicide to a_field.

References DO_IT_PROB, DoIt(), herbicide_treat, l_farm_herbicide_kills(), and UNREFERENCED_PARAMETER.

Referenced by WinterWheat::Do().

00768 {
00769   UNREFERENCED_PARAMETER( a_user );
00770   if (0 >= a_days) {
00771     if ( (!g_weather->Raining() && (g_weather->GetWind()<4.5)) && ((a_field->GetSignal() & LE_SIG_NO_HERBICIDE)==0 )) {
00772       a_field->Trace( herbicide_treat );
00773       a_field->SetLastTreatment( herbicide_treat );
00774       if ( l_farm_herbicide_kills.value()) {
00775         a_field->ReduceWeedBiomass( 0.05 );
00776       }
00777       a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
00778       a_field->SetHerbicideDelay( EL_HERBICIDE_DELAYTIME );
00779     }
00780     a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
00781     return true;
00782   }
00783   else if ((g_weather->GetWind()<4.5) &&
00784            (!g_weather->Raining()) && DoIt(DO_IT_PROB)) {
00785     if ( !(a_field->GetSignal() & LE_SIG_NO_HERBICIDE) ) {
00786       a_field->Trace( herbicide_treat );
00787       a_field->SetLastTreatment( herbicide_treat );
00788       if ( l_farm_herbicide_kills.value()) {
00789         a_field->ReduceWeedBiomass( 0.05 );
00790       }
00791       a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
00792       a_field->SetHerbicideDelay( EL_HERBICIDE_DELAYTIME );
00793     }
00794   return true;
00795   }
00796   return false;
00797 }

bool Farm::HillingUp ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Do hilling up on a_field, probably of potatoes.

References DO_IT_PROB, DoIt(), g_landscape_p, hilling_up, and UNREFERENCED_PARAMETER.

01156 {
01157   UNREFERENCED_PARAMETER( a_user );
01158   if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
01159     a_field->Trace( hilling_up );
01160     a_field->SetLastTreatment( hilling_up );
01161     a_field->InsectMortality( 0.75 );
01162     a_field->ReduceWeedBiomass( 0.25 );
01163     a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
01164     int pref=a_field->GetUnsprayedMarginPolyRef();
01165     if (pref!=-1){
01166       // Must have an unsprayed margin so need to pass the information on to it
01167       LE* um=g_landscape_p->SupplyLEPointer(pref);
01168       um->SetLastTreatment( hilling_up );
01169       um->ReduceWeedBiomass( 0.25 );
01170       um->InsectMortality( 0.75 );
01171       um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
01172     }
01173     return true;
01174   }
01175   return false;
01176 }

void Farm::InitiateManagement ( void   )  [virtual]

Kicks of the farm's management.

References AddNewEvent(), GetFirstCropIndex(), GetNextCropStartDate(), m_fields, m_rotation, PROG_START, tole_PermanentSetaside, tole_PermPasture, tole_PermPastureLowYield, tole_PermPastureTussocky, tole_YoungForest, tov_PermanentGrassGrazed, tov_PermanentGrassLowYield, tov_PermanentGrassTussocky, tov_PermanentSetaside, tov_Undefined, and tov_YoungForest.

00860                                     {
00861   for ( unsigned int i = 0; i < m_fields.size(); i++ ) {
00862     int rot_index = -1;
00863     TTypesOfVegetation new_veg = tov_PermanentGrassGrazed;
00864 
00865     // Check for either type of permanent pasture
00866     // field (with management plan).
00867         if ( m_fields[ i ]->GetElementType() == tole_PermanentSetaside ) {
00868       // Vegetation type is already set correctly by the constructor
00869       // for this element type. Start management plan and skip to next field.
00870       // Rotation is *not* possible on a field of type tole_PermanentSetaside!
00871       new_veg = tov_PermanentSetaside;
00872 
00873     } else if ( m_fields[ i ]->GetElementType() == tole_PermPastureLowYield ) {
00874       new_veg = tov_PermanentGrassLowYield;
00875     } else if ( m_fields[ i ]->GetElementType() == tole_PermPastureTussocky ) {
00876       new_veg = tov_PermanentGrassTussocky;
00877     } else if ( m_fields[ i ]->GetElementType() == tole_YoungForest ) {
00878       new_veg = tov_YoungForest;
00879     } else if ( m_fields[ i ]->GetElementType() != tole_PermPasture ) {
00880       rot_index = GetFirstCropIndex( m_fields[ i ]->GetElementType() );
00881       new_veg = m_rotation[ rot_index ];
00882     }
00883 
00884     long prog_start_date = g_date->Date();
00885 
00886     // Running in fixed crop mode?
00887     if ( g_farm_fixed_crop_enable.value() ) {
00888       int fv = g_farm_fixed_crop_type.value();
00889       new_veg = g_letype->TranslateVegTypes( fv );
00890     }
00891     /*
00892         if ( g_farm_test_crop.value() ) {
00893       prog_start_date = 0;
00894       new_veg = g_letype->TranslateVegTypes( g_farm_test_crop_type.value() );
00895     }
00896         */
00897     m_fields[ i ]->SetVegType( new_veg, tov_Undefined );
00898     m_fields[ i ]->SetRotIndex( rot_index );
00899     m_fields[ i ]->SetGrowthPhase( janfirst );
00900 
00901     // Reset event timeout counter. We are now 800 days from
00902     // oblivion.
00903     m_fields[ i ]->SetVegStore( 0 );
00904     TTypesOfVegetation l_tov = new_veg;
00905     int l_nextcropstartdate = GetNextCropStartDate( m_fields[ i ], l_tov );
00906 
00907     AddNewEvent( new_veg, prog_start_date, m_fields[ i ], PROG_START, 0, false, l_nextcropstartdate, true, l_tov );
00908   }
00909 }

bool Farm::InsecticideTreat ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Apply insecticide to a_field.

References DO_IT_PROB, DoIt(), insecticide_treat, l_farm_insecticide_kills(), and UNREFERENCED_PARAMETER.

Referenced by WinterWheat::Do().

00862 {
00863   UNREFERENCED_PARAMETER( a_user );
00864   if (0 >= a_days) {
00865   if ( (!g_weather->Raining()) && (g_weather->GetWind()<4.5) && ( ! (a_field->GetSignal() & LE_SIG_NO_INSECTICIDE) )) {
00866 // **CJT** Turn this code on to use the pesticide engine with insecticides
00867 //      g_pest->DailyQueueAdd( a_field, l_pest_insecticide_amount.value());
00868 //
00869       a_field->Trace( insecticide_treat );
00870       a_field->SetLastTreatment( insecticide_treat );
00871       if ( l_farm_insecticide_kills.value()) {
00872        a_field->Insecticide( 0.36 );
00873       }
00874       a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
00875     }
00876     return true;
00877   }
00878   else if ( (g_weather->GetWind()<4.5) &&
00879             (!g_weather->Raining()) && DoIt(DO_IT_PROB)) {
00880     if ( ! (a_field->GetSignal() & LE_SIG_NO_INSECTICIDE )) {
00881 // **CJT** Turn this code on to use the pesticide engine with insecticides
00882 //      g_pest->DailyQueueAdd( a_field, l_pest_insecticide_amount.value());
00883 //
00884       a_field->Trace( insecticide_treat );
00885       a_field->SetLastTreatment( insecticide_treat );
00886       if ( l_farm_insecticide_kills.value()) {
00887        a_field->Insecticide( 0.36 );
00888       }
00889       a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
00890     }
00891     return true;
00892   }
00893   return false;
00894 }

bool Farm::IsStockFarmer ( void   )  [inline]

References m_stockfarmer.

Referenced by WinterWheat::Do(), and SetAside::Do().

00533 { return m_stockfarmer; }

bool Farm::LeSwitch ( FarmEvent ev  )  [protected]

Call do function for any crop with an outstanding event. Signal if the crop has terminated.

References WinterWheat::Do(), SetAside::Do(), m_agrochemindustrycereal, m_carrots, m_CGG1, m_CGG2, FarmEvent::m_event, FarmEvent::m_field, m_fieldpeas, m_fieldpeasstrigling, m_fodderbeet, m_foddergrass, m_maize, m_maizesilage, m_maizestrigling, m_oats, m_OBarleyPCG, m_ocarrots, m_OCGG1, m_OCGG2, m_OCGS1, m_ofieldpeas, m_ofieldpeassilage, m_ograzingpigs, m_ooats, m_opermgrassgrazed, m_opotatoes, m_ospringbarley, m_ospringbarleypigs, m_owinterbarley, m_owinterrape, m_owinterrye, m_owinterwheatundersown, m_permanentsetaside, m_permgrassgrazed, m_permgrasslowyield, m_permgrasstussocky, m_potatoes, m_potatoesindustry, FarmEvent::m_run, m_sbarleyclovergrass, m_seedgrass1, m_seedgrass2, m_setaside, m_springbarley, m_springbarleyclovergrassstrigling, m_springbarleypeaclovergrassstrigling, m_springbarleyseed, m_springbarleysilage, m_springbarleystrigling, m_springbarleystriglingculm, m_springbarleystriglingsingle, m_springrape, FarmEvent::m_todo, m_triticale, m_winterbarley, m_winterbarleystrigling, m_winterrape, m_winterrapestrigling, m_winterrye, m_winterryestrigling, m_winterwheat, m_winterwheatstrigling, m_winterwheatstriglingculm, m_winterwheatstriglingsingle, m_wwheatpcontrol, m_wwheatptoxiccontrol, m_wwheatptreatment, m_youngforest, tov_AgroChemIndustryCereal, tov_Carrots, tov_CloverGrassGrazed1, tov_CloverGrassGrazed2, tov_FieldPeas, tov_FieldPeasStrigling, tov_FodderBeet, tov_FodderGrass, tov_Maize, tov_MaizeSilage, tov_MaizeStrigling, tov_Oats, tov_OBarleyPeaCloverGrass, tov_OCarrots, tov_OCloverGrassGrazed1, tov_OCloverGrassGrazed2, tov_OCloverGrassSilage1, tov_OFieldPeas, tov_OFieldPeasSilage, tov_OGrazingPigs, tov_OOats, tov_OPermanentGrassGrazed, tov_OPotatoes, tov_OSpringBarley, tov_OSpringBarleyPigs, tov_OWinterBarley, tov_OWinterRape, tov_OWinterRye, tov_OWinterWheatUndersown, tov_PermanentGrassGrazed, tov_PermanentGrassLowYield, tov_PermanentGrassTussocky, tov_PermanentSetaside, tov_Potatoes, tov_PotatoesIndustry, tov_SeedGrass1, tov_SeedGrass2, tov_Setaside, tov_SpringBarley, tov_SpringBarleyCloverGrass, tov_SpringBarleyCloverGrassStrigling, tov_SpringBarleyPeaCloverGrassStrigling, tov_SpringBarleySeed, tov_SpringBarleySilage, tov_SpringBarleyStrigling, tov_SpringBarleyStriglingCulm, tov_SpringBarleyStriglingSingle, tov_SpringRape, tov_Triticale, tov_WinterBarley, tov_WinterBarleyStrigling, tov_WinterRape, tov_WinterRapeStrigling, tov_WinterRye, tov_WinterRyeStrigling, tov_WinterWheat, tov_WinterWheatStrigling, tov_WinterWheatStriglingCulm, tov_WinterWheatStriglingSingle, tov_WWheatPControl, tov_WWheatPToxicControl, tov_WWheatPTreatment, and tov_YoungForest.

Referenced by HandleEvents().

00244                                     {
00245   // Ignore this event if it is from the execution of
00246   // a previous management plan.
00247   if ( ev->m_field->GetRunNum() > ev->m_run )
00248     return false;
00249 
00250   // Store what we are trying to do this time.
00251   // ***FN*** To be cleaned up later.
00252   ev->m_field->m_tried_to_do = ev->m_todo;
00253 
00254   bool done;
00255 
00256   switch ( ev->m_event ) {
00257     case tov_Carrots:
00258       done = m_carrots->Do( this, ev->m_field, ev );
00259     break;
00260     case tov_FodderGrass:
00261       done = m_foddergrass->Do( this, ev->m_field, ev );
00262     break;
00263     case tov_CloverGrassGrazed1:
00264       done = m_CGG1->Do( this, ev->m_field, ev );
00265     break;
00266     case tov_CloverGrassGrazed2:
00267       done = m_CGG2->Do( this, ev->m_field, ev );
00268     break;
00269     case tov_FieldPeas:
00270       done = m_fieldpeas->Do( this, ev->m_field, ev );
00271     break;
00272     case tov_FodderBeet:
00273       done = m_fodderbeet->Do( this, ev->m_field, ev );
00274     break;
00275     case tov_Maize:
00276       done = m_maize->Do( this, ev->m_field, ev );
00277     break;
00278     case tov_OBarleyPeaCloverGrass:
00279       done = m_OBarleyPCG->Do( this, ev->m_field, ev );
00280     break;
00281     case tov_OCarrots:
00282       done = m_ocarrots->Do( this, ev->m_field, ev );
00283     break;
00284     case tov_OCloverGrassSilage1:
00285       done = m_OCGS1->Do( this, ev->m_field, ev );
00286     break;
00287     case tov_OCloverGrassGrazed1:
00288       done = m_OCGG1->Do( this, ev->m_field, ev );
00289     break;
00290     case tov_OCloverGrassGrazed2:
00291       done = m_OCGG2->Do( this, ev->m_field, ev );
00292     break;
00293     case tov_OFieldPeas:
00294       done = m_ofieldpeas->Do( this, ev->m_field, ev );
00295     break;
00296     case tov_OFieldPeasSilage:
00297       done = m_ofieldpeassilage->Do( this, ev->m_field, ev );
00298     break;
00299     case tov_OGrazingPigs:
00300       done = m_ograzingpigs->Do( this, ev->m_field, ev );
00301     break;
00302     case tov_OOats:
00303       done = m_ooats->Do( this, ev->m_field, ev );
00304     break;
00305     case tov_Oats:
00306       done = m_oats->Do( this, ev->m_field, ev );
00307     break;
00308     case tov_OPermanentGrassGrazed:
00309       done = m_opermgrassgrazed->Do( this, ev->m_field, ev );
00310     break;
00311     case tov_OPotatoes:
00312       done = m_opotatoes->Do( this, ev->m_field, ev );
00313     break;
00314     case tov_OSpringBarley:
00315       done = m_ospringbarley->Do( this, ev->m_field, ev );
00316     break;
00317     case tov_OSpringBarleyPigs:
00318       done = m_ospringbarleypigs->Do( this, ev->m_field, ev );
00319     break;
00320     case tov_OWinterBarley:
00321       done = m_owinterbarley->Do( this, ev->m_field, ev );
00322     break;
00323     case tov_OWinterWheatUndersown:
00324       done = m_owinterwheatundersown->Do( this, ev->m_field, ev );
00325     break;
00326     case tov_OWinterRape:
00327       done = m_owinterrape->Do( this, ev->m_field, ev );
00328     break;
00329     case tov_OWinterRye:
00330       done = m_owinterrye->Do( this, ev->m_field, ev );
00331     break;
00332     case tov_PermanentGrassGrazed:
00333       done = m_permgrassgrazed->Do( this, ev->m_field, ev );
00334     break;
00335     case tov_PermanentGrassLowYield:
00336       done = m_permgrasslowyield->Do( this, ev->m_field, ev );
00337     break;
00338     case tov_PermanentGrassTussocky:
00339       done = m_permgrasstussocky->Do( this, ev->m_field, ev );
00340     break;
00341     case tov_PermanentSetaside:
00342       done = m_permanentsetaside->Do( this, ev->m_field, ev );
00343     break;
00344     case tov_Potatoes:
00345       done = m_potatoes->Do( this, ev->m_field, ev );
00346     break;
00347     case tov_PotatoesIndustry:
00348       done = m_potatoesindustry->Do( this, ev->m_field, ev );
00349     break;
00350     case tov_SeedGrass1:
00351       done = m_seedgrass1->Do( this, ev->m_field, ev );
00352     break;
00353     case tov_SeedGrass2:
00354       done = m_seedgrass2->Do( this, ev->m_field, ev );
00355     break;
00356     case tov_Setaside:
00357       done = m_setaside->Do( this, ev->m_field, ev );
00358     break;
00359     case tov_SpringBarley:
00360       done = m_springbarley->Do( this, ev->m_field, ev );
00361     break;
00362     case tov_SpringBarleyCloverGrass:
00363       done = m_sbarleyclovergrass->Do( this, ev->m_field, ev );
00364     break;
00365     case tov_SpringBarleySeed:
00366       done = m_springbarleyseed->Do( this, ev->m_field, ev );
00367     break;
00368     case tov_SpringBarleySilage:
00369       done = m_springbarleysilage->Do( this, ev->m_field, ev );
00370     break;
00371     case tov_SpringRape:
00372       done = m_springrape->Do( this, ev->m_field, ev );
00373     break;
00374     case tov_Triticale:
00375       done = m_triticale->Do( this, ev->m_field, ev );
00376     break;
00377     case tov_WinterBarley:
00378       done = m_winterbarley->Do( this, ev->m_field, ev );
00379     break;
00380     case tov_WinterRape:
00381       done = m_winterrape->Do( this, ev->m_field, ev );
00382     break;
00383     case tov_WinterRye:
00384       done = m_winterrye->Do( this, ev->m_field, ev );
00385     break;
00386     case tov_WinterWheat:
00387       done = m_winterwheat->Do( this, ev->m_field, ev );
00388     break;
00389     case tov_WWheatPControl:
00390       done = m_wwheatpcontrol->Do( this, ev->m_field, ev );
00391     break;
00392     case tov_WWheatPToxicControl:
00393       done = m_wwheatptoxiccontrol->Do( this, ev->m_field, ev );
00394     break;
00395     case tov_WWheatPTreatment:
00396       done = m_wwheatptreatment->Do( this, ev->m_field, ev );
00397     break;
00398     case tov_AgroChemIndustryCereal:
00399       done = m_agrochemindustrycereal->Do( this, ev->m_field, ev );
00400     break;
00401     case tov_WinterWheatStrigling:
00402       done = m_winterwheatstrigling->Do( this, ev->m_field, ev );
00403       break;
00404     case tov_WinterWheatStriglingSingle:
00405       done = m_winterwheatstriglingsingle->Do( this, ev->m_field, ev );
00406       break;
00407     case tov_WinterWheatStriglingCulm:
00408       done = m_winterwheatstriglingculm->Do( this, ev->m_field, ev );
00409       break;
00410     case tov_SpringBarleyCloverGrassStrigling:
00411       done = m_springbarleyclovergrassstrigling->Do( this, ev->m_field, ev );
00412     break;
00413     case tov_SpringBarleyStrigling:
00414       done = m_springbarleystrigling->Do( this, ev->m_field, ev );
00415     break;
00416     case tov_SpringBarleyStriglingSingle:
00417       done = m_springbarleystriglingsingle->Do( this, ev->m_field, ev );
00418     break;
00419     case tov_SpringBarleyStriglingCulm:
00420       done = m_springbarleystriglingculm->Do( this, ev->m_field, ev );
00421     break;
00422     case tov_MaizeStrigling:
00423       done = m_maizestrigling->Do( this, ev->m_field, ev );
00424     break;
00425     case tov_MaizeSilage:
00426       done = m_maizesilage->Do( this, ev->m_field, ev );
00427     break;
00428     case tov_WinterRapeStrigling:
00429       done = m_winterrapestrigling->Do( this, ev->m_field, ev );
00430     break;
00431     case tov_WinterRyeStrigling:
00432       done = m_winterryestrigling->Do( this, ev->m_field, ev );
00433     break;
00434     case tov_WinterBarleyStrigling:
00435       done = m_winterbarleystrigling->Do( this, ev->m_field, ev );
00436     break;
00437     case tov_FieldPeasStrigling:
00438       done = m_fieldpeasstrigling->Do( this, ev->m_field, ev );
00439     break;
00440     case tov_SpringBarleyPeaCloverGrassStrigling:
00441       done = m_springbarleypeaclovergrassstrigling->Do( this, ev->m_field, ev );
00442     break;
00443     case tov_YoungForest:
00444       done = m_youngforest->Do( this, ev->m_field, ev );
00445     break;
00446 
00447       /* case tov_OFirstYearDanger: done = m_ofirstyeardanger->Do( this, ev->m_field, ev ); break; */
00448     default:
00449       g_msg->Warn( WARN_BUG, "Farm::LeSwitch(): ""Unknown crop type! ", "" );
00450       exit( 1 );
00451   }
00452   return done;
00453 }

virtual void Farm::MakeStockFarmer ( void   )  [inline, virtual]

void Farm::Management ( void   )  [virtual]

Starts the main management loop for the farm and performs some error checking.

References HandleEvents(), and m_fields.

00219                             {
00220   HandleEvents();
00221   for ( unsigned int i = 0; i < m_fields.size(); i++ ) {
00222     // Check for infinite loop in management plan.
00223     int count = m_fields[ i ]->GetVegStore();
00224     if ( count >= 0 )
00225       m_fields[ i ]->SetVegStore( ++count );
00226     if ( count > 800 ) {
00227       // More than two years where nothing happened.
00228       // Raise 'Merry Christmas'!
00229       char error_num[ 20 ];
00230       sprintf( error_num, "%d", m_fields[ i ]->GetVegType() );
00231       g_msg->Warn( WARN_BUG, "I the Farm Manager caught infinite loop in tov type:", error_num );
00232       sprintf( error_num, "%d", m_fields[ i ]->m_tried_to_do );
00233       g_msg->Warn( WARN_BUG, "It was last seen trying to perform action # ""(or thereabouts):", error_num );
00234       exit( 1 );
00235     }
00236   }
00237 }

bool Farm::Molluscicide ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Apply molluscidie to a_field.

References DO_IT_PROB, DoIt(), molluscicide, and UNREFERENCED_PARAMETER.

01005 {
01006     UNREFERENCED_PARAMETER( a_user );
01007        if (0 >= a_days) {
01008     if ( (!g_weather->Raining()) && (g_weather->GetWind()<4.5) &&
01009         (! (a_field->GetSignal() & LE_SIG_NO_MOLLUSC ))) {
01010       a_field->Trace( molluscicide );
01011       a_field->SetLastTreatment( molluscicide );
01012       a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
01013     }
01014     return true;
01015   }
01016   else if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
01017     if ( ! (a_field->GetSignal() & LE_SIG_NO_MOLLUSC) ) {
01018       a_field->Trace( molluscicide );
01019       a_field->SetLastTreatment( molluscicide );
01020       a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
01021     }
01022     return true;
01023   }
01024   return false;
01025 }

bool Farm::PigsAreOut ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Start a pig grazing event on a_field today or soon.

References DoIt(), g_landscape_p, and UNREFERENCED_PARAMETER.

01460 {
01461   UNREFERENCED_PARAMETER( a_user );
01462   if ( (0 >= a_days)||  DoIt(50/a_days)) {
01463     a_field->TogglePigGrazing();
01464     int pref=a_field->GetUnsprayedMarginPolyRef();
01465     if (pref!=-1){
01466       // Must have an unsprayed margin so need to pass the information on to it
01467       LE* um=g_landscape_p->SupplyLEPointer(pref);
01468       um->TogglePigGrazing();
01469     }
01470     return true;
01471   }
01472   return false;
01473 }

bool Farm::PigsAreOutForced ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Start a pig grazing event on a_field today - no exceptions.

References g_landscape_p, l_farm_pig_veg_reduce(), pigs_out, and UNREFERENCED_PARAMETER.

01436 {
01437   UNREFERENCED_PARAMETER( a_days );
01438   UNREFERENCED_PARAMETER( a_user );
01439   a_field->SetLastTreatment( pigs_out );
01440   a_field->Trace( pigs_out );
01441   // Reduce the vegetation because of grazing
01442   a_field->ReduceVeg_Extended( l_farm_pig_veg_reduce.value() );
01443   // make this a function of grazing pressure
01444   //and field size - perhaps in a later life
01445   int pref=a_field->GetUnsprayedMarginPolyRef();
01446   if (pref!=-1){
01447     // Must have an unsprayed margin so need to pass the information on to it
01448     LE* um=g_landscape_p->SupplyLEPointer(pref);
01449     um->SetLastTreatment( pigs_out );
01450     um->ReduceVeg_Extended( l_farm_pig_veg_reduce.value() );
01451   }
01452   return false;
01453 }

bool Farm::PigsOut ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Generate a 'pigs_out' event for every day the cattle are on a_field.

References DO_IT_PROB, DoIt(), g_landscape_p, l_farm_pig_veg_reduce(), pigs_out, and UNREFERENCED_PARAMETER.

01408 {
01409   UNREFERENCED_PARAMETER( a_user );
01410   if ( (0 >= a_days)||  DoIt(DO_IT_PROB))
01411  {
01412     a_field->TogglePigGrazing();
01413     a_field->Trace( pigs_out );
01414     a_field->SetLastTreatment( pigs_out );
01415     // Reduce the vegetation because of grazing
01416     a_field->ReduceVeg_Extended( l_farm_pig_veg_reduce.value());
01417                                  // make this a function of grazing pressure
01418                                  //and field size - perhaps in a later life
01419     int pref=a_field->GetUnsprayedMarginPolyRef();
01420     if (pref!=-1){
01421       // Must have an unsprayed margin so need to pass the information on to it
01422       LE* um=g_landscape_p->SupplyLEPointer(pref);
01423       um->SetLastTreatment( pigs_out );
01424       um->ReduceVeg_Extended( l_farm_pig_veg_reduce.value() );
01425     }
01426     return true;
01427  }
01428   return false;
01429 }

bool Farm::ProductApplication0 ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Apply test pesticide to a_field.

References l_farm_insecticide_kills(), l_pest_product_0_amount, product_treat, and UNREFERENCED_PARAMETER.

00939 {
00940   UNREFERENCED_PARAMETER( a_user );
00941   // NOTE Differs from normal pesticide in that it will be done on the last
00942   // day if not managed before
00943   if (0 >= a_days) {
00944     a_field->Trace( product_treat );
00945     a_field->SetLastTreatment( product_treat );
00946     if ( l_farm_insecticide_kills.value()) {        
00947         a_field->Insecticide( 0.2 );     }
00948     a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
00949     double p=l_pest_product_0_amount.value();
00950     g_pest->DailyQueueAdd( a_field,p );
00951     return true;
00952   } else {
00953     if ( (!g_weather->Raining()) && (g_weather->GetWind()<4.5)) {
00954     a_field->Trace( product_treat );
00955     a_field->SetLastTreatment( product_treat );
00956     if ( l_farm_insecticide_kills.value()) {        
00957          a_field->Insecticide( 0.2 );     }
00958     a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
00959     double p=l_pest_product_0_amount.value();
00960     g_pest->DailyQueueAdd( a_field,p );
00961       return true;
00962          }
00963   }
00964   return false;
00965 }

bool Farm::ProductApplication1 ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Apply test pesticide to a_field.

References l_farm_insecticide_kills(), l_pest_product_1_amount, product_treat, and UNREFERENCED_PARAMETER.

00972 {
00973   UNREFERENCED_PARAMETER( a_user );
00974   // NOTE Differs from normal pesticide in that it will be done on the last
00975   // day if not managed before
00976   if (0 >= a_days) {
00977     a_field->Trace( product_treat );
00978     a_field->SetLastTreatment( product_treat );
00979     if ( l_farm_insecticide_kills.value()) {        
00980         a_field->Insecticide( 0.2 );     }
00981     a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
00982     double p=l_pest_product_1_amount.value();
00983     g_pest->DailyQueueAdd( a_field,p );
00984     return true;
00985   } else {
00986     if ( (!g_weather->Raining()) && (g_weather->GetWind()<4.5)) {
00987     a_field->Trace( product_treat );
00988     a_field->SetLastTreatment( product_treat );
00989     if ( l_farm_insecticide_kills.value()) {        
00990          a_field->Insecticide( 0.2 );     }
00991     a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
00992     double p=l_pest_product_1_amount.value();
00993     g_pest->DailyQueueAdd( a_field,p );
00994       return true;
00995          }
00996   }
00997   return false;
00998 }

void Farm::RemoveField ( LE *  a_field  ) 

Removes a field to a farm.

References m_fields.

00841                                      {
00842   int nf = (int) m_fields.size();
00843   for ( int i = 0; i < nf; i++ ) {
00844     if ( m_fields[ i ] == a_field ) {
00845       m_fields.erase( m_fields.begin() + i );
00846       return;
00847     }
00848   }
00849   // If we reach here there is something wrong because the field is not a
00850   // member of this farm
00851   g_msg->Warn( WARN_BUG, "Farm::RemoveField(LE* a_field): ""Unknown field! ", "" );
00852   exit( 1 );
00853 }

bool Farm::RowCultivation ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Carry out a harrowing between crop rows on a_field.

References DO_IT_PROB, DoIt(), g_landscape_p, row_cultivation, and UNREFERENCED_PARAMETER.

01032 {
01033   UNREFERENCED_PARAMETER( a_user );
01034   if ( (0 >= a_days) && (g_weather->GetRainPeriod(g_date->Date(),3)<0.1) )
01035   {
01036     // Too much rain, just give up and claim we did it.
01037     return true;
01038   }
01039 
01040   if ( (0 >= a_days) ||
01041        ((g_weather->GetRainPeriod(g_date->Date(),3)<0.1) && DoIt(DO_IT_PROB))
01042   ) {
01043     a_field->Trace( row_cultivation );
01044     a_field->SetLastTreatment( row_cultivation );
01045     a_field->ReduceWeedBiomass( 0.5 );
01046     a_field->InsectMortality( 0.25 );
01047     a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
01048     int pref=a_field->GetUnsprayedMarginPolyRef();
01049     if (pref!=-1){
01050       // Must have an unsprayed margin so need to pass the information on to it
01051       LE* um=g_landscape_p->SupplyLEPointer(pref);
01052       um->SetLastTreatment( row_cultivation );
01053       um->InsectMortality( 0.25 );
01054       um->ReduceWeedBiomass( 0.5 );
01055       um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
01056     }
01057     return true;
01058   }
01059   return false;
01060 }

void Farm::SetFarmNumber ( int  a_farm_num  )  [inline]

References m_farm_num.

00457 { m_farm_num = a_farm_num; }

bool Farm::SleepAllDay ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Nothing to to today on a_field.

References g_landscape_p, sleep_all_day, and UNREFERENCED_PARAMETER.

00124 {
00125     UNREFERENCED_PARAMETER( a_user );
00126     UNREFERENCED_PARAMETER( a_days );
00127   a_field->Trace( sleep_all_day );
00128   a_field->SetLastTreatment( sleep_all_day );
00129   int pref=a_field->GetUnsprayedMarginPolyRef();
00130   if (pref!=-1){
00131     // Must have an unsprayed margin so need to pass the information on to it
00132     LE* um=g_landscape_p->SupplyLEPointer(pref);
00133     um->SetLastTreatment(sleep_all_day);
00134   }
00135   return true;
00136 }

bool Farm::SpringHarrow ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Carry out a harrow event in the spring on a_field.

References DO_IT_PROB, DoIt(), g_landscape_p, spring_harrow, and UNREFERENCED_PARAMETER.

00297 {
00298   UNREFERENCED_PARAMETER( a_user );
00299   if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
00300     a_field->Trace( spring_harrow );
00301     a_field->SetLastTreatment( spring_harrow );
00302     // 30% insect mortality
00303        a_field->InsectMortality( 0.7 );
00304     // remove all vegetation
00305        a_field->ZeroVeg();
00306     int pref=a_field->GetUnsprayedMarginPolyRef();
00307     if (pref!=-1){
00308       // Must have an unsprayed margin so need to pass the information on to it
00309       LE* um=g_landscape_p->SupplyLEPointer(pref);
00310       um->SetLastTreatment( spring_harrow );
00311       um->InsectMortality( 0.7 );
00312       um->ZeroVeg();
00313     }
00314     return true;
00315   }
00316   return false;
00317 }

bool Farm::SpringPlough ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Carry out a ploughing event in the spring on a_field.

References DO_IT_PROB, DoIt(), g_landscape_p, spring_plough, and UNREFERENCED_PARAMETER.

00271 {
00272   UNREFERENCED_PARAMETER( a_user );
00273   if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
00274     a_field->Trace( spring_plough );
00275     a_field->SetLastTreatment( spring_plough );
00276    // Apply 90% mortality to the insects
00277     a_field->InsectMortality( 0.1 );
00278    // Reduce the vegetation to zero
00279     int pref=a_field->GetUnsprayedMarginPolyRef();
00280     if (pref!=-1){
00281       // Must have an unsprayed margin so need to pass the information on to it
00282       LE* um=g_landscape_p->SupplyLEPointer(pref);
00283       um->SetLastTreatment( spring_plough );
00284       um->InsectMortality( 0.1);
00285       um->ZeroVeg();
00286     }
00287     return true;
00288   }
00289   return false;
00290 }

bool Farm::SpringRoll ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Carry out a roll event in the spring on a_field.

References DO_IT_PROB, DoIt(), g_landscape_p, spring_roll, and UNREFERENCED_PARAMETER.

Referenced by WinterWheat::Do().

00324 {
00325   UNREFERENCED_PARAMETER( a_user );
00326   if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
00327     a_field->Trace( spring_roll );
00328     a_field->SetLastTreatment( spring_roll );
00329     int pref=a_field->GetUnsprayedMarginPolyRef();
00330     if (pref!=-1){
00331       // Must have an unsprayed margin so need to pass the information on to it
00332       LE* um=g_landscape_p->SupplyLEPointer(pref);
00333       um->SetLastTreatment( spring_roll );
00334     }
00335     return true;
00336   }
00337   return false;
00338 }

bool Farm::SpringSow ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Carry out a sowing event in the spring on a_field.

References DO_IT_PROB, DoIt(), g_landscape_p, spring_sow, and UNREFERENCED_PARAMETER.

00345 {
00346   UNREFERENCED_PARAMETER( a_user );
00347   if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
00348     a_field->Trace( spring_sow );
00349     a_field->SetLastTreatment( spring_sow );
00350     a_field->SetGrowthPhase( sow );
00351    // Reduce the  vegetation to zero - should not strictly be necessary, but prevents any false starts in the crop growth.
00352     a_field->ZeroVeg();
00353     int pref=a_field->GetUnsprayedMarginPolyRef();
00354    if (pref!=-1){
00355      // Must have an unsprayed margin so need to pass the information on to it
00356      LE* um=g_landscape_p->SupplyLEPointer(pref);
00357      um->SetLastTreatment( spring_sow );
00358      um->SetGrowthPhase( sow );
00359      um->ZeroVeg();
00360    }
00361    return true;
00362   }
00363   return false;
00364 }

bool Farm::StrawChopping ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Carry out straw chopping on a_field.

References DO_IT_PROB, DoIt(), g_landscape_p, straw_chopping, and UNREFERENCED_PARAMETER.

Referenced by WinterWheat::Do().

01480 {
01481   UNREFERENCED_PARAMETER( a_user );
01482   if ( (0 >= a_days) ||
01483        ((g_weather->GetRainPeriod(g_date->Date(),5)<0.1) && DoIt(DO_IT_PROB))
01484   ) {
01485     a_field->Trace( straw_chopping );
01486     a_field->SetLastTreatment( straw_chopping );
01487     a_field->InsectMortality( 0.4 );
01488     a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
01489     int pref=a_field->GetUnsprayedMarginPolyRef();
01490     if (pref!=-1){
01491       // Must have an unsprayed margin so need to pass the information on to it
01492       LE* um=g_landscape_p->SupplyLEPointer(pref);
01493       um->SetLastTreatment( straw_chopping );
01494       um->InsectMortality( 0.4 );
01495       um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
01496     }
01497     return true;
01498   }
01499   return false;
01500 }

bool Farm::Strigling ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Carry out a mechanical weeding on a_field.

References DO_IT_PROB, DoIt(), g_landscape_p, strigling, and UNREFERENCED_PARAMETER.

Referenced by WinterWheat::Do().

01067 {
01068   UNREFERENCED_PARAMETER( a_user );
01069   // Force strigling if it has not been done already!!!  This happens regardless of weather as of 26/10/2005
01070   if ( (0 >= a_days) )// && (g_weather->GetRainPeriod(g_date->Date(),3)>0.1) )
01071   {
01072     a_field->Trace( strigling );
01073     a_field->SetLastTreatment( strigling );
01074     a_field->ReduceWeedBiomass( 0.05 );
01075     a_field->InsectMortality( 0.7 );
01076     a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
01077     a_field->SetHerbicideDelay( EL_STRIGLING_DELAYTIME );
01078     int pref=a_field->GetUnsprayedMarginPolyRef();
01079     if (pref!=-1){
01080       // Must have an unsprayed margin so need to pass the information on to it
01081       LE* um=g_landscape_p->SupplyLEPointer(pref);
01082       um->SetLastTreatment( strigling );
01083       um->ReduceWeedBiomass( 0.05 );
01084       um->InsectMortality( 0.7 );
01085       um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
01086       um->SetHerbicideDelay( EL_STRIGLING_DELAYTIME );
01087     return true;
01088   }
01089   }
01090   if ( (0 >= a_days) ||
01091        ((g_weather->GetRainPeriod(g_date->Date(),3)<0.1) && DoIt(DO_IT_PROB))
01092   ) {
01093     a_field->Trace( strigling );
01094     a_field->SetLastTreatment( strigling );
01095     a_field->ReduceWeedBiomass( 0.05 );
01096     a_field->InsectMortality( 0.7 );
01097     a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
01098     a_field->SetHerbicideDelay( EL_STRIGLING_DELAYTIME );
01099     int pref=a_field->GetUnsprayedMarginPolyRef();
01100     if (pref!=-1){
01101       // Must have an unsprayed margin so need to pass the information on to it
01102       LE* um=g_landscape_p->SupplyLEPointer(pref);
01103       um->SetLastTreatment( strigling );
01104       um->ReduceWeedBiomass( 0.05 );
01105       um->InsectMortality( 0.7 );
01106       um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
01107       um->SetHerbicideDelay( EL_STRIGLING_DELAYTIME );
01108     }
01109     return true;
01110   }
01111   return false;
01112 }

bool Farm::StriglingSow ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Carry out a mechanical weeding followed by sowing on a_field.

References DO_IT_PROB, DoIt(), g_landscape_p, strigling_sow, and UNREFERENCED_PARAMETER.

01119 {
01120   UNREFERENCED_PARAMETER( a_user );
01121   //2 days good weather afterwards
01122   if ( (0 >= a_days) && (g_weather->GetRainPeriod(g_date->Date(),3)<0.1) )
01123   {
01124     return true;
01125   }
01126 
01127   if ( (0 >= a_days) ||
01128        ((g_weather->GetRainPeriod(g_date->Date(),3)<0.1) && DoIt(DO_IT_PROB))
01129   ) {
01130     a_field->Trace( strigling_sow );
01131     a_field->SetLastTreatment( strigling_sow );
01132     a_field->ReduceWeedBiomass( 0.05 );
01133     a_field->InsectMortality( 0.7 );
01134     a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
01135     a_field->SetHerbicideDelay( EL_STRIGLING_DELAYTIME );
01136     int pref=a_field->GetUnsprayedMarginPolyRef();
01137     if (pref!=-1){
01138       // Must have an unsprayed margin so need to pass the information on to it
01139       LE* um=g_landscape_p->SupplyLEPointer(pref);
01140       um->SetLastTreatment( strigling_sow );
01141       um->ReduceWeedBiomass( 0.05 );
01142       um->InsectMortality( 0.7 );
01143       um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
01144       um->SetHerbicideDelay( EL_STRIGLING_DELAYTIME );
01145     }
01146     return true;
01147   }
01148   return false;
01149 }

bool Farm::StubbleHarrowing ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Carry out stubble harrowing on a_field.

References DO_IT_PROB, DoIt(), g_landscape_p, stubble_harrowing, and UNREFERENCED_PARAMETER.

Referenced by WinterWheat::Do().

01557 {
01558   UNREFERENCED_PARAMETER( a_user );
01559   if ( (0 >= a_days) ||
01560        ((g_weather->GetRainPeriod(g_date->Date(),3)<0.1) && DoIt(DO_IT_PROB))
01561   ) {
01562     a_field->Trace( stubble_harrowing );
01563     a_field->SetLastTreatment( stubble_harrowing );
01564     a_field->InsectMortality( 0.25 );
01565     a_field->ZeroVeg();
01566     int pref=a_field->GetUnsprayedMarginPolyRef();
01567     if (pref!=-1){
01568       // Must have an unsprayed margin so need to pass the information on to it
01569       LE* um=g_landscape_p->SupplyLEPointer(pref);
01570       um->SetLastTreatment( stubble_harrowing );
01571       um->ZeroVeg();
01572       um->InsectMortality( 0.25 );
01573     }
01574     return true;
01575   }
01576   return false;
01577 }

bool Farm::Swathing ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Cut the crop on a_field and leave it lying (probably rape).

References DO_IT_PROB, DoIt(), g_landscape_p, swathing, and UNREFERENCED_PARAMETER.

01210 {
01211   UNREFERENCED_PARAMETER( a_user );
01212   if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
01213     a_field->Trace( swathing );
01214     a_field->SetLastTreatment( swathing );
01215     a_field->InsectMortality( 0.5 );
01216     a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
01217     int pref=a_field->GetUnsprayedMarginPolyRef();
01218     if (pref!=-1){
01219       // Must have an unsprayed margin so need to pass the information on to it
01220       LE* um=g_landscape_p->SupplyLEPointer(pref);
01221       um->SetLastTreatment( swathing );
01222       um->InsectMortality( 0.5 );
01223       um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
01224     }
01225     return true;
01226   }
01227   return false;
01228 }

bool Farm::SynInsecticideTreat ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Apply special insecticide to a_field.

References l_farm_insecticide_kills(), syninsecticide_treat, and UNREFERENCED_PARAMETER.

00901 {
00902   UNREFERENCED_PARAMETER( a_user );
00903   // NOTE Differs from normal insecticide in that it will be done on the last
00904   // day if not managed before
00905   if (0 >= a_days) {
00906     if ( ! (a_field->GetSignal() & LE_SIG_NO_SYNG_INSECT )) {
00907       a_field->Trace( syninsecticide_treat );
00908       a_field->SetLastTreatment( syninsecticide_treat );
00909       if ( l_farm_insecticide_kills.value()) {
00910        a_field->Insecticide( 0.2 );
00911       }
00912       a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
00913     }
00914 //    double p=l_pest_insecticide_amount.value();
00915 //    g_pest->DailyQueueAdd( a_field,p );
00916     return true;
00917   } else {
00918     if ( (!g_weather->Raining()) && (g_weather->GetWind()<4.5)) {
00919       if ( ! (a_field->GetSignal() & LE_SIG_NO_SYNG_INSECT ) ) {
00920        a_field->Trace( syninsecticide_treat );
00921        a_field->SetLastTreatment( syninsecticide_treat );
00922        if ( l_farm_insecticide_kills.value()) {
00923          a_field->Insecticide( 0.2 );
00924        }
00925        a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
00926       }
00927 //      g_pest->DailyQueueAdd( a_field, l_pest_insecticide_amount.value());
00928       return true;
00929     }
00930   }
00931   return false;
00932 }

TTypesOfVegetation Farm::TranslateCropCodes ( const char *  str  ) 

References tov_AgroChemIndustryCereal, tov_Carrots, tov_CloverGrassGrazed1, tov_CloverGrassGrazed2, tov_FieldPeas, tov_FieldPeasStrigling, tov_FodderBeet, tov_FodderGrass, tov_Maize, tov_MaizeSilage, tov_MaizeStrigling, tov_Oats, tov_OBarleyPeaCloverGrass, tov_OCarrots, tov_OCloverGrassGrazed1, tov_OCloverGrassGrazed2, tov_OCloverGrassSilage1, tov_OFieldPeas, tov_OFieldPeasSilage, tov_OGrazingPigs, tov_OOats, tov_OPermanentGrassGrazed, tov_OPotatoes, tov_OSeedGrass1, tov_OSeedGrass2, tov_OSpringBarley, tov_OSpringBarleyClover, tov_OSpringBarleyGrass, tov_OTriticale, tov_OWinterBarley, tov_OWinterRape, tov_OWinterRye, tov_OWinterWheatUndersown, tov_PermanentGrassGrazed, tov_PermanentGrassLowYield, tov_PermanentGrassTussocky, tov_PermanentSetaside, tov_Potatoes, tov_PotatoesIndustry, tov_SeedGrass1, tov_SeedGrass2, tov_Setaside, tov_SpringBarley, tov_SpringBarleyCloverGrass, tov_SpringBarleyCloverGrassStrigling, tov_SpringBarleyGrass, tov_SpringBarleyPeaCloverGrassStrigling, tov_SpringBarleySeed, tov_SpringBarleySilage, tov_SpringBarleyStrigling, tov_SpringBarleyStriglingCulm, tov_SpringBarleyStriglingSingle, tov_SpringRape, tov_SpringWheat, tov_Triticale, tov_WinterBarley, tov_WinterBarleyStrigling, tov_WinterRape, tov_WinterRapeStrigling, tov_WinterRye, tov_WinterRyeStrigling, tov_WinterWheat, tov_WinterWheatShort, tov_WinterWheatStrigling, tov_WinterWheatStriglingCulm, tov_WinterWheatStriglingSingle, tov_WWheatPControl, tov_WWheatPToxicControl, tov_WWheatPTreatment, and tov_YoungForest.

Referenced by OrganicCattle::OrganicCattle(), OrganicPig::OrganicPig(), OrganicPlant::OrganicPlant(), PesticideTrialTreatment::PesticideTrialTreatment(), UserDefinedFarm1::UserDefinedFarm1(), UserDefinedFarm10::UserDefinedFarm10(), UserDefinedFarm11::UserDefinedFarm11(), UserDefinedFarm12::UserDefinedFarm12(), UserDefinedFarm13::UserDefinedFarm13(), UserDefinedFarm14::UserDefinedFarm14(), UserDefinedFarm15::UserDefinedFarm15(), UserDefinedFarm16::UserDefinedFarm16(), UserDefinedFarm17::UserDefinedFarm17(), UserDefinedFarm2::UserDefinedFarm2(), UserDefinedFarm3::UserDefinedFarm3(), UserDefinedFarm4::UserDefinedFarm4(), UserDefinedFarm5::UserDefinedFarm5(), UserDefinedFarm6::UserDefinedFarm6(), UserDefinedFarm7::UserDefinedFarm7(), UserDefinedFarm8::UserDefinedFarm8(), and UserDefinedFarm9::UserDefinedFarm9().

01739                                                                {
01740   // This simply checks through the list of legal crop names and returns
01741   // the correct tov type
01742 
01743   string str = astr;
01744 
01745   // Unfortunately switch cannot use string so the long way:
01746   if ( str == "SpringBarley" ) return tov_SpringBarley;
01747   if ( str == "WinterBarley" ) return tov_WinterBarley;
01748   if ( str == "SpringWheat" ) return tov_SpringWheat;
01749   if ( str == "WinterWheat" ) return tov_WinterWheat;
01750   if ( str == "WinterRye" ) return tov_WinterRye;
01751   if ( str == "Oats" ) return tov_Oats;
01752   if ( str == "OOats" ) return tov_OOats;
01753   if ( str == "Triticale" ) return tov_Triticale;
01754   if ( str == "Maize" ) return tov_Maize;
01755   if ( str == "MaizeSilage" ) return tov_MaizeSilage;
01756   if ( str == "SpringBarleySeed" ) return tov_SpringBarleySeed;
01757   if ( str == "SpringRape" ) return tov_SpringRape;
01758   if ( str == "WinterRape" ) return tov_WinterRape;
01759   if ( str == "FieldPeas" ) return tov_FieldPeas;
01760   if ( str == "Setaside" ) return tov_Setaside;
01761   if ( str == "PermanentSetaside" ) return tov_PermanentSetaside;
01762   if ( str == "FodderBeet" ) return tov_FodderBeet;
01763   if ( str == "FodderGrass" ) return tov_FodderGrass;
01764   if ( str == "CloverGrassGrazed1" ) return tov_CloverGrassGrazed1;
01765   if ( str == "PotatoesIndustry" ) return tov_PotatoesIndustry;
01766   if ( str == "Potatoes" ) return tov_Potatoes;
01767   if ( str == "SeedGrass1" ) return tov_SeedGrass1;
01768   if ( str == "OWinterBarley" ) return tov_OWinterBarley;
01769   if ( str == "SpringBarleySilage" ) return tov_SpringBarleySilage;
01770   if ( str == "OWinterRye" ) return tov_OWinterRye;
01771   if ( str == "OFieldPeasSilage" ) return tov_OFieldPeasSilage;
01772   if ( str == "SpringBarleyGrass" ) return tov_SpringBarleyGrass;
01773   if ( str == "SpringBarleyCloverGrass" ) return tov_SpringBarleyCloverGrass;
01774   if ( str == "OBarleyPeaCloverGrass" ) return tov_OBarleyPeaCloverGrass;
01775   if ( str == "OWinterRape" ) return tov_OWinterRape;
01776   if ( str == "PermanentGrassGrazed" ) return tov_PermanentGrassGrazed;
01777   if ( str == "PermanentGrassLowYield" ) return tov_PermanentGrassLowYield;
01778   if ( str == "PermanentGrassTussocky" ) return tov_PermanentGrassTussocky;
01779   if ( str == "CloverGrassGrazed2" ) return tov_CloverGrassGrazed2;
01780   if ( str == "SeedGrass2" ) return tov_SeedGrass2;
01781   if ( str == "OSpringBarley" ) return tov_OSpringBarley;
01782   if ( str == "OWinterWheatUndersown" ) return tov_OWinterWheatUndersown;
01783   if ( str == "OOats" ) return tov_OOats;
01784   if ( str == "OTriticale" ) return tov_OTriticale;
01785   if ( str == "OFieldPeas" ) return tov_OFieldPeas;
01786   if ( str == "OCloverGrassGrazed1" ) return tov_OCloverGrassGrazed1;
01787   if ( str == "OGrazingPigs" ) return tov_OGrazingPigs;
01788   if ( str == "OCarrots" ) return tov_OCarrots;
01789   if ( str == "Carrots" ) return tov_Carrots;
01790   if ( str == "OPotatoes" ) return tov_OPotatoes;
01791   if ( str == "OSeedGrass1" ) return tov_OSeedGrass1;
01792   if ( str == "OSpringBarleyGrass" ) return tov_OSpringBarleyGrass;
01793   if ( str == "OSpringBarleyClover" ) return tov_OSpringBarleyClover;
01794   if ( str == "OPermanentGrassGrazed" ) return tov_OPermanentGrassGrazed;
01795   if ( str == "OCloverGrassSilage1" ) return tov_OCloverGrassSilage1;
01796   if ( str == "OCloverGrassGrazed2" ) return tov_OCloverGrassGrazed2;
01797   if ( str == "OSeedGrass2" ) return tov_OSeedGrass2;
01798   if ( str == "WWheatPControl" ) return tov_WWheatPControl;
01799   if ( str == "WWheatPToxicControl" ) return tov_WWheatPToxicControl;
01800   if ( str == "WWheatPTreatment" ) return tov_WWheatPTreatment;
01801   if ( str == "AgroChemIndustryCereal" ) return tov_AgroChemIndustryCereal;
01802   if ( str == "WinterWheatShort" ) return tov_WinterWheatShort;
01803   if ( str == "WinterWheatStrigling" ) return tov_WinterWheatStrigling;
01804   if ( str == "WinterWheatStriglingCulm" ) return tov_WinterWheatStriglingCulm;
01805   if ( str == "WinterWheatStriglingSgl" ) return tov_WinterWheatStriglingSingle;
01806   if ( str == "SpringBarleyCloverGrassStrigling" ) return tov_SpringBarleyCloverGrassStrigling;
01807   if ( str == "SpringBarleyStrigling" ) return tov_SpringBarleyStrigling;
01808   if ( str == "SpringBarleyStriglingSingle" ) return tov_SpringBarleyStriglingSingle;
01809   if ( str == "SpringBarleyStriglingCulm" ) return tov_SpringBarleyStriglingCulm;
01810   if ( str == "MaizeStrigling" ) return tov_MaizeStrigling;
01811   if ( str == "WinterRapeStrigling" ) return tov_WinterRapeStrigling;
01812   if ( str == "WinterRyeStrigling" ) return tov_WinterRyeStrigling;
01813   if ( str == "WinterBarleyStrigling" ) return tov_WinterBarleyStrigling;
01814   if ( str == "FieldPeasStrigling" ) return tov_FieldPeasStrigling;
01815   if ( str == "SpringBarleyPeaCloverGrassStrigling" ) return tov_SpringBarleyPeaCloverGrassStrigling;
01816   if (str == "YoungForest") return tov_YoungForest;
01817 
01818   // No match so issue a warning and quit
01819   g_msg->Warn( WARN_FILE, "Farm::TranslateCropCodes():"" Unknown Crop Code ", str.c_str() );
01820   exit( 1 );
01821 }

bool Farm::Trial_Control ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Special pesticide trial functionality.

References trial_control, and UNREFERENCED_PARAMETER.

01735 {
01736   UNREFERENCED_PARAMETER( a_user );
01737   UNREFERENCED_PARAMETER( a_days );
01738   // Will always do this at the first chance
01739   a_field->Trace( trial_control );
01740   a_field->SetLastTreatment( trial_control );
01741   a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
01742   return true;
01743 }

bool Farm::Trial_InsecticideTreat ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Special pesticide trial functionality.

References trial_insecticidetreat, and UNREFERENCED_PARAMETER.

01704 {
01705    UNREFERENCED_PARAMETER( a_days );
01706    UNREFERENCED_PARAMETER( a_user );
01707     a_field->Trace( trial_insecticidetreat );
01708     a_field->SetLastTreatment( trial_insecticidetreat );
01709     a_field->InsectMortality( 0.1 );
01710     a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
01711     return true;
01712 }

bool Farm::Trial_ToxicControl ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Special pesticide trial functionality.

References trial_toxiccontrol, and UNREFERENCED_PARAMETER.

01719 {
01720     UNREFERENCED_PARAMETER( a_user );
01721     UNREFERENCED_PARAMETER( a_days );
01722     a_field->Trace( trial_toxiccontrol );
01723     a_field->SetLastTreatment( trial_toxiccontrol );
01724     a_field->InsectMortality( 0.001 );
01725     a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
01726     return true;
01727 }

bool Farm::Water ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Carry out a watering on a_field.

References DO_IT_PROB, DoIt(), g_landscape_p, UNREFERENCED_PARAMETER, and water.

Referenced by WinterWheat::Do().

01183 {
01184   UNREFERENCED_PARAMETER( a_user );
01185 
01186   /* Turn on this code to avoid watering on heavy soils
01187   int soiltype = a_field->GetSoilType();
01188   if ( soiltype < 1 || soiltype > 4 )
01189     return true;
01190 */
01191   if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
01192     a_field->Trace( water );
01193     a_field->SetLastTreatment( water );
01194     int pref=a_field->GetUnsprayedMarginPolyRef();
01195     if (pref!=-1){
01196       // Must have an unsprayed margin so need to pass the information on to it
01197       LE* um=g_landscape_p->SupplyLEPointer(pref);
01198       um->SetLastTreatment( water );
01199     }
01200     return true;
01201   }
01202   return false;
01203 }

bool Farm::WinterPlough ( LE *  a_field,
double  a_user,
int  a_days 
) [virtual]

Carry out a ploughing event in the winter on a_field.

References DO_IT_PROB, DoIt(), g_landscape_p, UNREFERENCED_PARAMETER, and winter_plough.

00219 {
00220     UNREFERENCED_PARAMETER( a_user );
00221     if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
00222     a_field->Trace( winter_plough );
00223     a_field->SetLastTreatment( winter_plough );
00224     a_field->InsectMortality( 0.1 );
00225     a_field->ZeroVeg();
00226     int pref=a_field->GetUnsprayedMarginPolyRef();
00227     if (pref!=-1){
00228       // Must have an unsprayed margin so need to pass the information on to it
00229       LE* um=g_landscape_p->SupplyLEPointer(pref);
00230       um->SetLastTreatment( winter_plough );
00231       um->InsectMortality( 0.1 );
00232       um->ZeroVeg();
00233     }
00234     return true;
00235   }
00236   return false;
00237 }


Member Data Documentation

AgroChemIndustryCereal* Farm::m_agrochemindustrycereal [protected]

Referenced by Farm(), GetFirstDate(), LeSwitch(), and ~Farm().

Carrots* Farm::m_carrots [protected]

Referenced by Farm(), GetFirstDate(), LeSwitch(), and ~Farm().

CloverGrassGrazed1* Farm::m_CGG1 [protected]

Referenced by Farm(), GetFirstDate(), LeSwitch(), and ~Farm().

CloverGrassGrazed2* Farm::m_CGG2 [protected]

Referenced by Farm(), GetFirstDate(), LeSwitch(), and ~Farm().

int Farm::m_farm_num [protected]

Referenced by GetFarmNumber(), and SetFarmNumber().

FieldPeas* Farm::m_fieldpeas [protected]

Referenced by Farm(), GetFirstDate(), LeSwitch(), and ~Farm().

FieldPeasStrigling* Farm::m_fieldpeasstrigling [protected]

Referenced by Farm(), LeSwitch(), and ~Farm().

vector< LE* > Farm::m_fields [protected]

Fodderbeet* Farm::m_fodderbeet [protected]

Referenced by Farm(), GetFirstDate(), LeSwitch(), and ~Farm().

FodderGrass* Farm::m_foddergrass [protected]

Referenced by Farm(), GetFirstDate(), LeSwitch(), and ~Farm().

bool Farm::m_intensity [protected]

Referenced by Farm(), and GetIntensity().

Maize* Farm::m_maize [protected]

Referenced by Farm(), GetFirstDate(), LeSwitch(), and ~Farm().

MaizeSilage* Farm::m_maizesilage [protected]

Referenced by Farm(), GetFirstDate(), LeSwitch(), and ~Farm().

MaizeStrigling* Farm::m_maizestrigling [protected]

Referenced by Farm(), LeSwitch(), and ~Farm().

Oats* Farm::m_oats [protected]

Referenced by Farm(), GetFirstDate(), LeSwitch(), and ~Farm().

OBarleyPeaCloverGrass* Farm::m_OBarleyPCG [protected]

Referenced by Farm(), GetFirstDate(), LeSwitch(), and ~Farm().

OCarrots* Farm::m_ocarrots [protected]

Referenced by Farm(), GetFirstDate(), LeSwitch(), and ~Farm().

OCloverGrassGrazed1* Farm::m_OCGG1 [protected]

Referenced by Farm(), GetFirstDate(), LeSwitch(), and ~Farm().

OCloverGrassGrazed2* Farm::m_OCGG2 [protected]

Referenced by Farm(), GetFirstDate(), LeSwitch(), and ~Farm().

OCloverGrassSilage1* Farm::m_OCGS1 [protected]

Referenced by Farm(), GetFirstDate(), LeSwitch(), and ~Farm().

OFieldPeas* Farm::m_ofieldpeas [protected]

Referenced by Farm(), GetFirstDate(), LeSwitch(), and ~Farm().

OFieldPeasSilage* Farm::m_ofieldpeassilage [protected]

Referenced by Farm(), LeSwitch(), and ~Farm().

OFirstYearDanger* Farm::m_ofirstyeardanger [protected]

Referenced by Farm(), GetFirstDate(), and ~Farm().

OGrazingPigs* Farm::m_ograzingpigs [protected]

Referenced by Farm(), GetFirstDate(), LeSwitch(), and ~Farm().

OOats* Farm::m_ooats [protected]

Referenced by Farm(), GetFirstDate(), LeSwitch(), and ~Farm().

OPermanentGrassGrazed* Farm::m_opermgrassgrazed [protected]

Referenced by Farm(), GetFirstDate(), LeSwitch(), and ~Farm().

OPotatoes* Farm::m_opotatoes [protected]

Referenced by Farm(), GetFirstDate(), LeSwitch(), and ~Farm().

OSBarleySilage* Farm::m_OSBarleysilage [protected]

Referenced by Farm(), GetFirstDate(), and ~Farm().

OSpringBarley* Farm::m_ospringbarley [protected]

Referenced by Farm(), GetFirstDate(), LeSwitch(), and ~Farm().

OSpringBarleyPigs* Farm::m_ospringbarleypigs [protected]

Referenced by Farm(), GetFirstDate(), LeSwitch(), and ~Farm().

OWinterBarley* Farm::m_owinterbarley [protected]

Referenced by Farm(), GetFirstDate(), LeSwitch(), and ~Farm().

OWinterRape* Farm::m_owinterrape [protected]

Referenced by Farm(), GetFirstDate(), LeSwitch(), and ~Farm().

OWinterRye* Farm::m_owinterrye [protected]

Referenced by Farm(), GetFirstDate(), LeSwitch(), and ~Farm().

OWinterWheatUndersown* Farm::m_owinterwheatundersown [protected]

Referenced by Farm(), GetFirstDate(), LeSwitch(), and ~Farm().

PermanentSetAside* Farm::m_permanentsetaside [protected]

Referenced by Farm(), GetFirstDate(), LeSwitch(), and ~Farm().

PermanentGrassGrazed* Farm::m_permgrassgrazed [protected]

Referenced by Farm(), GetFirstDate(), LeSwitch(), and ~Farm().

PermanentGrassLowYield* Farm::m_permgrasslowyield [protected]

Referenced by Farm(), GetFirstDate(), LeSwitch(), and ~Farm().

PermanentGrassTussocky* Farm::m_permgrasstussocky [protected]

Referenced by Farm(), GetFirstDate(), LeSwitch(), and ~Farm().

Potatoes* Farm::m_potatoes [protected]

Referenced by Farm(), GetFirstDate(), LeSwitch(), and ~Farm().

PotatoesIndustry* Farm::m_potatoesindustry [protected]

Referenced by Farm(), and LeSwitch().

LowPriority< FarmEvent* > Farm::m_queue [protected]

Referenced by AddNewEvent(), HandleEvents(), and ~Farm().

int Farm::m_rotation_sync_index [protected]

Referenced by Farm(), and GetFirstCropIndex().

SpringBarleyCloverGrass* Farm::m_sbarleyclovergrass [protected]

Referenced by Farm(), GetFirstDate(), LeSwitch(), and ~Farm().

SeedGrass1* Farm::m_seedgrass1 [protected]

Referenced by Farm(), GetFirstDate(), LeSwitch(), and ~Farm().

SeedGrass2* Farm::m_seedgrass2 [protected]

Referenced by Farm(), GetFirstDate(), LeSwitch(), and ~Farm().

SetAside* Farm::m_setaside [protected]

Referenced by Farm(), GetFirstDate(), LeSwitch(), and ~Farm().

SpringBarley* Farm::m_springbarley [protected]

Referenced by Farm(), GetFirstDate(), LeSwitch(), and ~Farm().

SpringBarleyCloverGrassStrigling* Farm::m_springbarleyclovergrassstrigling [protected]

Referenced by Farm(), LeSwitch(), and ~Farm().

SpringBarleyPeaCloverGrassStrigling* Farm::m_springbarleypeaclovergrassstrigling [protected]

Referenced by Farm(), LeSwitch(), and ~Farm().

SpringBarleySeed* Farm::m_springbarleyseed [protected]

Referenced by Farm(), GetFirstDate(), LeSwitch(), and ~Farm().

SpringBarleySilage* Farm::m_springbarleysilage [protected]

Referenced by Farm(), GetFirstDate(), LeSwitch(), and ~Farm().

SpringBarleyStrigling* Farm::m_springbarleystrigling [protected]

Referenced by Farm(), GetFirstDate(), LeSwitch(), and ~Farm().

SpringBarleyStriglingCulm* Farm::m_springbarleystriglingculm [protected]

Referenced by Farm(), GetFirstDate(), LeSwitch(), and ~Farm().

SpringBarleyStriglingSingle* Farm::m_springbarleystriglingsingle [protected]

Referenced by Farm(), GetFirstDate(), LeSwitch(), and ~Farm().

SpringRape* Farm::m_springrape [protected]

Referenced by Farm(), GetFirstDate(), LeSwitch(), and ~Farm().

bool Farm::m_stockfarmer [protected]

Referenced by AgroChemIndustryCerealFarm1::AgroChemIndustryCerealFarm1(), AgroChemIndustryCerealFarm2::AgroChemIndustryCerealFarm2(), AgroChemIndustryCerealFarm3::AgroChemIndustryCerealFarm3(), ConventionalCattle::ConventionalCattle(), ConventionalPig::ConventionalPig(), ConventionalPlant::ConventionalPlant(), ConvMarginalJord::ConvMarginalJord(), Farm(), IsStockFarmer(), PesticideTrialTreatment::MakeStockFarmer(), PesticideTrialToxicControl::MakeStockFarmer(), PesticideTrialControl::MakeStockFarmer(), OrganicPlant::MakeStockFarmer(), ConventionalPlant::MakeStockFarmer(), MakeStockFarmer(), NoPesticideBaseFarm::NoPesticideBaseFarm(), NoPesticideNoPFarm::NoPesticideNoPFarm(), OrganicCattle::OrganicCattle(), OrganicPig::OrganicPig(), OrganicPlant::OrganicPlant(), PesticideTrialControl::PesticideTrialControl(), PesticideTrialToxicControl::PesticideTrialToxicControl(), PesticideTrialTreatment::PesticideTrialTreatment(), UserDefinedFarm1::UserDefinedFarm1(), UserDefinedFarm10::UserDefinedFarm10(), UserDefinedFarm11::UserDefinedFarm11(), UserDefinedFarm12::UserDefinedFarm12(), UserDefinedFarm13::UserDefinedFarm13(), UserDefinedFarm14::UserDefinedFarm14(), UserDefinedFarm15::UserDefinedFarm15(), UserDefinedFarm16::UserDefinedFarm16(), UserDefinedFarm17::UserDefinedFarm17(), UserDefinedFarm2::UserDefinedFarm2(), UserDefinedFarm3::UserDefinedFarm3(), UserDefinedFarm4::UserDefinedFarm4(), UserDefinedFarm5::UserDefinedFarm5(), UserDefinedFarm6::UserDefinedFarm6(), UserDefinedFarm7::UserDefinedFarm7(), UserDefinedFarm8::UserDefinedFarm8(), and UserDefinedFarm9::UserDefinedFarm9().

Triticale* Farm::m_triticale [protected]

Referenced by Farm(), GetFirstDate(), LeSwitch(), and ~Farm().

WinterBarley* Farm::m_winterbarley [protected]

Referenced by Farm(), GetFirstDate(), LeSwitch(), and ~Farm().

WinterBarleyStrigling* Farm::m_winterbarleystrigling [protected]

Referenced by Farm(), LeSwitch(), and ~Farm().

WinterRape* Farm::m_winterrape [protected]

Referenced by Farm(), GetFirstDate(), LeSwitch(), and ~Farm().

WinterRapeStrigling* Farm::m_winterrapestrigling [protected]

Referenced by Farm(), LeSwitch(), and ~Farm().

WinterRye* Farm::m_winterrye [protected]

Referenced by Farm(), GetFirstDate(), LeSwitch(), and ~Farm().

WinterRyeStrigling* Farm::m_winterryestrigling [protected]

Referenced by Farm(), LeSwitch(), and ~Farm().

Referenced by Farm(), GetFirstDate(), LeSwitch(), and ~Farm().

WinterWheatStrigling* Farm::m_winterwheatstrigling [protected]

Referenced by Farm(), GetFirstDate(), LeSwitch(), and ~Farm().

WinterWheatStriglingCulm* Farm::m_winterwheatstriglingculm [protected]

Referenced by Farm(), GetFirstDate(), LeSwitch(), and ~Farm().

WinterWheatStriglingSingle* Farm::m_winterwheatstriglingsingle [protected]

Referenced by Farm(), GetFirstDate(), LeSwitch(), and ~Farm().

WWheatPControl* Farm::m_wwheatpcontrol [protected]

Referenced by Farm(), GetFirstDate(), LeSwitch(), and ~Farm().

WWheatPToxicControl* Farm::m_wwheatptoxiccontrol [protected]

Referenced by Farm(), GetFirstDate(), LeSwitch(), and ~Farm().

WWheatPTreatment* Farm::m_wwheatptreatment [protected]

Referenced by Farm(), GetFirstDate(), LeSwitch(), and ~Farm().

YoungForestCrop* Farm::m_youngforest [protected]

Referenced by Farm(), GetFirstDate(), LeSwitch(), and ~Farm().


The documentation for this class was generated from the following files:


Farm Class Reference, 1.0