void cServant::Init(Vector3 position)
{
	AI_STATE = AS_ROAM;
	this->position = position;
	setWaypoints();
	rotation = 0.f;
	srand((unsigned int)time(NULL));
}
  void GpsController::calibrate (void){
	 printf ("Calibrating. . . .");
	 int i = 0;
	while ( i < 10) {
		if (msg_flag){
					setWaypoints(buffWaypoint,(buffWaypoint.lon +CurrentWaypoint.lon),(buffWaypoint.lat+CurrentWaypoint.lat));
		i++;
			}
		else
			cout << "\b\b\b\b\b\b\b. . . .";
		}	
		setWaypoints (offWaypoint, buffWaypoint.lon/10.0, buffWaypoint.lat/10.0);
	print(35, "Calibration Points: ", offWaypoint.lon, offWaypoint.lat);
	setWaypoints (offWaypoint, (offWaypoint.lon - calibration.lon), (offWaypoint.lat - offWaypoint.lat));
	print(35, "Using: ", offWaypoint.lon, offWaypoint.lat);	
	return;
	}
void GpsController::calcwaypoint (void){
	 printf ("Calculating Next Waypoint. . . .");
	 int i = 0;
	while ( i < 10) {

		if (msg_flag){
					setWaypoints(buffWaypoint,(buffWaypoint.lon +CurrentWaypoint.lon),(buffWaypoint.lat+CurrentWaypoint.lat));
		i++;
			}
		else{
			printf("\b\b\b\b\b\b\b. . . .");	
		break;}
	}
	
		setWaypoints (avgWaypoint, buffWaypoint.lon/10.0, buffWaypoint.lat/10.0);
	setWaypoints (buffWaypoint, 0.0, 0.0);
	print(35, "NextPoint: ", avgWaypoint.lon, avgWaypoint.lat);
	return;

	
}
void WorldModel::copyData(const WorldModel& org, const bool)
{
   BaseClass::copyData(org);

   const oe::dafif::AirportLoader* apLoader = org.airports;
   setAirports( const_cast<oe::dafif::AirportLoader*>(static_cast<const oe::dafif::AirportLoader*>(apLoader)) );

   const oe::dafif::NavaidLoader* naLoader = org.navaids;
   setNavaids( const_cast<oe::dafif::NavaidLoader*>(static_cast<const oe::dafif::NavaidLoader*>(naLoader)) );

   const oe::dafif::WaypointLoader* wpLoader = org.waypoints;
   setWaypoints( const_cast<oe::dafif::WaypointLoader*>(static_cast<const oe::dafif::WaypointLoader*>(wpLoader)) );
}
void WorldModel::deleteData()
{
   setAirports( nullptr );
   setNavaids( nullptr );
   setWaypoints( nullptr );
}
void GpsController::calcwaypoint (int i){
	setWaypoints(avgWaypoint, 49.26248123,-123.24881402);
}