--- /dev/null
+// SuperTux
+// Copyright (C) 2009 Ingo Ruhnke <grumbel@gmx.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 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
+// 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, see <http://www.gnu.org/licenses/>.
+
+#include "direction.hpp"
+
+#include "util/log.hpp"
+
+namespace WorldMapNS {
+
+Direction reverse_dir(Direction direction)
+{
+ switch(direction)
+ {
+ case D_WEST:
+ return D_EAST;
+ case D_EAST:
+ return D_WEST;
+ case D_NORTH:
+ return D_SOUTH;
+ case D_SOUTH:
+ return D_NORTH;
+ case D_NONE:
+ return D_NONE;
+ }
+ return D_NONE;
+}
+
+std::string
+direction_to_string(Direction direction)
+{
+ switch(direction)
+ {
+ case D_WEST:
+ return "west";
+ case D_EAST:
+ return "east";
+ case D_NORTH:
+ return "north";
+ case D_SOUTH:
+ return "south";
+ default:
+ return "none";
+ }
+}
+
+Direction
+string_to_direction(const std::string& directory)
+{
+ if (directory == "west")
+ return D_WEST;
+ else if (directory == "east")
+ return D_EAST;
+ else if (directory == "north")
+ return D_NORTH;
+ else if (directory == "south")
+ return D_SOUTH;
+ else if (directory == "none")
+ return D_NONE;
+ else {
+ log_warning << "unknown direction: \"" << directory << "\"" << std::endl;
+ return D_NONE;
+ }
+}
+
+} // namespace WorldMapNS
+
+/* EOF */
#ifndef HEADER_SUPERTUX_WORLDMAP_DIRECTION_HPP
#define HEADER_SUPERTUX_WORLDMAP_DIRECTION_HPP
+#include <string>
+
namespace WorldMapNS {
enum Direction { D_NONE, D_WEST, D_EAST, D_NORTH, D_SOUTH };
-}
+Direction reverse_dir(Direction direction);
+Direction string_to_direction(const std::string& directory);
+std::string direction_to_string(Direction direction);
+
+} // namespace WorldMapNS
#endif
WorldMap* WorldMap::current_ = NULL;
-Direction reverse_dir(Direction direction)
-{
- switch(direction)
- {
- case D_WEST:
- return D_EAST;
- case D_EAST:
- return D_WEST;
- case D_NORTH:
- return D_SOUTH;
- case D_SOUTH:
- return D_NORTH;
- case D_NONE:
- return D_NONE;
- }
- return D_NONE;
-}
-
-std::string
-direction_to_string(Direction direction)
-{
- switch(direction)
- {
- case D_WEST:
- return "west";
- case D_EAST:
- return "east";
- case D_NORTH:
- return "north";
- case D_SOUTH:
- return "south";
- default:
- return "none";
- }
-}
-
-Direction
-string_to_direction(const std::string& directory)
-{
- if (directory == "west")
- return D_WEST;
- else if (directory == "east")
- return D_EAST;
- else if (directory == "north")
- return D_NORTH;
- else if (directory == "south")
- return D_SOUTH;
- else if (directory == "none")
- return D_NONE;
- else {
- log_warning << "unknown direction: \"" << directory << "\"" << std::endl;
- return D_NONE;
- }
-}
-
-//---------------------------------------------------------------------------
-
WorldMap::WorldMap(const std::string& filename, const std::string& force_spawnpoint) :
tux(0),
tileset(NULL),