X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fobject_factory.cpp;h=bd93f21da478a75e1e04276241839fb1fcf860ca;hb=eba5f4b45f92cb19a09fbac1a478648062480adb;hp=9ce2686a6c32a43b9f791a3d42492e2620c4875d;hpb=e3bb6e46812f108f093e9ad0751a945c34b18cd3;p=supertux.git diff --git a/src/object_factory.cpp b/src/object_factory.cpp index 9ce2686a6..bd93f21da 100644 --- a/src/object_factory.cpp +++ b/src/object_factory.cpp @@ -21,6 +21,8 @@ #include #include +#include "lisp/lisp.h" +#include "lisp/parser.h" #include "object_factory.h" Factories* object_factories = 0; @@ -37,3 +39,14 @@ GameObject* create_object(const std::string& name, const lisp::Lisp& reader) return i->second->create_object(reader); } +GameObject* create_object(const std::string& name, const Vector& pos) +{ + std::stringstream lisptext; + lisptext << "(" << name + << " (x " << pos.x << ")" + << " (y " << pos.y << "))"; + + lisp::Parser parser; + std::auto_ptr lisp (parser.parse(lisptext)); + return create_object(name, *lisp); +}