X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fobject_factory.cpp;h=fe89724c440ec1e674ac74d5b051df611cd973bd;hb=fea3446f05e1e7673607b835c269d3e8d1929ab3;hp=0b6916961ddcf3258bd3a270dde5b073a72ac537;hpb=a113d3bd1feddd510e3b2852b0d42522735eee40;p=supertux.git diff --git a/src/object_factory.cpp b/src/object_factory.cpp index 0b6916961..fe89724c4 100644 --- a/src/object_factory.cpp +++ b/src/object_factory.cpp @@ -25,13 +25,12 @@ #include "lisp/lisp.hpp" #include "lisp/parser.hpp" #include "object_factory.hpp" - -Factories* object_factories = 0; +#include "math/vector.hpp" GameObject* create_object(const std::string& name, const lisp::Lisp& reader) { - Factories::iterator i = object_factories->find(name); - if(i == object_factories->end()) { + Factory::Factories::iterator i = Factory::get_factories().find(name); + if(i == Factory::get_factories().end()) { std::stringstream msg; msg << "No factory for object '" << name << "' found."; throw std::runtime_error(msg.str()); @@ -48,6 +47,8 @@ GameObject* create_object(const std::string& name, const Vector& pos) << " (y " << pos.y << "))"; lisp::Parser parser; - std::auto_ptr lisp (parser.parse(lisptext)); - return create_object(name, *lisp); + const lisp::Lisp* lisp = parser.parse(lisptext, "create_object"); + GameObject* object = create_object(name, *lisp); + + return object; }