//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
-// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifdef HAVE_CONFIG_H
# include <config.h>
#include <simgear/math/point3d.hxx>
#include <math.h>
+#include "AIFlightPlan.hxx"
#include "AIShip.hxx"
-FGAIShip::FGAIShip(FGAIManager* mgr) {
- manager = mgr;
- _type_str = "ship";
- _otype = otShip;
-
+FGAIShip::FGAIShip(object_type ot) : FGAIBase(ot) {
}
FGAIShip::~FGAIShip() {
}
+void FGAIShip::readFromScenario(SGPropertyNode* scFileNode) {
+ if (!scFileNode)
+ return;
+
+ FGAIBase::readFromScenario(scFileNode);
+
+ setRudder(scFileNode->getFloatValue("rudder", 0.0));
+ setName(scFileNode->getStringValue("name", "Titanic"));
+
+ std::string flightplan = scFileNode->getStringValue("flightplan");
+ if (!flightplan.empty()){
+ FGAIFlightPlan* fp = new FGAIFlightPlan(flightplan);
+ setFlightPlan(fp);
+ }
+}
bool FGAIShip::init() {
* speed * 1.686 / ft_per_deg_lon;
// set new position
- pos.setlat( pos.lat() + speed_north_deg_sec * dt);
- pos.setlon( pos.lon() + speed_east_deg_sec * dt);
+ pos.setLatitudeDeg( pos.getLatitudeDeg() + speed_north_deg_sec * dt);
+ pos.setLongitudeDeg( pos.getLongitudeDeg() + speed_east_deg_sec * dt);
// adjust heading based on current rudder angle