X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fobject_factory.cpp;h=cc68005b7be01c3f9a5883cf7cfe9e21fd283654;hb=657fc40723665c04b3150946f5bd66b6b0af9230;hp=5335140591183e14d87feeebe271f4d373830c56;hpb=7c579d3ef0a6667c18b53dad84c63c05d2760a84;p=supertux.git diff --git a/src/object_factory.cpp b/src/object_factory.cpp index 533514059..cc68005b7 100644 --- a/src/object_factory.cpp +++ b/src/object_factory.cpp @@ -27,12 +27,10 @@ #include "object_factory.hpp" #include "math/vector.hpp" -Factories* object_factories = 0; - 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()); @@ -41,16 +39,18 @@ 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) +GameObject* create_object(const std::string& name, const Vector& pos, const Direction dir) { std::stringstream lisptext; - lisptext << "(" << name - << " (x " << pos.x << ")" - << " (y " << pos.y << "))"; + lisptext << "((x " << pos.x << ")" + << " (y " << pos.y << ")"; + if(dir != AUTO) + lisptext << " (direction " << dir << "))"; 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; } +