#ifndef CMOVE_H
#define CMOVE_H

///////////////////////////////////////////////
//                                           //
//  This class represents a move and is the  //
//  data that will go over the network.      //
//                                           //
///////////////////////////////////////////////

class CMove
{
  unsigned char Source;
  unsigned char Destination;

 public:
  CMove(unsigned char SourceX = 0, unsigned char SourceY = 0,
        unsigned char DestinationX = 0, unsigned char DestinationY = 0)
    {
      Source = SourceX + (SourceY << 4);
      Destination = DestinationX + (DestinationY << 4);
    }

  unsigned char GetSourceX() const { return (Source & 0x0f); }
  void SetSourceX(unsigned char SourceX)
    { Source = (Source & (0xf0)) + SourceX; }

  unsigned char GetSourceY() const { return (Source >> 4); }
  void SetSourceY(unsigned char SourceY)
    { Source = (Source & (0x0f)) + (SourceY << 4); }

  unsigned char GetDestinationX() const { return (Destination & 0x0f); }
  void SetDestinationX(unsigned char DestinationX)
    { Destination = (Destination & (0xf0)) + DestinationX; }

  unsigned char GetDestinationY() const { return (Destination >> 4); }
  void SetDestinationY(unsigned char DestinationY)
    { Destination = (Destination & (0x0f)) + (DestinationY << 4); }
};

#endif
