X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Ftrigger%2Fscripttrigger.cpp;h=cc330a237872ecb31b1b9fe59906fb3a8eddadf9;hb=3e89eb527d5f3bca2cb8cd219784048764a148f5;hp=c5e93eb3f2989bdb4caa73a21ea1d1c06fbe51e9;hpb=5b7f9214cb929399f1a855ef5807018a9447d510;p=supertux.git diff --git a/src/trigger/scripttrigger.cpp b/src/trigger/scripttrigger.cpp index c5e93eb3f..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,12 +12,11 @@ // 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 @@ -29,16 +28,15 @@ #include "lisp/lisp.hpp" #include "lisp/writer.hpp" #include "object_factory.hpp" -#include "scripting/script_interpreter.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");