#include "cell.h" #include "block.h" #include "board.h" #include <memory> #include "subscriptions.h" using namespace std; Cell::Cell(Board *b, int _row, int _col) : row{_row}, column{_col}, boardId{b->getBoardId()}, theBlock{nullptr} {} char Cell::getType() { if (theBlock == nullptr) return ' '; return theBlock->getType(); } int Cell::getRow() const noexcept { return row; } int Cell::getCol() const noexcept { return column; } int Cell::getBoardId() const noexcept { return boardId; } Block *Cell::getBlock() const noexcept { return theBlock; } void Cell::setCoords(int _row, int _col) { row = _row; column = _col; } void Cell::fillBlock(Block *b) { theBlock = b; notifyObservers(SubscriptionType::CellModified); } void Cell::removeBlock() { theBlock = nullptr; notifyObservers(SubscriptionType::CellModified); }