fix cr/lfs and remove trailing whitespaces...
[supertux.git] / src / trigger / scripttrigger.cpp
index cc330a2..afac8ae 100644 (file)
@@ -1,93 +1,92 @@
-//  $Id$\r
-//\r
-//  SuperTux\r
-//  Copyright (C) 2006 Matthias Braun <matze@braunis.de>\r
-//\r
-//  This program is free software; you can redistribute it and/or\r
-//  modify it under the terms of the GNU General Public License\r
-//  as published by the Free Software Foundation; either version 2\r
-//  of the License, or (at your option) any later version.\r
-//\r
-//  This program is distributed in the hope that it will be useful,\r
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
-//  GNU General Public License for more details.\r
-//\r
-//  You should have received a copy of the GNU General Public License\r
-//  along with this program; if not, write to the Free Software\r
-//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.\r
-\r
-#include <config.h>\r
-\r
-#include <sstream>\r
-#include <stdexcept>\r
-#include <memory>\r
-\r
-#include "scripttrigger.hpp"\r
-#include "game_session.hpp"\r
-#include "lisp/lisp.hpp"\r
-#include "lisp/writer.hpp"\r
-#include "object_factory.hpp"\r
-#include "sector.hpp"\r
-\r
-ScriptTrigger::ScriptTrigger(const lisp::Lisp& reader)\r
-{\r
-  bool must_activate = false;\r
-  \r
-  reader.get("x", bbox.p1.x);\r
-  reader.get("y", bbox.p1.y);\r
-  float w = 0, h = 0;\r
-  reader.get("width", w);\r
-  reader.get("height", h);\r
-  bbox.set_size(w, h);\r
-  reader.get("script", script);\r
-  reader.get("button", must_activate);\r
-  if(script == "") {\r
-    throw std::runtime_error("Need to specify a script for trigger object");\r
-  }\r
-  \r
-  if (must_activate)\r
-    triggerevent = EVENT_ACTIVATE;\r
-  else\r
-    triggerevent = EVENT_TOUCH;\r
-}\r
-\r
-ScriptTrigger::ScriptTrigger(const Vector& pos, const std::string& script)\r
-{\r
-  bbox.set_pos(pos);\r
-  bbox.set_size(32, 32);\r
-  this->script = script;\r
-  triggerevent = EVENT_TOUCH;\r
-}\r
-\r
-ScriptTrigger::~ScriptTrigger()\r
-{\r
-}\r
-\r
-void\r
-ScriptTrigger::write(lisp::Writer& writer)\r
-{\r
-  writer.start_list("scripttrigger");\r
-\r
-  writer.write_float("x", bbox.p1.x);\r
-  writer.write_float("y", bbox.p1.y);\r
-  writer.write_float("width", bbox.get_width());\r
-  writer.write_float("height", bbox.get_height());\r
-  writer.write_string("script", script);\r
-  writer.write_bool("button", (triggerevent == EVENT_ACTIVATE) ? true : false);\r
-\r
-  writer.end_list("scripttrigger");\r
-}\r
-\r
-void\r
-ScriptTrigger::event(Player& , EventType type)\r
-{\r
-  if(type != triggerevent)\r
-    return;\r
-\r
-  std::istringstream stream(script);\r
-  Sector::current()->run_script(stream, "ScriptTrigger");\r
-}\r
-\r
-IMPLEMENT_FACTORY(ScriptTrigger, "scripttrigger");\r
-\r
+//  $Id$
+//
+//  SuperTux
+//  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
+//  as published by the Free Software Foundation; either version 2
+//  of the License, or (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  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.
+
+#include <config.h>
+
+#include <sstream>
+#include <stdexcept>
+#include <memory>
+
+#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 = false;
+
+  reader.get("x", bbox.p1.x);
+  reader.get("y", bbox.p1.y);
+  float w = 0, h = 0;
+  reader.get("width", w);
+  reader.get("height", h);
+  bbox.set_size(w, h);
+  reader.get("script", script);
+  reader.get("button", must_activate);
+  if(script == "") {
+    throw std::runtime_error("Need to specify a script for trigger object");
+  }
+
+  if (must_activate)
+    triggerevent = EVENT_ACTIVATE;
+  else
+    triggerevent = EVENT_TOUCH;
+}
+
+ScriptTrigger::ScriptTrigger(const Vector& pos, const std::string& script)
+{
+  bbox.set_pos(pos);
+  bbox.set_size(32, 32);
+  this->script = script;
+  triggerevent = EVENT_TOUCH;
+}
+
+ScriptTrigger::~ScriptTrigger()
+{
+}
+
+void
+ScriptTrigger::write(lisp::Writer& writer)
+{
+  writer.start_list("scripttrigger");
+
+  writer.write_float("x", bbox.p1.x);
+  writer.write_float("y", bbox.p1.y);
+  writer.write_float("width", bbox.get_width());
+  writer.write_float("height", bbox.get_height());
+  writer.write_string("script", script);
+  writer.write_bool("button", (triggerevent == EVENT_ACTIVATE) ? true : false);
+
+  writer.end_list("scripttrigger");
+}
+
+void
+ScriptTrigger::event(Player& , EventType type)
+{
+  if(type != triggerevent)
+    return;
+
+  std::istringstream stream(script);
+  Sector::current()->run_script(stream, "ScriptTrigger");
+}
+
+IMPLEMENT_FACTORY(ScriptTrigger, "scripttrigger");