#ifndef BATTLESHIP_CELL_H
#define BATTLESHIP_CELL_H

namespace Battleship{

class Cell{
private:
    // Valid types (Yes I changed these for improved comparisons):
    // '\0'     nothing yet!
    // 'o'      submarine
    // '<'      left horizontal bound
    // '>'      right horizontal bound
    // '^'      upper vertical bound
    // 'v'      lower vertical bound
    // 'X'      middle cell of ship
    // ' '      open water
    char type;
    int x, y;
    //Used to help handle deletions because eveything will be handled in the heap
    Cell* linkedCell;
public:
    Cell(char type = '\0', int x = -1, int y = -1, Cell* linkedCell = NULL)
        : type(type), x(x), y(y), linkedCell(linkedCell) {};

    void setType(char type) { this->type = type; };
    void setX(int x) { this->x = x; };
    void setY(int y) { this->y = y; };
    void setLinkedCell(Cell* cell) { linkedCell = cell; };

    char getType() const { return type; };
    int getX() const { return x; };
    int getY() const { return y; };
    Cell* getLinkedCell() { return linkedCell; };
    //This would be the only thing in the cpp file otherwise...
    static void deleteLinkedCells(Cell*& cell){
        if (cell == NULL) return;
        Cell* nextCell = cell->getLinkedCell();
        delete cell;
        deleteLinkedCells(cell = nextCell);
    }
};


};

#endif // BATTLESHIP_CELL_H
