Commit e9b1fe2a authored by Denis Kuplyakov's avatar Denis Kuplyakov
Browse files

Documented commondefs.h file

parent 6a43485e
......@@ -29,14 +29,21 @@
#include <preferences.h>
/**
* Used to indicate chip's state.
*/
enum ChipColor {
/** White state */
White = 0,
/** Black state */
Black = 1,
NoColor = 2 // noColor = empty
/** No chip (empty cell) */
NoColor = 2
};
/**
* Represents position on board.
*/
struct KReversiPos {
KReversiPos(int r = -1, int c = -1)
: row(r), col(c) { }
......@@ -49,6 +56,10 @@ struct KReversiPos {
}
};
/**
* Represents move of player.
* It is KReversiPos + ChipColor
*/
struct KReversiMove: public KReversiPos {
KReversiMove(ChipColor col = NoColor, int r = -1, int c = -1)
: KReversiPos(r, c), color(col) { }
......@@ -67,15 +78,47 @@ struct KReversiMove: public KReversiPos {
typedef QList<KReversiMove> MoveList;
enum ChipsPrefix { BlackWhite = 0, Colored = 1 };
/**
* Indicates current color setting of user
*/
enum ChipsPrefix {
/** Show Black and White chips */
BlackWhite = 0,
/** Show Red and Blue chips */
Colored = 1
};
namespace Utils
{
/**
* Gives appropriate prefix-string by @p prefix
* @return @c "chip_bw" for @c BlackWhite
* @c "chip_color" for @c Colored
*/
QString chipPrefixToString(ChipsPrefix prefix);
/**
* Return opposite color for @p color
* @return @c Black for @c White
* @c White for @c Black
* @c NoColor for @c NoColor
*/
ChipColor opponentColorFor(ChipColor color);
/**
* @return Human-readable string representing @p color
*/
QString colorToString(const ChipColor &color);
/**
* @return Human-readable string representing @p move
*/
QString moveToString(const KReversiMove& move);
/**
* @return Index of current difficulty level in increasing order
*/
int difficultyLevelToInt();
/**
* @return Difficulty level that in @p skill place in increasing order among
* all difficulty levels
*/
const KgDifficultyLevel *intToDifficultyLevel(int skill);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment