ALMaSS Vole ODDox  1.1
The vole model description following ODdox protocol
farmfuncs.cpp
Go to the documentation of this file.
1 
14 //
15 // farmfuncs.cpp
16 //
17 /*
18 *******************************************************************************************************
19 Copyright (c) 2011, Christopher John Topping, University of Aarhus
20 All rights reserved.
21 
22 Redistribution and use in source and binary forms, with or without modification, are permitted provided
23 that the following conditions are met:
24 
25 Redistributions of source code must retain the above copyright notice, this list of conditions and the
26 following disclaimer.
27 Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
28 the following disclaimer in the documentation and/or other materials provided with the distribution.
29 
30 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
31 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
32 FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
33 BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
34 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
35 BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
37 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 ********************************************************************************************************
39 */
40 #define UNREFERENCED_PARAMETER(P) (P)
41 
42 #include "ls.h"
43 
44 
45 using namespace std;
46 
47 extern Landscape* g_landscape_p;
48 extern CfgFloat cfg_pest_product_1_amount;
49 extern CfgInt l_pest_productapplic_startdate;
50 extern CfgInt l_pest_productapplic_enddate;
51 extern CfgInt l_pest_productapplic_period;
52 extern CfgBool cfg_OptimiseBedriftsmodelCrops;
53 extern CfgInt cfg_productapplicstartyear;
54 extern CfgInt cfg_productapplicendyear;
55 
56 #define DO_IT_PROB (l_farm_event_do_it_prob.value())
57 #define DO_IT_PROB_LONG (l_farm_event_do_it_prob_long.value())
58 
59 static CfgInt l_farm_event_do_it_prob("FARM_EVENT_DO_IT_PROB", CFG_PRIVATE, 50);
60 static CfgInt l_farm_event_do_it_prob_long("FARM_EVENT_DO_IT_PROB_LONG", CFG_PRIVATE, 5);
61 static CfgFloat l_farm_cattle_veg_reduce("FARM_CATTLE_VEG_REDUCE", CFG_CUSTOM, 1.5);
62 static CfgFloat l_farm_cattle_veg_reduce2("FARM_CATTLE_VEG_REDUCE_LOW", CFG_CUSTOM, 1.00 );
63 static CfgFloat l_farm_pig_veg_reduce("FARM_PIG_VEG_REDUCE", CFG_CUSTOM, 0.98 );
64 static CfgFloat cfg_CustomInsecticideKillProp("CUSTOMINSECTIVIDEKILLPROP", CFG_CUSTOM, 0.5,0,1.0);
65 
66 // Determine whether insecticide and herbicide actually
67 // influences the insect population. By default they *do*
68 // kill off some of the little critters.
69 static CfgBool l_farm_insecticide_kills("FARM_INSECTICIDE_KILLS", CFG_CUSTOM, true );
70 static CfgBool l_farm_herbicide_kills("FARM_PESTICIDE_KILLS", CFG_CUSTOM, true );
71 
73 CfgInt cfg_WW_InsecticideDay("PEST_WWINSECTONEDAY", CFG_CUSTOM, 1);
75 CfgInt cfg_WW_InsecticideMonth("PEST_WWINSECTONEMONTH", CFG_CUSTOM, 5);
77 CfgFloat cfg_WW_conv_tillage_prop1("TILLAGE_WWCONVONEPROP", CFG_CUSTOM, 1.0);
79 CfgFloat cfg_WW_conv_tillage_prop2("TILLAGE_WWCONVTWOPROP", CFG_CUSTOM, 1.0);
81 CfgFloat cfg_WW_NINV_tillage_prop1("TILLAGE_WWNINVONEPROP", CFG_CUSTOM, 1.0);
83 CfgFloat cfg_WW_NINV_tillage_prop2("TILLAGE_WWNINVTWOPROP", CFG_CUSTOM, 1.0);
85 CfgFloat cfg_WW_isecticide_prop1("PEST_WWINSECTONEPROP", CFG_CUSTOM, 1.0);
87 CfgFloat cfg_WW_isecticide_prop2("PEST_WWINSECTTWOPROP", CFG_CUSTOM, 1.0);
89 CfgFloat cfg_WW_isecticide_prop3("PEST_WWINSECTTHREEPROP", CFG_CUSTOM, 1.0);
90 
91 
93 CfgInt cfg_SB_InsecticideDay("PEST_SBINSECTONEDAY", CFG_CUSTOM, 15);
95 CfgInt cfg_SB_InsecticideMonth("PEST_SBINSECTONEMONTH", CFG_CUSTOM, 5);
97 CfgInt cfg_OSR_InsecticideDay("PEST_OSRINSECTONEDAY", CFG_CUSTOM, 30);
99 CfgInt cfg_OSR_InsecticideMonth("PEST_OSRINSECTONEMONTH", CFG_CUSTOM, 4);
100 
102 CfgInt cfg_CAB_InsecticideDay("PEST_CABINSECTONEDAY", CFG_CUSTOM, 15);
104 CfgInt cfg_CAB_InsecticideMonth("PEST_CABINSECTONEMONTH", CFG_CUSTOM, 5);
105 
107 CfgInt cfg_TU_InsecticideDay("PEST_TUINSECTONEDAY", CFG_CUSTOM, 15);
109 CfgInt cfg_TU_InsecticideMonth("PEST_TUINSECTONEMONTH", CFG_CUSTOM, 5);
110 
112 CfgInt cfg_POT_InsecticideDay("PEST_POTINSECTONEDAY", CFG_CUSTOM, 15);
114 CfgInt cfg_POT_InsecticideMonth("PEST_POTINSECTONEMONTH", CFG_CUSTOM, 5);
115 
117 CfgInt cfg_BE_InsecticideDay("PEST_BEINSECTONEDAY", CFG_CUSTOM, 15);
119 CfgInt cfg_BE_InsecticideMonth("PEST_BEINSECTONEMONTH", CFG_CUSTOM, 5);
120 
121 
122 //declared in elements.cpp
123 extern CfgFloat l_el_o_cut_height;
124 extern CfgFloat l_el_o_cut_green;
125 extern CfgFloat l_el_o_cut_total;
126 
127 
132 bool Farm::AutumnPlough( LE *a_field, double /*a_user*/, int a_days )
133 {
134 
135  // LE is a pointer to the field element
136  // a_user is a pointer to the farm
137  // a_days is the end of the operation time - today
138  // if a_days <0 then the time to do it is passed
139  // the line below reads 'plough if last day possible OR if not raining and pass a probability test
140  if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
141  // this bit sets up the events to occur when ploughing occurs
142  // The trace below is for debugging checks
143  a_field->Trace( autumn_plough );
144  // Record the event for this field, so other objects can find out it has happened
145  a_field->SetLastTreatment( autumn_plough );
146  // 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.
147  a_field->InsectMortality( 0.1 );
148  // Reduce the vegetation, in this case to zero
149  a_field->ZeroVeg();
150  // 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.
151  int pref=a_field->GetUnsprayedMarginPolyRef();
152  if (pref!=-1){
153  // Must have an unsprayed margin so need to pass the information on to it
154  LE* um=g_landscape_p->SupplyLEPointer(pref);
155  um->SetLastTreatment( autumn_plough );
156  um->InsectMortality( 0.1 );
157  um->ZeroVeg();
158  }
159  return true; // completed
160  }
161  return false; // not completed
162 }
163 
169 bool Farm::StubblePlough(LE *a_field, double /*a_user*/, int a_days)
170 {
171  if ((0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
172  a_field->Trace(stubble_plough);
173  a_field->SetLastTreatment(stubble_plough);
174  a_field->InsectMortality(0.1); // The same global mortality as for normal plough
175  a_field->ZeroVeg();
176  int pref = a_field->GetUnsprayedMarginPolyRef();
177  if (pref != -1) {
178  // Must have an unsprayed margin so need to pass the information on to it
179  LE* um = g_landscape_p->SupplyLEPointer(pref);
180  um->SetLastTreatment(stubble_plough);
181  um->InsectMortality(0.1);
182  um->ZeroVeg();
183  }
184  return true; // completed
185  }
186  return false; // not completed
187 }
188 
193 bool Farm::StubbleCultivatorHeavy(LE *a_field, double /*a_user*/, int a_days)
194 {
195  if ((0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
196  a_field->Trace(stubble_cultivator_heavy);
197  a_field->SetLastTreatment(stubble_cultivator_heavy);
198  a_field->InsectMortality(0.1); // The same global mortality as for normal plough
199  a_field->ZeroVeg(); // Zero veg as with stubble harrowing
200  int pref = a_field->GetUnsprayedMarginPolyRef();
201  if (pref != -1) {
202  // Must have an unsprayed margin so need to pass the information on to it
203  LE* um = g_landscape_p->SupplyLEPointer(pref);
204  um->SetLastTreatment(stubble_cultivator_heavy);
205  um->InsectMortality(0.1);
206  um->ZeroVeg();
207  }
208  return true; // completed
209  }
210  return false; // not completed
211 }
212 
217 bool Farm::HeavyCultivatorAggregate(LE *a_field, double /*a_user*/, int a_days)
218 {
219  if ((0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
220  a_field->Trace(heavy_cultivator_aggregate);
221  a_field->SetLastTreatment(heavy_cultivator_aggregate);
222  a_field->InsectMortality(0.1); // The same global mortality as for normal plough
223  a_field->ZeroVeg(); // Zero veg as with stubble harrowing
224  int pref = a_field->GetUnsprayedMarginPolyRef();
225  if (pref != -1) {
226  // Must have an unsprayed margin so need to pass the information on to it
227  LE* um = g_landscape_p->SupplyLEPointer(pref);
228  um->SetLastTreatment(heavy_cultivator_aggregate);
229  um->InsectMortality(0.1);
230  um->ZeroVeg();
231  }
232  return true; // completed
233  }
234  return false; // not completed
235 }
236 
241 bool Farm::SleepAllDay( LE *a_field, double /*a_user*/, int a_days)
242 {
243  if (0 >= a_days) {
244  a_field->Trace(sleep_all_day);
245  a_field->SetLastTreatment(sleep_all_day);
246  int pref = a_field->GetUnsprayedMarginPolyRef();
247  if (pref != -1) {
248  // Must have an unsprayed margin so need to pass the information on to it
249  LE* um = g_landscape_p->SupplyLEPointer(pref);
250  um->SetLastTreatment(sleep_all_day);
251  }
252  return true;
253  }
254  return false;
255 }
256 
261 bool Farm::AutumnHarrow( LE *a_field, double /*a_user*/, int a_days )
262 {
263 
264  if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
265  a_field->Trace( autumn_harrow );
266  a_field->SetLastTreatment( autumn_harrow );
267  // Apply 90% mortality to the insects
268  a_field->InsectMortality( 0.1 );
269  // Reduce the vegetation to zero
270  a_field->ZeroVeg();
271  int pref=a_field->GetUnsprayedMarginPolyRef();
272  if (pref!=-1){
273  // Must have an unsprayed margin so need to pass the information on to it
274  LE* um=g_landscape_p->SupplyLEPointer(pref);
275  um->SetLastTreatment( autumn_harrow );
276  um->InsectMortality( 0.1 );
277  um->ZeroVeg();
278  }
279  return true;
280  }
281  return false;
282 }
283 
288 bool Farm::AutumnRoll( LE *a_field, double /*a_user*/, int a_days )
289 {
290 
291  if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
292  a_field->Trace( autumn_roll );
293  a_field->SetLastTreatment( autumn_roll );
294  a_field->ZeroVeg();
295  int pref=a_field->GetUnsprayedMarginPolyRef();
296  if (pref!=-1){
297  // Must have an unsprayed margin so need to pass the information on to it
298  LE* um=g_landscape_p->SupplyLEPointer(pref);
299  um->SetLastTreatment( autumn_roll );
300  um->ZeroVeg();
301  }
302  return true;
303  }
304  return false;
305 }
306 
311 bool Farm::PreseedingCultivator(LE *a_field, double /*a_user*/, int a_days)
312 {
313  if ((0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
314  a_field->Trace(preseeding_cultivator);
315  a_field->SetLastTreatment(preseeding_cultivator);
316  // Apply 90% mortality to the insects as for harrowing
317  a_field->InsectMortality(0.1);
318  // Reduce the vegetation to zero as for harrowing
319  a_field->ZeroVeg();
320  int pref = a_field->GetUnsprayedMarginPolyRef();
321  if (pref != -1) {
322  // Must have an unsprayed margin so need to pass the information on to it
323  LE* um = g_landscape_p->SupplyLEPointer(pref);
324  um->SetLastTreatment(preseeding_cultivator);
325  um->InsectMortality(0.1);
326  um->ZeroVeg();
327  }
328  return true;
329  }
330  return false;
331 }
332 
337 bool Farm::PreseedingCultivatorSow(LE *a_field, double /*a_user*/, int a_days)
338 {
339  if ((0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
340  a_field->Trace(preseeding_cultivator_sow);
341  a_field->SetLastTreatment(preseeding_cultivator_sow);
342  a_field->SetGrowthPhase(sow); // as with AutumnSow treatment
343  a_field->SetLastSownVeg(a_field->GetVegType()); // as with AutumnSow treatment
344  // Reduce the vegetation to zero
345  a_field->ZeroVeg();
346  int pref = a_field->GetUnsprayedMarginPolyRef();
347  if (pref != -1) {
348  // Must have an unsprayed margin so need to pass the information on to it
349  LE* um = g_landscape_p->SupplyLEPointer(pref);
350  um->SetLastTreatment(preseeding_cultivator_sow);
351  um->SetGrowthPhase(sow);
352  um->ZeroVeg();
353  um->SetLastSownVeg(um->GetVegType());
354  }
355  return true;
356  }
357  return false;
358 }
359 
364 bool Farm::AutumnSow( LE *a_field, double /*a_user*/, int a_days )
365 {
366 
367  if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
368  a_field->Trace( autumn_sow );
369  a_field->SetLastTreatment( autumn_sow );
370  a_field->SetGrowthPhase( sow );
371  a_field->SetLastSownVeg(a_field->GetVegType());
372  // Reduce the vegetation to zero
373  a_field->ZeroVeg();
374  int pref=a_field->GetUnsprayedMarginPolyRef();
375  if (pref!=-1){
376  // Must have an unsprayed margin so need to pass the information on to it
377  LE* um=g_landscape_p->SupplyLEPointer(pref);
378  um->SetLastTreatment( autumn_sow );
379  um->SetGrowthPhase( sow );
380  um->ZeroVeg();
381  um->SetLastSownVeg(um->GetVegType());
382  }
383  return true;
384  }
385  return false;
386 }
387 
392 bool Farm::WinterPlough( LE *a_field, double /*a_user*/, int a_days )
393 {
394 
395  if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
396  a_field->Trace( winter_plough );
397  a_field->SetLastTreatment( winter_plough );
398  a_field->InsectMortality( 0.1 );
399  a_field->ZeroVeg();
400  int pref=a_field->GetUnsprayedMarginPolyRef();
401  if (pref!=-1){
402  // Must have an unsprayed margin so need to pass the information on to it
403  LE* um=g_landscape_p->SupplyLEPointer(pref);
404  um->SetLastTreatment( winter_plough );
405  um->InsectMortality( 0.1 );
406  um->ZeroVeg();
407  }
408  return true;
409  }
410  return false;
411 }
412 
417 bool Farm::DeepPlough( LE *a_field, double /*a_user*/, int a_days )
418 {
419 
420  if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
421  a_field->Trace( deep_ploughing );
422  a_field->SetLastTreatment( deep_ploughing );
423  // Apply 90% mortality to the insects
424  a_field->InsectMortality( 0.1 );
425  // Reduce the vegetation to zero
426  a_field->ZeroVeg();
427  int pref=a_field->GetUnsprayedMarginPolyRef();
428  if (pref!=-1){
429  // Must have an unsprayed margin so need to pass the information on to it
430  LE* um=g_landscape_p->SupplyLEPointer(pref);
431  um->SetLastTreatment( deep_ploughing );
432  um->InsectMortality( 0.1 );
433  um->ZeroVeg();
434  }
435  return true;
436  }
437  return false;
438 }
439 
444 bool Farm::SpringPlough( LE *a_field, double /*a_user*/, int a_days )
445 {
446 
447  if ((a_days <= 0) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
448  a_field->Trace( spring_plough );
449  a_field->SetLastTreatment( spring_plough );
450  // Apply 90% mortality to the insects
451  a_field->InsectMortality( 0.1 );
452  // Reduce the vegetation to zero
453  a_field->ZeroVeg();
454  int pref=a_field->GetUnsprayedMarginPolyRef();
455  if (pref!=-1){
456  // Must have an unsprayed margin so need to pass the information on to it
457  LE* um=g_landscape_p->SupplyLEPointer(pref);
458  um->SetLastTreatment( spring_plough );
459  um->InsectMortality( 0.1);
460  um->ZeroVeg();
461  }
462  return true;
463  }
464  return false;
465 }
466 
471 bool Farm::SpringHarrow( LE *a_field, double /*a_user*/, int a_days )
472 {
473 
474  if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
475  a_field->Trace( spring_harrow );
476  a_field->SetLastTreatment( spring_harrow );
477  // 30% insect mortality
478  a_field->InsectMortality( 0.7 );
479  // remove all vegetation
480  a_field->ZeroVeg();
481  int pref=a_field->GetUnsprayedMarginPolyRef();
482  if (pref!=-1){
483  // Must have an unsprayed margin so need to pass the information on to it
484  LE* um=g_landscape_p->SupplyLEPointer(pref);
485  um->SetLastTreatment( spring_harrow );
486  um->InsectMortality( 0.7 );
487  um->ZeroVeg();
488  }
489  return true;
490  }
491  return false;
492 }
493 
498 bool Farm::ShallowHarrow(LE *a_field, double /*a_user*/, int a_days)
499 {
500 
501  if ((0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
502  a_field->Trace(shallow_harrow);
503  a_field->SetLastTreatment(shallow_harrow);
504  // 30% insect mortality
505  a_field->InsectMortality(0.7);
506  // remove vegetation partly
507  a_field->ReduceVeg(0.8);
508  int pref = a_field->GetUnsprayedMarginPolyRef();
509  if (pref != -1) {
510  // Must have an unsprayed margin so need to pass the information on to it
511  LE* um = g_landscape_p->SupplyLEPointer(pref);
512  um->SetLastTreatment(shallow_harrow);
513  um->InsectMortality(0.7);
514  um->ReduceVeg(0.8);
515  }
516  return true;
517  }
518  return false;
519 }
520 
525 bool Farm::SpringRoll( LE *a_field, double /*a_user*/, int a_days )
526 {
527 
528  if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
529  a_field->Trace( spring_roll );
530  a_field->SetLastTreatment( spring_roll );
531  int pref=a_field->GetUnsprayedMarginPolyRef();
532  if (pref!=-1){
533  // Must have an unsprayed margin so need to pass the information on to it
534  LE* um=g_landscape_p->SupplyLEPointer(pref);
535  um->SetLastTreatment( spring_roll );
536  }
537  return true;
538  }
539  return false;
540 }
541 
546 bool Farm::SpringSow( LE *a_field, double /*a_user*/, int a_days )
547 {
548 
549  if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
550  a_field->Trace( spring_sow );
551  a_field->SetLastTreatment( spring_sow );
552  a_field->SetGrowthPhase( sow );
553  a_field->SetLastSownVeg(a_field->GetVegType());
554  // Reduce the vegetation to zero - should not strictly be necessary, but prevents any false starts in the crop growth.
555  a_field->ZeroVeg();
556  int pref=a_field->GetUnsprayedMarginPolyRef();
557  if (pref!=-1){
558  // Must have an unsprayed margin so need to pass the information on to it
559  LE* um=g_landscape_p->SupplyLEPointer(pref);
560  um->SetLastTreatment( spring_sow );
561  um->SetGrowthPhase( sow );
562  um->ZeroVeg();
563  um->SetLastSownVeg(um->GetVegType());
564  }
565  return true;
566  }
567  return false;
568 }
569 
574 bool Farm::SpringSowWithFerti(LE *a_field, double /*a_user*/, int a_days)
575 {
576 
577  if ((0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
578  a_field->Trace(spring_sow_with_ferti);
579  a_field->SetLastTreatment(spring_sow_with_ferti);
580  a_field->SetGrowthPhase(sow);
581  a_field->SetLastSownVeg(a_field->GetVegType());
582  // Reduce the vegetation to zero - should not strictly be necessary, but prevents any false starts in the crop growth.
583  a_field->ZeroVeg();
584  int pref = a_field->GetUnsprayedMarginPolyRef();
585  if (pref != -1) {
586  // Must have an unsprayed margin so need to pass the information on to it
587  LE* um = g_landscape_p->SupplyLEPointer(pref);
588  um->SetLastTreatment(spring_sow_with_ferti);
589  um->SetGrowthPhase(sow);
590  um->ZeroVeg();
591  um->SetLastSownVeg(um->GetVegType());
592  }
593  return true;
594  }
595  return false;
596 }
597 
602 bool Farm::FP_NPKS( LE *a_field, double /*a_user*/, int a_days )
603 {
604 
605  if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
606  a_field->Trace( fp_npks );
607  a_field->SetLastTreatment( fp_npks );
608  a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
609  int pref=a_field->GetUnsprayedMarginPolyRef();
610 if (pref!=-1){
611  // Must have an unsprayed margin so need to pass the information on to it
612  LE* um=g_landscape_p->SupplyLEPointer(pref);
613  um->SetLastTreatment(sleep_all_day);
614  um->SetGrowthPhase( harvest1 );
615  um->InsectMortality( 0.4 );
616  um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
617 }
618 
619  return true;
620  }
621  return false;
622 }
623 
624 
629 bool Farm::FP_NPK( LE *a_field, double /*a_user*/, int a_days )
630 {
631 
632  if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
633  a_field->Trace( fp_npk );
634  a_field->SetLastTreatment( fp_npk );
635  a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
636  int pref=a_field->GetUnsprayedMarginPolyRef();
637  if (pref!=-1){
638  // Must have an unsprayed margin so need to pass the information on to it
639  LE* um=g_landscape_p->SupplyLEPointer(pref);
640  um->SetLastTreatment(fp_npk);
641  um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
642  }
643  return true;
644  }
645  return false;
646 }
647 
648 
653 bool Farm::FP_PK( LE *a_field, double /*a_user*/, int a_days )
654 {
655 
656  if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
657  a_field->Trace( fp_pk );
658  a_field->SetLastTreatment( fp_pk );
659  a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
660  int pref=a_field->GetUnsprayedMarginPolyRef();
661  if (pref!=-1){
662  // Must have an unsprayed margin so need to pass the information on to it
663  LE* um=g_landscape_p->SupplyLEPointer(pref);
664  um->SetLastTreatment(fp_pk);
665  um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
666  }
667  return true;
668  }
669  return false;
670 }
671 
672 
677 bool Farm::FP_LiquidNH3( LE *a_field, double /*a_user*/, int a_days )
678 {
679 
680  if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
681  a_field->Trace( fp_liquidNH3 );
682  a_field->SetLastTreatment( fp_liquidNH3 );
683  a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
684  int pref=a_field->GetUnsprayedMarginPolyRef();
685  if (pref!=-1){
686  // Must have an unsprayed margin so need to pass the information on to it
687  LE* um=g_landscape_p->SupplyLEPointer(pref);
688  um->SetLastTreatment(fp_liquidNH3);
689  um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
690  }
691  return true;
692  }
693  return false;
694 }
695 
696 
701 bool Farm::FP_Slurry( LE *a_field, double /*a_user*/, int a_days )
702 {
703 
704  if ( (0 >= a_days) || ((g_weather->GetTemp()>0)&&
705  !g_weather->Raining() && DoIt(DO_IT_PROB)))
706 {
707  a_field->Trace( fp_slurry );
708  a_field->SetLastTreatment( fp_slurry );
709  a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
710  int pref=a_field->GetUnsprayedMarginPolyRef();
711  if (pref!=-1){
712  // Must have an unsprayed margin so need to pass the information on to it
713  LE* um=g_landscape_p->SupplyLEPointer(pref);
714  um->SetLastTreatment(fp_slurry);
715  um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
716  }
717  return true;
718  }
719  return false;
720 }
721 
722 
727 bool Farm::FP_ManganeseSulphate( LE *a_field, double /*a_user*/, int a_days )
728 {
729 
730  if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
731  a_field->Trace( fp_manganesesulphate );
732  a_field->SetLastTreatment( fp_manganesesulphate );
733  a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
734  int pref=a_field->GetUnsprayedMarginPolyRef();
735  if (pref!=-1){
736  // Must have an unsprayed margin so need to pass the information on to it
737  LE* um=g_landscape_p->SupplyLEPointer(pref);
738  um->SetLastTreatment( fp_manganesesulphate );
739  um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
740  }
741  return true;
742  }
743  return false;
744 }
745 
750 bool Farm::FP_AmmoniumSulphate(LE *a_field, double /*a_user*/, int a_days)
751 {
752 
753  if ((0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
754  a_field->Trace(fp_ammoniumsulphate);
755  a_field->SetLastTreatment(fp_ammoniumsulphate);
756  a_field->SetTramlinesDecay(EL_TRAMLINE_DECAYTIME);
757  int pref = a_field->GetUnsprayedMarginPolyRef();
758  if (pref != -1) {
759  // Must have an unsprayed margin so need to pass the information on to it
760  LE* um = g_landscape_p->SupplyLEPointer(pref);
761  um->SetLastTreatment(fp_ammoniumsulphate);
762  um->SetTramlinesDecay(EL_TRAMLINE_DECAYTIME);
763  }
764  return true;
765  }
766  return false;
767 }
768 
773 bool Farm::FP_Manure( LE *a_field, double /*a_user*/, int a_days )
774 {
775 
776  if ( (0 >= a_days) || ((g_weather->GetTemp()>0)&&
777  !g_weather->Raining() && DoIt(DO_IT_PROB))) {
778  a_field->Trace( fp_manure );
779  a_field->SetLastTreatment( fp_manure );
780  a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
781  int pref=a_field->GetUnsprayedMarginPolyRef();
782  if (pref!=-1){
783  // Must have an unsprayed margin so need to pass the information on to it
784  LE* um=g_landscape_p->SupplyLEPointer(pref);
785  um->SetLastTreatment( fp_manure );
786  um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
787  }
788  return true;
789  }
790  return false;
791 }
792 
793 
798 bool Farm::FP_GreenManure( LE *a_field, double /*a_user*/, int a_days )
799 {
800 
801  if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
802  a_field->Trace( fp_greenmanure );
803  a_field->SetLastTreatment( fp_greenmanure );
804  a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
805  int pref=a_field->GetUnsprayedMarginPolyRef();
806  if (pref!=-1){
807  // Must have an unsprayed margin so need to pass the information on to it
808  LE* um=g_landscape_p->SupplyLEPointer(pref);
809  um->SetLastTreatment( fp_greenmanure );
810  um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
811  }
812  return true;
813  }
814  return false;
815 }
816 
817 
822 bool Farm::FP_Sludge( LE *a_field, double /*a_user*/, int a_days )
823 {
824  //
825  if ( (0 >= a_days) || ((g_weather->GetTemp()>0)&&
826  !g_weather->Raining() && DoIt(DO_IT_PROB)))
827 {
828  a_field->Trace( fp_sludge );
829  a_field->SetLastTreatment( fp_sludge );
830  a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
831  int pref=a_field->GetUnsprayedMarginPolyRef();
832  if (pref!=-1){
833  // Must have an unsprayed margin so need to pass the information on to it
834  LE* um=g_landscape_p->SupplyLEPointer(pref);
835  um->SetLastTreatment( fp_sludge );
836  um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
837  }
838  return true;
839  }
840  return false;
841 }
842 
847 bool Farm::FP_RSM(LE * a_field, double /*a_user*/, int a_days)
848 {
849  if ((0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
850  a_field->Trace(fp_rsm);
851  a_field->SetLastTreatment(fp_rsm);
852  a_field->SetTramlinesDecay(EL_TRAMLINE_DECAYTIME);
853  int pref = a_field->GetUnsprayedMarginPolyRef();
854  if (pref != -1) {
855  // Must have an unsprayed margin so need to pass the information on to it
856  LE* um = g_landscape_p->SupplyLEPointer(pref);
857  um->SetLastTreatment(fp_rsm);
858  um->SetTramlinesDecay(EL_TRAMLINE_DECAYTIME);
859  }
860  return true;
861  }
862  return false;
863 }
864 
869 bool Farm::FP_Calcium(LE * a_field, double /*a_user*/, int a_days)
870 {
871  if ((0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
872  a_field->Trace(fp_calcium);
873  a_field->SetLastTreatment(fp_calcium);
874  a_field->SetTramlinesDecay(EL_TRAMLINE_DECAYTIME);
875  int pref = a_field->GetUnsprayedMarginPolyRef();
876  if (pref != -1) {
877  // Must have an unsprayed margin so need to pass the information on to it
878  LE* um = g_landscape_p->SupplyLEPointer(pref);
879  um->SetLastTreatment(fp_calcium);
880  um->SetTramlinesDecay(EL_TRAMLINE_DECAYTIME);
881  }
882  return true;
883  }
884  return false;
885 }
886 
891 bool Farm::FA_NPKS(LE *a_field, double /*a_user*/, int a_days)
892 {
893 
894  if ((0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
895  a_field->Trace(fa_npks);
896  a_field->SetLastTreatment(fa_npks);
897  a_field->SetTramlinesDecay(EL_TRAMLINE_DECAYTIME);
898  int pref = a_field->GetUnsprayedMarginPolyRef();
899  if (pref != -1) {
900  // Must have an unsprayed margin so need to pass the information on to it
901  LE* um = g_landscape_p->SupplyLEPointer(pref);
902  um->SetLastTreatment(sleep_all_day);
903  um->SetGrowthPhase(harvest1);
904  um->InsectMortality(0.4);
905  um->SetTramlinesDecay(EL_TRAMLINE_DECAYTIME);
906  }
907 
908  return true;
909  }
910  return false;
911 }
912 
917 bool Farm::FA_NPK( LE *a_field, double /*a_user*/, int a_days )
918 {
919 
920  if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
921  a_field->Trace( fa_npk );
922  a_field->SetLastTreatment( fa_npk );
923  a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
924  int pref=a_field->GetUnsprayedMarginPolyRef();
925  if (pref!=-1){
926  // Must have an unsprayed margin so need to pass the information on to it
927  LE* um=g_landscape_p->SupplyLEPointer(pref);
928  um->SetLastTreatment( fa_npk );
929  um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
930  }
931  return true;
932  }
933  return false;
934 }
935 
936 
941 bool Farm::FA_PK( LE *a_field, double /*a_user*/, int a_days )
942 {
943 
944  if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
945  a_field->Trace( fa_pk );
946  a_field->SetLastTreatment( fa_pk );
947  a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
948  int pref=a_field->GetUnsprayedMarginPolyRef();
949  if (pref!=-1){
950  // Must have an unsprayed margin so need to pass the information on to it
951  LE* um=g_landscape_p->SupplyLEPointer(pref);
952  um->SetLastTreatment( fa_pk );
953  um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
954  }
955  return true;
956  }
957  return false;
958 }
959 
965 bool Farm::FA_Slurry( LE *a_field, double /*a_user*/, int a_days )
966 {
967 
968  if ( (0 >= a_days) || ((g_weather->GetTemp()>0)&&
969  !g_weather->Raining() && DoIt(DO_IT_PROB)))
970 {
971  a_field->Trace( fa_slurry );
972  a_field->SetLastTreatment( fa_slurry );
973  a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
974  int pref=a_field->GetUnsprayedMarginPolyRef();
975  if (pref!=-1){
976  // Must have an unsprayed margin so need to pass the information on to it
977  LE* um=g_landscape_p->SupplyLEPointer(pref);
978  um->SetLastTreatment( fa_slurry );
979  um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
980  }
981  return true;
982  }
983  return false;
984 }
985 
990 bool Farm::FA_AmmoniumSulphate( LE *a_field, double /*a_user*/, int a_days )
991 {
992 
993  if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
994  a_field->Trace( fa_ammoniumsulphate );
995  a_field->SetLastTreatment( fa_ammoniumsulphate );
996  a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
997  int pref=a_field->GetUnsprayedMarginPolyRef();
998  if (pref!=-1){
999  // Must have an unsprayed margin so need to pass the information on to it
1000  LE* um=g_landscape_p->SupplyLEPointer(pref);
1001  um->SetLastTreatment( fa_ammoniumsulphate );
1002  um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
1003  }
1004  return true;
1005  }
1006  return false;
1007 }
1008 
1013 bool Farm::FA_ManganeseSulphate(LE *a_field, double /*a_user*/, int a_days)
1014 {
1015  if ((0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
1016  a_field->Trace(fa_manganesesulphate);
1017  a_field->SetLastTreatment(fa_manganesesulphate);
1018  a_field->SetTramlinesDecay(EL_TRAMLINE_DECAYTIME);
1019  int pref = a_field->GetUnsprayedMarginPolyRef();
1020  if (pref != -1) {
1021  // Must have an unsprayed margin so need to pass the information on to it
1022  LE* um = g_landscape_p->SupplyLEPointer(pref);
1023  um->SetLastTreatment(fa_manganesesulphate);
1024  um->SetTramlinesDecay(EL_TRAMLINE_DECAYTIME);
1025  }
1026  return true;
1027  }
1028  return false;
1029 }
1030 
1031 
1036 bool Farm::FA_Manure( LE *a_field, double /*a_user*/, int a_days )
1037 {
1038 
1039  if ( (0 >= a_days) || ((g_weather->GetTemp()>0)&&
1040  !g_weather->Raining() && DoIt(DO_IT_PROB)))
1041 {
1042  a_field->Trace( fa_manure );
1043  a_field->SetLastTreatment( fa_manure );
1044  a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
1045  int pref=a_field->GetUnsprayedMarginPolyRef();
1046  if (pref!=-1){
1047  // Must have an unsprayed margin so need to pass the information on to it
1048  LE* um=g_landscape_p->SupplyLEPointer(pref);
1049  um->SetLastTreatment( fa_manure );
1050  um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
1051  }
1052  return true;
1053  }
1054  return false;
1055 }
1056 
1057 
1062 bool Farm::FA_GreenManure( LE *a_field, double /*a_user*/, int a_days )
1063 {
1064 
1065  if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
1066  a_field->Trace( fa_greenmanure );
1067  a_field->SetLastTreatment( fa_greenmanure );
1068  a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
1069  int pref=a_field->GetUnsprayedMarginPolyRef();
1070  if (pref!=-1){
1071  // Must have an unsprayed margin so need to pass the information on to it
1072  LE* um=g_landscape_p->SupplyLEPointer(pref);
1073  um->SetLastTreatment( fa_greenmanure );
1074  um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
1075  }
1076  return true;
1077  }
1078  return false;
1079 }
1080 
1081 
1086 bool Farm::FA_Sludge( LE *a_field, double /*a_user*/, int a_days )
1087 {
1088 
1089  if ( (0 >= a_days) || ((g_weather->GetTemp()>0)&&
1090  !g_weather->Raining() && DoIt(DO_IT_PROB)))
1091 {
1092  a_field->Trace( fa_sludge );
1093  a_field->SetLastTreatment( fa_sludge );
1094  a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
1095  int pref=a_field->GetUnsprayedMarginPolyRef();
1096  if (pref!=-1){
1097  // Must have an unsprayed margin so need to pass the information on to it
1098  LE* um=g_landscape_p->SupplyLEPointer(pref);
1099  um->SetLastTreatment( fa_sludge );
1100  um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
1101  }
1102  return true;
1103  }
1104  return false;
1105 }
1106 
1111 bool Farm::FA_RSM(LE * a_field, double /*a_user*/, int a_days)
1112 {
1113  if ((0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
1114  a_field->Trace(fa_rsm);
1115  a_field->SetLastTreatment(fa_rsm);
1116  a_field->SetTramlinesDecay(EL_TRAMLINE_DECAYTIME);
1117  int pref = a_field->GetUnsprayedMarginPolyRef();
1118  if (pref != -1) {
1119  // Must have an unsprayed margin so need to pass the information on to it
1120  LE* um = g_landscape_p->SupplyLEPointer(pref);
1121  um->SetLastTreatment(fa_rsm);
1122  um->SetTramlinesDecay(EL_TRAMLINE_DECAYTIME);
1123  }
1124  return true;
1125  }
1126  return false;
1127 }
1128 
1133 bool Farm::FA_Calcium(LE * a_field, double /*a_user*/, int a_days)
1134 {
1135  if ((0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
1136  a_field->Trace(fa_calcium);
1137  a_field->SetLastTreatment(fa_calcium);
1138  a_field->SetTramlinesDecay(EL_TRAMLINE_DECAYTIME);
1139  int pref = a_field->GetUnsprayedMarginPolyRef();
1140  if (pref != -1) {
1141  // Must have an unsprayed margin so need to pass the information on to it
1142  LE* um = g_landscape_p->SupplyLEPointer(pref);
1143  um->SetLastTreatment(fa_calcium);
1144  um->SetTramlinesDecay(EL_TRAMLINE_DECAYTIME);
1145  }
1146  return true;
1147  }
1148  return false;
1149 }
1150 
1151 
1156 bool Farm::HerbicideTreat( LE *a_field, double /*a_user*/, int a_days )
1157 {
1158 
1159  if (0 >= a_days) // Must do this
1160  {
1161  if (((a_field->GetSignal() & LE_SIG_NO_HERBICIDE)==0 ))
1162  {
1163  a_field->Trace( herbicide_treat );
1164  a_field->SetLastTreatment( herbicide_treat );
1165  if ( l_farm_herbicide_kills.value())
1166  {
1167  a_field->ReduceWeedBiomass( 0.05 );
1168  }
1169  a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
1170  a_field->SetHerbicideDelay( EL_HERBICIDE_DELAYTIME );
1172 
1173  }
1174  return true;
1175  }
1176  else if ((g_weather->GetWind()<4.5) && (!g_weather->Raining()) && DoIt(DO_IT_PROB))
1177  {
1178  if ( !(a_field->GetSignal() & LE_SIG_NO_HERBICIDE) )
1179  {
1180  a_field->Trace( herbicide_treat );
1181  a_field->SetLastTreatment( herbicide_treat );
1182  if ( l_farm_herbicide_kills.value())
1183  {
1184  a_field->ReduceWeedBiomass( 0.05 );
1185  }
1186  a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
1187  a_field->SetHerbicideDelay( EL_HERBICIDE_DELAYTIME );
1189  }
1190  return true;
1191  }
1192  return false;
1193 }
1194 
1195 
1196 bool OptimisingFarm::HerbicideTreat( LE *a_field, double /*a_user*/, int a_days )
1197 {
1198 
1199  if (0 >= a_days) // Must do this
1200  {
1201  if (((a_field->GetSignal() & LE_SIG_NO_HERBICIDE)==0 ))
1202  {
1203  a_field->Trace( herbicide_treat );
1204  a_field->SetLastTreatment( herbicide_treat );
1205  if ( l_farm_herbicide_kills.value()) {
1206  a_field->ReduceWeedBiomass( 0.05 );
1207  }
1208  a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
1209  a_field->SetHerbicideDelay( EL_HERBICIDE_DELAYTIME );
1211 
1212 
1213  if(!cfg_OptimiseBedriftsmodelCrops.value()){
1214  Field * pf = dynamic_cast<Field*>(a_field);
1215  pf->Add_no_herb_app();
1216  }
1217 
1218  }
1219  return true;
1220  }
1221  else if ((g_weather->GetWind()<4.5) && (!g_weather->Raining()) && DoIt(DO_IT_PROB))
1222  {
1223  if ( !(a_field->GetSignal() & LE_SIG_NO_HERBICIDE) )
1224  {
1225  a_field->Trace( herbicide_treat );
1226  a_field->SetLastTreatment( herbicide_treat );
1227  if ( l_farm_herbicide_kills.value()) {
1228  a_field->ReduceWeedBiomass( 0.05 );
1229  }
1230  a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
1231  a_field->SetHerbicideDelay( EL_HERBICIDE_DELAYTIME );
1233 
1234  if(!cfg_OptimiseBedriftsmodelCrops.value()){
1235  Field * pf = dynamic_cast<Field*>(a_field);
1236  pf->Add_no_herb_app();
1237  }
1238  }
1239  return true;
1240  }
1241  return false;
1242 }
1243 
1244 
1245 
1250 bool Farm::GrowthRegulator( LE *a_field, double /*a_user*/, int a_days )
1251 {
1252 
1253  if (0 >= a_days)
1254  {
1255  if ( (!g_weather->Raining()) && (g_weather->GetWind()<4.5) &&
1256  (!(a_field->GetSignal() & LE_SIG_NO_GROWTH_REG) )) {
1257  a_field->Trace( growth_regulator );
1258  a_field->SetLastTreatment( growth_regulator );
1259  a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
1260  }
1261  return true;
1262  }
1263  else if ( (g_weather->GetWind()<4.5) &&
1264  (!g_weather->Raining()) && DoIt(DO_IT_PROB)) {
1265  if ( ! (a_field->GetSignal() & LE_SIG_NO_GROWTH_REG) ) {
1266  a_field->Trace( growth_regulator );
1267  a_field->SetLastTreatment( growth_regulator );
1268  a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
1269  }
1270  return true;
1271  }
1272  return false;
1273 }
1274 
1279 bool Farm::FungicideTreat( LE *a_field, double /*a_user*/, int a_days )
1280 {
1281 
1282  if (0 >= a_days)
1283  {
1284  if ( ( ! a_field->GetSignal() & LE_SIG_NO_FUNGICIDE ))
1285  {
1286  a_field->Trace( fungicide_treat );
1287  a_field->SetLastTreatment( fungicide_treat );
1288  a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
1290  }
1291  return true;
1292  }
1293  else if ( (g_weather->GetWind()<4.5) &&
1294  (!g_weather->Raining()) && DoIt(DO_IT_PROB)) {
1295  if ( ! (a_field->GetSignal() & LE_SIG_NO_FUNGICIDE) ) {
1296  a_field->Trace( fungicide_treat );
1297  a_field->SetLastTreatment( fungicide_treat );
1298  a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
1300  }
1301  return true;
1302  }
1303  return false;
1304 }
1305 
1306 
1307 bool OptimisingFarm::FungicideTreat( LE *a_field, double /*a_user*/, int a_days )
1308 {
1309 
1310  if (0 >= a_days)
1311  {
1312  if ( ( ! a_field->GetSignal() & LE_SIG_NO_FUNGICIDE )) {
1313  a_field->Trace( fungicide_treat );
1314  a_field->SetLastTreatment( fungicide_treat );
1315  a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
1317 
1318  if(!cfg_OptimiseBedriftsmodelCrops.value()){
1319  Field * pf = dynamic_cast<Field*>(a_field);
1320  pf->Add_no_fi_app();
1321  }
1322  }
1323  return true;
1324  }
1325  else if ( (g_weather->GetWind()<4.5) && (!g_weather->Raining()) && DoIt(DO_IT_PROB)) {
1326  if ( ! (a_field->GetSignal() & LE_SIG_NO_FUNGICIDE) ) {
1327  a_field->Trace( fungicide_treat );
1328  a_field->SetLastTreatment( fungicide_treat );
1329  a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
1331 
1332  if(!cfg_OptimiseBedriftsmodelCrops.value()){
1333  Field * pf = dynamic_cast<Field*>(a_field);
1334  pf->Add_no_fi_app();
1335  }
1336  }
1337  return true;
1338  }
1339  return false;
1340 }
1341 
1342 
1343 
1348 bool Farm::InsecticideTreat( LE *a_field, double /*a_user*/, int a_days )
1349 {
1350 
1351  if (0 >= a_days)
1352  {
1353  if (( ! (a_field->GetSignal() & LE_SIG_NO_INSECTICIDE) ))
1354  {
1355  // **CJT** Turn this code on to use the pesticide engine with insecticides
1356  // g_pest->DailyQueueAdd( a_field, l_pest_insecticide_amount.value());
1357  //
1358  a_field->Trace( insecticide_treat );
1359  a_field->SetLastTreatment( insecticide_treat );
1360  if ( l_farm_insecticide_kills.value())
1361  {
1362  a_field->Insecticide( 0.36 );
1363  }
1364  a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
1366  }
1367  return true;
1368  }
1369  else if ( (g_weather->GetWind()<4.5) &&
1370  (!g_weather->Raining()) && DoIt(DO_IT_PROB)) {
1371  if ( ! (a_field->GetSignal() & LE_SIG_NO_INSECTICIDE )) {
1372 // **CJT** Turn this code on to use the pesticide engine with insecticides
1373 // g_pest->DailyQueueAdd( a_field, l_pest_insecticide_amount.value());
1374 //
1375  a_field->Trace( insecticide_treat );
1376  a_field->SetLastTreatment( insecticide_treat );
1377  if ( l_farm_insecticide_kills.value()) {
1378  a_field->Insecticide( 0.36 );
1379  }
1380  a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
1382  }
1383  return true;
1384  }
1385  return false;
1386 }
1387 
1388 
1389 bool OptimisingFarm::InsecticideTreat( LE *a_field, double /*a_user*/, int a_days )
1390 {
1391 
1392  if (0 >= a_days)
1393  {
1394  if (( ! (a_field->GetSignal() & LE_SIG_NO_INSECTICIDE) ))
1395  {
1396  // **CJT** Turn this code on to use the pesticide engine with insecticides
1397  // g_pest->DailyQueueAdd( a_field, l_pest_insecticide_amount.value());
1398  //
1399  a_field->Trace( insecticide_treat );
1400  a_field->SetLastTreatment( insecticide_treat );
1401  if ( l_farm_insecticide_kills.value()) {
1402  a_field->Insecticide( 0.36 );
1403  }
1404  a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
1406 
1407  if(!cfg_OptimiseBedriftsmodelCrops.value()){
1408  Field * pf = dynamic_cast<Field*>(a_field);
1409  pf->Add_no_fi_app();
1410  }
1411 
1412  }
1413  return true;
1414  }
1415  else if ( (g_weather->GetWind()<4.5) && (!g_weather->Raining()) && DoIt(DO_IT_PROB))
1416  {
1417  if ( ! (a_field->GetSignal() & LE_SIG_NO_INSECTICIDE )) {
1418  // **CJT** Turn this code on to use the pesticide engine with insecticides
1419  // g_pest->DailyQueueAdd( a_field, l_pest_insecticide_amount.value());
1420  //
1421  a_field->Trace( insecticide_treat );
1422  a_field->SetLastTreatment( insecticide_treat );
1423  if ( l_farm_insecticide_kills.value()) {
1424  a_field->Insecticide( 0.36 );
1425  }
1426  a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
1428 
1429  if(!cfg_OptimiseBedriftsmodelCrops.value()){
1430  Field * pf = dynamic_cast<Field*>(a_field);
1431  pf->Add_no_fi_app();
1432  }
1433  }
1434 
1435  return true;
1436  }
1437  return false;
1438 }
1439 
1440 
1445 bool Farm::ProductApplication(LE *a_field, double /*a_user*/, int a_days, double a_applicationrate, PlantProtectionProducts a_ppp)
1446 {
1447  // NOTE Differs from normal pesticide in that it will be done on the last
1448  // day if not managed before
1449  if (0 >= a_days) {
1450  a_field->Trace(product_treat);
1451  a_field->SetLastTreatment(product_treat);
1452  if (l_farm_insecticide_kills.value())
1453  {
1454  a_field->Insecticide(cfg_CustomInsecticideKillProp.value());
1455  }
1456  a_field->SetTramlinesDecay(EL_TRAMLINE_DECAYTIME);
1458  g_pest->DailyQueueAdd(a_field, a_applicationrate, a_ppp);
1459  return true;
1460  }
1461  else {
1462  if ((!g_weather->Raining()) && (g_weather->GetWind() < 4.5)) {
1463  a_field->Trace(product_treat);
1464  a_field->SetLastTreatment(product_treat);
1465  if (l_farm_insecticide_kills.value()) {
1466  a_field->Insecticide(cfg_CustomInsecticideKillProp.value());
1467  }
1468  a_field->SetTramlinesDecay(EL_TRAMLINE_DECAYTIME);
1470  g_pest->DailyQueueAdd(a_field, a_applicationrate, a_ppp);
1471  return true;
1472  }
1473  }
1474  return false;
1475 }
1476 
1481 bool Farm::Molluscicide( LE *a_field, double /*a_user*/, int a_days )
1482 {
1483 
1484  if (0 >= a_days) {
1485  if ( (!g_weather->Raining()) && (g_weather->GetWind()<4.5) &&
1486  (! (a_field->GetSignal() & LE_SIG_NO_MOLLUSC ))) {
1487  a_field->Trace( molluscicide );
1488  a_field->SetLastTreatment( molluscicide );
1489  a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
1491  }
1492  return true;
1493  }
1494  else if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
1495  if ( ! (a_field->GetSignal() & LE_SIG_NO_MOLLUSC) ) {
1496  a_field->Trace( molluscicide );
1497  a_field->SetLastTreatment( molluscicide );
1498  a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
1500  }
1501  return true;
1502  }
1503  return false;
1504 }
1505 
1510 bool Farm::RowCultivation( LE *a_field, double /*a_user*/, int a_days )
1511 {
1512 
1513  if ( (0 >= a_days) && (g_weather->GetRainPeriod(g_date->Date(),3)<0.1) )
1514  {
1515  // Too much rain, just give up and claim we did it.
1516  return true;
1517  }
1518 
1519  if ( (0 >= a_days) ||
1520  ((g_weather->GetRainPeriod(g_date->Date(),3)<0.1) && DoIt(DO_IT_PROB))
1521  ) {
1522  a_field->Trace( row_cultivation );
1523  a_field->SetLastTreatment( row_cultivation );
1524  a_field->ReduceWeedBiomass( 0.5 );
1525  a_field->InsectMortality( 0.25 );
1526  a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
1527  int pref=a_field->GetUnsprayedMarginPolyRef();
1528  if (pref!=-1){
1529  // Must have an unsprayed margin so need to pass the information on to it
1530  LE* um=g_landscape_p->SupplyLEPointer(pref);
1531  um->SetLastTreatment( row_cultivation );
1532  um->InsectMortality( 0.25 );
1533  um->ReduceWeedBiomass( 0.5 );
1534  um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
1535  }
1536  return true;
1537  }
1538  return false;
1539 }
1540 
1545 bool Farm::Strigling( LE *a_field, double /*a_user*/, int a_days )
1546 {
1547 
1548  // Force strigling if it has not been done already!!! This happens regardless of weather as of 26/10/2005
1549  if ( (0 >= a_days) )// && (g_weather->GetRainPeriod(g_date->Date(),3)>0.1) )
1550  {
1551  a_field->Trace( strigling );
1552  a_field->SetLastTreatment( strigling );
1553  a_field->ReduceWeedBiomass( 0.05 );
1554  a_field->InsectMortality( 0.7 );
1555  a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
1556  a_field->SetHerbicideDelay( EL_STRIGLING_DELAYTIME );
1557  int pref=a_field->GetUnsprayedMarginPolyRef();
1558  if (pref!=-1){
1559  // Must have an unsprayed margin so need to pass the information on to it
1560  LE* um=g_landscape_p->SupplyLEPointer(pref);
1561  um->SetLastTreatment( strigling );
1562  um->ReduceWeedBiomass( 0.05 );
1563  um->InsectMortality( 0.7 );
1564  um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
1565  um->SetHerbicideDelay( EL_STRIGLING_DELAYTIME );
1566  return true;
1567  }
1568  }
1569  if ( (0 >= a_days) ||
1570  ((g_weather->GetRainPeriod(g_date->Date(),3)<0.1) && DoIt(DO_IT_PROB))
1571  ) {
1572  a_field->Trace( strigling );
1573  a_field->SetLastTreatment( strigling );
1574  a_field->ReduceWeedBiomass( 0.05 );
1575  a_field->InsectMortality( 0.7 );
1576  a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
1577  a_field->SetHerbicideDelay( EL_STRIGLING_DELAYTIME );
1578  int pref=a_field->GetUnsprayedMarginPolyRef();
1579  if (pref!=-1){
1580  // Must have an unsprayed margin so need to pass the information on to it
1581  LE* um=g_landscape_p->SupplyLEPointer(pref);
1582  um->SetLastTreatment( strigling );
1583  um->ReduceWeedBiomass( 0.05 );
1584  um->InsectMortality( 0.7 );
1585  um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
1586  um->SetHerbicideDelay( EL_STRIGLING_DELAYTIME );
1587  }
1588  return true;
1589  }
1590  return false;
1591 }
1592 
1597 bool Farm::StriglingSow( LE *a_field, double /*a_user*/, int a_days )
1598 {
1599 
1600  //2 days good weather afterwards
1601  if ( (0 >= a_days) && (g_weather->GetRainPeriod(g_date->Date(),3)<0.1) )
1602  {
1603  return true;
1604  }
1605 
1606  if ( (0 >= a_days) ||
1607  ((g_weather->GetRainPeriod(g_date->Date(),3)<0.1) && DoIt(DO_IT_PROB))
1608  ) {
1609  a_field->Trace( strigling_sow );
1610  a_field->SetLastTreatment( strigling_sow );
1611  a_field->ReduceWeedBiomass( 0.05 );
1612  a_field->InsectMortality( 0.7 );
1613  a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
1614  a_field->SetHerbicideDelay( EL_STRIGLING_DELAYTIME );
1615  int pref=a_field->GetUnsprayedMarginPolyRef();
1616  if (pref!=-1){
1617  // Must have an unsprayed margin so need to pass the information on to it
1618  LE* um=g_landscape_p->SupplyLEPointer(pref);
1619  um->SetLastTreatment( strigling_sow );
1620  um->ReduceWeedBiomass( 0.05 );
1621  um->InsectMortality( 0.7 );
1622  um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
1623  um->SetHerbicideDelay( EL_STRIGLING_DELAYTIME );
1624  }
1625  return true;
1626  }
1627  return false;
1628 }
1629 
1630 
1635 bool Farm::StriglingHill(LE *a_field, double /*a_user*/, int a_days)
1636 {
1637 
1638  if ((0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
1639  a_field->Trace(strigling_hill);
1640  a_field->SetLastTreatment(strigling_hill);
1641  a_field->InsectMortality(0.75);
1642  a_field->ReduceWeedBiomass(0.25);
1643  a_field->SetTramlinesDecay(EL_TRAMLINE_DECAYTIME);
1644  int pref = a_field->GetUnsprayedMarginPolyRef();
1645  if (pref != -1) {
1646  // Must have an unsprayed margin so need to pass the information on to it
1647  LE* um = g_landscape_p->SupplyLEPointer(pref);
1648  um->SetLastTreatment(strigling_hill);
1649  um->ReduceWeedBiomass(0.25);
1650  um->InsectMortality(0.75);
1651  um->SetTramlinesDecay(EL_TRAMLINE_DECAYTIME);
1652  }
1653  return true;
1654  }
1655  return false;
1656 }
1657 
1658 
1663 bool Farm::HillingUp( LE *a_field, double /*a_user*/, int a_days )
1664 {
1665 
1666  if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
1667  a_field->Trace( hilling_up );
1668  a_field->SetLastTreatment( hilling_up );
1669  a_field->InsectMortality( 0.75 );
1670  a_field->ReduceWeedBiomass( 0.25 );
1671  a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
1672  int pref=a_field->GetUnsprayedMarginPolyRef();
1673  if (pref!=-1){
1674  // Must have an unsprayed margin so need to pass the information on to it
1675  LE* um=g_landscape_p->SupplyLEPointer(pref);
1676  um->SetLastTreatment( hilling_up );
1677  um->ReduceWeedBiomass( 0.25 );
1678  um->InsectMortality( 0.75 );
1679  um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
1680  }
1681  return true;
1682  }
1683  return false;
1684 }
1685 
1690 bool Farm::BedForming(LE *a_field, double /*a_user*/, int a_days)
1691 {
1692 
1693  if ((0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
1694  a_field->Trace(bed_forming);
1695  a_field->SetLastTreatment(bed_forming);
1696  a_field->InsectMortality(0.75);
1697  a_field->ZeroVeg();
1698  a_field->SetTramlinesDecay(EL_TRAMLINE_DECAYTIME);
1699  int pref = a_field->GetUnsprayedMarginPolyRef();
1700  if (pref != -1) {
1701  // Must have an unsprayed margin so need to pass the information on to it
1702  LE* um = g_landscape_p->SupplyLEPointer(pref);
1703  um->SetLastTreatment(bed_forming);
1704  um->ZeroVeg();
1705  um->InsectMortality(0.75);
1706  um->SetTramlinesDecay(EL_TRAMLINE_DECAYTIME);
1707  }
1708  return true;
1709  }
1710  return false;
1711 }
1712 
1717 bool Farm::Water( LE *a_field, double /*a_user*/, int a_days )
1718 {
1719 
1720 
1721  /* Turn on this code to avoid watering on heavy soils
1722  int soiltype = a_field->GetSoilType();
1723  if ( soiltype < 1 || soiltype > 4 )
1724  return true;
1725 */
1726  if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
1727  a_field->Trace( water );
1728  a_field->SetLastTreatment( water );
1729  int pref=a_field->GetUnsprayedMarginPolyRef();
1730  if (pref!=-1){
1731  // Must have an unsprayed margin so need to pass the information on to it
1732  LE* um=g_landscape_p->SupplyLEPointer(pref);
1733  um->SetLastTreatment( water );
1734  }
1735  return true;
1736  }
1737  return false;
1738 }
1739 
1744 bool Farm::Swathing( LE *a_field, double /*a_user*/, int a_days )
1745 {
1746 
1747  if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
1748  a_field->Trace( swathing );
1749  a_field->SetLastTreatment( swathing );
1750  a_field->InsectMortality( 0.5 );
1751  a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
1752  int pref=a_field->GetUnsprayedMarginPolyRef();
1753  if (pref!=-1){
1754  // Must have an unsprayed margin so need to pass the information on to it
1755  LE* um=g_landscape_p->SupplyLEPointer(pref);
1756  um->SetLastTreatment( swathing );
1757  um->InsectMortality( 0.5 );
1758  um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
1759  }
1760  return true;
1761  }
1762  return false;
1763 }
1764 
1769 bool Farm::Harvest(LE *a_field, double /*a_user*/, int a_days)
1770 {
1771  //5 days good weather before
1772  if ((0 >= a_days) || ((g_weather->GetRainPeriod(g_date->Date(), 5) < 0.1) && DoIt(DO_IT_PROB))) {
1773  a_field->Trace(harvest);
1774  a_field->SetLastTreatment(harvest);
1775  a_field->SetGrowthPhase(harvest1);
1776  // Here we have to do a little skip to avoid too low insect populations after harvest, but a correct veg biomass
1777  a_field->InsectMortality(0.4);
1778  double insects = a_field->GetInsectPop();
1779  a_field->ResetDigestability();
1780  a_field->RecalculateBugsNStuff();
1781  a_field->SetInsectPop(insects);
1782  a_field->SetTramlinesDecay(EL_TRAMLINE_DECAYTIME);
1783  int pref = a_field->GetUnsprayedMarginPolyRef();
1784  // Are we a cereal crop? If so we need to have some spilled grain
1785  double someseed = 0.0;
1786  double somemaize = 0.0;
1787  if (dynamic_cast<VegElement*>(a_field)->IsMatureCereal()) {
1788  someseed = m_OurManager->GetSpilledGrain();
1789  a_field->SetStubble(true);
1790  }
1791  else if (dynamic_cast<VegElement*>(a_field)->IsMaize()) {
1792  // Maize in stubble
1793  a_field->SetStubble(true);
1794  somemaize = m_OurManager->GetSpilledMaize();
1795  }
1796  a_field->SetBirdSeed( someseed );
1797  a_field->SetBirdMaize( somemaize );
1798  if (pref != -1){
1799  // Must have an unsprayed margin so need to pass the information on to it
1800  LE* um = g_landscape_p->SupplyLEPointer(pref);
1801  um->SetLastTreatment(harvest);
1802  um->SetGrowthPhase(harvest1);
1803  um->InsectMortality(0.4);
1804  um->SetTramlinesDecay(EL_TRAMLINE_DECAYTIME);
1805  um->ResetDigestability();
1806  um->RecalculateBugsNStuff();
1807  um->SetBirdSeed( someseed );
1808  um->SetBirdMaize( somemaize );
1809  if ((somemaize > 0) || (someseed > 0)) um->SetStubble(true);
1810  }
1811  return true;
1812  }
1813  return false;
1814 }
1815 
1816 
1821 bool Farm::HarvestLong(LE *a_field, double /*a_user*/, int a_days)
1822 {
1823 
1824  //5 days good weather before
1825  if ((0 >= a_days) ||
1826  ((g_weather->GetRainPeriod(g_date->Date(), 5)<0.1) && DoIt(DO_IT_PROB_LONG))
1827  ) {
1828  a_field->Trace(harvest);
1829  a_field->SetLastTreatment(harvest);
1830  a_field->SetGrowthPhase(harvest1);
1831  // Here we have to do a little skip to avoid too low insect populations after harvest, but a correct veg biomass
1832  a_field->InsectMortality(0.4);
1833  double insects = a_field->GetInsectPop();
1834  a_field->ResetDigestability();
1835  a_field->RecalculateBugsNStuff();
1836  a_field->SetInsectPop(insects);
1837  a_field->SetTramlinesDecay(EL_TRAMLINE_DECAYTIME);
1838  int pref = a_field->GetUnsprayedMarginPolyRef();
1839  double someseed = 0.0; //No bird seed or maize forage on sugar beet (which is currently (March 2015) the only crop using HarvestLong.
1840  a_field->SetBirdSeed( someseed );
1841  a_field->SetBirdMaize( someseed );
1842  if (pref != -1){
1843  // Must have an unsprayed margin so need to pass the information on to it
1844  LE* um = g_landscape_p->SupplyLEPointer(pref);
1845  um->SetLastTreatment(harvest);
1846  um->SetGrowthPhase(harvest1);
1847  um->InsectMortality(0.4);
1848  um->SetTramlinesDecay(EL_TRAMLINE_DECAYTIME);
1849  um->ResetDigestability();
1850  um->RecalculateBugsNStuff();
1851  um->SetBirdSeed( someseed );
1852  um->SetBirdMaize( someseed );
1853  }
1854  return true;
1855  }
1856  return false;
1857 }
1858 
1859 bool OptimisingFarm::Harvest(LE *a_field, double /*a_user*/, int a_days)
1860 {
1861 
1862  //5 days good weather before
1863  if ( (0 >= a_days) ||
1864  ((g_weather->GetRainPeriod(g_date->Date(),5)<0.1) && DoIt(DO_IT_PROB)))
1865  {
1866 
1867  //05.03.13 need to get the info on biomass
1868  if(!cfg_OptimiseBedriftsmodelCrops.value()){
1869  Field * pf = dynamic_cast<Field*>(a_field); //ok????? - maybe should be VegElement instead of field!
1870  if(pf->GetVegType()!=tov_Potatoes && pf->GetVegType()!=tov_PotatoesIndustry){ //do not save biomass for potatoes!
1871  double biomass_at_harvest = a_field->GetVegBiomass();
1872  pf->Set_biomass_at_harvest(biomass_at_harvest, 0); //sets the biomass of a current crop; the current crop is at the index 0
1873  pf->Set_harvested(); //mark this crop as harvested
1874  }
1875  }
1876  //05.03.13 end
1877 
1878  a_field->Trace( harvest );
1879  a_field->SetLastTreatment( harvest );
1880  a_field->SetGrowthPhase( harvest1 );
1881  // Here we have to do a little skip to avoid too low insect populations after harvest, but a correct veg biomass
1882  a_field->InsectMortality( 0.4 );
1883  double insects=a_field->GetInsectPop();
1884  a_field->RecalculateBugsNStuff();
1885  a_field->SetInsectPop(insects);
1886  a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
1887  a_field->ResetDigestability();
1888  int pref=a_field->GetUnsprayedMarginPolyRef();
1889  if (pref!=-1){
1890  // Must have an unsprayed margin so need to pass the information on to it
1891  LE* um=g_landscape_p->SupplyLEPointer(pref);
1892  um->SetLastTreatment(harvest);
1893  um->SetGrowthPhase( harvest1 );
1894  um->InsectMortality( 0.4 );
1895  um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
1896  um->ResetDigestability();
1897  um->RecalculateBugsNStuff();
1898  }
1899  return true;
1900  }
1901  return false;
1902 }
1903 
1904 
1905 
1910 bool Farm::CattleOut( LE *a_field, double /*a_user*/, int a_days )
1911 {
1915  if ((0 >= a_days) || DoIt( DO_IT_PROB ))
1916  {
1917  a_field->ToggleCattleGrazing();
1918  a_field->Trace( cattle_out );
1919  a_field->SetLastTreatment( cattle_out );
1920  // Reduce the vegetation because of grazing
1921  //double h=a_field->GetVegHeight();
1922  //double reduc = 1-(l_farm_cattle_veg_reduce.value()*((h-15)/15));
1923  //a_field->ReduceVeg_Extended( reduc );
1924  a_field->GrazeVegetation( l_farm_cattle_veg_reduce.value(), false );
1925  int pref = a_field->GetUnsprayedMarginPolyRef();
1926  if (pref != -1)
1927  {
1928  // Must have an unsprayed margin so need to pass the information on to it
1929  // This happens if all arable fields are given unsprayed margins - they have no effect on grass unless it is sprayed with pesticides
1930  LE* um = g_landscape_p->SupplyLEPointer( pref );
1931  um->ToggleCattleGrazing();
1932  um->SetLastTreatment( cattle_out );
1933  um->GrazeVegetation( l_farm_cattle_veg_reduce.value( ), false );
1934  }
1935  return true;
1936  }
1937  return false;
1938 }
1939 
1944 bool Farm::CattleOutLowGrazing( LE *a_field, double /*a_user*/, int a_days )
1945 {
1946 
1947  if ( (0 >= a_days)|| DoIt(DO_IT_PROB)) {
1948  a_field->ToggleCattleGrazing();
1949  a_field->Trace( cattle_out_low );
1950  a_field->SetLastTreatment( cattle_out_low );
1951  // Reduce the vegetation because of grazing
1952  //double h=a_field->GetVegHeight();
1953  //double reduc = 1-(l_farm_cattle_veg_reduce.value()*((h-15)/15));
1954  //a_field->ReduceVeg_Extended( reduc );
1955  a_field->GrazeVegetation( l_farm_cattle_veg_reduce2.value( ), false );
1956  int pref=a_field->GetUnsprayedMarginPolyRef();
1957  if (pref!=-1){
1958  // Must have an unsprayed margin so need to pass the information on to it
1959  // This happens if all arable fields are given unsprayed margins - they have no effect on grass unless it is sprayed with pesticides
1960  LE* um=g_landscape_p->SupplyLEPointer(pref);
1961  um->ToggleCattleGrazing();
1962  um->SetLastTreatment( cattle_out_low );
1963  um->GrazeVegetation( l_farm_cattle_veg_reduce2.value( ), false );
1964  }
1965  return true;
1966  }
1967  return false;
1968 }
1969 
1974 bool Farm::CattleIsOut(LE *a_field, double /*a_user*/, int a_days, int a_max)
1975 {
1979  double biomass = a_field->GetVegBiomass();
1980  if (biomass > 100.0)
1981  {
1982  a_field->SetLastTreatment(cattle_out);
1983  a_field->Trace(cattle_out);
1984  // Reduce the vegetation because of grazing
1985  //double h=a_field->GetVegHeight();
1986  //double reduc = 1-(l_farm_cattle_veg_reduce.value()*((h-15)/15));
1987  //a_field->ReduceVeg_Extended( reduc );
1988  a_field->GrazeVegetation( l_farm_cattle_veg_reduce.value( ), false );
1989  int pref = a_field->GetUnsprayedMarginPolyRef();
1990  if (pref != -1)
1991  {
1992  // Must have an unsprayed margin so need to pass the information on to it
1993  LE* um = g_landscape_p->SupplyLEPointer(pref);
1994  um->SetLastTreatment(cattle_out);
1995  um->GrazeVegetation( l_farm_cattle_veg_reduce.value( ), false );
1996  }
1997  }
1998  int d1 = g_date->DayInYear(10, 9);
1999  if (d1 > a_max) d1 = a_max;
2000  if ((((g_date->DayInYear() > d1) && (10 >= a_days)) && DoIt(10)) || (0 >= a_days))
2001  {
2002  a_field->ToggleCattleGrazing();
2003  int pref = a_field->GetUnsprayedMarginPolyRef();
2004  if (pref != -1){
2005  // Must have an unsprayed margin so need to pass the information on to it
2006  LE* um = g_landscape_p->SupplyLEPointer(pref);
2007  um->ToggleCattleGrazing();
2008  }
2009  return true;
2010  }
2011  return false;
2012 }
2013 
2018 bool Farm::CattleIsOutLow(LE *a_field, double /*a_user*/, int a_days, int a_max)
2019 {
2020 
2021  // Generate a 'cattle_in_out' event for every day the cattle is on the
2022  // field.
2023  double biomass = a_field->GetVegBiomass();
2024  if (biomass > 100.0)
2025  {
2026  a_field->SetLastTreatment(cattle_out_low);
2027  a_field->Trace(cattle_out_low);
2028  // Reduce the vegetation because of grazing
2029  //double h=a_field->GetVegHeight();
2030  //double reduc = 1-(l_farm_cattle_veg_reduce2.value()*((h-15)/15));
2031  //a_field->ReduceVeg_Extended( reduc );
2032  a_field->GrazeVegetation( l_farm_cattle_veg_reduce2.value( ), false );
2033  int pref = a_field->GetUnsprayedMarginPolyRef();
2034  if (pref != -1)
2035  {
2036  // Must have an unsprayed margin so need to pass the information on to it
2037  LE* um = g_landscape_p->SupplyLEPointer(pref);
2038  um->SetLastTreatment(cattle_out_low);
2039  um->GrazeVegetation( l_farm_cattle_veg_reduce2.value( ), false );
2040  }
2041  }
2042  int d1 = g_date->DayInYear(10, 9);
2043  if (d1 > a_max) d1 = a_max;
2044  if ((((g_date->DayInYear() > d1) && (10 >= a_days)) && DoIt(10)) || (0 >= a_days))
2045  {
2046  a_field->ToggleCattleGrazing();
2047  int pref = a_field->GetUnsprayedMarginPolyRef();
2048  if (pref != -1){
2049  // Must have an unsprayed margin so need to pass the information on to it
2050  LE* um = g_landscape_p->SupplyLEPointer(pref);
2051  um->ToggleCattleGrazing();
2052  }
2053  return true;
2054  }
2055  return false;
2056 }
2057 
2062 bool Farm::PigsOut( LE *a_field, double /*a_user*/, int a_days )
2063 {
2064 
2065  if ( (0 >= a_days)|| DoIt(DO_IT_PROB))
2066  {
2067  a_field->TogglePigGrazing();
2068  a_field->Trace( pigs_out );
2069  a_field->SetLastTreatment( pigs_out );
2070  // Reduce the vegetation because of grazing
2071  a_field->ReduceVeg_Extended( l_farm_pig_veg_reduce.value());
2072  // make this a function of grazing pressure
2073  //and field size - perhaps in a later life
2074  int pref=a_field->GetUnsprayedMarginPolyRef();
2075  if (pref!=-1){
2076  // Must have an unsprayed margin so need to pass the information on to it
2077  LE* um=g_landscape_p->SupplyLEPointer(pref);
2078  um->SetLastTreatment( pigs_out );
2079  um->ReduceVeg_Extended( l_farm_pig_veg_reduce.value() );
2080  }
2081  return true;
2082  }
2083  return false;
2084 }
2085 
2090 bool Farm::PigsAreOutForced( LE *a_field, double /*a_user*/, int /*a_days*/)
2091 {
2092  a_field->SetLastTreatment( pigs_out );
2093  a_field->Trace( pigs_out );
2094  // Reduce the vegetation because of grazing
2095  a_field->ReduceVeg_Extended( l_farm_pig_veg_reduce.value() );
2096  // make this a function of grazing pressure
2097  //and field size - perhaps in a later life
2098  int pref=a_field->GetUnsprayedMarginPolyRef();
2099  if (pref!=-1){
2100  // Must have an unsprayed margin so need to pass the information on to it
2101  LE* um=g_landscape_p->SupplyLEPointer(pref);
2102  um->SetLastTreatment( pigs_out );
2103  um->ReduceVeg_Extended( l_farm_pig_veg_reduce.value() );
2104  }
2105  return false;
2106 }
2107 
2112 bool Farm::PigsAreOut( LE *a_field, double /*a_user*/, int a_days )
2113 {
2114 
2115  if ( (0 >= a_days)|| DoIt(50/a_days)) {
2116  a_field->TogglePigGrazing();
2117  int pref=a_field->GetUnsprayedMarginPolyRef();
2118  if (pref!=-1){
2119  // Must have an unsprayed margin so need to pass the information on to it
2120  LE* um=g_landscape_p->SupplyLEPointer(pref);
2121  um->TogglePigGrazing();
2122  }
2123  return true;
2124  }
2125  return false;
2126 }
2127 
2132 bool Farm::StrawChopping( LE *a_field, double /*a_user*/, int a_days )
2133 {
2134 
2135  if ( (0 >= a_days) ||
2136  ((g_weather->GetRainPeriod(g_date->Date(),5)<0.1) && DoIt(DO_IT_PROB))
2137  ) {
2138  a_field->Trace( straw_chopping );
2139  a_field->SetLastTreatment( straw_chopping );
2140  a_field->InsectMortality( 0.4 );
2141  a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
2142  int pref=a_field->GetUnsprayedMarginPolyRef();
2143  if (pref!=-1){
2144  // Must have an unsprayed margin so need to pass the information on to it
2145  LE* um=g_landscape_p->SupplyLEPointer(pref);
2146  um->SetLastTreatment( straw_chopping );
2147  um->InsectMortality( 0.4 );
2148  um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
2149  }
2150  return true;
2151  }
2152  return false;
2153 }
2154 
2159 bool Farm::HayTurning( LE *a_field, double /*a_user*/, int a_days )
2160 {
2161 
2162  if ( (0 >= a_days) ||
2163  ((g_weather->GetRainPeriod(g_date->Date(),5)<0.1) && DoIt(DO_IT_PROB))
2164  ) {
2165  a_field->Trace( hay_turning );
2166  a_field->SetLastTreatment( hay_turning );
2167  a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
2168  int pref=a_field->GetUnsprayedMarginPolyRef();
2169  if (pref!=-1){
2170  // Must have an unsprayed margin so need to pass the information on to it
2171  LE* um=g_landscape_p->SupplyLEPointer(pref);
2172  um->SetLastTreatment( hay_turning );
2173  um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
2174  }
2175  return true;
2176  }
2177  return false;
2178 }
2179 
2184 bool Farm::HayBailing( LE *a_field, double /*a_user*/, int a_days )
2185 {
2186 
2187  if ( (0 >= a_days) ||
2188  ((g_weather->GetRainPeriod(g_date->Date(),5)<0.1) && DoIt(DO_IT_PROB))
2189  ) {
2190  a_field->Trace( hay_bailing );
2191  a_field->SetLastTreatment( hay_bailing );
2192  a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
2193  int pref=a_field->GetUnsprayedMarginPolyRef();
2194  if (pref!=-1){
2195  // Must have an unsprayed margin so need to pass the information on to it
2196  LE* um=g_landscape_p->SupplyLEPointer(pref);
2197  um->SetLastTreatment( hay_bailing );
2198  um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
2199  }
2200  return true;
2201  }
2202  return false;
2203 }
2204 
2209 bool Farm::StubbleHarrowing( LE *a_field, double /*a_user*/, int a_days )
2210 {
2211 
2212  if ( (0 >= a_days) ||
2213  ((g_weather->GetRainPeriod(g_date->Date(),3)<0.1) && DoIt(DO_IT_PROB))
2214  ) {
2215  a_field->Trace( stubble_harrowing );
2216  a_field->SetLastTreatment( stubble_harrowing );
2217  a_field->InsectMortality( 0.25 );
2218  a_field->ZeroVeg();
2219  int pref=a_field->GetUnsprayedMarginPolyRef();
2220  if (pref!=-1){
2221  // Must have an unsprayed margin so need to pass the information on to it
2222  LE* um=g_landscape_p->SupplyLEPointer(pref);
2223  um->SetLastTreatment( stubble_harrowing );
2224  um->ZeroVeg();
2225  um->InsectMortality( 0.25 );
2226  }
2227  return true;
2228  }
2229  return false;
2230 }
2231 
2236 bool Farm::BurnStrawStubble( LE *a_field, double /*a_user*/, int a_days )
2237 {
2238 
2239  if ( (0 >= a_days) && (g_weather->GetRainPeriod(g_date->Date(),3)>0.1))
2240  {
2241  return true;
2242  }
2243  if ( (0 >= a_days) || ((g_weather->GetRainPeriod(g_date->Date(),3)<0.1)
2244  && DoIt(DO_IT_PROB)))
2245  {
2246  a_field->Trace( burn_straw_stubble );
2247  a_field->SetLastTreatment( burn_straw_stubble );
2248  a_field->InsectMortality( 0.4 );
2249  a_field->ReduceVeg( 0.2 );
2250  a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
2251  int pref=a_field->GetUnsprayedMarginPolyRef();
2252  if (pref!=-1){
2253  // Must have an unsprayed margin so need to pass the information on to it
2254  LE* um=g_landscape_p->SupplyLEPointer(pref);
2255  um->SetLastTreatment( burn_straw_stubble );
2256  um->ReduceVeg( 0.2 );
2257  um->InsectMortality( 0.4 );
2258  um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
2259  }
2260  return true;
2261  }
2262  return false;
2263 }
2264 
2269 bool Farm::CutToHay( LE *a_field, double /*a_user*/, int a_days )
2270 {
2271 
2272  if ( (0 >= a_days) || ((g_weather->GetRainPeriod(g_date->Date(),5)<0.1)
2273  && DoIt(DO_IT_PROB)))
2274  {
2275  a_field->Trace( cut_to_hay );
2276  a_field->SetLastTreatment( cut_to_hay );
2277  a_field->SetGrowthPhase(harvest1);
2278  a_field->InsectMortality(0.4);
2279  a_field->ReduceVeg_Extended( 0.2 );
2280  a_field->SetVegHeight(10);
2281  //a_field->ResetDigestability();
2282  a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
2283  int pref=a_field->GetUnsprayedMarginPolyRef();
2284  if (pref!=-1){
2285  // Must have an unsprayed margin so need to pass the information on to it
2286  LE* um=g_landscape_p->SupplyLEPointer(pref);
2287  um->SetLastTreatment( cut_to_hay );
2288  um->SetGrowthPhase(harvest1);
2289  um->InsectMortality(0.4);
2290  um->ReduceVeg_Extended( 0.2 );
2291  um->SetVegHeight( 10);
2292  um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
2293  }
2294  return true;
2295  }
2296  return false;
2297 }
2298 
2303 bool Farm::CutWeeds( LE *a_field, double /*a_user*/, int a_days )
2304 {
2305 
2306  if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB)))
2307  {
2308  a_field->Trace( cut_weeds );
2309  a_field->SetLastTreatment( cut_weeds );
2310  a_field->ReduceVeg( 0.8 );
2311  a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
2312  int pref=a_field->GetUnsprayedMarginPolyRef();
2313  if (pref!=-1){
2314  // Must have an unsprayed margin so need to pass the information on to it
2315  LE* um=g_landscape_p->SupplyLEPointer(pref);
2316  um->SetLastTreatment( cut_weeds );
2317  um->ReduceVeg( 0.8 );
2318  um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
2319  }
2320  return true;
2321  }
2322  return false;
2323 }
2324 
2329 bool Farm::CutToSilage( LE *a_field, double /*a_user*/, int a_days )
2330 {
2331 
2332  if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
2333  a_field->Trace( cut_to_silage );
2334  a_field->SetLastTreatment( cut_to_silage );
2335  a_field->ReduceVeg_Extended( 0.2 );
2336  a_field->InsectMortality( 0.4 );
2337  a_field->SetVegHeight( 10 );
2338  a_field->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
2339  a_field->SetGrowthPhase(harvest1);
2340  //a_field->ResetDigestability();
2341  int pref=a_field->GetUnsprayedMarginPolyRef();
2342  if (pref!=-1){
2343  // Must have an unsprayed margin so need to pass the information on to it
2344  LE* um=g_landscape_p->SupplyLEPointer(pref);
2345  um->SetLastTreatment( cut_to_silage );
2346  um->ReduceVeg_Extended( 0.2 );
2347  um->InsectMortality( 0.4 );
2348  um->SetVegHeight( 10 );
2349  um->SetTramlinesDecay( EL_TRAMLINE_DECAYTIME );
2350  um->ResetDigestability();
2351  um->SetGrowthPhase(harvest1);
2352  }
2353  return true;
2354  }
2355  return false;
2356 }
2357 
2362 bool Farm::CutOrch( LE *a_field, double /* a_user */, int a_days )
2363 {
2364 
2365  if ( (0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
2366  a_field->Trace( mow ); //? tried to do=mow...
2367  a_field->SetLastTreatment( mow );
2368  a_field->SetMownDecay( 12 ); // 12 days of not suitable
2369  //ReduceVeg_Extended( 0.2 );
2370  //a_field->InsectMortality( 0.4 );
2371  a_field->SetGrowthPhase( harvest1 );
2372  //m_DateCut = a_today; ?? what to substitute it with?
2373 
2374  a_field->SetVegParameters( l_el_o_cut_height.value(), l_el_o_cut_total.value(), l_el_o_cut_green.value(), 0 ); //is 0 ok for weed biomass
2375 
2376  int pref=a_field->GetUnsprayedMarginPolyRef();
2377  if (pref!=-1){
2378  // Must have an unsprayed margin so need to pass the information on to it
2379  LE* um=g_landscape_p->SupplyLEPointer(pref);
2380  um->SetLastTreatment( mow );
2381  um->ReduceVeg_Extended( 0.2 ); //are these values ok?
2382  um->InsectMortality( 0.4 );
2383  um->SetVegParameters( l_el_o_cut_height.value(), l_el_o_cut_total.value(), l_el_o_cut_green.value(), 0 );
2384  }
2385  return true;
2386  }
2387  return false;
2388 }
2389 
2390 
2395 // Pesticide Trial Farm Function Code
2396 bool Farm::ProductApplication_DateLimited(LE *a_field, double /*a_user*/, int /*a_days*/, double a_applicationrate, PlantProtectionProducts a_ppp)
2397 {
2399  int year = g_landscape_p->SupplyYearNumber();
2400  if (year < cfg_productapplicstartyear.value()) return false;
2401  if (year > cfg_productapplicendyear.value()) return false;
2402  a_field->Trace(trial_insecticidetreat); // Debug function only
2403  a_field->SetLastTreatment(trial_insecticidetreat);
2404  a_field->InsectMortality(cfg_CustomInsecticideKillProp.value()); // Change this manually if it is really a herbicide
2405  a_field->SetTramlinesDecay(EL_TRAMLINE_DECAYTIME);
2406  a_field->SetSprayedToday(true);
2407  g_pest->DailyQueueAdd(a_field, a_applicationrate, a_ppp);
2408  return true;
2409 }
2410 
2415 bool Farm::Biocide(LE * a_field, double /*a_user*/, int a_days)
2416 {
2417  if ((0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
2418  a_field->Trace(biocide);
2419  a_field->SetLastTreatment(biocide);
2420  a_field->SetTramlinesDecay(EL_TRAMLINE_DECAYTIME);
2421  int pref = a_field->GetUnsprayedMarginPolyRef();
2422  if (pref != -1) {
2423  // Must have an unsprayed margin so need to pass the information on to it
2424  LE* um = g_landscape_p->SupplyLEPointer(pref);
2425  um->SetLastTreatment(biocide);
2426  um->SetTramlinesDecay(EL_TRAMLINE_DECAYTIME);
2427  }
2428  return true;
2429  }
2430  return false;
2431 }
2432 
2437 bool Farm::FlowerCutting(LE * a_field, double /*a_user*/, int a_days)
2438 {
2439  if ((0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
2440  a_field->Trace(flower_cutting);
2441  a_field->ReduceVeg_Extended(0.8);
2442  a_field->InsectMortality(0.9);
2443  a_field->SetVegHeight(35);
2444  a_field->SetLastTreatment(flower_cutting);
2445  a_field->SetTramlinesDecay(EL_TRAMLINE_DECAYTIME);
2446  int pref = a_field->GetUnsprayedMarginPolyRef();
2447  if (pref != -1) {
2448  // Must have an unsprayed margin so need to pass the information on to it
2449  LE* um = g_landscape_p->SupplyLEPointer(pref);
2450  um->ReduceVeg_Extended(0.8);
2451  um->InsectMortality(0.9);
2452  um->SetVegHeight(30);
2453  um->SetLastTreatment(flower_cutting);
2454  um->SetTramlinesDecay(EL_TRAMLINE_DECAYTIME);
2455  }
2456  return true;
2457  }
2458  return false;
2459 }
2460 
2465 bool Farm::BulbHarvest(LE *a_field, double /*a_user*/, int a_days)
2466 {
2467  //5 days good weather before
2468  if ((0 >= a_days) || ((g_weather->GetRainPeriod(g_date->Date(), 5) < 0.1) && DoIt(DO_IT_PROB))) {
2469  a_field->Trace(bulb_harvest);
2470  a_field->SetLastTreatment(bulb_harvest);
2471  a_field->SetGrowthPhase(harvest1);
2472  // Here we have to do a little skip to avoid too low insect populations after harvest, but a correct veg biomass
2473  a_field->InsectMortality(0.3);
2474  // remove all vegetation
2475  a_field->ZeroVeg();
2476  double insects = a_field->GetInsectPop();
2477  a_field->ResetDigestability();
2478  a_field->RecalculateBugsNStuff();
2479  a_field->SetInsectPop(insects);
2480  a_field->SetTramlinesDecay(EL_TRAMLINE_DECAYTIME);
2481  int pref = a_field->GetUnsprayedMarginPolyRef();
2482  if (pref != -1) {
2483  // Must have an unsprayed margin so need to pass the information on to it
2484  LE* um = g_landscape_p->SupplyLEPointer(pref);
2485  um->SetLastTreatment(bulb_harvest);
2486  um->SetGrowthPhase(harvest1);
2487  um->InsectMortality(0.3);
2488  um->ZeroVeg();
2489  um->SetTramlinesDecay(EL_TRAMLINE_DECAYTIME);
2490  um->ResetDigestability();
2491  um->RecalculateBugsNStuff();
2492  }
2493  return true;
2494  }
2495  return false;
2496 }
2497 
2502 bool Farm::StrawCovering(LE * a_field, double /*a_user*/, int a_days)
2503 {
2504  if ((0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
2505  a_field->Trace(straw_covering);
2506  a_field->SetLastTreatment(straw_covering);
2507  a_field->SetTramlinesDecay(EL_TRAMLINE_DECAYTIME);
2508  int pref = a_field->GetUnsprayedMarginPolyRef();
2509  if (pref != -1) {
2510  // Must have an unsprayed margin so need to pass the information on to it
2511  LE* um = g_landscape_p->SupplyLEPointer(pref);
2512  um->SetLastTreatment(straw_covering);
2513  um->SetTramlinesDecay(EL_TRAMLINE_DECAYTIME);
2514  }
2515  return true;
2516  }
2517  return false;
2518 }
2519 
2524 bool Farm::StrawRemoval(LE * a_field, double /*a_user*/, int a_days)
2525 {
2526  if ((0 >= a_days) || (!g_weather->Raining() && DoIt(DO_IT_PROB))) {
2527  a_field->Trace(straw_removal);
2528  a_field->SetLastTreatment(straw_removal);
2529  a_field->SetTramlinesDecay(EL_TRAMLINE_DECAYTIME);
2530  int pref = a_field->GetUnsprayedMarginPolyRef();
2531  if (pref != -1) {
2532  // Must have an unsprayed margin so need to pass the information on to it
2533  LE* um = g_landscape_p->SupplyLEPointer(pref);
2534  um->SetLastTreatment(straw_removal);
2535  um->SetTramlinesDecay(EL_TRAMLINE_DECAYTIME);
2536  }
2537  return true;
2538  }
2539  return false;
2540 }
insecticide_treat
Definition: treatment.h:74
Farm::FP_Sludge
virtual bool FP_Sludge(LE *a_field, double a_user, int a_days)
Spread sewege on a_field owned by an arable farmer.
Definition: farmfuncs.cpp:822
Farm::PigsAreOut
virtual bool PigsAreOut(LE *a_field, double a_user, int a_days)
Start a pig grazing event on a_field today or soon.
Definition: farmfuncs.cpp:2112
cfg_SB_InsecticideMonth
CfgInt cfg_SB_InsecticideMonth("PEST_SBINSECTONEMONTH", CFG_CUSTOM, 5)
Provided to allow configuration control of the first insecticide spray in spring barley crops - this ...
Farm::SpringRoll
virtual bool SpringRoll(LE *a_field, double a_user, int a_days)
Carry out a roll event in the spring on a_field.
Definition: farmfuncs.cpp:525
Landscape::SupplyLEPointer
LE * SupplyLEPointer(int a_polyref)
Definition: Landscape.h:1099
Farm::FA_Slurry
virtual bool FA_Slurry(LE *a_field, double a_user, int a_days)
Spready slurry on a_field owned by an stock farmer.
Definition: farmfuncs.cpp:965
strigling
Definition: treatment.h:77
OptimisingFarm::HerbicideTreat
virtual bool HerbicideTreat(LE *a_field, double, int a_days)
Carries out herbicide application. Saves information on each application for a given crop.
Definition: farmfuncs.cpp:1196
Farm::PreseedingCultivator
virtual bool PreseedingCultivator(LE *a_field, double a_user, int a_days)
Carry out preseeding cultivation on a_field (tilling set including cultivator and string roller to co...
Definition: farmfuncs.cpp:311
hay_bailing
Definition: treatment.h:89
Farm::SpringPlough
virtual bool SpringPlough(LE *a_field, double a_user, int a_days)
Carry out a ploughing event in the spring on a_field.
Definition: farmfuncs.cpp:444
PlantProtectionProducts
PlantProtectionProducts
A list PPP names for tracking by the Pesticide class.
Definition: farm.h:420
flower_cutting
Definition: treatment.h:109
Farm::HerbicideTreat
virtual bool HerbicideTreat(LE *a_field, double a_user, int a_days)
Apply herbicide to a_field.
Definition: farmfuncs.cpp:1156
autumn_roll
Definition: treatment.h:38
spring_sow_with_ferti
Definition: treatment.h:103
Farm::Strigling
virtual bool Strigling(LE *a_field, double a_user, int a_days)
Carry out a mechanical weeding on a_field.
Definition: farmfuncs.cpp:1545
l_farm_event_do_it_prob_long
static CfgInt l_farm_event_do_it_prob_long("FARM_EVENT_DO_IT_PROB_LONG", CFG_PRIVATE, 5)
cfg_WW_conv_tillage_prop2
CfgFloat cfg_WW_conv_tillage_prop2("TILLAGE_WWCONVTWOPROP", CFG_CUSTOM, 1.0)
Provided to allow configuration control of the proportion of farmers doing second conventional tillag...
Farm::Harvest
virtual bool Harvest(LE *a_field, double a_user, int a_days)
Carry out a harvest on a_field.
Definition: farmfuncs.cpp:1769
Farm::PreseedingCultivatorSow
virtual bool PreseedingCultivatorSow(LE *a_field, double a_user, int a_days)
Carry out preseeding cultivation together with sow on a_field (tilling and sowing set including culti...
Definition: farmfuncs.cpp:337
Farm::FP_ManganeseSulphate
virtual bool FP_ManganeseSulphate(LE *a_field, double a_user, int a_days)
Apply Manganse Sulphate to a_field owned by an arable farmer.
Definition: farmfuncs.cpp:727
Farm::StubbleCultivatorHeavy
virtual bool StubbleCultivatorHeavy(LE *a_field, double a_user, int a_days)
Carry out a stubble cultivation event on a_field. This is non-inversion type of cultivation which can...
Definition: farmfuncs.cpp:193
Farm::PigsAreOutForced
virtual bool PigsAreOutForced(LE *a_field, double a_user, int a_days)
Start a pig grazing event on a_field today - no exceptions.
Definition: farmfuncs.cpp:2090
Farm::ProductApplication
virtual bool ProductApplication(LE *a_field, double a_user, int a_days, double a_applicationrate, PlantProtectionProducts a_ppp)
Apply test pesticide to a_field.
Definition: farmfuncs.cpp:1445
cfg_POT_InsecticideMonth
CfgInt cfg_POT_InsecticideMonth("PEST_POTINSECTONEMONTH", CFG_CUSTOM, 5)
Provided to allow configuration control of the first insecticide spray in potatoes crops - this chang...
Farm::CattleIsOut
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.
Definition: farmfuncs.cpp:1974
Farm::FP_NPK
virtual bool FP_NPK(LE *a_field, double a_user, int a_days)
Apply NPK fertilizer, on a_field owned by an arable farmer.
Definition: farmfuncs.cpp:629
Farm::CutToSilage
virtual bool CutToSilage(LE *a_field, double a_user, int a_days)
Cut vegetation for silage on a_field.
Definition: farmfuncs.cpp:2329
OptimisingFarm::Harvest
bool Harvest(LE *a_field, double a_user, int a_days)
OptimisingFarm's virtual version of Farm::Harvest(). Saves information on biomass of a crop at harves...
Definition: farmfuncs.cpp:1859
fa_ammoniumsulphate
Definition: treatment.h:65
autumn_harrow
Definition: treatment.h:37
preseeding_cultivator
Definition: treatment.h:39
l_farm_event_do_it_prob
static CfgInt l_farm_event_do_it_prob("FARM_EVENT_DO_IT_PROB", CFG_PRIVATE, 50)
OptimisingFarm::FungicideTreat
virtual bool FungicideTreat(LE *a_field, double, int a_days)
Carries out fungicide application. Saves information on each application for a given crop.
Definition: farmfuncs.cpp:1307
Farm::Molluscicide
virtual bool Molluscicide(LE *a_field, double a_user, int a_days)
Apply molluscidie to a_field.
Definition: farmfuncs.cpp:1481
Farm::StrawRemoval
virtual bool StrawRemoval(LE *a_field, double a_user, int a_days)
Straw covering applied on a_field.
Definition: farmfuncs.cpp:2524
Farm::StubblePlough
virtual bool StubblePlough(LE *a_field, double a_user, int a_days)
Carry out a stubble ploughing event on a_field. This is similar to normal plough but shallow (normall...
Definition: farmfuncs.cpp:169
Farm::FA_GreenManure
virtual bool FA_GreenManure(LE *a_field, double a_user, int a_days)
Spread green manure on a_field owned by an stock farmer.
Definition: farmfuncs.cpp:1062
autumn_sow
Definition: treatment.h:41
harvest
Definition: treatment.h:82
l_farm_insecticide_kills
static CfgBool l_farm_insecticide_kills("FARM_INSECTICIDE_KILLS", CFG_CUSTOM, true)
Farm::BedForming
virtual bool BedForming(LE *a_field, double a_user, int a_days)
Do bed forming up on a_field, probably of carrots.
Definition: farmfuncs.cpp:1690
Farm::FA_Manure
virtual bool FA_Manure(LE *a_field, double a_user, int a_days)
Spread manure on a_field owned by an stock farmer.
Definition: farmfuncs.cpp:1036
fp_slurry
Definition: treatment.h:52
cfg_OSR_InsecticideMonth
CfgInt cfg_OSR_InsecticideMonth("PEST_OSRINSECTONEMONTH", CFG_CUSTOM, 4)
Provided to allow configuration control of the first insecticide spray in OSR - this changes the mont...
Farm::FA_Sludge
virtual bool FA_Sludge(LE *a_field, double a_user, int a_days)
Spread sewege sludge on a_field owned by an stock farmer.
Definition: farmfuncs.cpp:1086
Farm::SpringSowWithFerti
virtual bool SpringSowWithFerti(LE *a_field, double a_user, int a_days)
Carry out a sowing event with start fertilizer in the spring on a_field.
Definition: farmfuncs.cpp:574
Farm::FA_NPKS
virtual bool FA_NPKS(LE *a_field, double a_user, int a_days)
Apply NPKS fertilizer, on a_field owned by a stock farmer.
Definition: farmfuncs.cpp:891
fp_rsm
Definition: treatment.h:58
cfg_WW_isecticide_prop1
CfgFloat cfg_WW_isecticide_prop1("PEST_WWINSECTONEPROP", CFG_CUSTOM, 1.0)
Provided to allow configuration control of the proportion of farmers doing first insecticide spray in...
fa_sludge
Definition: treatment.h:68
fa_rsm
Definition: treatment.h:69
fp_greenmanure
Definition: treatment.h:56
Farm::ProductApplication_DateLimited
virtual bool ProductApplication_DateLimited(LE *a_field, double, int, double a_applicationrate, PlantProtectionProducts a_ppp)
Special pesticide trial functionality.
Definition: farmfuncs.cpp:2396
straw_removal
Definition: treatment.h:112
Farm::CutToHay
virtual bool CutToHay(LE *a_field, double a_user, int a_days)
Carry out hay cutting on a_field.
Definition: farmfuncs.cpp:2269
cfg_CAB_InsecticideMonth
CfgInt cfg_CAB_InsecticideMonth("PEST_CABINSECTONEMONTH", CFG_CUSTOM, 5)
Provided to allow configuration control of the first insecticide spray in cabbage crops - this change...
hay_turning
Definition: treatment.h:88
bulb_harvest
Definition: treatment.h:110
cfg_WW_NINV_tillage_prop1
CfgFloat cfg_WW_NINV_tillage_prop1("TILLAGE_WWNINVONEPROP", CFG_CUSTOM, 1.0)
Provided to allow configuration control of the proportion of farmers doing first non-inversion tillag...
cfg_WW_isecticide_prop2
CfgFloat cfg_WW_isecticide_prop2("PEST_WWINSECTTWOPROP", CFG_CUSTOM, 1.0)
Provided to allow configuration control of the proportion of farmers doing second insecticide spray i...
Farm::FA_NPK
virtual bool FA_NPK(LE *a_field, double a_user, int a_days)
Apply NPK fertilizer to a_field owned by an stock farmer.
Definition: farmfuncs.cpp:917
Farm::FungicideTreat
virtual bool FungicideTreat(LE *a_field, double a_user, int a_days)
Apply fungicide to a_field.
Definition: farmfuncs.cpp:1279
straw_covering
Definition: treatment.h:111
shallow_harrow
Definition: treatment.h:107
Farm::HillingUp
virtual bool HillingUp(LE *a_field, double a_user, int a_days)
Do hilling up on a_field, probably of potatoes.
Definition: farmfuncs.cpp:1663
heavy_cultivator_aggregate
Definition: treatment.h:108
water
Definition: treatment.h:80
fp_liquidNH3
Definition: treatment.h:51
cfg_productapplicendyear
CfgInt cfg_productapplicendyear
cfg_CAB_InsecticideDay
CfgInt cfg_CAB_InsecticideDay("PEST_CABINSECTONEDAY", CFG_CUSTOM, 15)
Provided to allow configuration control of the first insecticide spray in cabbage crops - this change...
Farm::FP_PK
virtual bool FP_PK(LE *a_field, double a_user, int a_days)
Apply PK fertilizer, on a_field owned by an arable farmer.
Definition: farmfuncs.cpp:653
molluscicide
Definition: treatment.h:75
Farm::CattleIsOutLow
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.
Definition: farmfuncs.cpp:2018
Farm::StriglingHill
virtual bool StriglingHill(LE *a_field, double a_user, int a_days)
Carry out a mechanical weeding on a_field followed by hilling up (probably on potatoes)
Definition: farmfuncs.cpp:1635
burn_straw_stubble
Definition: treatment.h:92
l_pest_productapplic_period
CfgInt l_pest_productapplic_period
Farm::CattleOutLowGrazing
virtual bool CattleOutLowGrazing(LE *a_field, double a_user, int a_days)
Start a extensive grazing event on a_field today.
Definition: farmfuncs.cpp:1944
DO_IT_PROB
#define DO_IT_PROB
Definition: farmfuncs.cpp:56
Farm::FP_Manure
virtual bool FP_Manure(LE *a_field, double a_user, int a_days)
Spread manure on a_field owned by an arable farmer.
Definition: farmfuncs.cpp:773
cattle_out_low
Definition: treatment.h:100
cfg_WW_InsecticideDay
CfgInt cfg_WW_InsecticideDay("PEST_WWINSECTONEDAY", CFG_CUSTOM, 1)
Provided to allow configuration control of the first insecticide spray in winter wheat - this changes...
fp_pk
Definition: treatment.h:50
fa_npk
Definition: treatment.h:61
Farm::AutumnSow
virtual bool AutumnSow(LE *a_field, double a_user, int a_days)
Carry out a sowing event in the autumn on a_field.
Definition: farmfuncs.cpp:364
Landscape
The landscape class containing all environmental and topographical data.
Definition: Landscape.h:112
cattle_out
Definition: treatment.h:83
l_el_o_cut_height
CfgFloat l_el_o_cut_height
Farm::FA_RSM
virtual bool FA_RSM(LE *a_field, double a_user, int a_days)
RSM (ammonium nitrate solution) applied on a_field owned by a stock farmer.
Definition: farmfuncs.cpp:1111
Farm::Biocide
virtual bool Biocide(LE *a_field, double a_user, int a_days)
Biocide applied on a_field.
Definition: farmfuncs.cpp:2415
cfg_WW_NINV_tillage_prop2
CfgFloat cfg_WW_NINV_tillage_prop2("TILLAGE_WWNINVTWOPROP", CFG_CUSTOM, 1.0)
Provided to allow configuration control of the proportion of farmers doing second non-inversion tilla...
fp_npk
Definition: treatment.h:49
fa_npks
Definition: treatment.h:60
stubble_harrowing
Definition: treatment.h:90
l_pest_productapplic_enddate
CfgInt l_pest_productapplic_enddate
stubble_plough
Definition: treatment.h:35
autumn_plough
Definition: treatment.h:34
tov_PotatoesIndustry
Definition: tov_declaration.h:50
fp_manure
Definition: treatment.h:55
cfg_POT_InsecticideDay
CfgInt cfg_POT_InsecticideDay("PEST_POTINSECTONEDAY", CFG_CUSTOM, 15)
Provided to allow configuration control of the first insecticide spray in potatoes crops - this chang...
strigling_sow
Definition: treatment.h:95
Farm::FP_AmmoniumSulphate
virtual bool FP_AmmoniumSulphate(LE *a_field, double a_user, int a_days)
Apply Ammonium Sulphate to a_field owned by an arable farmer.
Definition: farmfuncs.cpp:750
cfg_SB_InsecticideDay
CfgInt cfg_SB_InsecticideDay("PEST_SBINSECTONEDAY", CFG_CUSTOM, 15)
Provided to allow configuration control of the first insecticide spray in spring barley crops - this ...
Farm::HayBailing
virtual bool HayBailing(LE *a_field, double a_user, int a_days)
Carry out hay bailing on a_field.
Definition: farmfuncs.cpp:2184
fungicide
Definition: Landscape.h:63
Farm::FA_Calcium
virtual bool FA_Calcium(LE *a_field, double a_user, int a_days)
Calcium applied on a_field owned by a stock farmer.
Definition: farmfuncs.cpp:1133
Farm::StrawChopping
virtual bool StrawChopping(LE *a_field, double a_user, int a_days)
Carry out straw chopping on a_field.
Definition: farmfuncs.cpp:2132
winter_plough
Definition: treatment.h:42
cfg_OptimiseBedriftsmodelCrops
CfgBool cfg_OptimiseBedriftsmodelCrops
OptimisingFarm::InsecticideTreat
virtual bool InsecticideTreat(LE *a_field, double, int a_days)
Carries out insecticide application. Saves information on each application for a given crop.
Definition: farmfuncs.cpp:1389
Farm::FA_ManganeseSulphate
virtual bool FA_ManganeseSulphate(LE *a_field, double a_user, int a_days)
Apply manganese sulphate to a_field owned by an stock farmer.
Definition: farmfuncs.cpp:1013
l_el_o_cut_green
CfgFloat l_el_o_cut_green
testpesticide
Definition: Landscape.h:63
l_el_o_cut_total
CfgFloat l_el_o_cut_total
fp_sludge
Definition: treatment.h:57
Farm::CutOrch
virtual bool CutOrch(LE *a_field, double a_user, int a_days)
Cut vegetation on orchard crop. //based on cut to silage - values from cutting function of orchard.
Definition: farmfuncs.cpp:2362
straw_chopping
Definition: treatment.h:87
Farm::FP_Calcium
virtual bool FP_Calcium(LE *a_field, double a_user, int a_days)
Calcium applied on a_field owned by an arable farmer.
Definition: farmfuncs.cpp:869
tov_Potatoes
Definition: tov_declaration.h:50
cfg_OSR_InsecticideDay
CfgInt cfg_OSR_InsecticideDay("PEST_OSRINSECTONEDAY", CFG_CUSTOM, 30)
Provided to allow configuration control of the first insecticide spray in OSR - this changes the day ...
fungicide_treat
Definition: treatment.h:73
deep_ploughing
Definition: treatment.h:43
preseeding_cultivator_sow
Definition: treatment.h:40
Farm::FlowerCutting
virtual bool FlowerCutting(LE *a_field, double a_user, int a_days)
Flower cutting applied on a_field.
Definition: farmfuncs.cpp:2437
herbicide
Definition: Landscape.h:63
cfg_CustomInsecticideKillProp
static CfgFloat cfg_CustomInsecticideKillProp("CUSTOMINSECTIVIDEKILLPROP", CFG_CUSTOM, 0.5, 0, 1.0)
mow
Definition: treatment.h:93
fa_pk
Definition: treatment.h:62
cfg_productapplicstartyear
CfgInt cfg_productapplicstartyear
cfg_WW_conv_tillage_prop1
CfgFloat cfg_WW_conv_tillage_prop1("TILLAGE_WWCONVONEPROP", CFG_CUSTOM, 1.0)
Provided to allow configuration control of the proportion of farmers doing first conventional tillage...
spring_harrow
Definition: treatment.h:45
Landscape::CheckForPesticideRecord
void CheckForPesticideRecord(LE *a_field, TTypesOfPesticideCategory a_pcide)
Check if needed and record pesticide application.
Definition: Landscape.cpp:669
Landscape::SupplyYearNumber
int SupplyYearNumber(void)
Definition: Landscape.h:1616
cfg_WW_InsecticideMonth
CfgInt cfg_WW_InsecticideMonth("PEST_WWINSECTONEMONTH", CFG_CUSTOM, 5)
Provided to allow configuration control of the first insecticide spray in winter wheat - this changes...
cfg_TU_InsecticideMonth
CfgInt cfg_TU_InsecticideMonth("PEST_TUINSECTONEMONTH", CFG_CUSTOM, 5)
Provided to allow configuration control of the first insecticide spray in tulip crops - this changes ...
Farm::InsecticideTreat
virtual bool InsecticideTreat(LE *a_field, double a_user, int a_days)
Apply insecticide to a_field.
Definition: farmfuncs.cpp:1348
Farm::AutumnRoll
virtual bool AutumnRoll(LE *a_field, double a_user, int a_days)
Carry out a roll event in the autumn on a_field.
Definition: farmfuncs.cpp:288
hilling_up
Definition: treatment.h:79
Farm::ShallowHarrow
virtual bool ShallowHarrow(LE *a_field, double a_user, int a_days)
Carry out a shallow harrow event on a_field, e.g., after grass cutting event.
Definition: farmfuncs.cpp:498
Farm::FP_Slurry
virtual bool FP_Slurry(LE *a_field, double a_user, int a_days)
Apply slurry to a_field owned by an arable farmer.
Definition: farmfuncs.cpp:701
Farm::HarvestLong
virtual bool HarvestLong(LE *a_field, double a_user, int a_days)
Carry out a harvest on a_field.
Definition: farmfuncs.cpp:1821
biocide
Definition: treatment.h:104
Farm::SleepAllDay
virtual bool SleepAllDay(LE *a_field, double a_user, int a_days)
Nothing to to today on a_field.
Definition: farmfuncs.cpp:241
fa_calcium
Definition: treatment.h:70
fa_manure
Definition: treatment.h:66
fp_npks
Definition: treatment.h:48
Farm::RowCultivation
virtual bool RowCultivation(LE *a_field, double a_user, int a_days)
Carry out a harrowing between crop rows on a_field.
Definition: farmfuncs.cpp:1510
row_cultivation
Definition: treatment.h:76
trial_insecticidetreat
Definition: treatment.h:96
Farm::Water
virtual bool Water(LE *a_field, double a_user, int a_days)
Carry out a watering on a_field.
Definition: farmfuncs.cpp:1717
Farm::AutumnPlough
virtual bool AutumnPlough(LE *a_field, double a_user, int a_days)
Carry out a ploughing event in the autumn on a_field.
Definition: farmfuncs.cpp:132
Farm::SpringSow
virtual bool SpringSow(LE *a_field, double a_user, int a_days)
Carry out a sowing event in the spring on a_field.
Definition: farmfuncs.cpp:546
Farm::AutumnHarrow
virtual bool AutumnHarrow(LE *a_field, double a_user, int a_days)
Carry out a harrow event in the autumn on a_field.
Definition: farmfuncs.cpp:261
Farm::FA_AmmoniumSulphate
virtual bool FA_AmmoniumSulphate(LE *a_field, double a_user, int a_days)
Apply ammonium sulphate to a_field owned by an stock farmer.
Definition: farmfuncs.cpp:990
insecticide
Definition: Landscape.h:63
fp_ammoniumsulphate
Definition: treatment.h:54
stubble_cultivator_heavy
Definition: treatment.h:36
Farm::FP_LiquidNH3
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.
Definition: farmfuncs.cpp:677
DO_IT_PROB_LONG
#define DO_IT_PROB_LONG
Definition: farmfuncs.cpp:57
Farm::StriglingSow
virtual bool StriglingSow(LE *a_field, double a_user, int a_days)
Carry out a mechanical weeding followed by sowing on a_field.
Definition: farmfuncs.cpp:1597
spring_plough
Definition: treatment.h:44
l_pest_productapplic_startdate
CfgInt l_pest_productapplic_startdate
fa_greenmanure
Definition: treatment.h:67
cfg_TU_InsecticideDay
CfgInt cfg_TU_InsecticideDay("PEST_TUINSECTONEDAY", CFG_CUSTOM, 15)
Provided to allow configuration control of the first insecticide spray in tulip crops - this changes ...
g_landscape_p
Landscape * g_landscape_p
Definition: Landscape.cpp:258
cfg_BE_InsecticideMonth
CfgInt cfg_BE_InsecticideMonth("PEST_BEINSECTONEMONTH", CFG_CUSTOM, 5)
Provided to allow configuration control of the first insecticide spray in beet crops - this changes t...
cfg_WW_isecticide_prop3
CfgFloat cfg_WW_isecticide_prop3("PEST_WWINSECTTHREEPROP", CFG_CUSTOM, 1.0)
Provided to allow configuration control of the proportion of farmers doing third insecticide spray in...
Farm::DeepPlough
virtual bool DeepPlough(LE *a_field, double a_user, int a_days)
Carry out a deep ploughing event on a_field.
Definition: farmfuncs.cpp:417
l_farm_cattle_veg_reduce2
static CfgFloat l_farm_cattle_veg_reduce2("FARM_CATTLE_VEG_REDUCE_LOW", CFG_CUSTOM, 1.00)
Farm::StrawCovering
virtual bool StrawCovering(LE *a_field, double a_user, int a_days)
Straw covering applied on a_field.
Definition: farmfuncs.cpp:2502
cfg_pest_product_1_amount
CfgFloat cfg_pest_product_1_amount
fp_calcium
Definition: treatment.h:59
Farm::FP_RSM
virtual bool FP_RSM(LE *a_field, double a_user, int a_days)
RSM (ammonium nitrate solution) applied on a_field owned by an arable farmer.
Definition: farmfuncs.cpp:847
spring_roll
Definition: treatment.h:46
fa_manganesesulphate
Definition: treatment.h:64
Farm::WinterPlough
virtual bool WinterPlough(LE *a_field, double a_user, int a_days)
Carry out a ploughing event in the winter on a_field.
Definition: farmfuncs.cpp:392
bed_forming
Definition: treatment.h:106
cut_weeds
Definition: treatment.h:94
Farm::BulbHarvest
virtual bool BulbHarvest(LE *a_field, double a_user, int a_days)
Carry out a bulb harvest on a_field.
Definition: farmfuncs.cpp:2465
fp_manganesesulphate
Definition: treatment.h:53
herbicide_treat
Definition: treatment.h:71
Farm::FP_GreenManure
virtual bool FP_GreenManure(LE *a_field, double a_user, int a_days)
Spread green manure on a_field owned by an arable farmer.
Definition: farmfuncs.cpp:798
Farm::GrowthRegulator
virtual bool GrowthRegulator(LE *a_field, double a_user, int a_days)
Apply growth regulator to a_field.
Definition: farmfuncs.cpp:1250
growth_regulator
Definition: treatment.h:72
cut_to_silage
Definition: treatment.h:86
product_treat
Definition: treatment.h:101
pigs_out
Definition: treatment.h:84
Farm::FA_PK
virtual bool FA_PK(LE *a_field, double a_user, int a_days)
Apply PK fertilizer to a_field owned by an stock farmer.
Definition: farmfuncs.cpp:941
l_farm_pig_veg_reduce
static CfgFloat l_farm_pig_veg_reduce("FARM_PIG_VEG_REDUCE", CFG_CUSTOM, 0.98)
Farm::BurnStrawStubble
virtual bool BurnStrawStubble(LE *a_field, double a_user, int a_days)
Burn stubble on a_field.
Definition: farmfuncs.cpp:2236
cut_to_hay
Definition: treatment.h:85
spring_sow
Definition: treatment.h:47
Farm::Swathing
virtual bool Swathing(LE *a_field, double a_user, int a_days)
Cut the crop on a_field and leave it lying (probably rape)
Definition: farmfuncs.cpp:1744
sleep_all_day
Definition: treatment.h:33
cfg_BE_InsecticideDay
CfgInt cfg_BE_InsecticideDay("PEST_BEINSECTONEDAY", CFG_CUSTOM, 15)
Provided to allow configuration control of the first insecticide spray in beet crops - this changes t...
Farm::PigsOut
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.
Definition: farmfuncs.cpp:2062
Farm::HayTurning
virtual bool HayTurning(LE *a_field, double a_user, int a_days)
Carry out hay turning on a_field.
Definition: farmfuncs.cpp:2159
Farm::CattleOut
virtual bool CattleOut(LE *a_field, double a_user, int a_days)
Start a grazing event on a_field today.
Definition: farmfuncs.cpp:1910
strigling_hill
Definition: treatment.h:105
Farm::HeavyCultivatorAggregate
virtual bool HeavyCultivatorAggregate(LE *a_field, double a_user, int a_days)
Carry out a heavy cultivation event on a_field. This is non-inversion type of cultivation which can b...
Definition: farmfuncs.cpp:217
fa_slurry
Definition: treatment.h:63
swathing
Definition: treatment.h:81
g_pest
class Pesticide * g_pest
Farm::StubbleHarrowing
virtual bool StubbleHarrowing(LE *a_field, double a_user, int a_days)
Carry out stubble harrowing on a_field.
Definition: farmfuncs.cpp:2209
Farm::SpringHarrow
virtual bool SpringHarrow(LE *a_field, double a_user, int a_days)
Carry out a harrow event in the spring on a_field.
Definition: farmfuncs.cpp:471
Farm::FP_NPKS
virtual bool FP_NPKS(LE *a_field, double a_user, int a_days)
Apply NPKS fertilizer, on a_field owned by an arable farmer.
Definition: farmfuncs.cpp:602
Farm::CutWeeds
virtual bool CutWeeds(LE *a_field, double a_user, int a_days)
Carry out weed topping on a_field.
Definition: farmfuncs.cpp:2303
l_farm_cattle_veg_reduce
static CfgFloat l_farm_cattle_veg_reduce("FARM_CATTLE_VEG_REDUCE", CFG_CUSTOM, 1.5)
l_farm_herbicide_kills
static CfgBool l_farm_herbicide_kills("FARM_PESTICIDE_KILLS", CFG_CUSTOM, true)