-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCell.h
50 lines (43 loc) · 1.16 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//
// Cell.h
// battleeee
//
// Created by Ingy on 12/29/14.
// Copyright (c) 2014 Ingy. All rights reserved.
//
#ifndef __battleeee__Cell__
#define __battleeee__Cell__
#include <Ship.h>
#include <iostream>
// needs overloading > and ==
using namespace std;
class Cell
{
public:
Cell();// Constructor
// Cell(Cell &); // copy constructor
~Cell();
bool isHit();
bool isMiss(); // Check if a cell that is hit is a miss
void hitCell(); // attack the ship and update the boolean "hit" update miss as well
bool hasShip();
void setPosition (int x, int y, bool);
pair <int, int> getPosition ();
bool shipSunk (); // return true if the ship the cell contains is sunk
void placeShip(Ship*);
Ship * getShip();
void removeShip();
void drawC (RenderWindow *);
private:
bool hit;// set to false in constructor
bool miss; // set to false in constructor
int xpos, ypos;
Ship * s; // null in constructor
// SFML SHIT
sf::Sprite cellSprite;
sf::Texture blank;
sf::Texture shipTexture;
sf::Texture shipHitTexture;
sf::Texture cellHitTexture;
};
#endif /* defined(__battleeee__Cell__) */