X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fworldmap%2Fspawn_point.cpp;h=a57d71263dc4a923c2ef9c313eb2b1bd6e5ff217;hb=08813a74da6ac1fd045a105e4e8105f1d7f716f0;hp=a74921d22fc9359553eafc222e7d4a738ac5ddeb;hpb=f406067af6cbeb0a638078fe1d386d092583909c;p=supertux.git diff --git a/src/worldmap/spawn_point.cpp b/src/worldmap/spawn_point.cpp index a74921d22..a57d71263 100644 --- a/src/worldmap/spawn_point.cpp +++ b/src/worldmap/spawn_point.cpp @@ -1,12 +1,10 @@ -// $Id$ -// // SuperTux - Worldmap Spawnpoint // 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 -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. +// 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 3 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 @@ -14,50 +12,48 @@ // 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 +// along with this program. If not, see . #include -#include -#include "spawn_point.hpp" -#include "lisp/lisp.hpp" + #include "lisp/list_iterator.hpp" -#include "log.hpp" +#include "util/log.hpp" +#include "worldmap/spawn_point.hpp" -namespace WorldMapNS -{ +namespace WorldMapNS { // from worldmap.cpp Direction string_to_direction(const std::string& directory); -SpawnPoint::SpawnPoint(const lisp::Lisp* slisp) : auto_dir(D_NONE) +SpawnPoint::SpawnPoint(const lisp::Lisp* slisp) : + auto_dir(D_NONE) { - pos.x = -1; - pos.y = -1; - lisp::ListIterator iter(slisp); - while(iter.next()) { - const std::string& token = iter.item(); - if(token == "name") { - iter.value()->get(name); - } else if(token == "x") { - iter.value()->get(pos.x); - } else if(token == "y") { - iter.value()->get(pos.y); - } else if(token == "auto-dir") { - std::string s = ""; - iter.value()->get(s); - auto_dir = string_to_direction(s); - } else { - log_warning << "unknown token '" << token << "' in SpawnPoint" << std::endl; - } + pos.x = -1; + pos.y = -1; + lisp::ListIterator iter(slisp); + while(iter.next()) { + const std::string& token = iter.item(); + if(token == "name") { + iter.value()->get(name); + } else if(token == "x") { + iter.value()->get(pos.x); + } else if(token == "y") { + iter.value()->get(pos.y); + } else if(token == "auto-dir") { + std::string s = ""; + iter.value()->get(s); + auto_dir = string_to_direction(s); + } else { + log_warning << "unknown token '" << token << "' in SpawnPoint" << std::endl; } + } - if(name == "") - throw std::runtime_error("No name specified for spawnpoint"); - if(pos.x < 0 || pos.y < 0) - throw std::runtime_error("Invalid coordinates for spawnpoint"); + if(name == "") + throw std::runtime_error("No name specified for spawnpoint"); + if(pos.x < 0 || pos.y < 0) + throw std::runtime_error("Invalid coordinates for spawnpoint"); } } + +/* EOF */