Allow to set promoted flag in shogi Piece constructor.
[tagua/yd.git] / src / hlvariant / shogi / piece.h
blob4ebaac7a246a4d2dfdc199ac4ad94974eddd193d
1 /*
2 Copyright (c) 2007 Paolo Capriotti <p.capriotti@gmail.com>
3 (c) 2007 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 HLVARIANT__SHOGI__PIECE_H
12 #define HLVARIANT__SHOGI__PIECE_H
14 #include <QString>
15 #include "export.h"
17 namespace HLVariant {
18 namespace Shogi {
20 class TAGUA_EXPORT Piece {
21 public:
22 enum Color {
23 INVALID_COLOR = -1,
24 BLACK,
25 WHITE
27 enum Type {
28 KING,
29 GOLD,
30 SILVER,
31 KNIGHT,
32 LANCE,
33 ROOK,
34 BISHOP,
35 PAWN,
36 INVALID_TYPE = -1
38 private:
39 Color m_color;
40 Type m_type;
41 bool m_promoted;
42 public:
43 Piece(Color color = INVALID_COLOR, Type type = INVALID_TYPE, bool promoted = false);
44 virtual ~Piece();
46 virtual Color color() const;
47 virtual Type type() const;
49 virtual QString colorName() const;
50 static QString colorName(Color color);
51 virtual QString typeName() const;
52 static QString typeName(Type type);
53 virtual QString name() const;
55 static Color oppositeColor(Color color);
57 virtual bool operator==(const Piece& other) const;
58 virtual bool operator!=(const Piece& other) const;
60 void setPromoted();
61 bool promoted() const;
64 } // namespace Shogi
65 } // namespace HLVariant
67 #endif // HLVARIANT__SHOGI__VARIANT_H