int BoatPlan::TrySwitchBoatPlan(double VW, double H, double Swell, const wxDateTime &gribtime, double lat, double lon, int &daytime) { H = abs(heading_resolve(H)); /* make this work for both tacks */ for(unsigned int i=0; i<SwitchPlans.size(); i++) { SwitchPlan &p = SwitchPlans[i]; if(p.MaxWindSpeed >= VW) continue; if(p.MinWindSpeed <= VW) continue; if(p.MaxWindDirection >= H) continue; if(p.MinWindDirection <= H) continue; if(p.MaxWaveHeight >= Swell) continue; if(p.MinWaveHeight <= Swell) continue; if(!p.DayTime) { if(ComputeDayTime(gribtime, lat, lon, daytime)) continue; } else if(!p.NightTime) if(!ComputeDayTime(gribtime, lat, lon, daytime)) continue; return i; } return -1; }
CDateTime::CDateTime(void) { CTimeStamp ts; m_utctime = ts.ToUTCTime(); ComputeDayTime(); }