#include "sjmMove.h"

sjmMove::sjmMove(){
  data = playerid = playercode = datalength = 0;
  type = NIL;
}
 
sjmMove::~sjmMove(){
  if(data) delete [] data;
}

int IsValidLength(int x){
  if(x>64) return 0;
  //will need to fill in valid data here
}

void sjmMove::setPlayerId(int id){
  playerid = id;
}

void sjmMove::setPlayerCode(int code){
  playercode = code;
}

void sjmMove::setType(sjmMoveType set){
  type = set;
}

 int sjmMove::setData(char* word){
   int a;

   for(int a=0; word[a] && a<64; a++);
   if(!IsValidLength(a)) return 0;
   if(data){
     delete [] data;
     data = 0;
   }
   else data = new char[a];
   for(int a = 0; word[a]; a++) data[a] = word[a];
   data[a] = 0;
   datalength = a;
   return 1;
 }

int sjmMove::getPlayerId(){
  return playerid;
}

int sjmMove::getPlayerCode(){
  return playercode;
}

sjmMoveType sjmMove::getMoveType(){
  return type;
}

char* sjmMove::getType(){
  return data;
}
