00001 00007 #ifndef TILELOCATION_H_ERM423 00008 #define TILELOCATION_H_ERM423 00009 00020 class TileLocation { 00021 public: 00025 TileLocation() : x(0), y(0) {} 00026 00030 TileLocation( const TileLocation& o ) : x(o.x), y(o.y) {} 00031 00035 TileLocation( int x, int y ) : x(x), y(y) {} 00036 00040 ~TileLocation() {} 00041 00045 int getX() const { return x; } 00046 00050 int getY() const { return y; } 00051 00055 void north() { --x; --y; } 00056 00060 void northeast() { --y; } 00061 00065 void east() { ++x; --y; } 00066 00070 void southeast() { ++x; } 00071 00075 void south() { ++x; ++y; } 00076 00080 void southwest() { ++y; } 00081 00085 void west() { --x; ++y; } 00086 00090 void northwest() { --x; } 00091 00095 TileLocation& operator= ( const TileLocation& rhs ) { 00096 x = rhs.x; 00097 y = rhs.y; 00098 return *this; 00099 } 00100 00104 bool operator== ( const TileLocation& rhs ) { 00105 return ( x == rhs.x && y == rhs.y ); 00106 } 00107 00108 private: 00109 int x; 00110 int y; 00111 }; 00112 00113 #endif