mail[Wesnoth-commits] r20094 - in /trunk/src: map.cpp map.hpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by Soliton on September 04, 2007 - 04:00:
Author: soliton
Date: Tue Sep  4 04:00:03 2007
New Revision: 20094

URL: http://svn.gna.org/viewcvs/wesnoth?rev=20094&view=rev
Log:
revert revision 20093 on Sapient's request

Modified:
    trunk/src/map.cpp
    trunk/src/map.hpp

Modified: trunk/src/map.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/map.cpp?rev=20094&r1=20093&r2=20094&view=diff
==============================================================================
--- trunk/src/map.cpp (original)
+++ trunk/src/map.cpp Tue Sep  4 04:00:03 2007
@@ -245,6 +245,27 @@
        // Impossible
        wassert(false);
        return NDIRECTIONS;
+
+
+}
+gamemap::location::DIRECTION 
gamemap::location::get_opposite_dir(gamemap::location::DIRECTION d) {
+       switch (d) {
+               case NORTH:
+                       return SOUTH;
+               case NORTH_EAST:
+                       return SOUTH_WEST;
+               case SOUTH_EAST:
+                       return NORTH_WEST;
+               case SOUTH:
+                       return NORTH;
+               case SOUTH_WEST:
+                       return NORTH_EAST;
+               case NORTH_WEST:
+                       return SOUTH_EAST;
+               case NDIRECTIONS:
+               default:
+                       return NDIRECTIONS;
+       }
 }
 
 gamemap::gamemap(const config& cfg, const std::string& data) :

Modified: trunk/src/map.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/map.hpp?rev=20094&r1=20093&r2=20094&view=diff
==============================================================================
--- trunk/src/map.hpp (original)
+++ trunk/src/map.hpp Tue Sep  4 04:00:03 2007
@@ -56,15 +56,9 @@
        //structure which represents a location on the map.
        struct location {
                //any valid direction which can be moved in in our hexagonal 
world.
-               enum DIRECTION { NORTH =-3, 
-                                                NORTH_EAST,
-                                                SOUTH_EAST,
-                                                NDIRECTIONS,
-                                                NORTH_WEST,
-                                                SOUTH_WEST,
-                                                SOUTH,
-                               };
-               static DIRECTION get_opposite_dir(DIRECTION d) {return 
static_cast<DIRECTION>(-d);}
+               enum DIRECTION { NORTH, NORTH_EAST, SOUTH_EAST, SOUTH,
+                                SOUTH_WEST, NORTH_WEST, NDIRECTIONS };
+
                static DIRECTION parse_direction(const std::string& str);
                //parse_directions takes a comma-separated list and filters 
out any invalid directions
                static std::vector<DIRECTION> parse_directions(const 
std::string& str);
@@ -100,6 +94,7 @@
 
                location get_direction(DIRECTION d) const;
                DIRECTION get_relative_dir(location loc) const;
+               static DIRECTION get_opposite_dir(DIRECTION d);
 
                static location null_location;
        };




Related Messages


Powered by MHonArc, Updated Tue Sep 04 05:20:14 2007