#ifndef _COORD_H
#define _COORD_H

struct Offset {
  Offset(int X, int Y) {x=X; y=Y;}
  int x,y;
};

class MapCoord
{
public:
  int x, y;

  MapCoord() {;}
  MapCoord(int X, int Y);
  int valid() const;
  int operator == (MapCoord c) const {return ((x == c.x) && (y == c.y));}
  int operator !=(MapCoord c) const {return !(operator==(c));}
  Offset operator -(MapCoord c) const;
  void operator++();
  int move(int key); // returns 0 if invalid key / move 

  MapCoord up(int n = 1) const {return down(-n);}
  MapCoord down(int n = 1) const;
  MapCoord left(int n = 1) const {return right(-n);}
  MapCoord right(int n = 1) const;

  static void SetWorldSize(int maxx, int maxy) {maxX = maxx; maxY = maxy;}
private:
  static int maxX, maxY;
};

class ScreenCoord {
  friend class WDisplay;
  friend class MapDisplay;
  friend class CityDisplay;
  friend class TextDisplay;

private:
  int x, y;
  ScreenCoord(int X, int Y) {x = X; y = Y;}
  ScreenCoord() {;}
};

#endif
