projects
/
supertux.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixed check for Block killing Badguy from below
[supertux.git]
/
src
/
object_factory.cpp
diff --git
a/src/object_factory.cpp
b/src/object_factory.cpp
index
bd93f21
..
fe89724
100644
(file)
--- a/
src/object_factory.cpp
+++ b/
src/object_factory.cpp
@@
-1,7
+1,8
@@
// $Id$
//
// $Id$
//
-// SuperTux
- A Jump'n Run
+// SuperTux
// Copyright (C) 2004 Ricardo Cruz <rick2@aeiou.pt>
// Copyright (C) 2004 Ricardo Cruz <rick2@aeiou.pt>
+// Copyright (C) 2006 Matthias Braun <matze@braunis.de>
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
@@
-21,16
+22,15
@@
#include <sstream>
#include <stdexcept>
#include <sstream>
#include <stdexcept>
-#include "lisp/lisp.h"
-#include "lisp/parser.h"
-#include "object_factory.h"
-
-Factories* object_factories = 0;
+#include "lisp/lisp.hpp"
+#include "lisp/parser.hpp"
+#include "object_factory.hpp"
+#include "math/vector.hpp"
GameObject* create_object(const std::string& name, const lisp::Lisp& reader)
{
GameObject* create_object(const std::string& name, const lisp::Lisp& reader)
{
- Factor
ies::iterator i = object_factories->
find(name);
- if(i ==
object_factories->
end()) {
+ Factor
y::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());
std::stringstream msg;
msg << "No factory for object '" << name << "' found.";
throw std::runtime_error(msg.str());
@@
-45,8
+45,10
@@
GameObject* create_object(const std::string& name, const Vector& pos)
lisptext << "(" << name
<< " (x " << pos.x << ")"
<< " (y " << pos.y << "))";
lisptext << "(" << name
<< " (x " << pos.x << ")"
<< " (y " << pos.y << "))";
-
+
lisp::Parser parser;
lisp::Parser parser;
- std::auto_ptr<lisp::Lisp> 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;
}
}