/* プロトコル バージョン */
#define VERSION_MAJ 1
#define VERSION_MIN 0

#define PY_NOTHING 0
#define PY_OJAMA   6
#define PY_KILLED  7

#define MD_MOVE 0
#define MD_FALL 1
#define MD_JAMA 2

typedef struct{
  int sd;
  int map[8][14];
  int x[2];
  int y[2];
  int puyo[2];
  int next[2];

  int sc_multi;
  int kill;
  int kill_max;
  int kill_colors;
  int color[6];
  int point;
  int del_all;

  int stock;
  int jama;
  int drop;
  int mode;
  int wait;

  unsigned char recv_buf[128];
  int recv_len;
  int recv_next;
  unsigned char *recv_read;

} player_t;

extern int Time_start;

extern player_t P[2];

extern int Dir_x[4];
extern int Dir_y[4];

extern char *Myname;

extern int M_time;
extern int Rate;

extern int Children;
extern int Waiting;
extern int Sock;

void game( void );
void wait_start( void );

int kill_puyo( int p );

int network( int port );
int connection( int private, int auto_exit );
void fill_buf( void );
int recv_msg( int p );
int recv_snum( int p );
int recv_lnum( int p );
void send_init( int msg );
void send_snum( int num );
void send_lnum( int num );
void send_msg( int p );
