X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Ftrigger%2Fscripttrigger.cpp;h=cc330a237872ecb31b1b9fe59906fb3a8eddadf9;hb=3e89eb527d5f3bca2cb8cd219784048764a148f5;hp=8d2a2779d667608456c3eeab3b72df40233fb591;hpb=aec32b2eca58fcbe1a2730d79d500a44cf9043f1;p=supertux.git diff --git a/src/trigger/scripttrigger.cpp b/src/trigger/scripttrigger.cpp index 8d2a2779d..cc330a237 100644 --- a/src/trigger/scripttrigger.cpp +++ b/src/trigger/scripttrigger.cpp @@ -1,7 +1,7 @@ // $Id$ -// +// // SuperTux -// Copyright (C) 2005 Matthias Braun +// Copyright (C) 2006 Matthias Braun // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -12,33 +12,31 @@ // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -// +// // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -// 02111-1307, USA. -// +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + #include #include #include #include -#include "scripttrigger.h" -#include "game_session.h" -#include "lisp/lisp.h" -#include "lisp/writer.h" -#include "object_factory.h" -#include "scripting/script_interpreter.h" -#include "sector.h" +#include "scripttrigger.hpp" +#include "game_session.hpp" +#include "lisp/lisp.hpp" +#include "lisp/writer.hpp" +#include "object_factory.hpp" +#include "sector.hpp" ScriptTrigger::ScriptTrigger(const lisp::Lisp& reader) { - bool must_activate; + bool must_activate = false; reader.get("x", bbox.p1.x); reader.get("y", bbox.p1.y); - float w, h; + float w = 0, h = 0; reader.get("width", w); reader.get("height", h); bbox.set_size(w, h); @@ -87,8 +85,8 @@ ScriptTrigger::event(Player& , EventType type) if(type != triggerevent) return; - ScriptInterpreter::add_script_object(Sector::current(), "trigger - scritp", - script); + std::istringstream stream(script); + Sector::current()->run_script(stream, "ScriptTrigger"); } IMPLEMENT_FACTORY(ScriptTrigger, "scripttrigger");