set(SOURCES
NasalSys.cxx
nasal-props.cxx
+ NasalAircraft.cxx
NasalPositioned.cxx
NasalPositioned_cppbind.cxx
NasalCanvas.cxx
set(HEADERS
NasalSys.hxx
NasalSys_private.hxx
+ NasalAircraft.hxx
NasalPositioned.hxx
NasalCanvas.hxx
NasalClipboard.hxx
--- /dev/null
+// Expose aircraft related data to Nasal
+//
+// Copyright (C) 2014 Thomas Geymayer
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License as
+// published by the Free Software Foundation; either version 2 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "NasalAircraft.hxx"
+#include <Aircraft/FlightHistory.hxx>
+#include <Main/globals.hxx>
+
+#include <simgear/nasal/cppbind/NasalHash.hxx>
+#include <simgear/nasal/cppbind/Ghost.hxx>
+
+//------------------------------------------------------------------------------
+static naRef f_getHistory(const nasal::CallContext& ctx)
+{
+ FGFlightHistory* history =
+ static_cast<FGFlightHistory*>(globals->get_subsystem("history"));
+ if( !history )
+ naRuntimeError(ctx.c, "Failed to get 'history' subsystem");
+
+ return ctx.to_nasal(history);
+}
+
+//------------------------------------------------------------------------------
+void initNasalAircraft(naRef globals, naContext c)
+{
+ nasal::Ghost<SGSharedPtr<FGFlightHistory> >::init("FGFlightHistory")
+ .method("pathForHistory", &FGFlightHistory::pathForHistory);
+
+ nasal::Hash aircraft_module = nasal::Hash(globals, c).createHash("aircraft");
+ aircraft_module.set("history", &f_getHistory);
+}
--- /dev/null
+//@file Expose aircraft related data to Nasal
+//
+// Copyright (C) 2014 Thomas Geymayer
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License as
+// published by the Free Software Foundation; either version 2 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+#ifndef SCRIPTING_NASAL_AIRCRAFT_HXX
+#define SCRIPTING_NASAL_AIRCRAFT_HXX
+
+#include <simgear/nasal/nasal.h>
+
+void initNasalAircraft(naRef globals, naContext c);
+
+#endif // SCRIPTING_NASAL_AIRCRAFT_HXX
+
#include "NasalSGPath.hxx"
#include "NasalSys.hxx"
#include "NasalSys_private.hxx"
+#include "NasalAircraft.hxx"
#include "NasalModelData.hxx"
#include "NasalPositioned.hxx"
#include "NasalCanvas.hxx"
initNasalPositioned(_globals, _context);
initNasalPositioned_cppbind(_globals, _context);
+ initNasalAircraft(_globals, _context);
NasalClipboard::init(this);
initNasalCanvas(_globals, _context);
initNasalCondition(_globals, _context);
#ifndef __NASALSYS_HXX
#define __NASALSYS_HXX
-#include <simgear/misc/sg_path.hxx>
-#include <simgear/structure/subsystem_mgr.hxx>
+#include <simgear/math/SGMath.hxx> // keep before any cppbind include to enable
+ // SGVec2<T> conversion.
#include <simgear/misc/sg_dir.hxx>
+#include <simgear/misc/sg_path.hxx>
#include <simgear/nasal/cppbind/NasalHash.hxx>
#include <simgear/nasal/nasal.h>
-#include <simgear/threads/SGQueue.hxx>
#include <simgear/props/props.hxx>
+#include <simgear/structure/subsystem_mgr.hxx>
+#include <simgear/threads/SGQueue.hxx>
// Required only for MSVC
#ifdef _MSC_VER