Field of the board.
More...
#include <Field.hpp>
Field of the board.
- last 4 bites
number | posible vales | code | hex |
0 | empty | -—0000 | 0x00 |
1 - 8 | number of mines around | | 0x01-0x8 |
15 | mine | -—1001 | 0x09 |
- fisrt 4 bites
States | code | hex |
cover | 0000-— | 0x00 |
flag | 0001-— | 0x10 |
uncover | 0010-— | 0x20 |
◆ Field() [1/4]
Construct a new Field object.
◆ Field() [2/4]
Field::Field |
( |
uint8_t |
v | ) |
|
|
inline |
Construct a new Field object.
- Parameters
-
◆ Field() [3/4]
Construct a new Field object.
- Parameters
-
47 { this->
val(
static_cast<uint8_t
>(
code ) ); }
◆ Field() [4/4]
Field::Field |
( |
const Field & |
field | ) |
|
|
inline |
Copy constructor.
- Parameters
-
◆ ~Field()
Destroy the Field object (default destructor)
◆ operator*()
uint8_t& Field::operator* |
( |
| ) |
|
|
inline |
Operator of one side *.
- Returns
- uint8_t -
◆ val() [1/2]
uint8_t Field::val |
( |
| ) |
const |
|
inline |
Return value of field.
- Returns
- uint8_t - value of field
73 {
return (uint8_t)
code & 0x0F; }
◆ val() [2/2]
void Field::val |
( |
const uint8_t |
value | ) |
|
|
inline |
Set value of field and cover.
- Parameters
-
- Postcondition
- After that field allways be covered!
◆ flag()
◆ unflag()
Delete flag from the field.
◆ uncover()
◆ flagged()
bool Field::flagged |
( |
| ) |
const |
|
inline |
Is field flagged? ** flagged field is covered! **.
- Returns
- true - yes
-
false - no
110 {
return (
code & 0xF0 ) == 0x10; }
◆ uncovered()
bool Field::uncovered |
( |
| ) |
const |
|
inline |
Is field uncovered? (no covered, no flag)
- Returns
- true - yes
-
false - no
119 {
return (
code & 0xF0 ) == 0x20; }
◆ covered()
bool Field::covered |
( |
| ) |
const |
|
inline |
Is field covered? (is covered)
- Returns
- true - yes
-
false - no
127 {
return (
code & 0xF0 ) == 0x00; }
◆ hidden()
bool Field::hidden |
( |
| ) |
const |
|
inline |
todo Zamiania uncover, covered, hidden
- Warning
- uncoverAble change to covered covered to hidden
Is value of fields hidden? (is cover or flagged)
- Returns
- true - yes
-
false - no
142 {
return (
code & 0xF0 ) != 0x20; }
◆ mine()
bool Field::mine |
( |
| ) |
const |
|
inline |
Is the mine?!
- Returns
- true - yes
-
false - no
150 {
return (
code & 0x0F ) == 0x09; }
◆ empty()
bool Field::empty |
( |
| ) |
const |
|
inline |
Is the field empty?
- Returns
- true - yes
-
false - no
158 {
return (
code & 0x0F ) == 0x00; }
◆ code
The documentation for this class was generated from the following file: