blob: c50f17cf228110ab07012fbfc70c06ac6f4cfd4c (
plain)
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
51
52
53
54
55
56
57
58
59
60
|
#ifndef _CELL_H
#define _CELL_H
#include "types.h"
// Forward declaration to avoid circular include
class Player;
// Nothing more to define here except if you want intelligence to be in the cells.
struct Coordinates
{
int x;
int y;
Coordinates(int _x = 0, int _y = 0): x(_x), y(_y) {}
};
typedef enum
{
EMPTY_CELL,
BOOM,
PLAYER,
PLAYER_WALL,
PLAYER_JUST_MOVED
} CellState;
class Cell
{
public:
Cell(void);
Cell(CellState cs);
virtual ~Cell(void);
public:
/**
* Changes the state of this cell
**/
void setState(CellState cs);
/**
* Returns the cell's state.
**/
CellState getState();
/**
* If a player is or was on the cell, return it
**/
Player* getPlayer();
/**
* Define that a player is currently on this cell.
**/
void setPlayer(Player* pPlayer);
private:
CellState m_currentState;
Player* m_pPlayer; // A pointer to the player currently or previously on this space. May be NULL.
};
#endif
|