mail[Wesnoth-commits] r20093 - 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 patrick_X99 on September 04, 2007 - 03:48:
Author: sapient
Date: Tue Sep  4 03:47:29 2007
New Revision: 20093

URL: http://svn.gna.org/viewcvs/wesnoth?rev=20093&view=rev
Log:
reorganize the enum for gamemap::location::DIRECTION so that it is more useful

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=20093&r1=20092&r2=20093&view=diff
==============================================================================
--- trunk/src/map.cpp (original)
+++ trunk/src/map.cpp Tue Sep  4 03:47:29 2007
@@ -245,27 +245,6 @@
        // 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=20093&r1=20092&r2=20093&view=diff
==============================================================================
--- trunk/src/map.hpp (original)
+++ trunk/src/map.hpp Tue Sep  4 03:47:29 2007
@@ -56,9 +56,15 @@
        //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, NORTH_EAST, SOUTH_EAST, SOUTH,
-                                SOUTH_WEST, NORTH_WEST, NDIRECTIONS };
-
+               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);}
                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);
@@ -94,7 +100,6 @@
 
                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 04:20:16 2007