Messaging subsystem rewrite, step I
[supertux.git] / src / scripting / functions.cpp
index 6bff401..5c1d6ff 100644 (file)
@@ -9,6 +9,7 @@
 #include "resources.hpp"
 #include "gettext.hpp"
 #include "msg.hpp"
+#include "mainloop.hpp"
 
 namespace Scripting
 {
@@ -26,8 +27,8 @@ std::string translate(const std::string& text)
 void display_text_file(const std::string& filename)
 {
   std::string file 
-    = ScriptInterpreter::current()->get_working_directory() + filename;
-  ::display_text_file(file);
+      = ScriptInterpreter::current()->get_working_directory() + filename;
+  main_loop->push_screen(new TextScroller(file));
 }
 
 void import(HSQUIRRELVM v, const std::string& filename)
@@ -35,15 +36,13 @@ void import(HSQUIRRELVM v, const std::string& filename)
   std::string file 
     = ScriptInterpreter::current()->get_working_directory() + filename;
   if(sqstd_loadfile(v, file.c_str(), true) < 0) {
-    msg_warning("couldn't load script '" << filename << "' ("
-      << file << ")");
+    msg_warning << "couldn't load script '" << filename << "' (" << file << ")" << std::endl;
     return;
   }
 
   sq_push(v, -2);
   if(sq_call(v, 1, false) < 0) {
-    msg_warning("Couldn't execute script '" << filename << "' ("
-      << file << ")");
+    msg_warning << "Couldn't execute script '" << filename << "' (" << file << ")" << std::endl;
     return;
   }
 }