#include <simgear/misc/sg_path.hxx>
#include <simgear/structure/subsystem_mgr.hxx>
#include <simgear/nasal/nasal.h>
+#include <simgear/scene/model/model.hxx>
#include <map>
SG_USING_STD(map);
virtual bool handleCommand(const SGPropertyNode* arg);
void createModule(const char* moduleName, const char* fileName,
- const char* src, int len);
+ const char* src, int len, const SGPropertyNode* arg=0);
+
+ void deleteModule(const char* moduleName);
private:
friend class FGNasalScript;
public: void handleTimer(NasalTimer* t);
};
+
class FGNasalScript {
public:
~FGNasalScript() { _nas->gcRelease(_gcKey); }
FGNasalSys* _nas;
};
+
class FGNasalListener : public SGPropertyChangeListener {
public:
FGNasalListener(SGPropertyNode_ptr node, naRef handler,
- FGNasalSys* nasal, int key)
- : _node(node), _handler(handler), _gcKey(key), _nas(nasal) {}
+ FGNasalSys* nasal, int key);
- ~FGNasalListener() {
- _nas->gcRelease(_gcKey);
- }
-
- void valueChanged(SGPropertyNode* node) {
- _nas->_cmdArg = node;
- naContext c = naNewContext();
- naModUnlock();
- naCall(c, _handler, 0, 0, naNil(), naNil());
- naModLock();
- if(naGetError(c))
- _nas->logError(c);
- naFreeContext(c);
- }
+ ~FGNasalListener();
+ void valueChanged(SGPropertyNode* node);
private:
friend class FGNasalSys;
naRef _handler;
int _gcKey;
FGNasalSys* _nas;
+ unsigned int _active;
+};
+
+
+class FGNasalModelData : public SGModelData {
+public:
+ FGNasalModelData() : _unload(0) {}
+ ~FGNasalModelData();
+ void modelLoaded(const string& path, SGPropertyNode *prop, ssgBranch *);
+
+private:
+ string _module;
+ SGConstPropertyNode_ptr _unload;
};
#endif // __NASALSYS_HXX