Address some valgrind-detected problems, flag others for later.
[tagua/yd.git] / src / core / type.h
blob7c264a5fca9f4a4e5f2b14b6461610a25f0192e7
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 CORE__TYPE_H
12 #define CORE__TYPE_H
14 #include <QString>
15 #include "export.h"
17 class Piece;
18 class Move;
19 class IState;
21 /**
22 * @brief A piece type.
24 * Piece types are associated to graphical representation of pieces,
25 * and to movement rules.
27 class TAGUA_EXPORT IType {
28 public:
29 virtual ~IType();
31 /**
32 * @return The name of this type.
34 virtual QString name() const = 0;
36 /**
37 * Check if this piece type can perform a given move.
38 * @param piece A piece of this type.
39 * @param target The piece that would be captured by the move.
40 * @param move The move to be checked.
41 * @param state The state in which @a move is to be played.
43 virtual bool canMove(const Piece& piece, const Piece& target,
44 Move& move, const IState* state) const = 0;
46 /**
47 * A symbolic index associated to this type.
48 * This is not required to uniquely identify the type.
49 * It can be used to sort a collection of types.
51 virtual int index() const = 0;
54 #endif // CORE__TYPE_H