]> git.mxchange.org Git - flightgear.git/blobdiff - src/Scripting/scriptmgr.cxx
Moved random ground cover object management code (userdata.[ch]xx) over
[flightgear.git] / src / Scripting / scriptmgr.cxx
index 106cd032ead962abf01835dacf65750ab8b170a1..a9b18424c9dd4e31c220e52415cc9181a979fbda 100644 (file)
@@ -135,9 +135,8 @@ FGScriptMgr::update (double delta_time_sec)
 }
 
 bool
-FGScriptMgr::run (const char * script)
+FGScriptMgr::run (const char * script) const
 {
-#if defined(FG_PSL_STRING_COMPILE)
                                 // FIXME: detect and report errors
     pslProgram program(extensions);
     if (program.compile(script, globals->get_fg_root().c_str()) > 0)
@@ -145,10 +144,15 @@ FGScriptMgr::run (const char * script)
     while (program.step() != PSL_PROGRAM_END)
         ;
     return true;
-#else
-    SG_LOG(SG_INPUT, SG_ALERT, "Input-binding scripts not supported");
-    return false;
-#endif
+}
+
+bool
+FGScriptMgr::run_inline (const char * script) const
+{
+    string s = "int main () {\n";
+    s += script;
+    s += "\n  return 0;\n}\n";
+    return run(s.c_str());
 }