Fix debian/rules to build in BUILD/ dir.
[tagua/yd.git] / src / positioninfo.h
blob4bfbc97a62aa898a89d1bc1eab5c28000efaf09c
1 /*
2 Copyright (c) 2006 Paolo Capriotti <p.capriotti@gmail.com>
3 (c) 2006 Maurizio Monge <maurizio.monge@kdemail.net>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9 */
11 #ifndef POSITIONINFO_H
12 #define POSITIONINFO_H
14 #include <vector>
15 #include <map>
16 #include <boost/shared_ptr.hpp>
17 #include <QRegExp>
19 #include "tagua.h"
20 #include "icsgamedata.h"
21 #include "fwd.h"
23 class PositionInfo {
24 public:
25 enum Relation {
26 MoveListStart = -4,
27 IsolatedPosition = -3,
28 ObservingExamined = -2,
29 NotMyMove = -1,
30 ObservingPlayed = 0,
31 MyMove = 1,
32 Examining = 2,
33 UnknownRelation = -255
36 class CaptureIndexes {
37 public:
38 enum {
39 ChessboardStart = 1,
40 Turn = 9,
41 EnPassant = 10,
42 WhiteKingCastle = 11,
43 WhiteQueenCastle = 12,
44 BlackKingCastle = 13,
45 BlackQueenCastle = 14,
46 ReversibleMoves = 15,
47 GameNumber = 16,
48 WhitePlayer = 17,
49 BlackPlayer = 18,
50 Relation = 19,
51 StartingTime = 20,
52 StartingIncrement = 21,
53 WhiteTime = 24,
54 BlackTime = 25,
55 MoveOrdinal = 26,
56 LastMoveVerbose = 27,
57 TimeUsed = 28,
58 LastMove = 29,
59 Flip = 30
63 class PositionRow {
64 public:
65 std::vector<AbstractPiece::Ptr> row;
66 explicit PositionRow(const ICSAPIPtr& icsapi, const QString& str);
69 static QRegExp pattern;
71 bool valid;
72 PositionInfo();
74 /**
75 * Parse a style12 line filling the fields of this PositionInfo object.
76 * \param games Games we know about.
77 * \param style12 A style12 line.
78 * \return Whether the game is new.
80 bool load(std::map<int, ICSGameData>& games, const QString& style12);
82 int turn;
83 int moveIndex;
84 int index() const;
85 int gameNumber;
86 QString whitePlayer;
87 QString blackPlayer;
88 AbstractPosition::Ptr position;
89 Point enPassantSquare;
91 Relation relation;
93 QString lastMoveSAN;
94 QString lastMove;
95 int whiteTime;
96 int blackTime;
99 #endif // POSITIONINFO_H