28 #include "../../Landscape/ls.h"
29 #include "../../Landscape/cropprogs/OCloverGrassGrazed2.h"
47 switch ( m_ev->m_todo ) {
55 m_last_date=g_date->DayInYear(10,10);
57 m_field->SetMDates(0,0,g_date->DayInYear(27,7));
59 m_field->SetMDates(1,0,g_date->DayInYear(10,10));
60 m_field->SetMDates(0,1,g_date->DayInYear(1,9));
61 m_field->SetMDates(1,1,g_date->DayInYear(1,10));
65 if (m_ev->m_startday>g_date->DayInYear(1,7))
67 if (m_field->GetMDates(0,0) >=m_ev->m_startday)
69 g_msg->Warn( WARN_BUG,
"OCloverGrassGrazed2::Do(): "
70 "Harvest too late for the next crop to start!!!",
"" );
74 for (
int i=0; i<noDates; i++)
76 if (m_field->GetMDates(0,i)>=m_ev->m_startday) m_field->SetMDates(0,i,m_ev->m_startday-1);
77 if (m_field->GetMDates(1,i)>=m_ev->m_startday) m_field->SetMDates(1,i,m_ev->m_startday-1);
82 if ( ! ( m_ev->m_first_year )) {
84 d1 = g_date->OldDays() + g_date->DayInYear( 1,7 );
85 if (g_date->Date() < d1) {
87 g_msg->Warn( WARN_BUG,
"OCloverGrassGrazed2::Do(): "
88 "Crop start attempt between 1st Jan & 1st July",
"" );
91 d1 = g_date->OldDays() + m_first_date+365;
92 if (g_date->Date() > d1) {
94 g_msg->Warn( WARN_BUG,
"OCloverGrassGrazed2::Do(): "
95 "Crop start attempt after last possible start date",
102 d1 = g_date->OldDays() + g_date->DayInYear( 1, 4 );
106 if (!m_ev->m_first_year) d1 += 365;
108 m_field->SetLastSownVeg( m_field->GetOwner()->GetNextCrop( m_field->GetRotIndex() ) );
114 if ( m_ev->m_lock || m_farm->DoIt( 50 ))
116 if (!m_farm->FA_Slurry( m_field, 0.0,
117 g_date->DayInYear( 30, 4 ) - g_date->DayInYear())) {
123 SimpleEvent( g_date->OldDays() + g_date->DayInYear( 1,5 ),
129 SimpleEvent( g_date->OldDays() + g_date->DayInYear( 15, 5 ),
135 if ( m_ev->m_lock || m_farm->DoIt( (
int) (100-(
cfg_silage_prop.value()*40) ))) {
137 if (!m_farm->CattleOutLowGrazing( m_field, 0.0,
138 m_field->GetMDates(1,1) -
139 g_date->DayInYear())) {
145 if (!m_farm->CattleOut( m_field, 0.0,
146 m_field->GetMDates(1,1) -
147 g_date->DayInYear())) {
157 SimpleEvent( g_date->OldDays() + g_date->DayInYear( 25,5 ),
164 if (!m_farm->CattleIsOutLow( m_field, 0.0, m_field->GetMDates(1,1) -
165 g_date->DayInYear(),m_field->GetMDates(1,1))) {
171 if ( !m_farm->CattleIsOut( m_field, 0.0,
172 m_field->GetMDates(1,1) -
173 g_date->DayInYear(),m_field->GetMDates(1,1)))
183 if ( m_ev->m_lock || m_farm->DoIt( 100 )) {
188 if (!m_farm->CutToSilage( m_field, 0.0,
189 g_date->DayInYear( 25, 6 ) -
190 g_date->DayInYear())) {
203 if ( m_ev->m_lock || m_farm->DoIt( 20 )) {
206 if (!m_farm->StubbleHarrowing( m_field, 0.0,
207 m_field->GetMDates(1,1) -
208 g_date->DayInYear())) {
215 m_field->SetMDates(1,1,g_date->DayInYear()-1);
220 if ( m_ev->m_lock || m_farm->DoIt( 25 )) {
226 if (!m_farm->Water( m_field, 0.0,
227 g_date->DayInYear( 30, 5 ) -
228 g_date->DayInYear())) {
235 long newdate1 = g_date->OldDays() + g_date->DayInYear( 1,6 );
236 long newdate2 = g_date->Date() + 7;
237 if ( newdate2 > newdate1 )
244 if ( m_ev->m_lock || m_farm->DoIt( 25 )) {
250 if (!m_farm->Water( m_field, 0.0,
251 g_date->DayInYear( 15, 6 ) -
252 g_date->DayInYear())) {
264 g_msg->Warn( WARN_BUG,
"OCloverGrassGrazed2::Do(): "
265 "Unknown event type! ",
"" );