*include stdio.h in a couple files for MinGW GCC 4.4.0
[supertux.git] / src / object_factory.cpp
index fe89724..667a12f 100644 (file)
@@ -42,13 +42,27 @@ GameObject* create_object(const std::string& name, const lisp::Lisp& reader)
 GameObject* create_object(const std::string& name, const Vector& pos)
 {
   std::stringstream lisptext;
-  lisptext << "(" << name
-           << " (x " << pos.x << ")"
+  lisptext << "((x " << pos.x << ")"
            << " (y " << pos.y << "))";
 
   lisp::Parser parser;
   const lisp::Lisp* lisp = parser.parse(lisptext, "create_object");
-  GameObject* object = create_object(name, *lisp);
+  GameObject* object = create_object(name, *(lisp->get_car()));
 
   return object;
 }
+
+GameObject* create_badguy_object(const std::string& name, const Vector& pos, const Direction dir)
+{
+  std::stringstream lisptext;
+  lisptext << "((x " << pos.x << ")"
+           << " (y " << pos.y << ")"
+           << " (direction " << dir << "))";
+
+  lisp::Parser parser;
+  const lisp::Lisp* lisp = parser.parse(lisptext, "create_object");
+  GameObject* object = create_object(name, *(lisp->get_car()));
+
+  return object;
+}
+