summaryrefslogtreecommitdiffstats
path: root/knights/command.cpp
blob: 85158abe9928bd1a7aa89d7f5e2d53b917cac4ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/***************************************************************************
                          command.cpp  -  description
                             -------------------
    begin                : Sun Jun 30 2002
    copyright            : (C) 2003 by Troy Corbin Jr.
    email                : tcorbin@users.sf.net
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#include "command.h"

Command::Command( int ID, int Command, int WhiteTime, int BlackTime, struct ChessMove Move )
{
  white_time = WhiteTime;
  black_time = BlackTime;
  move = Move;
	id = ID;
  command = Command;
}

Command::Command( int ID, int Command, int WhiteTime, int BlackTime, struct ChessMove Move, TQString Data )
{
  white_time = WhiteTime;
  black_time = BlackTime;
  data = Data;
  move = Move;
	id = ID;
  command = Command;
}

Command::Command( int ID, int Command, int WhiteTime, int BlackTime, TQString Data )
{
  white_time = WhiteTime;
  black_time = BlackTime;
  data = Data;
	id = ID;
  command = Command;
}

Command::Command( int ID, int Command )
{
	clear();
	id = ID;
	command = Command;
}

Command::Command( int ID, int Command, TQString Data )
{
	clear();
	id = ID;
	command = Command;
	data = Data;
}

Command::Command()
{
	clear();
}

Command::~Command()
{
}

void Command::clear(void)
{
	white_time = 0;
	black_time = 0;
	command = CMD_None;
	clearMove( &move );
}
///////////////////////////////////////
//
//	Command::clearMove
//
///////////////////////////////////////
void Command::clearMove( ChessMove *Move )
{
	Move->fromFile = Null;
	Move->fromRank = Null;
	Move->toFile = Null;
	Move->toRank = Null;
	Move->Promote = Null;
	Move->ManTaken = Null;
	Move->NAG = 0;
	Move->ICS_MoveCounter = 0;
	Move->ICS_PawnPushFile = Null;
	Move->ICS_Mode = Null;
	Move->ICS_OnMove = 0;
	Move->ICS_ClockTicking = TRUE;
}