-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcell.h
32 lines (29 loc) · 1.27 KB
/
cell.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#ifndef CELL_H_
#define CELL_H_
#include <vector>
#include <memory>
#include "types.h"
class Observer;
class ChessPiece;
class Board;
class Cell{
std::vector<Observer*> ob; //Pair of observers to notify
std::shared_ptr<ChessPiece> obj; //Pointer to a chess piece if it exists
std::shared_ptr<ChessPiece> testobj; //Pointer to a chess piece if it exists
Position Pos; //The Position of the cell in the grid
void notifyObservers();
void attach(Observer*); //Observers should only be attached at initialization
Cell(Position Pos, std::shared_ptr<ChessPiece> a);
public:
void setState(std::shared_ptr<ChessPiece>&); //Insert the new piece and return the old one
std::vector<Position> getAvailableMoves(Board*);
Position getCoords(); //Return the Coordinates of the cell
Piece getType(); //Return the piece information
int moved(); //Returns the number of moves made
void movent();
void test();
void undo();
Cell(Position Pos, std::shared_ptr<ChessPiece> ,Observer* a); //ctor
~Cell(); //dtor
};
#endif